Title: [234806] branches/safari-606.1.36.1-branch/Source
Revision
234806
Author
[email protected]
Date
2018-08-13 11:06:50 -0700 (Mon, 13 Aug 2018)

Log Message

Cherry-pick r234778. rdar://problem/43240324

    [macOS] Multiple third party apps crash due to the thread safety check in TimerBase::setNextFireTime
    https://bugs.webkit.org/show_bug.cgi?id=188480

    Reviewed by Simon Fraser.

    Source/WebCore:

    Suppress the release assert in WebKit1 on macOS (isInWebProcess is always true in non-Cocoa platforms).

    In the future, we should consider throwing Objective-C exceptions when third party apps call WebKit1
    or WebKit2 APIs in non-main threads.

    * platform/Timer.cpp:
    (WebCore::shouldSuppressThreadSafetyCheck): Extracted out of ~TimerBase and setNextFireTime.
    (WebCore::TimerBase::~TimerBase):
    (WebCore::TimerBase::setNextFireTime):

    Source/WTF:

    Added the SDK version for macOS Mojave.

    * wtf/spi/darwin/dyldSPI.h:

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

Modified Paths

Diff

Modified: branches/safari-606.1.36.1-branch/Source/WTF/ChangeLog (234805 => 234806)


--- branches/safari-606.1.36.1-branch/Source/WTF/ChangeLog	2018-08-13 16:46:49 UTC (rev 234805)
+++ branches/safari-606.1.36.1-branch/Source/WTF/ChangeLog	2018-08-13 18:06:50 UTC (rev 234806)
@@ -1,3 +1,44 @@
+2018-08-13  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r234778. rdar://problem/43240324
+
+    [macOS] Multiple third party apps crash due to the thread safety check in TimerBase::setNextFireTime
+    https://bugs.webkit.org/show_bug.cgi?id=188480
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    Suppress the release assert in WebKit1 on macOS (isInWebProcess is always true in non-Cocoa platforms).
+    
+    In the future, we should consider throwing Objective-C exceptions when third party apps call WebKit1
+    or WebKit2 APIs in non-main threads.
+    
+    * platform/Timer.cpp:
+    (WebCore::shouldSuppressThreadSafetyCheck): Extracted out of ~TimerBase and setNextFireTime.
+    (WebCore::TimerBase::~TimerBase):
+    (WebCore::TimerBase::setNextFireTime):
+    
+    Source/WTF:
+    
+    Added the SDK version for macOS Mojave.
+    
+    * wtf/spi/darwin/dyldSPI.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234778 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-08-10  Ryosuke Niwa  <[email protected]>
+
+            [macOS] Multiple third party apps crash due to the thread safety check in TimerBase::setNextFireTime
+            https://bugs.webkit.org/show_bug.cgi?id=188480
+
+            Reviewed by Simon Fraser.
+
+            Added the SDK version for macOS Mojave.
+
+            * wtf/spi/darwin/dyldSPI.h:
+
 2018-08-02  Babak Shafiei  <[email protected]>
 
         Cherry-pick r234528. rdar://problem/42883788

Modified: branches/safari-606.1.36.1-branch/Source/WTF/wtf/spi/darwin/dyldSPI.h (234805 => 234806)


--- branches/safari-606.1.36.1-branch/Source/WTF/wtf/spi/darwin/dyldSPI.h	2018-08-13 16:46:49 UTC (rev 234805)
+++ branches/safari-606.1.36.1-branch/Source/WTF/wtf/spi/darwin/dyldSPI.h	2018-08-13 18:06:50 UTC (rev 234806)
@@ -45,6 +45,10 @@
 #define DYLD_MACOSX_VERSION_10_13 0x000A0D00
 #endif
 
+#ifndef DYLD_MACOSX_VERSION_10_14
+#define DYLD_MACOSX_VERSION_10_14 0x000A0E00
+#endif
+
 #else
 
 #define DYLD_IOS_VERSION_3_0 0x00030000
@@ -61,6 +65,7 @@
 #define DYLD_MACOSX_VERSION_10_11 0x000A0B00
 #define DYLD_MACOSX_VERSION_10_12 0x000A0C00
 #define DYLD_MACOSX_VERSION_10_13 0x000A0D00
+#define DYLD_MACOSX_VERSION_10_14 0x000A0E00
 
 #endif
 

Modified: branches/safari-606.1.36.1-branch/Source/WebCore/ChangeLog (234805 => 234806)


