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

Delta Between Two Patch Sets: ext/background.js

Issue 29882555: Issue 6953 - Update frame structure for data URI frames (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Created Sept. 16, 2018, 2:10 p.m.
Right Patch Set: Remove mistakenly uploaded dependencies file Created Sept. 25, 2018, 4:08 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 | « no previous file | no next file » | 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-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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 244 }
245 245
246 updatePageFrameStructure(details.frameId, details.tabId, details.url, 246 updatePageFrameStructure(details.frameId, details.tabId, details.url,
247 details.parentFrameId); 247 details.parentFrameId);
248 }, 248 },
249 {types: ["main_frame", "sub_frame"], urls: ["http://*/*", "https://*/*"]}, 249 {types: ["main_frame", "sub_frame"], urls: ["http://*/*", "https://*/*"]},
250 ["responseHeaders"]); 250 ["responseHeaders"]);
251 251
252 browser.webNavigation.onBeforeNavigate.addListener(details => 252 browser.webNavigation.onBeforeNavigate.addListener(details =>
253 { 253 {
254 // Requests can be made by about: and data: frames before the frame's 254 // Requests can be made by about:blank frames before the frame's
255 // onCommitted event has fired, so we update the frame structure for those 255 // onCommitted event has fired; besides, the parent frame's ID is not
256 // now. 256 // available in onCommitted, nor is the onHeadersReceived event fired for
257 if (/^(about|data):/.test(details.url)) 257 // about: and data: frames; so we update the frame structure for such
Sebastian Noack 2018/09/17 16:02:31 Nit: I'm not sure if a regular expression is justi
Manish Jethani 2018/09/21 20:32:24 Changed to String.startsWith. I have a hunch that
258 // frames here.
259 if (details.url.startsWith("about:") || details.url.startsWith("data:"))
258 { 260 {
259 updatePageFrameStructure(details.frameId, details.tabId, details.url, 261 updatePageFrameStructure(details.frameId, details.tabId, details.url,
260 details.parentFrameId); 262 details.parentFrameId);
261 } 263 }
262 }); 264 });
263 265
264 browser.webNavigation.onCommitted.addListener(details => 266 browser.webNavigation.onCommitted.addListener(details =>
265 { 267 {
266 // We have to update the frame structure for documents that weren't 268 // We have to update the frame structure for documents that weren't
267 // loaded over HTTP (including documents cached by Service Workers), 269 // loaded over HTTP (including documents cached by Service Workers),
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 return frames.get(0) || null; 603 return frames.get(0) || null;
602 } 604 }
603 }; 605 };
604 } 606 }
605 607
606 return ext.onMessage._dispatch( 608 return ext.onMessage._dispatch(
607 message, sender, sendResponse 609 message, sender, sendResponse
608 ).includes(true); 610 ).includes(true);
609 }); 611 });
610 } 612 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld