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]; |