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

Side by Side Diff: lib/devtools.js

Issue 29739603: Issue 6544 - Prevent requests sent by Chrome or Adblock Plus from being blocked (Closed)
Patch Set: Streamlined request logging Created April 5, 2018, 5:39 a.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 | lib/requestBlocker.js » ('j') | lib/requestBlocker.js » ('J')
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 * document differs 127 * document differs
128 * @param {?string} sitekey The active sitekey if there is any 128 * @param {?string} sitekey The active sitekey if there is any
129 * @param {?boolean} specificOnly Whether generic filters should be ignored 129 * @param {?boolean} specificOnly Whether generic filters should be ignored
130 * @param {?BlockingFilter} filter The matched filter or null if there is no 130 * @param {?BlockingFilter} filter The matched filter or null if there is no
131 * match 131 * match
132 */ 132 */
133 exports.logRequest = function(tabIds, url, type, docDomain, 133 exports.logRequest = function(tabIds, url, type, docDomain,
134 thirdParty, sitekey, 134 thirdParty, sitekey,
135 specificOnly, filter) 135 specificOnly, filter)
136 { 136 {
137 if (panels.size == 0) 137 for (let tabId of tabIds)
kzar 2018/04/05 10:56:37 How come you removed this check? I agreed with it,
Sebastian Noack 2018/04/05 17:38:59 Why bother checking the size if we would only do o
138 return; 138 {
139 139 let panel = getActivePanel(tabId);
140 let request = {url, type, docDomain, thirdParty, sitekey, specificOnly}; 140 if (panel)
141 for (let [tabId, panel] of panels) 141 {
142 if ((tabIds.length == 0 || tabIds.includes(tabId)) && isActivePanel(panel)) 142 let request = {url, type, docDomain, thirdParty, sitekey, specificOnly};
kzar 2018/04/05 10:56:37 How come we're now assigning request inside the lo
Sebastian Noack 2018/04/05 17:38:59 Most of the time we have only one tabId which most
kzar 2018/04/06 14:48:10 Sure, that's why we had the extra check above whic
Sebastian Noack 2018/04/06 17:55:46 The object was still created redundantly if there
kzar 2018/04/09 11:08:43 Well I guess we disagree on this but whatever, I w
143 addRecord(panel, request, filter); 143 addRecord(panel, request, filter);
144 }
145 }
Sebastian Noack 2018/04/05 05:42:45 I figured now where we don't log requests out of c
Sebastian Noack 2018/04/05 06:03:58 For reference, the case of `tabIds.length == 0` ri
144 }; 146 };
145 147
146 /** 148 /**
147 * Logs active element hiding filters to the devtools panel. 149 * Logs active element hiding filters to the devtools panel.
148 * 150 *
149 * @param {number} tabId The ID of the tab, the elements were hidden in 151 * @param {number} tabId The ID of the tab, the elements were hidden in
150 * @param {string[]} selectors The selectors of applied ElemHideFilters 152 * @param {string[]} selectors The selectors of applied ElemHideFilters
151 * @param {string[]} filters The text of applied ElemHideEmulationFilters 153 * @param {string[]} filters The text of applied ElemHideEmulationFilters
152 * @param {string} docDomain The IDN-decoded hostname of the document 154 * @param {string} docDomain The IDN-decoded hostname of the document
153 */ 155 */
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 panels.set(inspectedTabId, {port: newPort, records: []}); 376 panels.set(inspectedTabId, {port: newPort, records: []});
375 }); 377 });
376 378
377 port.on("devtools.traceElemHide", (message, sender) => 379 port.on("devtools.traceElemHide", (message, sender) =>
378 { 380 {
379 logHiddenElements( 381 logHiddenElements(
380 sender.page.id, message.selectors, message.filters, 382 sender.page.id, message.selectors, message.filters,
381 extractHostFromFrame(sender.frame) 383 extractHostFromFrame(sender.frame)
382 ); 384 );
383 }); 385 });
OLDNEW
« no previous file with comments | « no previous file | lib/requestBlocker.js » ('j') | lib/requestBlocker.js » ('J')

Powered by Google App Engine
This is Rietveld