--- branches/safari-606.1.36.1-branch/Source/WebCore/ChangeLog	2018-08-13 16:46:49 UTC (rev 234805)
+++ branches/safari-606.1.36.1-branch/Source/WebCore/ChangeLog	2018-08-13 18:06:50 UTC (rev 234806)
@@ -1,3 +1,50 @@
+2018-08-13  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r234778. rdar://problem/43240324
+
+    [macOS] Multiple third party apps crash due to the thread safety check in TimerBase::setNextFireTime
+    https://bugs.webkit.org/show_bug.cgi?id=188480
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    Suppress the release assert in WebKit1 on macOS (isInWebProcess is always true in non-Cocoa platforms).
+    
+    In the future, we should consider throwing Objective-C exceptions when third party apps call WebKit1
+    or WebKit2 APIs in non-main threads.
+    
+    * platform/Timer.cpp:
+    (WebCore::shouldSuppressThreadSafetyCheck): Extracted out of ~TimerBase and setNextFireTime.
+    (WebCore::TimerBase::~TimerBase):
+    (WebCore::TimerBase::setNextFireTime):
+    
+    Source/WTF:
+    
+    Added the SDK version for macOS Mojave.
+    
+    * wtf/spi/darwin/dyldSPI.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234778 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-08-10  Ryosuke Niwa  <[email protected]>
+
+            [macOS] Multiple third party apps crash due to the thread safety check in TimerBase::setNextFireTime
+            https://bugs.webkit.org/show_bug.cgi?id=188480
+
+            Reviewed by Simon Fraser.
+
+            Suppress the release assert in WebKit1 on macOS (isInWebProcess is always true in non-Cocoa platforms).
+
+            In the future, we should consider throwing Objective-C exceptions when third party apps call WebKit1
+            or WebKit2 APIs in non-main threads.
+
+            * platform/Timer.cpp:
+            (WebCore::shouldSuppressThreadSafetyCheck): Extracted out of ~TimerBase and setNextFireTime.
+            (WebCore::TimerBase::~TimerBase):
+            (WebCore::TimerBase::setNextFireTime):
+
 2018-08-09  Kocsen Chung  <[email protected]>
 
         Cherry-pick r234718. rdar://problem/43102434

Modified: branches/safari-606.1.36.1-branch/Source/WebCore/platform/Timer.cpp (234805 => 234806)


--- branches/safari-606.1.36.1-branch/Source/WebCore/platform/Timer.cpp	2018-08-13 16:46:49 UTC (rev 234805)
+++ branches/safari-606.1.36.1-branch/Source/WebCore/platform/Timer.cpp	2018-08-13 18:06:50 UTC (rev 234806)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "Timer.h"
 
+#include "RuntimeApplicationChecks.h"
 #include "SharedTimer.h"
 #include "ThreadGlobalData.h"
 #include "ThreadTimers.h"
@@ -36,6 +37,10 @@
 #include <wtf/MainThread.h>
 #include <wtf/Vector.h>
 
+#if USE(WEB_THREAD) || PLATFORM(MAC)
+#include <wtf/spi/darwin/dyldSPI.h>
+#endif
+
 namespace WebCore {
 
 class TimerHeapReference;
@@ -184,6 +189,17 @@
 
 // ----------------
 
+static bool shouldSuppressThreadSafetyCheck()
+{
+#if USE(WEB_THREAD)
+    return WebThreadIsEnabled();
+#elif PLATFORM(MAC)
+    return !isInWebProcess() && applicationSDKVersion() < DYLD_MACOSX_VERSION_10_14;
+#else
+    return false;
+#endif
+}
+
 TimerBase::TimerBase()
 {
 }
@@ -190,12 +206,8 @@
 
 TimerBase::~TimerBase()
 {
-#if USE(WEB_THREAD)
     ASSERT(canAccessThreadLocalDataForThread(m_thread.get()));
-    RELEASE_ASSERT(WebThreadIsEnabled() || canAccessThreadLocalDataForThread(m_thread.get()));
-#else
-    RELEASE_ASSERT(canAccessThreadLocalDataForThread(m_thread.get()));
-#endif
+    RELEASE_ASSERT(canAccessThreadLocalDataForThread(m_thread.get()) || shouldSuppressThreadSafetyCheck());
     stop();
     ASSERT(!inHeap());
     m_wasDeleted = true;
@@ -362,12 +374,8 @@
 
 void TimerBase::setNextFireTime(MonotonicTime newTime)
 {
-#if USE(WEB_THREAD)
     ASSERT(canAccessThreadLocalDataForThread(m_thread.get()));
-    RELEASE_ASSERT(WebThreadIsEnabled() || canAccessThreadLocalDataForThread(m_thread.get()));
-#else
-    RELEASE_ASSERT(canAccessThreadLocalDataForThread(m_thread.get()));
-#endif
+    RELEASE_ASSERT(canAccessThreadLocalDataForThread(m_thread.get()) || shouldSuppressThreadSafetyCheck());
     RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(!m_wasDeleted);
 
     if (m_unalignedNextFireTime != newTime)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to