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

Delta Between Two Patch Sets: lib/devtools.js

Issue 29418679: Issue 5042 - Adds handling for requests which are not associated with browser tab (Closed)
Left Patch Set: addresses comments, nits, redundancies, white space Created May 31, 2017, 8:43 a.m.
Right Patch Set: fix whitespace, add comment abut null page, remove redundancies Created June 2, 2017, 5:01 a.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 | « ext/background.js ('k') | 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
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 request.docDomain, 114 request.docDomain,
115 request.thirdParty, 115 request.thirdParty,
116 request.sitekey, 116 request.sitekey,
117 request.specificOnly 117 request.specificOnly
118 ); 118 );
119 } 119 }
120 120
121 /** 121 /**
122 * Logs a request to the devtools panel. 122 * Logs a request to the devtools panel.
123 * 123 *
124 * @param {?Page} page The page the request occured on 124 * @param {?Page} page The page the request occured on or null if
Sebastian Noack 2017/06/01 17:32:21 Please describe the scenario in which Page is null
Jon Sonesen 2017/06/02 05:02:57 Acknowledged.
125 * the request isn't associated with a page
125 * @param {string} url The URL of the request 126 * @param {string} url The URL of the request
126 * @param {string} type The request type 127 * @param {string} type The request type
127 * @param {string} docDomain The IDN-decoded hostname of the document 128 * @param {string} docDomain The IDN-decoded hostname of the document
128 * @param {boolean} thirdParty Whether the origin of the request and 129 * @param {boolean} thirdParty Whether the origin of the request and
129 * document differs 130 * document differs
130 * @param {?string} sitekey The active sitekey if there is any 131 * @param {?string} sitekey The active sitekey if there is any
131 * @param {?boolean} specificOnly Whether generic filters should be ignored 132 * @param {?boolean} specificOnly Whether generic filters should be ignored
132 * @param {?BlockingFilter} filter The matched filter or null if there is no 133 * @param {?BlockingFilter} filter The matched filter or null if there is no
133 * match 134 * match
134 */ 135 */
135 exports.logRequest = function(page, url, type, docDomain, 136 exports.logRequest = function(page, url, type, docDomain,
136 thirdParty, sitekey, 137 thirdParty, sitekey,
137 specificOnly, filter) 138 specificOnly, filter)
138 { 139 {
139 if (panels.size == 0) 140 if (panels.size == 0)
140 return; 141 return;
142
141 let request = {url, type, docDomain, thirdParty, sitekey, specificOnly}; 143 let request = {url, type, docDomain, thirdParty, sitekey, specificOnly};
142 if (page)
143 {
144 let panel = getActivePanel(page);
145 if (panel)
146 addRecord(panel, request, filter);
147 return;
148 }
149 for (let [tabId, panel] of panels) 144 for (let [tabId, panel] of panels)
Sebastian Noack 2017/06/01 17:32:21 The logic above, handling the case of page being n
Jon Sonesen 2017/06/02 05:02:57 Acknowledged.
150 if ((!page || page.id == tabId) && isActivePanel(panel)) 145 if ((!page || page.id == tabId) && isActivePanel(panel))
151 addRecord(panel, request, filter); 146 addRecord(panel, request, filter);
152 }; 147 };
153 148
154 /** 149 /**
155 * Logs active element hiding filters to the devtools panel. 150 * Logs active element hiding filters to the devtools panel.
156 * 151 *
157 * @param {Page} page The page the elements were hidden on 152 * @param {Page} page The page the elements were hidden on
158 * @param {string[]} selectors The selectors of applied ElemHideFilters 153 * @param {string[]} selectors The selectors of applied ElemHideFilters
159 * @param {string[]} filters The text of applied ElemHideEmulationFilters 154 * @param {string[]} filters The text of applied ElemHideEmulationFilters
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 panels.set(inspectedTabId, {port: newPort, records: []}); 377 panels.set(inspectedTabId, {port: newPort, records: []});
383 }); 378 });
384 379
385 port.on("devtools.traceElemHide", (message, sender) => 380 port.on("devtools.traceElemHide", (message, sender) =>
386 { 381 {
387 logHiddenElements( 382 logHiddenElements(
388 sender.page, message.selectors, message.filters, 383 sender.page, message.selectors, message.filters,
389 extractHostFromFrame(sender.frame) 384 extractHostFromFrame(sender.frame)
390 ); 385 );
391 }); 386 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld