diff --git a/platform/chromium/manifest.json b/platform/chromium/manifest.json index f2570cbfb..2f924ab9b 100644 --- a/platform/chromium/manifest.json +++ b/platform/chromium/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "uBlock Origin", - "version": "1.3.1", + "version": "1.3.2", "default_locale": "en", "description": "__MSG_extShortDesc__", diff --git a/platform/firefox/vapi-background.js b/platform/firefox/vapi-background.js index a91ecae40..5df6011a5 100644 --- a/platform/firefox/vapi-background.js +++ b/platform/firefox/vapi-background.js @@ -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). diff --git a/platform/opera/manifest.json b/platform/opera/manifest.json index 1e6b79c76..d850eee97 100644 --- a/platform/opera/manifest.json +++ b/platform/opera/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "uBlock Origin", - "version": "1.3.1", + "version": "1.3.2", "default_locale": "en", "description": "__MSG_extShortDesc__",