mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
forgot to add shutdown to other platforms (re. https://github.com/gorhill/uMatrix/issues/144)
This commit is contained in:
parent
44bbf356f7
commit
125513164f
@ -167,6 +167,8 @@ vAPI.messaging = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
// No need to have vAPI client linger around after shutdown if
|
// No need to have vAPI client linger around after shutdown if
|
||||||
// we are not a top window (because element picker can still
|
// we are not a top window (because element picker can still
|
||||||
// be injected in top window).
|
// be injected in top window).
|
||||||
|
@ -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) {
|
var messagingConnector = function(response) {
|
||||||
if ( !response ) {
|
if ( !response ) {
|
||||||
return;
|
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);
|
})(this);
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -39,6 +39,27 @@
|
|||||||
vAPI.sessionId = String.fromCharCode(Date.now() % 25 + 97) +
|
vAPI.sessionId = String.fromCharCode(Date.now() % 25 + 97) +
|
||||||
Math.random().toString(36).slice(2);
|
Math.random().toString(36).slice(2);
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
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) {
|
var messagingConnector = function(response) {
|
||||||
if(!response) {
|
if(!response) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user