Title: [250506] branches/safari-608-branch/Source/WebCore
Revision
250506
Author
bshaf...@apple.com
Date
2019-09-30 01:30:43 -0700 (Mon, 30 Sep 2019)

Log Message

Cherry-pick r249077. rdar://problem/55826882

    Crash under TimerBase::setNextFireTime() in the NetworkProcess
    https://bugs.webkit.org/show_bug.cgi?id=201097
    <rdar://problem/54658339>

    Reviewed by Ryosuke Niwa.

    NetworkStateNotifier is a WebCore/platform class used by both WebKitLegacy and WebKit2 in the NetworkProcess.
    On iOS, the lambda in the implementation of NetworkStateNotifier::startObserving() may get called by the
    underlying framework on a non-main thread and we therefore want to go back to the main thread before calling
    NetworkStateNotifier::singleton().updateStateSoon(). This is important because updateStateSoon() will schedule
    a WebCore::Timer. The issue is that the code was using WebThreadRun() to go back the the main thread. While
    this works fine in iOS WK1, it does not do what we want in WebKit2 in the network process. Indeed, before there
    is no WebThread in the network process, WebThreadRun() will simply run the block on whatever thread we're one.
    This would lead to crashes when trying to schedule the Timer in updateStateSoon(). To address the issue, we now
    use callOnMainThread().

    * platform/network/ios/NetworkStateNotifierIOS.mm:
    (WebCore::NetworkStateNotifier::startObserving):

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

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (250505 => 250506)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-09-30 08:30:40 UTC (rev 250505)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-09-30 08:30:43 UTC (rev 250506)
@@ -1,5 +1,52 @@
 2019-09-30  Babak Shafiei  <bshaf...@apple.com>
 
+        Cherry-pick r249077. rdar://problem/55826882
+
+    Crash under TimerBase::setNextFireTime() in the NetworkProcess
+    https://bugs.webkit.org/show_bug.cgi?id=201097
+    <rdar://problem/54658339>
+    
+    Reviewed by Ryosuke Niwa.
+    
+    NetworkStateNotifier is a WebCore/platform class used by both WebKitLegacy and WebKit2 in the NetworkProcess.
+    On iOS, the lambda in the implementation of NetworkStateNotifier::startObserving() may get called by the
+    underlying framework on a non-main thread and we therefore want to go back to the main thread before calling
+    NetworkStateNotifier::singleton().updateStateSoon(). This is important because updateStateSoon() will schedule
+    a WebCore::Timer. The issue is that the code was using WebThreadRun() to go back the the main thread. While
+    this works fine in iOS WK1, it does not do what we want in WebKit2 in the network process. Indeed, before there
+    is no WebThread in the network process, WebThreadRun() will simply run the block on whatever thread we're one.
+    This would lead to crashes when trying to schedule the Timer in updateStateSoon(). To address the issue, we now
+    use callOnMainThread().
+    
+    * platform/network/ios/NetworkStateNotifierIOS.mm:
+    (WebCore::NetworkStateNotifier::startObserving):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-08-23  Chris Dumez  <cdu...@apple.com>
+
+            Crash under TimerBase::setNextFireTime() in the NetworkProcess
+            https://bugs.webkit.org/show_bug.cgi?id=201097
+            <rdar://problem/54658339>
+
+            Reviewed by Ryosuke Niwa.
+
+            NetworkStateNotifier is a WebCore/platform class used by both WebKitLegacy and WebKit2 in the NetworkProcess.
+            On iOS, the lambda in the implementation of NetworkStateNotifier::startObserving() may get called by the
+            underlying framework on a non-main thread and we therefore want to go back to the main thread before calling
+            NetworkStateNotifier::singleton().updateStateSoon(). This is important because updateStateSoon() will schedule
+            a WebCore::Timer. The issue is that the code was using WebThreadRun() to go back the the main thread. While
+            this works fine in iOS WK1, it does not do what we want in WebKit2 in the network process. Indeed, before there
+            is no WebThread in the network process, WebThreadRun() will simply run the block on whatever thread we're one.
+            This would lead to crashes when trying to schedule the Timer in updateStateSoon(). To address the issue, we now
+            use callOnMainThread().
+
+            * platform/network/ios/NetworkStateNotifierIOS.mm:
+            (WebCore::NetworkStateNotifier::startObserving):
+
+2019-09-30  Babak Shafiei  <bshaf...@apple.com>
+
         Cherry-pick r248591. rdar://problem/55826878
 
     FrameLoader::open can execute scritps via style recalc in Frame::setDocument

Modified: branches/safari-608-branch/Source/WebCore/platform/network/ios/NetworkStateNotifierIOS.mm (250505 => 250506)


--- branches/safari-608-branch/Source/WebCore/platform/network/ios/NetworkStateNotifierIOS.mm	2019-09-30 08:30:40 UTC (rev 250505)
+++ branches/safari-608-branch/Source/WebCore/platform/network/ios/NetworkStateNotifierIOS.mm	2019-09-30 08:30:43 UTC (rev 250506)
@@ -84,7 +84,7 @@
     if (DeprecatedGlobalSettings::shouldOptOutOfNetworkStateObservation())
         return;
     m_observer = adoptNS([[WebNetworkStateObserver alloc] initWithBlock:^ {
-        WebThreadRun(^ {
+        callOnMainThread([] {
             NetworkStateNotifier::singleton().updateStateSoon();
         });
     }]);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to