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

Side by Side Diff: lib/devtools.js

Issue 29418679: Issue 5042 - Adds handling for requests which are not associated with browser tab (Closed)
Patch Set: Created April 20, 2017, 9:43 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
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-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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 * document differs 129 * document differs
130 * @param {?string} sitekey The active sitekey if there is any 130 * @param {?string} sitekey The active sitekey if there is any
131 * @param {?boolean} specificOnly Whether generic filters should be ignored 131 * @param {?boolean} specificOnly Whether generic filters should be ignored
132 * @param {?BlockingFilter} filter The matched filter or null if there is no 132 * @param {?BlockingFilter} filter The matched filter or null if there is no
133 * match 133 * match
134 */ 134 */
135 exports.logRequest = function(page, url, type, docDomain, 135 exports.logRequest = function(page, url, type, docDomain,
136 thirdParty, sitekey, 136 thirdParty, sitekey,
137 specificOnly, filter) 137 specificOnly, filter)
138 { 138 {
139 let panel = getActivePanel(page); 139 let request = {url, type, docDomain, thirdParty, sitekey, specificOnly};
Sebastian Noack 2017/04/21 08:39:53 Perhaps, we should bail if there are no panels, be
Jon Sonesen 2017/04/24 08:40:56 Acknowledged.
140 if (panel) 140 if (page)
141 { 141 {
142 let request = {url, type, docDomain, thirdParty, sitekey, specificOnly}; 142 let panel = getActivePanel(page);
143 addRecord(panel, request, filter); 143 if (panel)
144 addRecord(panel, request, filter);
145 return;
144 } 146 }
147 for (let panelId in panels)
Sebastian Noack 2017/04/21 08:39:53 Some of the code added here, and in this file in g
Jon Sonesen 2017/04/24 08:40:56 Awesome, I agree here. I am wondering though, shou
148 addRecord(panels[panelId], request, filter);
Sebastian Noack 2017/04/21 08:39:53 getActivePanel(), called when logging for a specif
Jon Sonesen 2017/04/24 08:40:56 Acknowledged.
145 }; 149 };
146 150
147 /** 151 /**
148 * Logs active element hiding filters to the devtools panel. 152 * Logs active element hiding filters to the devtools panel.
149 * 153 *
150 * @param {Page} page The page the elements were hidden on 154 * @param {Page} page The page the elements were hidden on
151 * @param {string[]} selectors The selectors of applied ElemHideFilters 155 * @param {string[]} selectors The selectors of applied ElemHideFilters
152 * @param {string[]} filters The text of applied ElemHideEmulationFilters 156 * @param {string[]} filters The text of applied ElemHideEmulationFilters
153 * @param {string} docDomain The IDN-decoded hostname of the document 157 * @param {string} docDomain The IDN-decoded hostname of the document
154 */ 158 */
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 panels[inspectedTabId] = {port: newPort, records: []}; 381 panels[inspectedTabId] = {port: newPort, records: []};
378 }); 382 });
379 383
380 port.on("devtools.traceElemHide", (message, sender) => 384 port.on("devtools.traceElemHide", (message, sender) =>
381 { 385 {
382 logHiddenElements( 386 logHiddenElements(
383 sender.page, message.selectors, message.filters, 387 sender.page, message.selectors, message.filters,
384 extractHostFromFrame(sender.frame) 388 extractHostFromFrame(sender.frame)
385 ); 389 );
386 }); 390 });
OLDNEW

Powered by Google App Engine
This is Rietveld