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}); |
} |