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

Delta Between Two Patch Sets: lib/popupBlocker.js

Issue 29417597: Issue 5161 - Use maps and sets where appropriate (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Revert previous change and remove unnecessary logic Created May 19, 2017, 4:15 p.m.
Right Patch Set: Minor unrelated changes Created May 21, 2017, 10:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/devtools.js ('k') | lib/whitelisting.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 forgetPopup(details.tabId); 88 forgetPopup(details.tabId);
89 } 89 }
90 90
91 chrome.webNavigation.onCreatedNavigationTarget.addListener(details => 91 chrome.webNavigation.onCreatedNavigationTarget.addListener(details =>
92 { 92 {
93 if (loadingPopups.size == 0) 93 if (loadingPopups.size == 0)
94 { 94 {
95 chrome.webRequest.onBeforeRequest.addListener( 95 chrome.webRequest.onBeforeRequest.addListener(
96 onPopupURLChanged, 96 onPopupURLChanged,
97 { 97 {
98 urls: ["<all_urls>"], 98 urls: ["http://*/*", "https://*/*"],
99 types: ["main_frame"] 99 types: ["main_frame"]
100 } 100 }
101 ); 101 );
102 chrome.webNavigation.onCommitted.addListener(onPopupURLChanged); 102 chrome.webNavigation.onCommitted.addListener(onPopupURLChanged);
103 chrome.webNavigation.onCompleted.addListener(onCompleted); 103 chrome.webNavigation.onCompleted.addListener(onCompleted);
104 chrome.tabs.onRemoved.addListener(forgetPopup); 104 chrome.tabs.onRemoved.addListener(forgetPopup);
105 } 105 }
106 106
107 let {tabId} = details;
108
109 let popup = { 107 let popup = {
110 url: details.url, 108 url: details.url,
111 sourcePage: new ext.Page({id: details.sourceTabId}), 109 sourcePage: new ext.Page({id: details.sourceTabId}),
112 sourceFrame: null 110 sourceFrame: null
113 }; 111 };
114 112
115 loadingPopups.set(tabId, popup); 113 loadingPopups.set(details.tabId, popup);
116 114
117 let frame = ext.getFrame(details.sourceTabId, details.sourceFrameId); 115 let frame = ext.getFrame(details.sourceTabId, details.sourceFrameId);
118 116
119 if (checkWhitelisted(popup.sourcePage, frame)) 117 if (checkWhitelisted(popup.sourcePage, frame))
120 { 118 {
121 forgetPopup(tabId); 119 forgetPopup(details.tabId);
122 } 120 }
123 else 121 else
124 { 122 {
125 popup.sourceFrame = frame; 123 popup.sourceFrame = frame;
126 checkPotentialPopup(tabId, popup); 124 checkPotentialPopup(details.tabId, popup);
127 } 125 }
128 }); 126 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld