[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 378/483: Made shortcut key selector a module as well
David Prévot
taffit at moszumanska.debian.org
Thu Jan 22 21:41:58 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus-element-hiding-helper.
commit e954ffc5b9ec2a3e9b68b25ddb9cff72147a70ec
Author: Wladimir Palant <trev at adblockplus.org>
Date: Sat Jan 21 18:17:04 2012 +0100
Made shortcut key selector a module as well
--HG--
rename : chrome/content/keySelector.js => keySelector.js
---
appIntegration.js | 6 ++----
bootstrap.js | 7 ++++++-
chrome/content/keySelector.js => keySelector.js | 2 ++
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/appIntegration.js b/appIntegration.js
index d26d8c3..978cf6e 100644
--- a/appIntegration.js
+++ b/appIntegration.js
@@ -380,10 +380,8 @@ WindowWrapper.prototype =
configureKey: function(window)
{
- let variants = Prefs.selectelement_key;
- let scope = {};
- Services.scriptloader.loadSubScript("chrome://elemhidehelper/content/keySelector.js", scope);
- this.key = scope.selectKey(window, variants);
+ this.key = require("keySelector").selectKey(window, Prefs.selectelement_key);
+ unrequire("keySelector"); // This module is used only once, release its scope
},
hideTooltips: function()
diff --git a/bootstrap.js b/bootstrap.js
index 1b6bb8d..e77801e 100644
--- a/bootstrap.js
+++ b/bootstrap.js
@@ -68,7 +68,7 @@ function require(module)
}
else
{
- scopes[module] = {require: require, exports: {}};
+ scopes[module] = {require: require, unrequire: unrequire, exports: {}};
Services.scriptloader.loadSubScript(addonData.resourceURI.spec + module + ".js", scopes[module]);
}
}
@@ -76,6 +76,11 @@ function require(module)
}
require.scopes = {__proto__: null};
+function unrequire(module)
+{
+ delete require.scopes[module];
+}
+
let RequireObserver =
{
observe: function(subject, topic, data)
diff --git a/chrome/content/keySelector.js b/keySelector.js
similarity index 99%
rename from chrome/content/keySelector.js
rename to keySelector.js
index 7af4992..3d57cb8 100644
--- a/chrome/content/keySelector.js
+++ b/keySelector.js
@@ -124,6 +124,8 @@ function getTextForKey(/**Object*/ keyData) /**String*/
}
}
+exports.selectKey = selectKey;
+
/**
* Selects a keyboard shortcut variant that isn't already taken in the window,
* parses it into an object.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus-element-hiding-helper.git
More information about the Pkg-mozext-commits
mailing list