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

Unified Diff: chrome/ext/background.js

Issue 4890865847762944: Issue 1739 - Respect MessageSender.frameId if available (Closed)
Patch Set: Created Dec. 28, 2014, 1:27 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: chrome/ext/background.js
===================================================================
--- a/chrome/ext/background.js
+++ b/chrome/ext/background.js
@@ -358,10 +358,21 @@
if (!frames)
return null;
- for (var frameId in frames)
+ if ("frameId" in rawSender)
{
- if (frames[frameId].url == rawSender.url)
- return frames[frameId].parent;
+ // Chrome 41+
+ var frame = frames[rawSender.frameId];
+ if (frame)
+ return frame.parent;
+ }
+ else
kzar 2015/01/05 15:30:15 Maybe remove the else here? That way if rawSender.
Sebastian Noack 2015/01/05 15:33:36 I think falling back to the top-level frame in thi
+ {
+ // Chrome 28-40
+ for (var frameId in frames)
+ {
+ if (frames[frameId].url == rawSender.url)
+ return frames[frameId].parent;
+ }
}
return frames[0];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld