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 18, 2018, 4:06 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..857bafaa729d56febd7d1a4328cc113b26804063 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
+ {
+ let rawSenderHref = rawSender.url ?
Sebastian Noack 2018/07/19 16:18:05 Do we even want to enter this code path if we don'
geo 2018/07/19 18:48:16 No, you are right, there is no point to it. `frame
+ 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