Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3415)

Unified Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc

Issue 1381003004: Better distinguish didFinishLoad and didStopLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
index 2e8522fb0e484f0f6572bcc9d02a8bc66339bad1..3d196e09b27fa34d7bf9add4e5958dbc4aed00e1 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -398,12 +398,15 @@ void WebNavigationTabObserver::DidFinishLoad(
navigation_state_.SetNavigationCompleted(render_frame_host);
if (!navigation_state_.CanSendEvents(render_frame_host))
return;
- DCHECK(navigation_state_.GetUrl(render_frame_host) == validated_url ||
- (navigation_state_.GetUrl(render_frame_host) ==
- GURL(content::kAboutSrcDocURL) &&
- validated_url == GURL(url::kAboutBlankURL)))
- << "validated URL is " << validated_url << " but we expected "
- << navigation_state_.GetUrl(render_frame_host);
+
+ // A new navigation might have started before the old one completed.
+ // Ignore the old navigation completion in that case.
+ if (navigation_state_.GetUrl(render_frame_host) != validated_url &&
dcheng 2015/10/08 05:34:35 This first check seems obviously related to the co
Nate Chapin 2015/10/08 21:03:59 Done.
+ (navigation_state_.GetUrl(render_frame_host) !=
+ GURL(content::kAboutSrcDocURL) ||
+ validated_url != GURL(url::kAboutBlankURL))) {
+ return;
+ }
// The load might already have finished by the time we finished parsing. For
// compatibility reasons, we artifically delay the load completed signal until

Powered by Google App Engine
This is Rietveld 408576698