diff --git a/third_party/WebKit/LayoutTests/fast/dom/Document/open-with-pending-load2-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Document/open-with-pending-load2-expected.txt new file mode 100644 index 0000000000000..39cf5a38b486d --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/dom/Document/open-with-pending-load2-expected.txt @@ -0,0 +1 @@ +This tests that calling document.open on a document that has a pending load correctly cancels the load and does not crash even if the frame is removed. diff --git a/third_party/WebKit/LayoutTests/fast/dom/Document/open-with-pending-load2.html b/third_party/WebKit/LayoutTests/fast/dom/Document/open-with-pending-load2.html new file mode 100644 index 0000000000000..75481624bcb75 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/dom/Document/open-with-pending-load2.html @@ -0,0 +1,19 @@ + +
+This tests that calling document.open on a document that has a pending load correctly cancels the load and does not crash even if the frame is removed. + + diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index a98f9819ebe6d..e628c1ab8242d 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc @@ -3108,7 +3108,7 @@ void Document::open() { if (frame_ && frame_->Loader().HasProvisionalNavigation()) { frame_->Loader().StopAllLoaders(); // Navigations handled by the client should also be cancelled. - if (frame_->Client()) + if (frame_ && frame_->Client()) frame_->Client()->AbortClientNavigation(); }