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 19, 2018, 6:39 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..3b43ec49af55f15be2e6bb7c46f6c5b55335dcec 100644
--- a/ext/background.js
+++ b/ext/background.js
@@ -559,10 +559,34 @@
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 if (rawSender.url)
+ {
+ let rawSenderHref = rawSender.url.replace(/#.*/, "");
+
+ for (let [frameId, frameInfo] of frames)
+ {
+ let frameInfoHref = frameInfo.url.href.replace(/#.*/, "");
+
+ // If we have two frames with the same URL
+ // we are going to pick the first one we find
+ // as we have no other way of distinguishing between them.
+ if (frameInfoHref == rawSenderHref)
+ {
+ frame = frameInfo;
+ this.id = frameId;
+ 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