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

Delta Between Two Patch Sets: include.preload.js

Issue 6269930580213760: Issue 309 - Don't use Shadow DOM in Chrome 32.0.1700 (Closed)
Left Patch Set: Created April 17, 2014, 11:52 a.m.
Right Patch Set: Fixed typo in comment Created April 17, 2014, 12:27 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 <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 var SELECTOR_GROUP_SIZE = 20; 18 var SELECTOR_GROUP_SIZE = 20;
19 19
20 // Sets the currently used CSS rules for elemhide filters 20 // Sets the currently used CSS rules for elemhide filters
21 function setElemhideCSSRules(selectors) 21 function setElemhideCSSRules(selectors)
22 { 22 {
23 if (selectors.length == 0) 23 if (selectors.length == 0)
24 return; 24 return;
25 25
26 var style = document.createElement("style"); 26 var style = document.createElement("style");
27 style.setAttribute("type", "text/css"); 27 style.setAttribute("type", "text/css");
28 28
29 // Use Shadow DOM if available to don't mess with web pages that 29 // Use Shadow DOM if available to don't mess with web pages that
30 // rely on the order of their own <style> tags. However the 30 // rely on the order of their own <style> tags. However
31 // <shadow> element is broken in Chrome Chrome 32.0.1700 (#309) 31 // the <shadow> element is broken in Chrome 32.0.1700 (#309)
Thomas Greiner 2014/04/17 12:24:17 "in Chrome Chrome" ;)
Sebastian Noack 2014/04/17 12:30:32 Done.
32 if ("webkitCreateShadowRoot" in document.documentElement && !/\bChrome\/32\.0\ .1700\b/.test(navigator.userAgent)) 32 if ("webkitCreateShadowRoot" in document.documentElement && !/\bChrome\/32\.0\ .1700\b/.test(navigator.userAgent))
Felix Dahlke 2014/04/17 12:05:38 Is there no other way to figure out if the shadow
Sebastian Noack 2014/04/17 12:24:17 Please see the discussion at https://issues.adbloc
Thomas Greiner 2014/04/17 12:24:17 In what way is it broken? You mention that the "<s
Sebastian Noack 2014/04/17 12:30:32 Same effect as if it wouldn't be there. And since
33 { 33 {
34 var shadow = document.documentElement.webkitCreateShadowRoot(); 34 var shadow = document.documentElement.webkitCreateShadowRoot();
35 shadow.appendChild(document.createElement("shadow")); 35 shadow.appendChild(document.createElement("shadow"));
36 shadow.appendChild(style); 36 shadow.appendChild(style);
37 37
38 try 38 try
39 { 39 {
40 document.querySelector("::content"); 40 document.querySelector("::content");
41 41
42 for (var i = 0; i < selectors.length; i++) 42 for (var i = 0; i < selectors.length; i++)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 ext.backgroundPage.sendMessage({type: "add-key-exception", token: attr}); 122 ext.backgroundPage.sendMessage({type: "add-key-exception", token: attr});
123 123
124 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); 124 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules);
125 } 125 }
126 126
127 // In Chrome 18 the document might not be initialized yet 127 // In Chrome 18 the document might not be initialized yet
128 if (document.documentElement) 128 if (document.documentElement)
129 init(); 129 init();
130 else 130 else
131 window.setTimeout(init, 0); 131 window.setTimeout(init, 0);
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