mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 13:17:59 +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 = 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
|
||||
|
||||
1
common/bootstrap.js
vendored
1
common/bootstrap.js
vendored
@@ -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);
|
||||
|
||||
@@ -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 + " <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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user