Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/popupBlocker.js

Issue 29539831: Issue 5648 - Include lib/popupBlocker.js on Firefox (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Sept. 8, 2017, 6:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | metadata.gecko-webext » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 checkPotentialPopup(details.tabId, popup); 81 checkPotentialPopup(details.tabId, popup);
82 } 82 }
83 } 83 }
84 84
85 function onCompleted(details) 85 function onCompleted(details)
86 { 86 {
87 if (details.frameId == 0 && details.url != "about:blank") 87 if (details.frameId == 0 && details.url != "about:blank")
88 forgetPopup(details.tabId); 88 forgetPopup(details.tabId);
89 } 89 }
90 90
91 chrome.webNavigation.onCreatedNavigationTarget.addListener(details => 91 // Versions of Firefox before 54 do not support
92 // webNavigation.onCreatedNavigationTarget
93 // https://bugzilla.mozilla.org/show_bug.cgi?id=1190687
94 if ("onCreatedNavigationTarget" in chrome.webNavigation)
92 { 95 {
93 if (loadingPopups.size == 0) 96 chrome.webNavigation.onCreatedNavigationTarget.addListener(details =>
94 { 97 {
95 chrome.webRequest.onBeforeRequest.addListener( 98 if (loadingPopups.size == 0)
96 onPopupURLChanged, 99 {
97 { 100 chrome.webRequest.onBeforeRequest.addListener(
98 urls: ["http://*/*", "https://*/*"], 101 onPopupURLChanged,
99 types: ["main_frame"] 102 {
100 } 103 urls: ["http://*/*", "https://*/*"],
101 ); 104 types: ["main_frame"]
102 chrome.webNavigation.onCommitted.addListener(onPopupURLChanged); 105 }
103 chrome.webNavigation.onCompleted.addListener(onCompleted); 106 );
104 chrome.tabs.onRemoved.addListener(forgetPopup); 107 chrome.webNavigation.onCommitted.addListener(onPopupURLChanged);
105 } 108 chrome.webNavigation.onCompleted.addListener(onCompleted);
109 chrome.tabs.onRemoved.addListener(forgetPopup);
110 }
106 111
107 let popup = { 112 let popup = {
108 url: details.url, 113 url: details.url,
109 sourcePage: new ext.Page({id: details.sourceTabId}), 114 sourcePage: new ext.Page({id: details.sourceTabId}),
110 sourceFrame: null 115 sourceFrame: null
111 }; 116 };
112 117
113 loadingPopups.set(details.tabId, popup); 118 loadingPopups.set(details.tabId, popup);
114 119
115 let frame = ext.getFrame(details.sourceTabId, details.sourceFrameId); 120 let frame = ext.getFrame(details.sourceTabId, details.sourceFrameId);
116 121
117 if (checkWhitelisted(popup.sourcePage, frame)) 122 if (checkWhitelisted(popup.sourcePage, frame))
118 { 123 {
119 forgetPopup(details.tabId); 124 forgetPopup(details.tabId);
120 } 125 }
121 else 126 else
122 { 127 {
123 popup.sourceFrame = frame; 128 popup.sourceFrame = frame;
124 checkPotentialPopup(details.tabId, popup); 129 checkPotentialPopup(details.tabId, popup);
125 } 130 }
126 }); 131 });
132 }
OLDNEW
« no previous file with comments | « no previous file | metadata.gecko-webext » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld