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

Side by Side Diff: include.preload.js

Issue 29349744: Issue 4210 - Remove outdated workaround causing overeager element collapsing (Closed)
Patch Set: Created Aug. 11, 2016, 2:53 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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 { 121 {
122 if (/^(?!https?:)[\w-]+:/i.test(urls[i])) 122 if (/^(?!https?:)[\w-]+:/i.test(urls[i]))
123 urls.splice(i--, 1); 123 urls.splice(i--, 1);
124 } 124 }
125 125
126 return urls; 126 return urls;
127 } 127 }
128 128
129 function checkCollapse(element) 129 function checkCollapse(element)
130 { 130 {
131 window.collapsing = true;
132
133 var mediatype = typeMap[element.localName]; 131 var mediatype = typeMap[element.localName];
134 if (!mediatype) 132 if (!mediatype)
135 return; 133 return;
136 134
137 var urls = getURLsFromElement(element); 135 var urls = getURLsFromElement(element);
138 if (urls.length == 0) 136 if (urls.length == 0)
139 return; 137 return;
140 138
141 ext.backgroundPage.sendMessage( 139 ext.backgroundPage.sendMessage(
142 { 140 {
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 var contentWindow = contentDocument.defaultView; 590 var contentWindow = contentDocument.defaultView;
593 if (contentDocument instanceof contentWindow.HTMLDocument) 591 if (contentDocument instanceof contentWindow.HTMLDocument)
594 { 592 {
595 // Prior to Chrome 37, content scripts cannot run in 593 // Prior to Chrome 37, content scripts cannot run in
596 // dynamically created frames. Also on Chrome 37-40 594 // dynamically created frames. Also on Chrome 37-40
597 // document_start content scripts (like this one) don't 595 // document_start content scripts (like this one) don't
598 // run either in those frames due to https://crbug.com/416907. 596 // run either in those frames due to https://crbug.com/416907.
599 // So we have to apply element hiding from the parent frame. 597 // So we have to apply element hiding from the parent frame.
600 if (!("init" in contentWindow)) 598 if (!("init" in contentWindow))
601 init(contentDocument); 599 init(contentDocument);
602
603 // Moreover, "load" and "error" events aren't dispatched for elements
604 // in dynamically created frames due to https://crbug.com/442107.
605 // So we also have to apply element collpasing from the parent frame.
606 if (!contentWindow.collapsing)
607 Array.prototype.forEach.call(
608 contentDocument.querySelectorAll(Object.keys(typeMap).join(",")),
609 checkCollapse
610 );
611 } 600 }
612 } 601 }
613 } 602 }
614 }, true); 603 }, true);
615 604
616 return updateStylesheet; 605 return updateStylesheet;
617 } 606 }
618 607
619 if (document instanceof HTMLDocument) 608 if (document instanceof HTMLDocument)
620 { 609 {
621 checkSitekey(); 610 checkSitekey();
622 window.updateStylesheet = init(document); 611 window.updateStylesheet = init(document);
623 } 612 }
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