This commit is contained in:
gorhill 2015-10-21 09:02:31 -04:00
parent d4c2179e2f
commit 1d85c16f82
3 changed files with 26 additions and 20 deletions

View file

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "uBlock Origin",
"version": "1.3.1",
"version": "1.3.2",
"default_locale": "en",
"description": "__MSG_extShortDesc__",

View file

@ -1213,29 +1213,30 @@ var tabWatcher = (function() {
}
};
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWindowWatcher
var windowWatcher = {
observe: function(aSubject, topic) {
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWindowWatcher#registerNotification%28%29
// "aSubject - the window being opened or closed, sent as an
// "nsISupports which can be ... QueryInterfaced to an
// "nsIDOMWindow."
// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIWindowMediator
// https://github.com/gorhill/uMatrix/issues/357
// Use nsIWindowMediator for being notified of opened/closed windows.
var windowListener = {
onOpenWindow: function(aWindow) {
var win;
try {
win = aSubject.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
win = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
} catch (ex) {
}
if ( !win ) {
return;
}
if ( topic === 'domwindowopened' ) {
if ( 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);
return;
}
}
};
@ -1261,11 +1262,11 @@ var tabWatcher = (function() {
}
}
Services.ww.registerNotification(windowWatcher);
Services.wm.addListener(windowListener);
};
var stop = function() {
Services.ww.unregisterNotification(windowWatcher);
Services.wm.removeListener(windowListener);
for ( var win of vAPI.tabs.getWindows() ) {
onWindowUnload(win);
@ -2976,6 +2977,11 @@ vAPI.contextMenu.register = function(doc) {
return;
}
// Already installed?
if ( doc.getElementById(this.menuItemId) !== null ) {
return;
}
var contextMenu = doc.getElementById('contentAreaContextMenu');
// This can happen (Thunderbird).

View file

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "uBlock Origin",
"version": "1.3.1",
"version": "1.3.2",
"default_locale": "en",
"description": "__MSG_extShortDesc__",