mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 17:17:58 +01:00
Mangle pathnames in the XPI to foil the fastload cache on upgrade and fix the command line option handler in fresh installs.
This commit is contained in:
@@ -7,7 +7,8 @@ BASE = $(TOP)/../common
|
|||||||
GOOGLE_PROJ = dactyl
|
GOOGLE_PROJ = dactyl
|
||||||
GOOGLE = https://$(GOOGLE_PROJ).googlecode.com/files
|
GOOGLE = https://$(GOOGLE_PROJ).googlecode.com/files
|
||||||
VERSION ?= $(shell sed -n 's/.*em:version\(>\|="\)\(.*\)["<].*/\2/p' $(TOP)/install.rdf | sed 1q)
|
VERSION ?= $(shell sed -n 's/.*em:version\(>\|="\)\(.*\)["<].*/\2/p' $(TOP)/install.rdf | sed 1q)
|
||||||
UUID = $(shell sed -n 's/.*em:id\(>\|="\)\(.*\)["<].*/\2/p' $(TOP)/install.rdf | sed 1q)
|
UUID := $(shell sed -n 's/.*em:id\(>\|="\)\(.*\)["<].*/\2/p' $(TOP)/install.rdf | sed 1q)
|
||||||
|
MANGLE := $(shell date | md5sum - | awk '{ print $$1 }')
|
||||||
|
|
||||||
LOCALEDIR = locale
|
LOCALEDIR = locale
|
||||||
DOC_FILES = $(wildcard $(LOCALEDIR)/*/*.xml)
|
DOC_FILES = $(wildcard $(LOCALEDIR)/*/*.xml)
|
||||||
@@ -17,16 +18,16 @@ MAKE_JAR = sh $(BASE)/make_jar.sh
|
|||||||
|
|
||||||
# TODO: specify source files manually?
|
# TODO: specify source files manually?
|
||||||
JAR_BASES = $(TOP) $(BASE)
|
JAR_BASES = $(TOP) $(BASE)
|
||||||
JAR_DIRS = content skin locale
|
JAR_DIRS = content skin locale modules
|
||||||
JAR_TEXTS = js css dtd xml xul html xhtml xsl
|
JAR_TEXTS = js jsm css dtd xml xul html xhtml xsl
|
||||||
JAR_BINS = png
|
JAR_BINS = png
|
||||||
|
|
||||||
CHROME = chrome/
|
CHROME = $(MANGLE)/
|
||||||
JAR = $(CHROME)$(NAME).jar
|
JAR = $(CHROME)$(NAME).jar
|
||||||
|
|
||||||
XPI_BASES = $(JAR_BASES) $(TOP)/..
|
XPI_BASES = $(JAR_BASES) $(TOP)/..
|
||||||
XPI_FILES = bootstrap.js install.rdf TODO AUTHORS Donors NEWS LICENSE.txt
|
XPI_FILES = bootstrap.js install.rdf TODO AUTHORS Donors NEWS LICENSE.txt
|
||||||
XPI_DIRS = modules components chrome defaults
|
XPI_DIRS = components $(MANGLE) defaults
|
||||||
XPI_TEXTS = js jsm $(JAR_TEXTS)
|
XPI_TEXTS = js jsm $(JAR_TEXTS)
|
||||||
XPI_BINS = $(JAR_BINS)
|
XPI_BINS = $(JAR_BINS)
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ AWK ?= awk
|
|||||||
B64ENCODE ?= base64
|
B64ENCODE ?= base64
|
||||||
CURL ?= curl
|
CURL ?= curl
|
||||||
|
|
||||||
.SILENT:
|
#.SILENT:
|
||||||
|
|
||||||
#### rules
|
#### rules
|
||||||
|
|
||||||
@@ -161,8 +162,13 @@ distclean:
|
|||||||
$(XPI): $(CHROME)
|
$(XPI): $(CHROME)
|
||||||
@echo "Building XPI..."
|
@echo "Building XPI..."
|
||||||
mkdir -p $(XPI_PATH)
|
mkdir -p $(XPI_PATH)
|
||||||
$(AWK) -v 'name=$(NAME)' -f $(BASE)/process_manifest.awk $(TOP)/chrome.manifest >$(XPI_PATH)/chrome.manifest
|
|
||||||
|
$(AWK) -v 'name=$(NAME)' -v 'chrome=$(MANGLE)' \
|
||||||
|
-f $(BASE)/process_manifest.awk \
|
||||||
|
$(TOP)/chrome.manifest >$(XPI_PATH)/chrome.manifest
|
||||||
|
|
||||||
$(MAKE_JAR) "$(XPI)" "$(XPI_BASES)" "$(XPI_DIRS)" "$(XPI_TEXTS)" "$(XPI_BINS)" "$(XPI_FILES)"
|
$(MAKE_JAR) "$(XPI)" "$(XPI_BASES)" "$(XPI_DIRS)" "$(XPI_TEXTS)" "$(XPI_BINS)" "$(XPI_FILES)"
|
||||||
|
rm -r -- $(CHROME)
|
||||||
@echo "Built XPI: $@"
|
@echo "Built XPI: $@"
|
||||||
|
|
||||||
#### jar
|
#### jar
|
||||||
|
|||||||
1
common/bootstrap.js
vendored
1
common/bootstrap.js
vendored
@@ -99,6 +99,7 @@ FactoryProxy.prototype = {
|
|||||||
},
|
},
|
||||||
get module() {
|
get module() {
|
||||||
try {
|
try {
|
||||||
|
dump("dactyl: bootstrap: create module: " + this.contractID + "\n");
|
||||||
Object.defineProperty(this, "module", { value: {}, enumerable: true });
|
Object.defineProperty(this, "module", { value: {}, enumerable: true });
|
||||||
JSMLoader.load(this.url, this.module);
|
JSMLoader.load(this.url, this.module);
|
||||||
JSMLoader.registerGlobal(this.url, this.module.global);
|
JSMLoader.registerGlobal(this.url, this.module.global);
|
||||||
|
|||||||
@@ -5,53 +5,54 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function reportError(e) {
|
function reportError(e) {
|
||||||
dump("dactyl: components: " + e + "\n" + (e.stack || Error().stack));
|
dump("dactyl: command-line-handler: " + e + "\n" + (e.stack || Error().stack));
|
||||||
Cu.reportError(e);
|
Cu.reportError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
var global = this;
|
var global = this;
|
||||||
|
var NAME = "command-line-handler";
|
||||||
var Cc = Components.classes;
|
var Cc = Components.classes;
|
||||||
var Ci = Components.interfaces;
|
var Ci = Components.interfaces;
|
||||||
var Cu = Components.utils;
|
var Cu = Components.utils;
|
||||||
|
|
||||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService)
|
|
||||||
.getBranch("extensions.dactyl.");
|
|
||||||
var appName = prefs.getComplexValue("appName", Ci.nsISupportsString).data;
|
|
||||||
var name = prefs.getComplexValue("name", Ci.nsISupportsString).data;
|
|
||||||
|
|
||||||
function CommandLineHandler() {
|
function CommandLineHandler() {
|
||||||
this.wrappedJSObject = this;
|
this.wrappedJSObject = this;
|
||||||
|
|
||||||
|
Cu.import("resource://dactyl/base.jsm");
|
||||||
|
require(global, "util");
|
||||||
|
require(global, "config");
|
||||||
}
|
}
|
||||||
CommandLineHandler.prototype = {
|
CommandLineHandler.prototype = {
|
||||||
|
|
||||||
classDescription: appName + " Command-line Handler",
|
classDescription: "Dactyl Command-line Handler",
|
||||||
|
|
||||||
classID: Components.ID("{16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}"),
|
classID: Components.ID("{16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}"),
|
||||||
|
|
||||||
contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=" + name,
|
contractID: "@mozilla.org/commandlinehandler/general-startup;1?type=dactyl",
|
||||||
|
|
||||||
_xpcom_categories: [{
|
_xpcom_categories: [{
|
||||||
category: "command-line-handler",
|
category: "command-line-handler",
|
||||||
entry: "m-" + name
|
entry: "m-dactyl"
|
||||||
}],
|
}],
|
||||||
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]),
|
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]),
|
||||||
|
|
||||||
handle: function (commandLine) {
|
handle: function (commandLine) {
|
||||||
|
|
||||||
// TODO: handle remote launches differently?
|
// TODO: handle remote launches differently?
|
||||||
try {
|
try {
|
||||||
this.optionValue = commandLine.handleFlagWithParam(name, false);
|
this.optionValue = commandLine.handleFlagWithParam(config.name, false);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
dump(name + ": option '-" + name + "' requires an argument\n");
|
util.dump("option '-" + config.name + "' requires an argument\n");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
helpInfo: " -" + name + " <opts>" + " Additional options for " + appName + " startup\n".substr(name.length)
|
get helpInfo() " -" + config.name + " <opts>" + " Additional options for " + config.appName + " startup\n".substr(config.name.length)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (XPCOMUtils.generateNSGetFactory)
|
if (XPCOMUtils.generateNSGetFactory)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function reportError(e) {
|
function reportError(e) {
|
||||||
dump("dactyl: components: " + e + "\n" + (e.stack || Error().stack));
|
dump("dactyl: protocols: " + e + "\n" + (e.stack || Error().stack));
|
||||||
Cu.reportError(e);
|
Cu.reportError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2108,9 +2108,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
|
|
||||||
prefs.set("extensions.dactyl.version", util.addon.version);
|
prefs.set("extensions.dactyl.version", util.addon.version);
|
||||||
|
|
||||||
if (!services.commandLineHandler)
|
|
||||||
services.add("commandLineHandler", "@mozilla.org/commandlinehandler/general-startup;1?type=" + config.name);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (services.fuel)
|
if (services.fuel)
|
||||||
var args = services.fuel.storage.get("dactyl.commandlineArgs", null);
|
var args = services.fuel.storage.get("dactyl.commandlineArgs", null);
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ copytext() {
|
|||||||
sed -e "s,@VERSION@,$VERSION,g" \
|
sed -e "s,@VERSION@,$VERSION,g" \
|
||||||
-e "s,@DATE@,$BUILD_DATE,g" \
|
-e "s,@DATE@,$BUILD_DATE,g" \
|
||||||
<"$1" >"$2"
|
<"$1" >"$2"
|
||||||
cmp -s "$1" "$2" ||
|
cmp -s -- "$1" "$2" ||
|
||||||
( echo "modified: $1"; diff -u "$1" "$2" | grep '^[-+][^-+]' )
|
( echo "modified: $1"; diff -u -- "$1" "$2" | grep '^[-+][^-+]' )
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -e "$top/$jar" ] && rm -rf "$top/$jar"
|
[ -e "$top/$jar" ] && rm -rf "$top/$jar"
|
||||||
@@ -62,7 +62,7 @@ do
|
|||||||
for f in $(getfiles "$bin" "$dir")
|
for f in $(getfiles "$bin" "$dir")
|
||||||
do
|
do
|
||||||
mkdir -p "$stage/${f%/*}"
|
mkdir -p "$stage/${f%/*}"
|
||||||
cp $f "$stage/$f"
|
cp -- $f "$stage/$f"
|
||||||
done
|
done
|
||||||
for f in $(getfiles "$text" "$dir")
|
for f in $(getfiles "$text" "$dir")
|
||||||
do
|
do
|
||||||
@@ -82,8 +82,8 @@ done
|
|||||||
set -e;
|
set -e;
|
||||||
cd $stage;
|
cd $stage;
|
||||||
case $jar in
|
case $jar in
|
||||||
(*/) if [ "$stage" != "$top/$jar" ]; then mv * $top/$jar; fi;;
|
(*/) if [ "$stage" != "$top/$jar" ]; then mv -- * $top/$jar; fi;;
|
||||||
(*) zip -9r "$top/$jar" *;;
|
(*) zip -9r "$top/$jar" -- *;;
|
||||||
esac
|
esac
|
||||||
) || exit 1
|
) || exit 1
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ var Services = Module("Services", {
|
|||||||
this.add("browserSearch", "@mozilla.org/browser/search-service;1", Ci.nsIBrowserSearchService);
|
this.add("browserSearch", "@mozilla.org/browser/search-service;1", Ci.nsIBrowserSearchService);
|
||||||
this.add("cache", "@mozilla.org/network/cache-service;1", Ci.nsICacheService);
|
this.add("cache", "@mozilla.org/network/cache-service;1", Ci.nsICacheService);
|
||||||
this.add("charset", "@mozilla.org/charset-converter-manager;1", Ci.nsICharsetConverterManager);
|
this.add("charset", "@mozilla.org/charset-converter-manager;1", Ci.nsICharsetConverterManager);
|
||||||
|
this.add("commandLineHandler", "@mozilla.org/commandlinehandler/general-startup;1?type=dactyl");
|
||||||
this.add("console", "@mozilla.org/consoleservice;1", Ci.nsIConsoleService);
|
this.add("console", "@mozilla.org/consoleservice;1", Ci.nsIConsoleService);
|
||||||
this.add("dactyl:", "@mozilla.org/network/protocol;1?name=dactyl");
|
this.add("dactyl:", "@mozilla.org/network/protocol;1?name=dactyl");
|
||||||
this.add("debugger", "@mozilla.org/js/jsd/debugger-service;1", Ci.jsdIDebuggerService);
|
this.add("debugger", "@mozilla.org/js/jsd/debugger-service;1", Ci.jsdIDebuggerService);
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
{ content = $1 ~ /^(content|skin|locale)$/ }
|
BEGIN { if (!chrome) chrome = "chrome" }
|
||||||
|
{ content = $1 ~ /^(content|skin|locale|resource)$/ }
|
||||||
content && $NF ~ /^[a-z]/ { $NF = "/" name "/" $NF }
|
content && $NF ~ /^[a-z]/ { $NF = "/" name "/" $NF }
|
||||||
content {
|
content {
|
||||||
sub(/^\.\./, "", $NF);
|
sub(/^\.\./, "", $NF);
|
||||||
if (isjar)
|
if (isjar)
|
||||||
$NF = "jar:chrome/" name ".jar!" $NF
|
$NF = "jar:chrome/" name ".jar!" $NF
|
||||||
else
|
else
|
||||||
$NF = "chrome" $NF
|
$NF = chrome $NF
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
sub("^\\.\\./common/", "", $NF)
|
sub("^\\.\\./common/", "", $NF)
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ overlay chrome://songbird/content/xul/layoutBaseOverlay.xul chrome://melodactyl
|
|||||||
overlay chrome://songbird/content/xul/layoutBaseOverlay.xul chrome://dactyl/content/dactyl.xul
|
overlay chrome://songbird/content/xul/layoutBaseOverlay.xul chrome://dactyl/content/dactyl.xul
|
||||||
|
|
||||||
#component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
|
#component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
|
||||||
#contract @mozilla.org/commandlinehandler/general-startup;1?type=melodactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
#contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
||||||
#category command-line-handler m-melodactyl @mozilla.org/commandlinehandler/general-startup;1?type=melodactyl
|
#category command-line-handler m-dactyl @mozilla.org/commandlinehandler/general-startup;1?type=dactyl
|
||||||
#
|
#
|
||||||
#component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js
|
#component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js
|
||||||
#contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d}
|
#contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ override chrome://dactyl/content/dactyl.dtd chrome://pentadactyl/content/dactyl
|
|||||||
override chrome://dactyl/content/config.js chrome://pentadactyl/content/config.js
|
override chrome://dactyl/content/config.js chrome://pentadactyl/content/config.js
|
||||||
|
|
||||||
component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
|
component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
|
||||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=pentadactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
||||||
category command-line-handler m-pentadactyl @mozilla.org/commandlinehandler/general-startup;1?type=pentadactyl
|
category command-line-handler m-dactyl @mozilla.org/commandlinehandler/general-startup;1?type=dactyl
|
||||||
|
|
||||||
component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js
|
component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js
|
||||||
contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d}
|
contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome
|
|||||||
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://teledactyl/content/compose/compose.xul
|
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://teledactyl/content/compose/compose.xul
|
||||||
|
|
||||||
component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
|
component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
|
||||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=teledactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
||||||
category command-line-handler m-teledactyl @mozilla.org/commandlinehandler/general-startup;1?type=teledactyl
|
category command-line-handler m-dactyl @mozilla.org/commandlinehandler/general-startup;1?type=dactyl
|
||||||
|
|
||||||
component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js
|
component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js
|
||||||
contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d}
|
contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d}
|
||||||
|
|||||||
Reference in New Issue
Block a user