Crash in Page::setActivityState because m_page is null
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Feb 2019 09:07:23 +0000 (09:07 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Feb 2019 09:07:23 +0000 (09:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194584

Reviewed by Antti Koivisto.

Add a null check to avoid the crash. Also add a debug assertion to help diagnose this in the future.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setActivityState):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241401 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/WebPage.cpp

index 0f75ae4..c09c79e 100644 (file)
@@ -1,5 +1,17 @@
 2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
 
+        Crash in Page::setActivityState because m_page is null
+        https://bugs.webkit.org/show_bug.cgi?id=194584
+
+        Reviewed by Antti Koivisto.
+
+        Add a null check to avoid the crash. Also add a debug assertion to help diagnose this in the future.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setActivityState):
+
+2019-02-13  Ryosuke Niwa  <rniwa@webkit.org>
+
         Release assert in PolicyCheckIdentifier::isValidFor via WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction
         https://bugs.webkit.org/show_bug.cgi?id=194582
 
index 79729f5..0d28250 100644 (file)
@@ -3045,7 +3045,8 @@ void WebPage::setActivityState(OptionSet<ActivityState::Flag> activityState, Act
     if (changed)
         updateThrottleState();
 
-    {
+    ASSERT_WITH_MESSAGE(m_page, "setActivityState called on %lld but WebCore page was null", pageID());
+    if (m_page) {
         SetForScope<bool> currentlyChangingActivityState { m_changingActivityState, true };
         m_page->setActivityState(activityState);
     }