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

Unified Diff: include.preload.js

Issue 5868615689568256: Issue 1703 - Work around Chrome bug 442107, hiding placeholders in frames with javascript: URL (Closed)
Patch Set: Created Dec. 16, 2014, 8:42 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include.preload.js
===================================================================
--- a/include.preload.js
+++ b/include.preload.js
@@ -157,12 +157,6 @@
function init(document)
{
- // prior to Chrome 37, content scripts don't run on about:blank
- // and about:srcdoc. So we have to apply element hiding and collapsing
- // from the parent frame, when inline frames are loaded.
- var match = navigator.userAgent.match(/\bChrome\/(\d+)/);
- var fixInlineFrames = match && parseInt(match[1], 10) < 37;
-
// use Shadow DOM if available to don't mess with web pages that
// rely on the order of their own <style> tags (#309). However we
// must not create the shadow root in the response callback passed
@@ -233,7 +227,11 @@
if (/^i?frame$/.test(element.localName))
checkCollapse(element);
- if (fixInlineFrames && isInlineFrame(element))
+ // prior to Chrome 37, content scripts cannot run on about:blank,
+ // about:srcdoc and javascript: URLs. Moreover, as of Chrome 40
+ // "load" and "error" events aren't dispatched there. So we have
+ // to apply element hiding and collapsing from the parent frame.
+ if (/\bChrome\//.test(navigator.userAgent) && isInlineFrame(element))
{
init(element.contentDocument);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld