mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 01:02:08 +01:00
hopefully this finally fix https://github.com/gorhill/uMatrix/issues/357
This commit is contained in:
parent
d4c2179e2f
commit
1d85c16f82
3 changed files with 26 additions and 20 deletions
|
@ -2,7 +2,7 @@
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
|
|
||||||
"name": "uBlock Origin",
|
"name": "uBlock Origin",
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
|
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_extShortDesc__",
|
"description": "__MSG_extShortDesc__",
|
||||||
|
|
|
@ -1213,29 +1213,30 @@ var tabWatcher = (function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWindowWatcher
|
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWindowMediator
|
||||||
var windowWatcher = {
|
// https://github.com/gorhill/uMatrix/issues/357
|
||||||
observe: function(aSubject, topic) {
|
// Use nsIWindowMediator for being notified of opened/closed windows.
|
||||||
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWindowWatcher#registerNotification%28%29
|
var windowListener = {
|
||||||
// "aSubject - the window being opened or closed, sent as an
|
onOpenWindow: function(aWindow) {
|
||||||
// "nsISupports which can be ... QueryInterfaced to an
|
|
||||||
// "nsIDOMWindow."
|
|
||||||
var win;
|
var win;
|
||||||
try {
|
try {
|
||||||
win = aSubject.QueryInterface(Ci.nsIInterfaceRequestor)
|
win = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindow);
|
.getInterface(Ci.nsIDOMWindow);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
}
|
}
|
||||||
if ( !win ) {
|
if ( win ) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ( topic === 'domwindowopened' ) {
|
|
||||||
onWindowLoad(win);
|
onWindowLoad(win);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if ( topic === 'domwindowclosed' ) {
|
},
|
||||||
|
onCloseWindow: function(aWindow) {
|
||||||
|
var win;
|
||||||
|
try {
|
||||||
|
win = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
.getInterface(Ci.nsIDOMWindow);
|
||||||
|
} catch (ex) {
|
||||||
|
}
|
||||||
|
if ( win ) {
|
||||||
onWindowUnload(win);
|
onWindowUnload(win);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1261,11 +1262,11 @@ var tabWatcher = (function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Services.ww.registerNotification(windowWatcher);
|
Services.wm.addListener(windowListener);
|
||||||
};
|
};
|
||||||
|
|
||||||
var stop = function() {
|
var stop = function() {
|
||||||
Services.ww.unregisterNotification(windowWatcher);
|
Services.wm.removeListener(windowListener);
|
||||||
|
|
||||||
for ( var win of vAPI.tabs.getWindows() ) {
|
for ( var win of vAPI.tabs.getWindows() ) {
|
||||||
onWindowUnload(win);
|
onWindowUnload(win);
|
||||||
|
@ -2976,6 +2977,11 @@ vAPI.contextMenu.register = function(doc) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Already installed?
|
||||||
|
if ( doc.getElementById(this.menuItemId) !== null ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var contextMenu = doc.getElementById('contentAreaContextMenu');
|
var contextMenu = doc.getElementById('contentAreaContextMenu');
|
||||||
|
|
||||||
// This can happen (Thunderbird).
|
// This can happen (Thunderbird).
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
|
|
||||||
"name": "uBlock Origin",
|
"name": "uBlock Origin",
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
|
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_extShortDesc__",
|
"description": "__MSG_extShortDesc__",
|
||||||
|
|
Loading…
Reference in a new issue