1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-23 15:45:45 +01:00

Commit some changes that were somehow skipped before

This commit is contained in:
Kris Maglione
2008-12-02 14:30:07 -05:00
parent edf1c5ce99
commit 7d8a5719cf
7 changed files with 65 additions and 131 deletions

View File

@@ -5,26 +5,32 @@
modules.modules = modules;
var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
function load(script, i)
const loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Components.interfaces.mozIJSSubScriptLoader);
function load(script)
{
try
for (let [i, base] in Iterator(prefix))
{
loader.loadSubScript(BASE + script, modules)
}
catch (e)
{
if (Components.utils.reportError)
Components.utils.reportError(e);
dump("liberator: Loading script " + script + ": " + e + "\n");
if (!i || i < 3)
return load(script, i + 1); // Sometimes loading (seemingly randomly) fails
try
{
loader.loadSubScript(base + script, modules)
return;
}
catch (e)
{
if (i + 1 < prefix.length)
continue;
if (Components.utils.reportError)
Components.utils.reportError(e);
dump("liberator: Loading script " + script + ": " + e + "\n");
}
}
}
Components.utils.import("resource://liberator/storage.jsm", modules);
let prefix = [BASE];
["liberator.js",
"config.js",
"util.js",
@@ -43,6 +49,7 @@
"template.js",
"ui.js"].forEach(load);
prefix.unshift("chrome://" + modules.config.name.toLowerCase() + "/content/");
if (modules.config.scripts)
modules.config.scripts.forEach(load);