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

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

Issue 13929020: Artifically delay the load finished signal until after dom content loaded (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years, 8 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
« no previous file with comments | « chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 989c3263aa0580ac125564d394987e81bc964f12..9ee909df878da2c989dac8314d7094ac90432f2f 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -528,10 +528,22 @@ void WebNavigationTabObserver::DocumentLoadedInFrame(
FrameNavigationState::FrameID frame_id(frame_num, render_view_host);
if (!navigation_state_.CanSendEvents(frame_id))
return;
+ navigation_state_.SetParsingFinished(frame_id);
helpers::DispatchOnDOMContentLoaded(web_contents(),
navigation_state_.GetUrl(frame_id),
navigation_state_.IsMainFrame(frame_id),
frame_num);
+
+ if (!navigation_state_.GetNavigationCompleted(frame_id))
+ return;
+
+ // The load might already have finished by the time we finished parsing. For
+ // compatibility reasons, we artifically delay the load completed signal until
+ // after parsing was completed.
+ helpers::DispatchOnCompleted(web_contents(),
+ navigation_state_.GetUrl(frame_id),
+ navigation_state_.IsMainFrame(frame_id),
+ frame_num);
}
void WebNavigationTabObserver::DidFinishLoad(
@@ -559,6 +571,12 @@ void WebNavigationTabObserver::DidFinishLoad(
<< "validated URL is " << validated_url << " but we expected "
<< navigation_state_.GetUrl(frame_id);
DCHECK_EQ(navigation_state_.IsMainFrame(frame_id), is_main_frame);
+
+ // The load might already have finished by the time we finished parsing. For
+ // compatibility reasons, we artifically delay the load completed signal until
+ // after parsing was completed.
+ if (!navigation_state_.GetParsingFinished(frame_id))
+ return;
helpers::DispatchOnCompleted(web_contents(),
navigation_state_.GetUrl(frame_id),
is_main_frame,
« no previous file with comments | « chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698