From a1047e33c6a543f5e5d87bad4256ae584030a422 Mon Sep 17 00:00:00 2001 From: tumpio Date: Mon, 16 Nov 2015 22:07:54 +0200 Subject: [PATCH] allow subscript loader to work on unpacket extension --- bootstrap.js | 6 ++---- content/options.js | 14 ++------------ {scripts => content/scripts}/helper.js | 0 {scripts => content/scripts}/pref.js | 0 4 files changed, 4 insertions(+), 16 deletions(-) rename {scripts => content/scripts}/helper.js (100%) rename {scripts => content/scripts}/pref.js (100%) diff --git a/bootstrap.js b/bootstrap.js index b01d5f1..d42f048 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -3257,10 +3257,8 @@ function startup(data, reason) AddonManager.getAddonByID(data.id, function(addon } // Load various javascript includes for helper functions - ["helper", "pref"].forEach(function(fileName) { - let fileURI = addon.getResourceURI("scripts/" + fileName + ".js"); - Services.scriptloader.loadSubScript(fileURI.spec, global); - }); + Services.scriptloader.loadSubScript("chrome://uienhancer/content/scripts/helper.js", global); + Services.scriptloader.loadSubScript("chrome://uienhancer/content/scripts/pref.js", global); if (Services.vc.compare(Services.appinfo.platformVersion, "10.0") < 0) Components.manager.addBootstrappedManifestLocation(data.installPath); diff --git a/content/options.js b/content/options.js index feda535..6d8225c 100644 --- a/content/options.js +++ b/content/options.js @@ -34,17 +34,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/NetUtil.jsm"); Cu.import("resource://gre/modules/FileUtils.jsm"); -function getURIForFile2(filepath, rootDir) { - let file = FileUtils.getFile("ProfD", rootDir?[rootDir]:["extensions"]); - if (rootDir == null) - file.append("UIEnhancer@girishsharma.xpi"); - return Services.io.newURI("jar:file:///" + file.path.replace(/[\\]/g, "/") + "!/" + filepath, null, null); -} - -["pref"].forEach(function(fileName) { - let fileURI = getURIForFile2("scripts/" + fileName + ".js"); - Services.scriptloader.loadSubScript(fileURI.spec, global); -}); +Services.scriptloader.loadSubScript("chrome://uienhancer/content/scripts/pref.js", global); let optionsWindow = { shortcutTextBox: null, @@ -289,4 +279,4 @@ let optionsWindow = { XPCOMUtils.defineLazyGetter(optionsWindow, "strings", function () { return Services.strings.createBundle("chrome://uienhancer/locale/optionwindow.properties"); -}); \ No newline at end of file +}); diff --git a/scripts/helper.js b/content/scripts/helper.js similarity index 100% rename from scripts/helper.js rename to content/scripts/helper.js diff --git a/scripts/pref.js b/content/scripts/pref.js similarity index 100% rename from scripts/pref.js rename to content/scripts/pref.js