Index: lib/popupBlocker.js |
=================================================================== |
--- a/lib/popupBlocker.js |
+++ b/lib/popupBlocker.js |
@@ -28,20 +28,20 @@ |
let loadingPopups = new Map(); |
function forgetPopup(tabId) |
{ |
loadingPopups.delete(tabId); |
if (loadingPopups.size == 0) |
{ |
- chrome.webRequest.onBeforeRequest.removeListener(onPopupURLChanged); |
- chrome.webNavigation.onCommitted.removeListener(onPopupURLChanged); |
- chrome.webNavigation.onCompleted.removeListener(onCompleted); |
- chrome.tabs.onRemoved.removeListener(forgetPopup); |
+ browser.webRequest.onBeforeRequest.removeListener(onPopupURLChanged); |
+ browser.webNavigation.onCommitted.removeListener(onPopupURLChanged); |
+ browser.webNavigation.onCompleted.removeListener(onCompleted); |
+ browser.tabs.onRemoved.removeListener(forgetPopup); |
} |
} |
function checkPotentialPopup(tabId, popup) |
{ |
let urlObj = new URL(popup.url || "about:blank"); |
let urlString = stringifyURL(urlObj); |
let documentHost = extractHostFromFrame(popup.sourceFrame); |
@@ -53,17 +53,17 @@ |
); |
let filter = defaultMatcher.matchesAny( |
urlString, RegExpFilter.typeMap.POPUP, |
documentHost, thirdParty, null, specificOnly |
); |
if (filter instanceof BlockingFilter) |
- chrome.tabs.remove(tabId); |
+ browser.tabs.remove(tabId); |
logRequest( |
popup.sourcePage, urlString, "POPUP", |
documentHost, thirdParty, null, |
specificOnly, filter |
); |
} |
@@ -86,32 +86,32 @@ |
{ |
if (details.frameId == 0 && details.url != "about:blank") |
forgetPopup(details.tabId); |
} |
// Versions of Firefox before 54 do not support |
// webNavigation.onCreatedNavigationTarget |
// https://bugzilla.mozilla.org/show_bug.cgi?id=1190687 |
-if ("onCreatedNavigationTarget" in chrome.webNavigation) |
+if ("onCreatedNavigationTarget" in browser.webNavigation) |
{ |
- chrome.webNavigation.onCreatedNavigationTarget.addListener(details => |
+ browser.webNavigation.onCreatedNavigationTarget.addListener(details => |
{ |
if (loadingPopups.size == 0) |
{ |
- chrome.webRequest.onBeforeRequest.addListener( |
+ browser.webRequest.onBeforeRequest.addListener( |
onPopupURLChanged, |
{ |
urls: ["http://*/*", "https://*/*"], |
types: ["main_frame"] |
} |
); |
- chrome.webNavigation.onCommitted.addListener(onPopupURLChanged); |
- chrome.webNavigation.onCompleted.addListener(onCompleted); |
- chrome.tabs.onRemoved.addListener(forgetPopup); |
+ browser.webNavigation.onCommitted.addListener(onPopupURLChanged); |
+ browser.webNavigation.onCompleted.addListener(onCompleted); |
+ browser.tabs.onRemoved.addListener(forgetPopup); |
} |
let popup = { |
url: details.url, |
sourcePage: new ext.Page({id: details.sourceTabId}), |
sourceFrame: null |
}; |