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

Unified Diff: chrome/ext/background.js

Issue 29362203: Issue 4599 - Update the page structure more eagerly (Closed)
Patch Set: Improved comment Created Nov. 14, 2016, 3:11 p.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
diff --git a/chrome/ext/background.js b/chrome/ext/background.js
index 0c8bdfc289fc8276fa7a8c6b5f171ad41e729328..d8cbaee11f3c6a6358392f52469cbfc8514880bc 100644
--- a/chrome/ext/background.js
+++ b/chrome/ext/background.js
@@ -123,13 +123,6 @@
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)
@@ -168,6 +161,22 @@
frame.url = new URL(url);
};
+ 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;
+
+ // Chrome will sometimes perform requests for pre-rendered pages before
+ // navigation was confirmed and the onComitted event was fired. Those
+ // requests will often wrongly be considered to be third party, since we
+ // don't know the correct document domain for requests until after we've
+ // updated the page structure. As a work around we update the page
+ // structure eagerly for new tabs (which includes pre-rendered pages).
+ if (!(details.tabId in framesOfTabs))
Wladimir Palant 2016/11/14 15:56:29 While this is probably not wrong, I think that you
kzar 2016/11/15 12:19:28 Well so far the issue only described a problem wit
+ ext._updatePageFrameStructure(details.frameId, details.tabId, details.url);
+ });
+
chrome.webNavigation.onCommitted.addListener(function(details)
{
ext._updatePageFrameStructure(details.frameId, details.tabId, details.url);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld