[iOS] Bail out if the page proxy is invalid when WebPageProxy::processWillBecome...
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Dec 2015 02:50:31 +0000 (02:50 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 Dec 2015 02:50:31 +0000 (02:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151877

Reviewed by Darin Adler.

We cannot assume that a WebPageProxy is in a valid state when WebPageProxy::processWillBecome{Foreground, Suspended}()
are called because these callbacks may occur after the web process crashed and before a
WebPageProxy attaches to a new web process (and hence is considered in a valid state).

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::processWillBecomeSuspended): Early return if the page proxy is invalid.
(WebKit::WebPageProxy::processWillBecomeForeground): Ditto.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp

index 4a8d8e8..f0792d3 100644 (file)
@@ -1,3 +1,18 @@
+2015-12-09  Daniel Bates  <dabates@apple.com>
+
+        [iOS] Bail out if the page proxy is invalid when WebPageProxy::processWillBecome{Foreground, Suspended}() are called
+        https://bugs.webkit.org/show_bug.cgi?id=151877
+
+        Reviewed by Darin Adler.
+
+        We cannot assume that a WebPageProxy is in a valid state when WebPageProxy::processWillBecome{Foreground, Suspended}()
+        are called because these callbacks may occur after the web process crashed and before a
+        WebPageProxy attaches to a new web process (and hence is considered in a valid state).
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::processWillBecomeSuspended): Early return if the page proxy is invalid.
+        (WebKit::WebPageProxy::processWillBecomeForeground): Ditto.
+
 2015-12-09  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r193864.
index 59dcf08..4144377 100644 (file)
@@ -4902,7 +4902,8 @@ void WebPageProxy::processDidCrash()
 #if PLATFORM(IOS)
 void WebPageProxy::processWillBecomeSuspended()
 {
-    ASSERT(m_isValid);
+    if (!isValid())
+        return;
 
     m_hasNetworkRequestsOnSuspended = m_pageLoadState.networkRequestsInProgress();
     if (m_hasNetworkRequestsOnSuspended)
@@ -4911,7 +4912,8 @@ void WebPageProxy::processWillBecomeSuspended()
 
 void WebPageProxy::processWillBecomeForeground()
 {
-    ASSERT(m_isValid);
+    if (!isValid())
+        return;
 
     if (m_hasNetworkRequestsOnSuspended) {
         setNetworkRequestsInProgress(true);