diff --git a/common/Makefile b/common/Makefile index 470ddb33..22bb0c4b 100644 --- a/common/Makefile +++ b/common/Makefile @@ -7,7 +7,8 @@ BASE = $(TOP)/../common GOOGLE_PROJ = dactyl GOOGLE = https://$(GOOGLE_PROJ).googlecode.com/files 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 DOC_FILES = $(wildcard $(LOCALEDIR)/*/*.xml) @@ -17,16 +18,16 @@ MAKE_JAR = sh $(BASE)/make_jar.sh # TODO: specify source files manually? JAR_BASES = $(TOP) $(BASE) -JAR_DIRS = content skin locale -JAR_TEXTS = js css dtd xml xul html xhtml xsl +JAR_DIRS = content skin locale modules +JAR_TEXTS = js jsm css dtd xml xul html xhtml xsl JAR_BINS = png -CHROME = chrome/ +CHROME = $(MANGLE)/ JAR = $(CHROME)$(NAME).jar XPI_BASES = $(JAR_BASES) $(TOP)/.. 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_BINS = $(JAR_BINS) @@ -43,7 +44,7 @@ AWK ?= awk B64ENCODE ?= base64 CURL ?= curl -.SILENT: +#.SILENT: #### rules @@ -161,8 +162,13 @@ distclean: $(XPI): $(CHROME) @echo "Building XPI..." 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)" + rm -r -- $(CHROME) @echo "Built XPI: $@" #### jar diff --git a/common/bootstrap.js b/common/bootstrap.js index e356cfac..76f9c5c7 100755 --- a/common/bootstrap.js +++ b/common/bootstrap.js @@ -99,6 +99,7 @@ FactoryProxy.prototype = { }, get module() { try { + dump("dactyl: bootstrap: create module: " + this.contractID + "\n"); Object.defineProperty(this, "module", { value: {}, enumerable: true }); JSMLoader.load(this.url, this.module); JSMLoader.registerGlobal(this.url, this.module.global); diff --git a/common/components/commandline-handler.js b/common/components/commandline-handler.js index 52d7682b..b3ba875e 100644 --- a/common/components/commandline-handler.js +++ b/common/components/commandline-handler.js @@ -5,53 +5,54 @@ "use strict"; 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); } try { var global = this; +var NAME = "command-line-handler"; var Cc = Components.classes; var Ci = Components.interfaces; var Cu = Components.utils; 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() { this.wrappedJSObject = this; + + Cu.import("resource://dactyl/base.jsm"); + require(global, "util"); + require(global, "config"); } CommandLineHandler.prototype = { - classDescription: appName + " Command-line Handler", + classDescription: "Dactyl Command-line Handler", 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: [{ category: "command-line-handler", - entry: "m-" + name + entry: "m-dactyl" }], QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsICommandLineHandler]), handle: function (commandLine) { + // TODO: handle remote launches differently? try { - this.optionValue = commandLine.handleFlagWithParam(name, false); + this.optionValue = commandLine.handleFlagWithParam(config.name, false); } catch (e) { - dump(name + ": option '-" + name + "' requires an argument\n"); + util.dump("option '-" + config.name + "' requires an argument\n"); } }, - helpInfo: " -" + name + " " + " Additional options for " + appName + " startup\n".substr(name.length) + get helpInfo() " -" + config.name + " " + " Additional options for " + config.appName + " startup\n".substr(config.name.length) }; if (XPCOMUtils.generateNSGetFactory) diff --git a/common/components/protocols.js b/common/components/protocols.js index 330ea079..2b47d414 100644 --- a/common/components/protocols.js +++ b/common/components/protocols.js @@ -5,7 +5,7 @@ "use strict"; function reportError(e) { - dump("dactyl: components: " + e + "\n" + (e.stack || Error().stack)); + dump("dactyl: protocols: " + e + "\n" + (e.stack || Error().stack)); Cu.reportError(e); } diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 6f9d75a5..e568c43d 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -2108,9 +2108,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { prefs.set("extensions.dactyl.version", util.addon.version); - if (!services.commandLineHandler) - services.add("commandLineHandler", "@mozilla.org/commandlinehandler/general-startup;1?type=" + config.name); - try { if (services.fuel) var args = services.fuel.storage.get("dactyl.commandlineArgs", null); diff --git a/common/make_jar.sh b/common/make_jar.sh index 488a6dbe..5e08f522 100644 --- a/common/make_jar.sh +++ b/common/make_jar.sh @@ -45,8 +45,8 @@ copytext() { sed -e "s,@VERSION@,$VERSION,g" \ -e "s,@DATE@,$BUILD_DATE,g" \ <"$1" >"$2" - cmp -s "$1" "$2" || - ( echo "modified: $1"; diff -u "$1" "$2" | grep '^[-+][^-+]' ) + cmp -s -- "$1" "$2" || + ( echo "modified: $1"; diff -u -- "$1" "$2" | grep '^[-+][^-+]' ) } [ -e "$top/$jar" ] && rm -rf "$top/$jar" @@ -62,7 +62,7 @@ do for f in $(getfiles "$bin" "$dir") do mkdir -p "$stage/${f%/*}" - cp $f "$stage/$f" + cp -- $f "$stage/$f" done for f in $(getfiles "$text" "$dir") do @@ -82,8 +82,8 @@ done set -e; cd $stage; case $jar in - (*/) if [ "$stage" != "$top/$jar" ]; then mv * $top/$jar; fi;; - (*) zip -9r "$top/$jar" *;; + (*/) if [ "$stage" != "$top/$jar" ]; then mv -- * $top/$jar; fi;; + (*) zip -9r "$top/$jar" -- *;; esac ) || exit 1 diff --git a/common/modules/services.jsm b/common/modules/services.jsm index 70cbdccd..9852cdf0 100644 --- a/common/modules/services.jsm +++ b/common/modules/services.jsm @@ -29,6 +29,7 @@ var Services = Module("Services", { this.add("browserSearch", "@mozilla.org/browser/search-service;1", Ci.nsIBrowserSearchService); this.add("cache", "@mozilla.org/network/cache-service;1", Ci.nsICacheService); 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("dactyl:", "@mozilla.org/network/protocol;1?name=dactyl"); this.add("debugger", "@mozilla.org/js/jsd/debugger-service;1", Ci.jsdIDebuggerService); diff --git a/common/process_manifest.awk b/common/process_manifest.awk index de7aa94c..5a9c6eaa 100644 --- a/common/process_manifest.awk +++ b/common/process_manifest.awk @@ -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 { sub(/^\.\./, "", $NF); if (isjar) $NF = "jar:chrome/" name ".jar!" $NF else - $NF = "chrome" $NF + $NF = chrome $NF } { sub("^\\.\\./common/", "", $NF) diff --git a/melodactyl/chrome.manifest b/melodactyl/chrome.manifest index 3f8502ce..71f4cf77 100644 --- a/melodactyl/chrome.manifest +++ b/melodactyl/chrome.manifest @@ -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 #component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js -#contract @mozilla.org/commandlinehandler/general-startup;1?type=melodactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} -#category command-line-handler m-melodactyl @mozilla.org/commandlinehandler/general-startup;1?type=melodactyl +#contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} +#category command-line-handler m-dactyl @mozilla.org/commandlinehandler/general-startup;1?type=dactyl # #component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js #contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} diff --git a/pentadactyl/chrome.manifest b/pentadactyl/chrome.manifest index d70bbc78..cf9463d3 100644 --- a/pentadactyl/chrome.manifest +++ b/pentadactyl/chrome.manifest @@ -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 component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js -contract @mozilla.org/commandlinehandler/general-startup;1?type=pentadactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} -category command-line-handler m-pentadactyl @mozilla.org/commandlinehandler/general-startup;1?type=pentadactyl +contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} +category command-line-handler m-dactyl @mozilla.org/commandlinehandler/general-startup;1?type=dactyl component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} diff --git a/teledactyl/chrome.manifest b/teledactyl/chrome.manifest index 137637f3..01a6e5ea 100644 --- a/teledactyl/chrome.manifest +++ b/teledactyl/chrome.manifest @@ -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 component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js -contract @mozilla.org/commandlinehandler/general-startup;1?type=teledactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} -category command-line-handler m-teledactyl @mozilla.org/commandlinehandler/general-startup;1?type=teledactyl +contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} +category command-line-handler m-dactyl @mozilla.org/commandlinehandler/general-startup;1?type=dactyl component {c1b67a07-18f7-4e13-b361-2edcc35a5a0d} components/protocols.js contract @mozilla.org/network/protocol;1?name=chrome-data {c1b67a07-18f7-4e13-b361-2edcc35a5a0d}