summaryrefslogtreecommitdiff
path: root/extensions/requestpolicy
diff options
context:
space:
mode:
authorportix <none@none>2013-03-19 01:05:10 +0100
committerportix <none@none>2013-03-19 01:05:10 +0100
commit34a5c436db3271c72f91cf0f028c934d6474c902 (patch)
tree184218d2dcb9adaddd52f857fb386f3b5f944825 /extensions/requestpolicy
parentf98991177a2c21acfe737d9180ce6e18fa924ffa (diff)
downloaddwb-34a5c436db3271c72f91cf0f028c934d6474c902.zip
New Signal api
Diffstat (limited to 'extensions/requestpolicy')
-rw-r--r--extensions/requestpolicy31
1 files changed, 7 insertions, 24 deletions
diff --git a/extensions/requestpolicy b/extensions/requestpolicy
index 9af23275..6ceee7a3 100644
--- a/extensions/requestpolicy
+++ b/extensions/requestpolicy
@@ -109,12 +109,6 @@ var defaultConfig = {
};
var config = {};
-var sigs = {
- resource : -1,
- navigation : -1,
- loadFinished : -1
-};
-
var persistentList = null;
var tmpList = {};
@@ -412,23 +406,6 @@ function loadFinishedCB(wv)
io.notify("RP: blocked " + blocked + " requests");
}
-function connect()
-{
- sigs.resource = signals.connect("resource", resourceCB);
- sigs.navigation = signals.connect("navigation", navigationCB);
- if (config.notify)
- sigs.loadFinished = signals.connect("loadFinished", loadFinishedCB);
-}
-function disconnect()
-{
- sigs.forEach(function (key, value) {
- if (value != -1)
- {
- signals.disconnect(value);
- sigs[key] = -1;
- }
- });
-}//}}}
var requestpolicy = {
defaultConfig : defaultConfig,
init : function(c)
@@ -448,7 +425,10 @@ var requestpolicy = {
}
}
persistentList = persistentList || {};
- connect();
+ Signal.connect("resource", resourceCB);
+ Signal.connect("navigation", navigationCB);
+ if (config.notify)
+ Signal.connect("loadFinished", loadFinishedCB);
bind(config.shortcut, showMenu, "requestpolicy");
bind(config.unblockCurrent, unblockCurrent, "requestpolicyUnblockCurrent");
bind(config.unblockAll, unblockAll, "requestpolicyUnblockAll");
@@ -457,6 +437,9 @@ var requestpolicy = {
end : function ()
{
disconnect();
+ Signal.disconnect(resourceCB);
+ Signal.disconnect(navigationCB);
+ Signal.disconnect(loadFinishedCB);
unbind("requestpolicy");
unbind("requestpolicyUnblockCurrent");
unbind("requestpolicyUnblockAll");