From 8ef35fee8bdce22bc5899d94e5cfd5670fb885c7 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 1 Oct 2011 13:02:26 -0400 Subject: [PATCH] Include config.json in XPI. Closes issue \#670. --- common/Makefile | 3 ++- common/content/mappings.js | 4 ++-- common/modules/cache.jsm | 13 +++++++++++-- common/modules/help.jsm | 3 +++ common/process_manifest.awk | 3 ++- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/common/Makefile b/common/Makefile index 1d28b14f..ef118e80 100644 --- a/common/Makefile +++ b/common/Makefile @@ -32,8 +32,9 @@ MAKE_JAR = sh $(BASE)/make_jar.sh # TODO: specify source files manually? JAR_BASES = $(TOP) $(BASE) +JAR_FILES = config.json JAR_DIRS = content skin locale modules -JAR_TEXTS = js jsm css dtd xml xul html xhtml xsl properties +JAR_TEXTS = js jsm css dtd xml xul html xhtml xsl properties json JAR_BINS = png CHROME = $(MANGLE)/ diff --git a/common/content/mappings.js b/common/content/mappings.js index 078b85bf..01e32f16 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -420,7 +420,7 @@ var Mappings = Module("mappings", { get: function get(mode, cmd) this.hives.map(function (h) h.get(mode, cmd)).compact()[0] || null, /** - * Returns an array of maps with names starting with but not equal to + * Returns a count of maps with names starting with but not equal to * *prefix*. * * @param {Modes.Mode} mode The mode to search. @@ -429,7 +429,7 @@ var Mappings = Module("mappings", { */ getCandidates: function (mode, prefix) this.hives.map(function (h) h.getCandidates(mode, prefix)) - .flatten(), + .reduce(function (a, b) a + b, 0), /** * Lists all user-defined mappings matching *filter* for the specified diff --git a/common/modules/cache.jsm b/common/modules/cache.jsm index 6bc5faa6..6b209a04 100644 --- a/common/modules/cache.jsm +++ b/common/modules/cache.jsm @@ -15,6 +15,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), { this.queue = []; this.cache = {}; this.providers = {}; + this.providing = {}; this.localProviders = {}; if (JSMLoader.cacheFlush) @@ -176,8 +177,16 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), { } if (Set.has(this.providers, name)) { - let [func, self] = this.providers[name]; - this.cache[name] = func.call(self || this, name); + util.assert(!Set.add(this.providing, name), + "Already generating cache for " + name, + false); + try { + let [func, self] = this.providers[name]; + this.cache[name] = func.call(self || this, name); + } + finally { + delete this.providing[name]; + } cache.queue.push([Date.now(), name]); cache.processQueue(); diff --git a/common/modules/help.jsm b/common/modules/help.jsm index 31e2ec0d..7e460576 100644 --- a/common/modules/help.jsm +++ b/common/modules/help.jsm @@ -13,6 +13,9 @@ defineModule("help", { var HelpBuilder = Class("HelpBuilder", { init: function init() { try { + // The versions munger will need to access the tag map + // during this process and without this we'll get an + // infinite loop. help._data = this; this.files = {}; diff --git a/common/process_manifest.awk b/common/process_manifest.awk index 8a513932..4abfceef 100644 --- a/common/process_manifest.awk +++ b/common/process_manifest.awk @@ -4,7 +4,7 @@ BEGIN { chrome = suffix } { content = $1 ~ /^(content|skin|locale|resource)$/ } -content && $NF ~ /^[a-z]/ { $NF = "/" name "/" $NF } +content && $NF ~ /^[a-z]|^\.\// { $NF = "/" name "/" $NF } content { sub(/^\.\./, "", $NF); if (isjar) @@ -13,6 +13,7 @@ content { $NF = chrome $NF } { + gsub(/\/\.\//, "/") sub("^\\.\\./common/", "", $NF) print }