Title: [234714] trunk
Revision
234714
Author
[email protected]
Date
2018-08-08 15:58:21 -0700 (Wed, 08 Aug 2018)

Log Message

Fix possible null dereference in WebBackForwardList::restoreFromState
https://bugs.webkit.org/show_bug.cgi?id=188418
<rdar://problem/42531726>

Patch by Alex Christensen <[email protected]> on 2018-08-08
Reviewed by Chris Dumez.

Source/WebKit:

* UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::restoreFromState):
Null-check m_page like we do everywhere else in this file because it can be set to null when closing the page.

Tools:

* TestWebKitAPI/Tests/WebKit/RestoreSessionState.cpp:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (234713 => 234714)


--- trunk/Source/WebKit/ChangeLog	2018-08-08 22:42:30 UTC (rev 234713)
+++ trunk/Source/WebKit/ChangeLog	2018-08-08 22:58:21 UTC (rev 234714)
@@ -1,3 +1,15 @@
+2018-08-08  Alex Christensen  <[email protected]>
+
+        Fix possible null dereference in WebBackForwardList::restoreFromState
+        https://bugs.webkit.org/show_bug.cgi?id=188418
+        <rdar://problem/42531726>
+
+        Reviewed by Chris Dumez.
+
+        * UIProcess/WebBackForwardList.cpp:
+        (WebKit::WebBackForwardList::restoreFromState):
+        Null-check m_page like we do everywhere else in this file because it can be set to null when closing the page.
+
 2018-08-08  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r234314, r234320, and r234321.

Modified: trunk/Source/WebKit/UIProcess/WebBackForwardList.cpp (234713 => 234714)


--- trunk/Source/WebKit/UIProcess/WebBackForwardList.cpp	2018-08-08 22:42:30 UTC (rev 234713)
+++ trunk/Source/WebKit/UIProcess/WebBackForwardList.cpp	2018-08-08 22:58:21 UTC (rev 234714)
@@ -433,6 +433,9 @@
 
 void WebBackForwardList::restoreFromState(BackForwardListState backForwardListState)
 {
+    if (!m_page)
+        return;
+
     Vector<Ref<WebBackForwardListItem>> items;
     items.reserveInitialCapacity(backForwardListState.items.size());
 

Modified: trunk/Tools/ChangeLog (234713 => 234714)


--- trunk/Tools/ChangeLog	2018-08-08 22:42:30 UTC (rev 234713)
+++ trunk/Tools/ChangeLog	2018-08-08 22:58:21 UTC (rev 234714)
@@ -1,3 +1,14 @@
+2018-08-08  Alex Christensen  <[email protected]>
+
+        Fix possible null dereference in WebBackForwardList::restoreFromState
+        https://bugs.webkit.org/show_bug.cgi?id=188418
+        <rdar://problem/42531726>
+
+        Reviewed by Chris Dumez.
+
+        * TestWebKitAPI/Tests/WebKit/RestoreSessionState.cpp:
+        (TestWebKitAPI::TEST):
+
 2018-08-08  Ross Kirsling  <[email protected]>
 
         run-builtins-generator-tests does not correctly handle CRLFs from stderr

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionState.cpp (234713 => 234714)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionState.cpp	2018-08-08 22:42:30 UTC (rev 234713)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionState.cpp	2018-08-08 22:58:21 UTC (rev 234714)
@@ -126,6 +126,18 @@
     EXPECT_JS_EQ(webView.page(), "history.scrollRestoration", "auto");
 }
 
+TEST(WebKit, RestoreSessionStateAfterClose)
+{
+    auto context = adoptWK(WKContextCreate());
+    PlatformWebView webView(context.get());
+    setPageLoaderClient(webView.page());
+    auto data = ""
+    EXPECT_NOT_NULL(data);
+    WKPageClose(webView.page());
+    auto sessionState = adoptWK(WKSessionStateCreateFromData(data.get()));
+    WKPageRestoreFromSessionState(webView.page(), sessionState.get());
+}
+    
 } // namespace TestWebKitAPI
 
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to