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

Delta Between Two Patch Sets: lib/cssInjection.js

Issue 29696583: Issue 6385 - Don't attempt to inject styles for frames we can't find (Closed)
Left Patch Set: Created Feb. 13, 2018, 3 p.m.
Right Patch Set: Return `false` explicitly instead of `undefined` implicitly Created Feb. 14, 2018, 2:49 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) 109 if (!frame)
110 return; 110 return false;
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 111
112 if (!frame.injectedStyleSheets) 112 if (!frame.injectedStyleSheets)
113 frame.injectedStyleSheets = new Map(); 113 frame.injectedStyleSheets = new Map();
114 114
115 let oldStyleSheet = frame.injectedStyleSheets.get(groupName); 115 let oldStyleSheet = frame.injectedStyleSheets.get(groupName);
116 116
117 // 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
118 // 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
119 // 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
120 // regardless. 120 // regardless.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 response.inlineEmulated = true; 176 response.inlineEmulated = true;
177 177
178 return response; 178 return response;
179 }); 179 });
180 180
181 port.on("elemhide.injectSelectors", (message, sender) => 181 port.on("elemhide.injectSelectors", (message, sender) =>
182 { 182 {
183 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors, 183 updateFrameStyles(sender.page.id, sender.frame.id, message.selectors,
184 message.groupName); 184 message.groupName);
185 }); 185 });
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