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

Delta Between Two Patch Sets: lib/devtools.js

Issue 29739603: Issue 6544 - Prevent requests sent by Chrome or Adblock Plus from being blocked (Closed)
Left Patch Set: Improved comment Created April 3, 2018, 11:35 p.m.
Right Patch Set: Made logic more verbose Created April 9, 2018, 9:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | lib/requestBlocker.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
(no file at all)
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 * document differs 128 * document differs
129 * @param {?string} sitekey The active sitekey if there is any 129 * @param {?string} sitekey The active sitekey if there is any
130 * @param {?boolean} specificOnly Whether generic filters should be ignored 130 * @param {?boolean} specificOnly Whether generic filters should be ignored
131 * @param {?BlockingFilter} filter The matched filter or null if there is no 131 * @param {?BlockingFilter} filter The matched filter or null if there is no
132 * match 132 * match
133 */ 133 */
134 exports.logRequest = function(tabIds, url, type, docDomain, 134 exports.logRequest = function(tabIds, url, type, docDomain,
135 thirdParty, sitekey, 135 thirdParty, sitekey,
136 specificOnly, filter) 136 specificOnly, filter)
137 { 137 {
138 if (panels.size == 0) 138 for (let tabId of tabIds)
139 return; 139 {
140 140 let panel = getActivePanel(tabId);
141 let request = {url, type, docDomain, thirdParty, sitekey, specificOnly}; 141 if (panel)
142 for (let [tabId, panel] of panels) 142 {
143 if ((tabIds.length == 0 || tabIds.includes(tabId)) && isActivePanel(panel)) 143 let request = {url, type, docDomain, thirdParty, sitekey, specificOnly};
144 addRecord(panel, request, filter); 144 addRecord(panel, request, filter);
145 }
146 }
145 }; 147 };
146 148
147 /** 149 /**
148 * Logs active element hiding filters to the devtools panel. 150 * Logs active element hiding filters to the devtools panel.
149 * 151 *
150 * @param {number} tabId The ID of the tab, the elements were hidden in 152 * @param {number} tabId The ID of the tab, the elements were hidden in
151 * @param {string[]} selectors The selectors of applied ElemHideFilters 153 * @param {string[]} selectors The selectors of applied ElemHideFilters
152 * @param {string[]} filters The text of applied ElemHideEmulationFilters 154 * @param {string[]} filters The text of applied ElemHideEmulationFilters
153 * @param {string} docDomain The IDN-decoded hostname of the document 155 * @param {string} docDomain The IDN-decoded hostname of the document
154 */ 156 */
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 panels.set(inspectedTabId, {port: newPort, records: []}); 377 panels.set(inspectedTabId, {port: newPort, records: []});
376 }); 378 });
377 379
378 port.on("devtools.traceElemHide", (message, sender) => 380 port.on("devtools.traceElemHide", (message, sender) =>
379 { 381 {
380 logHiddenElements( 382 logHiddenElements(
381 sender.page.id, message.selectors, message.filters, 383 sender.page.id, message.selectors, message.filters,
382 extractHostFromFrame(sender.frame) 384 extractHostFromFrame(sender.frame)
383 ); 385 );
384 }); 386 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld