diff options
author | gorhill <rhill@raymondhill.net> | 2015-04-08 06:15:10 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2015-04-08 06:15:10 -0400 |
commit | 125513164f739ecf9ec6b6c48f41f2e8998c7ac1 (patch) | |
tree | 528a13839b6aeabcdb4666f9fb115d2a913b562a /platform/firefox/vapi-client.js | |
parent | 44bbf356f70c5b091432fdf260768d6db982f0fa (diff) | |
download | uBlock-125513164f739ecf9ec6b6c48f41f2e8998c7ac1.zip uBlock-125513164f739ecf9ec6b6c48f41f2e8998c7ac1.tar.gz uBlock-125513164f739ecf9ec6b6c48f41f2e8998c7ac1.tar.bz2 |
forgot to add shutdown to other platforms (re. https://github.com/gorhill/uMatrix/issues/144)
Diffstat (limited to 'platform/firefox/vapi-client.js')
-rw-r--r-- | platform/firefox/vapi-client.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/platform/firefox/vapi-client.js b/platform/firefox/vapi-client.js index 2d35b2e..5f37ce2 100644 --- a/platform/firefox/vapi-client.js +++ b/platform/firefox/vapi-client.js @@ -38,6 +38,29 @@ vAPI.sessionId = String.fromCharCode(Date.now() % 25 + 97) + /******************************************************************************/ +vAPI.shutdown = (function() { + var jobs = []; + + var add = function(job) { + jobs.push(job); + }; + + var exec = function() { + //console.debug('Shutting down...'); + var job; + while ( job = jobs.pop() ) { + job(); + } + }; + + return { + add: add, + exec: exec + }; +})(); + +/******************************************************************************/ + var messagingConnector = function(response) { if ( !response ) { return; @@ -168,6 +191,15 @@ window.addEventListener('pageshow', vAPI.messaging.toggleListener, true); /******************************************************************************/ +// No need to have vAPI client linger around after shutdown if +// we are not a top window (because element picker can still +// be injected in top window). +if ( window !== window.top ) { + // Can anything be done? +} + +/******************************************************************************/ + })(this); /******************************************************************************/ |