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

Side by Side Diff: include.preload.js

Issue 6238490647855104: Issue 498 - Don't use Shadow DOM on Chrome 31-33 (Closed)
Patch Set: Created May 16, 2014, 1:25 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 <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 // use Shadow DOM if available to don't mess with web pages that 20 // use Shadow DOM if available to don't mess with web pages that
21 // rely on the order of their own <style> tags. However 21 // rely on the order of their own <style> tags. However
22 // the <shadow> element is broken in some Chrome 32 builds (#309) 22 // the <shadow> element is broken in some Chrome 32 builds (#309)
23 // 23 //
24 // also Chrome 31-33 crashes in some situations on some pages when using
25 // ShadowDOM, e.g. when pressing tab key on Wikipedia and Facebook (#498)
26 //
24 // also we must not create the shadow root in the response callback passed 27 // also we must not create the shadow root in the response callback passed
25 // to sendMessage(), otherwise Chrome breaks some websites (#450) 28 // to sendMessage(), otherwise Chrome breaks some websites (#450)
26 var shadow = null; 29 var shadow = null;
27 if ("webkitCreateShadowRoot" in document.documentElement && !/\bChrome\/32\b/.te st(navigator.userAgent)) 30 if ("webkitCreateShadowRoot" in document.documentElement && !/\bChrome\/3[1-3]\b /.test(navigator.userAgent))
28 { 31 {
29 shadow = document.documentElement.webkitCreateShadowRoot(); 32 shadow = document.documentElement.webkitCreateShadowRoot();
30 shadow.appendChild(document.createElement("shadow")); 33 shadow.appendChild(document.createElement("shadow"));
31 } 34 }
32 35
33 // Sets the currently used CSS rules for elemhide filters 36 // Sets the currently used CSS rules for elemhide filters
34 function setElemhideCSSRules(selectors) 37 function setElemhideCSSRules(selectors)
35 { 38 {
36 if (selectors.length == 0) 39 if (selectors.length == 0)
37 return; 40 return;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ext.backgroundPage.sendMessage({type: "add-key-exception", token: attr}); 133 ext.backgroundPage.sendMessage({type: "add-key-exception", token: attr});
131 134
132 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules); 135 ext.backgroundPage.sendMessage({type: "get-selectors"}, setElemhideCSSRules);
133 } 136 }
134 137
135 // In Chrome 18 the document might not be initialized yet 138 // In Chrome 18 the document might not be initialized yet
136 if (document.documentElement) 139 if (document.documentElement)
137 init(); 140 init();
138 else 141 else
139 window.setTimeout(init, 0); 142 window.setTimeout(init, 0);
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