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

Side by Side Diff: ext/background.js

Issue 29958567: Issue 7104 - Clear style sheets when frame structure is updated (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Patch Set: Created Dec. 4, 2018, 2:33 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 let frame = createFrame(tabId, frameId); 161 let frame = createFrame(tabId, frameId);
162 frame.url = new URL(url); 162 frame.url = new URL(url);
163 163
164 let frames = framesOfTabs.get(tabId); 164 let frames = framesOfTabs.get(tabId);
165 let parentFrame = frames.get(parentFrameId); 165 let parentFrame = frames.get(parentFrameId);
166 if (!parentFrame && parentFrameId > 0) 166 if (!parentFrame && parentFrameId > 0)
167 parentFrame = frames.get(0); 167 parentFrame = frames.get(0);
168 168
169 if (parentFrame) 169 if (parentFrame)
170 frame.parent = parentFrame; 170 frame.parent = parentFrame;
171
172 frame.injectedStyleSheets = null;
171 } 173 }
172 174
173 browser.webRequest.onHeadersReceived.addListener(details => 175 browser.webRequest.onHeadersReceived.addListener(details =>
174 { 176 {
175 // We have to update the frame structure when switching to a new 177 // We have to update the frame structure when switching to a new
176 // document, so that we process any further requests made by that 178 // document, so that we process any further requests made by that
177 // document in the right context. Unfortunately, we cannot rely 179 // document in the right context. Unfortunately, we cannot rely
178 // on webNavigation.onCommitted since it isn't guaranteed to fire 180 // on webNavigation.onCommitted since it isn't guaranteed to fire
179 // before any subresources start downloading[1]. As an 181 // before any subresources start downloading[1]. As an
180 // alternative we use webRequest.onHeadersReceived for HTTP(S) 182 // alternative we use webRequest.onHeadersReceived for HTTP(S)
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 return frames.get(0) || null; 520 return frames.get(0) || null;
519 } 521 }
520 }; 522 };
521 } 523 }
522 524
523 return ext.onMessage._dispatch( 525 return ext.onMessage._dispatch(
524 message, sender, sendResponse 526 message, sender, sendResponse
525 ).includes(true); 527 ).includes(true);
526 }); 528 });
527 } 529 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld