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

Unified Diff: ext/background.js

Issue 29832561: Issue 6774 - $document doesn't whitelist everything inside iframes in Edge (Closed)
Patch Set: Created July 17, 2018, 4:36 p.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: ext/background.js
diff --git a/ext/background.js b/ext/background.js
index e0242e545396f8e48fdbbfea961b8cf42e14a8b9..f9ad0b655064323285e0dd14b28444f724feb6cb 100644
--- a/ext/background.js
+++ b/ext/background.js
@@ -559,10 +559,36 @@
if (!frames)
return null;
- let frame = frames.get(rawSender.frameId);
+ let frame;
+ // In Microsoft Edge (version 42.17134.1.0) we don't have frameId
+ // so we fall back to iterating over the tab's frames
+ // see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11716733
+ if (rawSender.frameId != undefined)
+ frame = frames.get(rawSender.frameId);
+ else
+ {
+ for (let [key, value] of frames)
kzar 2018/07/17 16:54:35 Nit: Would be nice to use some more descriptive va
geo 2018/07/18 16:08:11 Done.
+ {
+ let valueHref = value.url.href.replace(/#.*/, "");
kzar 2018/07/17 16:54:35 Nit: I'd consider using `String.prototype.substrin
geo 2018/07/18 16:08:10 I'm not sure either, but for `String.prototype.sub
+
+ let rawSenderHref = rawSender.url ?
kzar 2018/07/17 16:54:35 Can't we do this outside of the for loop?
geo 2018/07/18 16:08:10 Done.
+ rawSender.url.replace(/#.*/, "") :
+ "";
+
+ // if we have two frames with the same URL
kzar 2018/07/17 16:54:35 Nit: This is a good comment, but would you mind ca
geo 2018/07/18 16:08:10 Done.
+ // we are going to pick the first one we find
+ // as we have no other way of distinguishing between them
+ if (valueHref == rawSenderHref)
+ {
+ frame = value;
+ this.id = key;
+ break;
+ }
+ }
+ }
+
if (frame)
return frame.parent || null;
-
return frames.get(0) || null;
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld