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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2943523002: Fire start/stop based on Frame::IsLoading for same document navigations (Closed)
Patch Set: Fire start/stop based on IsLoading Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 FrameLoadType type, 492 FrameLoadType type,
493 Document* initiating_document) { 493 Document* initiating_document) {
494 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url", 494 TRACE_EVENT1("blink", "FrameLoader::updateForSameDocumentNavigation", "url",
495 new_url.GetString().Ascii().data()); 495 new_url.GetString().Ascii().data());
496 496
497 // Generate start and stop notifications only when loader is completed so that 497 // Generate start and stop notifications only when loader is completed so that
498 // we don't fire them for fragment redirection that happens in window.onload 498 // we don't fire them for fragment redirection that happens in window.onload
499 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 499 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838
500 // Do not fire the notifications if the frame is concurrently navigating away 500 // Do not fire the notifications if the frame is concurrently navigating away
501 // from the document, since a new document is already loading. 501 // from the document, since a new document is already loading.
502 if (frame_->GetDocument()->LoadEventFinished() && 502 bool was_loading = frame_->IsLoading();
503 !provisional_document_loader_) 503 if (!was_loading)
504 Client()->DidStartLoading(kNavigationWithinSameDocument); 504 Client()->DidStartLoading(kNavigationWithinSameDocument);
505 505
506 // Update the data source's request with the new URL to fake the URL change 506 // Update the data source's request with the new URL to fake the URL change
507 frame_->GetDocument()->SetURL(new_url); 507 frame_->GetDocument()->SetURL(new_url);
508 GetDocumentLoader()->UpdateForSameDocumentNavigation( 508 GetDocumentLoader()->UpdateForSameDocumentNavigation(
509 new_url, same_document_navigation_source, std::move(data), 509 new_url, same_document_navigation_source, std::move(data),
510 scroll_restoration_type, type, initiating_document); 510 scroll_restoration_type, type, initiating_document);
511 511 if (!was_loading)
512 Client()->DispatchDidReceiveTitle(frame_->GetDocument()->title());
Nate Chapin 2017/06/19 20:49:31 DispatchDidReceiveTitle should be called whenever
513 if (frame_->GetDocument()->LoadEventFinished() &&
514 !provisional_document_loader_)
515 Client()->DidStopLoading(); 512 Client()->DidStopLoading();
516 } 513 }
517 514
518 void FrameLoader::DetachDocumentLoader(Member<DocumentLoader>& loader) { 515 void FrameLoader::DetachDocumentLoader(Member<DocumentLoader>& loader) {
519 if (!loader) 516 if (!loader)
520 return; 517 return;
521 518
522 FrameNavigationDisabler navigation_disabler(*frame_); 519 FrameNavigationDisabler navigation_disabler(*frame_);
523 loader->DetachFromFrame(); 520 loader->DetachFromFrame();
524 loader = nullptr; 521 loader = nullptr;
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 // TODO(japhet): This is needed because the browser process DCHECKs if the 1689 // TODO(japhet): This is needed because the browser process DCHECKs if the
1693 // first entry we commit in a new frame has replacement set. It's unclear 1690 // first entry we commit in a new frame has replacement set. It's unclear
1694 // whether the DCHECK is right, investigate removing this special case. 1691 // whether the DCHECK is right, investigate removing this special case.
1695 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem && 1692 bool replace_current_item = load_type == kFrameLoadTypeReplaceCurrentItem &&
1696 (!Opener() || !request.Url().IsEmpty()); 1693 (!Opener() || !request.Url().IsEmpty());
1697 loader->SetReplacesCurrentHistoryItem(replace_current_item); 1694 loader->SetReplacesCurrentHistoryItem(replace_current_item);
1698 return loader; 1695 return loader;
1699 } 1696 }
1700 1697
1701 } // namespace blink 1698 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/navigation/same-origin-fragment-navigation-is-sync-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698