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

Unified Diff: ext/background.js

Issue 29633597: Issue 6119 - Work in Progress use framAncestors in Firefox
Patch Set: Issue 6119 - Work in Progress use framAncestors in Firefox Created Dec. 8, 2017, 11:50 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: ext/background.js
===================================================================
--- a/ext/background.js
+++ b/ext/background.js
@@ -608,13 +608,41 @@
if (type == "sub_frame")
frameId = details.parentFrameId;
+ let frame2 = null;
+ if (details.frameAncestors) {
+ for (let i = details.frameAncestors.length - 1; i >= 0; i--) {
+ frame2 = {id: details.frameAncestors[i].frameId,
+ url: new URL(details.frameAncestors[i].url),
+ parent: frame2};
+ }
+
+ // the url here is not correct I think.
+ if (type != "sub_frame")
+ frame2 = {url: new URL(details.documentUrl), parent: frame2};
+ }
+
// Sometimes requests are not associated with a browser tab and
// in this case we want to still be able to view the url being called.
+ let page = null;
let frame = null;
- let page = null;
if (details.tabId != -1)
{
- frame = ext.getFrame(details.tabId, frameId);
+ // Only Firefox supports frameAncestors, so we have to keep the list
+ // of frames ourself.
+ if (!frame)
+ frame = ext.getFrame(details.tabId, frameId);
+
+
+ let s = (f, a = []) => {
+ a.push(f.url.toString());
+ if (f.parent)
+ return s(f.parent, a)
+ return a;
+ }
+
+ if (s(frame).length > 0)
+ console.log(url.toString(), s(frame), s(frame2))
+
page = new Page({id: details.tabId});
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld