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

Unified Diff: chrome/ext/background.js

Issue 6136997097766912: Fallback to the top-level frame if we don't know the frame on Chrome (Closed)
Patch Set: Created Jan. 23, 2014, 8:57 a.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
@@ -463,11 +463,22 @@
else
frameId = details.frameId;
- // the high-level code relies on the frame. However in case the frame can't
- // be controlled by the extension or the extension was (re)loaded after the
- // frame was loaded, the frame is unknown and we have to ignore the request.
if (!(frameId in frames))
- return;
+ {
+ // the high-level code relies on the frame. So ignore the request if we
+ // don't even know the top-level frame. That can happen for example when
+ // the extension was just (re)loaded.
+ if (!(0 in frames))
+ return;
+
+ // however when the src of the frame is a javascript: or data: URL, we
+ // don't know the frame either. But since we know the top-level frame we
+ // can just pretend that we are in the top-level frame, in order to have
+ // at least most domain-based filter rules working.
+ frameId = 0;
+ if (details.type == "sub_frame")
+ frames[details.frameId].parent = frameId;
+ }
var frame = new Frame({id: frameId, tab: tab});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld