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

Side by Side Diff: lib/cssInjection.js

Issue 29696583: Issue 6385 - Don't attempt to inject styles for frames we can't find (Closed)
Patch Set: Created Feb. 13, 2018, 3 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 }); 99 });
100 } 100 }
101 101
102 function updateFrameStyles(tabId, frameId, selectors, groupName) 102 function updateFrameStyles(tabId, frameId, selectors, groupName)
103 { 103 {
104 let styleSheet = null; 104 let styleSheet = null;
105 if (selectors.length > 0) 105 if (selectors.length > 0)
106 styleSheet = createStyleSheet(selectors); 106 styleSheet = createStyleSheet(selectors);
107 107
108 let frame = ext.getFrame(tabId, frameId); 108 let frame = ext.getFrame(tabId, frameId);
109 if (!frame)
110 return;
Manish Jethani 2018/02/14 13:41:16 OK, I guess this is the right thing to do. But we
Manish Jethani 2018/02/14 14:03:41 If this is reproduceable, we should check why it i
kzar 2018/02/14 14:52:58 This is reproducible, the issue description is up
kzar 2018/02/14 14:52:58 Done.
Manish Jethani 2018/02/15 14:06:22 See my comment here: https://issues.adblockplus.o
111
109 if (!frame.injectedStyleSheets) 112 if (!frame.injectedStyleSheets)
110 frame.injectedStyleSheets = new Map(); 113 frame.injectedStyleSheets = new Map();
111 114
112 let oldStyleSheet = frame.injectedStyleSheets.get(groupName); 115 let oldStyleSheet = frame.injectedStyleSheets.get(groupName);
113 116
114 // Ideally we would compare the old and new style sheets and skip this code 117 // Ideally we would compare the old and new style sheets and skip this code
115 // if they're the same, but the old style sheet can be a leftover from a 118 // if they're the same, but the old style sheet can be a leftover from a
116 // previous instance of the frame. We must add the new style sheet 119 // previous instance of the frame. We must add the new style sheet
117 // regardless. 120 // regardless.
118 121
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 response.inlineEmulated = true; 176 response.inlineEmulated = true;
174 177
175 return response; 178 return response;
176 }); 179 });
177 180
178 port.on("elemhide.injectSelectors", (message, sender) => 181 port.on("elemhide.injectSelectors", (message, sender) =>
179 { 182 {
180 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors, 183 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors,
181 message.groupName); 184 message.groupName);
182 }); 185 });
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