From 967a213019cc771e7c2745f35d89235418f96705 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 13 Jan 2011 19:59:21 -0500 Subject: [PATCH] Fix loading components after XPI update. --- common/bootstrap.js | 6 ++++-- common/modules/bootstrap.jsm | 16 ++++++++++------ common/modules/util.jsm | 3 ++- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/common/bootstrap.js b/common/bootstrap.js index 5fb9330c..e63bc0c6 100755 --- a/common/bootstrap.js +++ b/common/bootstrap.js @@ -63,8 +63,8 @@ function startup(data, reason) { AddonManager.getAddonByID(addon.id, function (a) { addon = a; }); // Temporary hack. - if (basePath.isDirectory() && false && JSMLoader.bump == null) - JSMLoader.bump = 1; + if (basePath.isDirectory() && JSMLoader.bump == null) + JSMLoader.bump = 2; if (basePath.isDirectory()) getURI = function getURI(path) { @@ -100,6 +100,8 @@ FactoryProxy.prototype = { dump("dactyl: bootstrap: create module: " + this.contractID + "\n"); Object.defineProperty(this, "module", { value: {}, enumerable: true }); + dump("get module " + this.url + "\n"); + dump(" " + (JSMLoader.stale[this.url]) + "\n"); JSMLoader.load(this.url, this.module); return this.module; }, diff --git a/common/modules/bootstrap.jsm b/common/modules/bootstrap.jsm index 815fc28a..e74d4635 100644 --- a/common/modules/bootstrap.jsm +++ b/common/modules/bootstrap.jsm @@ -8,9 +8,9 @@ let is_bootstrap = 1; try { -if (!JSMLoader || JSMLoader.bump != 1) +if (!JSMLoader || JSMLoader.bump != 2) var JSMLoader = { - bump: 1, + bump: 2, builtin: Components.utils.Sandbox(this), canonical: {}, factories: [], @@ -32,13 +32,15 @@ if (!JSMLoader || JSMLoader.bump != 1) let url = name; if (url.indexOf(":") === -1) url = "resource://dactyl" + this.suffix + "/" + url; + let targetURL = this.getTarget(url); - if (name in this.stale) { - let stale = this.stale[name]; + let stale = this.stale[name] || this.stale[targetURL]; + if (stale) { delete this.stale[name]; + delete this.stale[targetURL]; let global = this.globals[name]; - if (stale === this.getTarget(url)) + if (stale === targetURL) this.loadSubScript(url, global.global || global); } @@ -65,7 +67,9 @@ if (!JSMLoader || JSMLoader.bump != 1) }, purge: function purge() { for (let [url, global] in Iterator(this.globals)) { - this.stale[url] = this.getTarget(url); + let target = this.getTarget(url); + this.stale[url] = target; + this.stale[target] = target; for each (let prop in Object.getOwnPropertyNames(global)) try { diff --git a/common/modules/util.jsm b/common/modules/util.jsm index fec12239..c17ee4c6 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -9,8 +9,9 @@ try { Components.utils.import("resource://dactyl/bootstrap.jsm"); + let frag=1; defineModule("util", { - exports: ["FailedAssertion", "Math", "NS", "Point", "Util", "XBL", "XHTML", "XUL", "util"], + exports: ["frag", "FailedAssertion", "Math", "NS", "Point", "Util", "XBL", "XHTML", "XUL", "util"], require: ["services"], use: ["config", "highlight", "storage", "template"] }, this);