| Index: chrome/ext/background.js |
| diff --git a/chrome/ext/background.js b/chrome/ext/background.js |
| index 0c8bdfc289fc8276fa7a8c6b5f171ad41e729328..e99a71842f172d1b0943c5ac2226ebc1743c3d05 100644 |
| --- a/chrome/ext/background.js |
| +++ b/chrome/ext/background.js |
| @@ -123,16 +123,10 @@ |
| return frame; |
| } |
| - chrome.webNavigation.onBeforeNavigate.addListener(function(details) |
| - { |
| - // Capture parent frame here because onCommitted doesn't get this info. |
| - var frame = createFrame(details.tabId, details.frameId); |
| - frame.parent = framesOfTabs[details.tabId][details.parentFrameId] || null; |
| - }); |
| - |
| var eagerlyUpdatedPages = new ext.PageMap(); |
| - ext._updatePageFrameStructure = function(frameId, tabId, url, eager) |
| + ext._updatePageFrameStructure = function(frameId, tabId, url, eager, |
| + parentFrameId) |
| { |
| if (frameId == 0) |
| { |
| @@ -166,11 +160,26 @@ |
| // Update frame URL in frame structure |
| var frame = createFrame(tabId, frameId); |
| frame.url = new URL(url); |
| + |
| + // We only get the parentFrameId for onBeforeNavigate, not for onCommitted |
| + if (typeof parentFrameId != "undefined") |
| + frame.parent = framesOfTabs[tabId][parentFrameId] || null; |
| }; |
| + chrome.webNavigation.onBeforeNavigate.addListener(function(details) |
| + { |
| + // Since requests are sometimes made by a page before its onCommitted event |
| + // fires we also need to update the page structure here. Otherwise those |
| + // requests will be considered third party since a URL for the page wasn't |
| + // yet determined. |
| + ext._updatePageFrameStructure(details.frameId, details.tabId, |
| + details.url, false, details.parentFrameId); |
|
Wladimir Palant
2016/11/14 08:18:44
You are essentially reverting changes from issue 4
|
| + }); |
| + |
| chrome.webNavigation.onCommitted.addListener(function(details) |
| { |
| - ext._updatePageFrameStructure(details.frameId, details.tabId, details.url); |
| + ext._updatePageFrameStructure(details.frameId, details.tabId, |
| + details.url, false); |
| }); |
| function forgetTab(tabId) |