Commit 12101ed8 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Null-check DocumentLoader in ApplyScrollRestorationLogic.

All of the referenced crashes are due to this. I was unable
to reproduce a situation when this would happen unfortuantely.

Bug: 1038355

Change-Id: Idb7ceb468bd11cc6bc33d48b04cf7212d7f85d67
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1984420Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727798}
parent a94eb016
......@@ -3035,12 +3035,14 @@ void Document::ApplyScrollRestorationLogic() {
View()->InvokeFragmentAnchor();
auto& frame_loader = GetFrame()->Loader();
auto& document_loader = *frame_loader.GetDocumentLoader();
auto* document_loader = frame_loader.GetDocumentLoader();
if (!document_loader)
return;
if (frame_->IsLoading() &&
!FrameLoader::NeedsHistoryItemRestore(document_loader.LoadType()))
!FrameLoader::NeedsHistoryItemRestore(document_loader->LoadType()))
return;
auto* history_item = frame_loader.GetDocumentLoader()->GetHistoryItem();
auto* history_item = document_loader->GetHistoryItem();
if (!history_item || !history_item->GetViewState())
return;
......@@ -3062,7 +3064,7 @@ void Document::ApplyScrollRestorationLogic() {
scroll_offset;
bool can_restore_without_annoying_user =
!document_loader.GetInitialScrollState().was_scrolled_by_user &&
!document_loader->GetInitialScrollState().was_scrolled_by_user &&
(can_restore_without_clamping || !frame_->IsLoading() ||
!should_restore_scroll);
if (!can_restore_without_annoying_user)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment