Title: [234905] trunk/Source
Revision
234905
Author
[email protected]
Date
2018-08-15 16:37:31 -0700 (Wed, 15 Aug 2018)

Log Message

Can't share an app on AppStore to WeChat due to a release assert
https://bugs.webkit.org/show_bug.cgi?id=188621
<rdar://problem/43343976>

Reviewed by Geoffrey Garen.

Disable the thread safety check when the app is not linked on or after iOS 12 since this release assert
is getting hit by third party applications on iOS in UI process.

Source/WebCore:

* platform/Timer.cpp:
(WebCore::shouldSuppressThreadSafetyCheck): Added a SDK check.

Source/WebKit:

* UIProcess/Cocoa/VersionChecks.h:
(WebKit::SDKVersion::FirstWithMainThreadReleaseAssertionInWebPageProxy): Added. It's iOS 12 or macOS 10.14 Mojave.
* UIProcess/WebProcessProxy.cpp:
(WebKit::isMainThreadOrCheckDisabled): Added. Returns true whether when we're in the main thread or if the app
is not linked on or after iOS 12 or macOS 10.14 Mojave.
(WebKit::globalPageMap):
(WebKit::m_isInPrewarmedPool):
(WebKit::WebProcessProxy::~WebProcessProxy):
(WebKit::WebProcessProxy::shutDown):
(WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
(WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
(WebKit::WebProcessProxy::didFinishLaunching):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (234904 => 234905)


--- trunk/Source/WebCore/ChangeLog	2018-08-15 23:11:38 UTC (rev 234904)
+++ trunk/Source/WebCore/ChangeLog	2018-08-15 23:37:31 UTC (rev 234905)
@@ -1,3 +1,17 @@
+2018-08-15  Ryosuke Niwa  <[email protected]>
+
+        Can't share an app on AppStore to WeChat due to a release assert
+        https://bugs.webkit.org/show_bug.cgi?id=188621
+        <rdar://problem/43343976>
+
+        Reviewed by Geoffrey Garen.
+
+        Disable the thread safety check when the app is not linked on or after iOS 12 since this release assert
+        is getting hit by third party applications on iOS in UI process.
+
+        * platform/Timer.cpp:
+        (WebCore::shouldSuppressThreadSafetyCheck): Added a SDK check.
+
 2018-08-15  Christopher Reid  <[email protected]>
 
         [Curl] Implement default cookie path handling correctly as outlined in RFC6265.

Modified: trunk/Source/WebCore/platform/Timer.cpp (234904 => 234905)


--- trunk/Source/WebCore/platform/Timer.cpp	2018-08-15 23:11:38 UTC (rev 234904)
+++ trunk/Source/WebCore/platform/Timer.cpp	2018-08-15 23:37:31 UTC (rev 234905)
@@ -37,7 +37,7 @@
 #include <wtf/MainThread.h>
 #include <wtf/Vector.h>
 
-#if USE(WEB_THREAD) || PLATFORM(MAC)
+#if PLATFORM(IOS) || PLATFORM(MAC)
 #include <wtf/spi/darwin/dyldSPI.h>
 #endif
 
@@ -191,8 +191,8 @@
 
 static bool shouldSuppressThreadSafetyCheck()
 {
-#if USE(WEB_THREAD)
-    return WebThreadIsEnabled();
+#if PLATFORM(IOS)
+    return WebThreadIsEnabled() || applicationSDKVersion() < DYLD_IOS_VERSION_12_0;
 #elif PLATFORM(MAC)
     return !isInWebProcess() && applicationSDKVersion() < DYLD_MACOSX_VERSION_10_14;
 #else

Modified: trunk/Source/WebKit/ChangeLog (234904 => 234905)


--- trunk/Source/WebKit/ChangeLog	2018-08-15 23:11:38 UTC (rev 234904)
+++ trunk/Source/WebKit/ChangeLog	2018-08-15 23:37:31 UTC (rev 234905)
@@ -1,3 +1,27 @@
+2018-08-15  Ryosuke Niwa  <[email protected]>
+
+        Can't share an app on AppStore to WeChat due to a release assert
+        https://bugs.webkit.org/show_bug.cgi?id=188621
+        <rdar://problem/43343976>
+
+        Reviewed by Geoffrey Garen.
+
+        Disable the thread safety check when the app is not linked on or after iOS 12 since this release assert
+        is getting hit by third party applications on iOS in UI process.
+
+        * UIProcess/Cocoa/VersionChecks.h:
+        (WebKit::SDKVersion::FirstWithMainThreadReleaseAssertionInWebPageProxy): Added. It's iOS 12 or macOS 10.14 Mojave.
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::isMainThreadOrCheckDisabled): Added. Returns true whether when we're in the main thread or if the app
+        is not linked on or after iOS 12 or macOS 10.14 Mojave.
+        (WebKit::globalPageMap):
+        (WebKit::m_isInPrewarmedPool):
+        (WebKit::WebProcessProxy::~WebProcessProxy):
+        (WebKit::WebProcessProxy::shutDown):
+        (WebKit::WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores):
+        (WebKit::WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData):
+        (WebKit::WebProcessProxy::didFinishLaunching):
+
 2018-08-15  Alex Christensen  <[email protected]>
 
         Remove WKNavigationDelegatePrivate's canAuthenticateAgainstProtectionSpace

Modified: trunk/Source/WebKit/UIProcess/Cocoa/VersionChecks.h (234904 => 234905)


--- trunk/Source/WebKit/UIProcess/Cocoa/VersionChecks.h	2018-08-15 23:11:38 UTC (rev 234904)
+++ trunk/Source/WebKit/UIProcess/Cocoa/VersionChecks.h	2018-08-15 23:37:31 UTC (rev 234905)
@@ -40,11 +40,13 @@
     FirstThatDefaultsToPassiveTouchListenersOnDocument = DYLD_IOS_VERSION_11_3,
     FirstWhereScrollViewContentInsetsAreNotObscuringInsets = DYLD_IOS_VERSION_12_0,
     FirstWhereUIScrollViewDoesNotApplyKeyboardInsetsUnconditionally = DYLD_IOS_VERSION_12_0,
+    FirstWithMainThreadReleaseAssertionInWebPageProxy = DYLD_IOS_VERSION_12_0,
 #elif PLATFORM(MAC)
     FirstWithNetworkCache = DYLD_MACOSX_VERSION_10_11,
     FirstWithExceptionsForDuplicateCompletionHandlerCalls = DYLD_MACOSX_VERSION_10_13,
     FirstWithDropToNavigateDisallowedByDefault = DYLD_MACOSX_VERSION_10_13,
     FirstWithExpiredOnlyReloadBehavior = DYLD_MACOSX_VERSION_10_13,
+    FirstWithMainThreadReleaseAssertionInWebPageProxy = DYLD_MACOSX_VERSION_10_14,
 #endif
 };
 

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (234904 => 234905)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2018-08-15 23:11:38 UTC (rev 234904)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2018-08-15 23:37:31 UTC (rev 234905)
@@ -67,6 +67,7 @@
 #include "ObjCObjectGraph.h"
 #include "PDFPlugin.h"
 #include "UserMediaCaptureManagerProxy.h"
+#include "VersionChecks.h"
 #endif
 
 #if ENABLE(SEC_ITEM_SHIM)
@@ -80,9 +81,20 @@
 
 namespace WebKit {
 
+static bool isMainThreadOrCheckDisabled()
+{
+#if PLATFORM(IOS)
+    return LIKELY(RunLoop::isMain()) || !linkedOnOrAfter(SDKVersion::FirstWithMainThreadReleaseAssertionInWebPageProxy);
+#elif PLATFORM(MAC)
+    return LIKELY(RunLoop::isMain()) || !linkedOnOrAfter(SDKVersion::FirstWithMainThreadReleaseAssertionInWebPageProxy);
+#else
+    return RunLoop::isMain();
+#endif
+}
+
 static HashMap<ProcessIdentifier, WebProcessProxy*>& allProcesses()
 {
-    ASSERT(RunLoop::isMain());
+    ASSERT(isMainThreadOrCheckDisabled());
     static NeverDestroyed<HashMap<ProcessIdentifier, WebProcessProxy*>> map;
     return map;
 }
@@ -100,7 +112,7 @@
 
 static WebProcessProxy::WebPageProxyMap& globalPageMap()
 {
-    ASSERT(RunLoop::isMain());
+    ASSERT(isMainThreadOrCheckDisabled());
     static NeverDestroyed<WebProcessProxy::WebPageProxyMap> pageMap;
     return pageMap;
 }
@@ -128,7 +140,7 @@
 #endif
     , m_isInPrewarmedPool(isInPrewarmedPool == IsInPrewarmedPool::Yes)
 {
-    RELEASE_ASSERT(RunLoop::isMain());
+    RELEASE_ASSERT(isMainThreadOrCheckDisabled());
 
     auto result = allProcesses().add(coreProcessIdentifier(), this);
     ASSERT_UNUSED(result, result.isNewEntry);
@@ -138,7 +150,7 @@
 
 WebProcessProxy::~WebProcessProxy()
 {
-    RELEASE_ASSERT(RunLoop::isMain());
+    RELEASE_ASSERT(isMainThreadOrCheckDisabled());
     ASSERT(m_pageURLRetainCountMap.isEmpty());
 
     auto result = allProcesses().remove(coreProcessIdentifier());
@@ -212,7 +224,7 @@
 
 void WebProcessProxy::shutDown()
 {
-    RELEASE_ASSERT(RunLoop::isMain());
+    RELEASE_ASSERT(isMainThreadOrCheckDisabled());
 
     shutDownProcess();
 
@@ -253,7 +265,7 @@
 void WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, CompletionHandler<void (const HashSet<String>&)>&& completionHandler)
 {
     // We expect this to be called on the main thread so we get the default website data store.
-    ASSERT(RunLoop::isMain());
+    ASSERT(isMainThreadOrCheckDisabled());
     
     struct CallbackAggregator : ThreadSafeRefCounted<CallbackAggregator> {
         explicit CallbackAggregator(CompletionHandler<void(HashSet<String>)>&& completionHandler)
@@ -301,7 +313,7 @@
         callbackAggregator->addPendingCallback();
         dataStore.removeDataForTopPrivatelyControlledDomains(dataTypes, fetchOptions, topPrivatelyControlledDomains, [callbackAggregator, shouldNotifyPage, page](HashSet<String>&& domainsWithDeletedWebsiteData) {
             // When completing the task, we should be getting called on the main thread.
-            ASSERT(RunLoop::isMain());
+            ASSERT(isMainThreadOrCheckDisabled());
             
             if (shouldNotifyPage)
                 page.value->postMessageToInjectedBundle("WebsiteDataDeletionForTopPrivatelyOwnedDomainsFinished", nullptr);
@@ -315,7 +327,7 @@
 void WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, CompletionHandler<void(HashSet<String>&&)>&& completionHandler)
 {
     // We expect this to be called on the main thread so we get the default website data store.
-    ASSERT(RunLoop::isMain());
+    ASSERT(isMainThreadOrCheckDisabled());
     
     struct CallbackAggregator : ThreadSafeRefCounted<CallbackAggregator> {
         explicit CallbackAggregator(CompletionHandler<void(HashSet<String>&&)>&& completionHandler)
@@ -363,7 +375,7 @@
         callbackAggregator->addPendingCallback();
         dataStore.topPrivatelyControlledDomainsWithWebsiteData(dataTypes, { }, [callbackAggregator, shouldNotifyPage, page = makeRef(*page)](HashSet<String>&& domainsWithDataRecords) {
             // When completing the task, we should be getting called on the main thread.
-            ASSERT(RunLoop::isMain());
+            ASSERT(isMainThreadOrCheckDisabled());
             
             if (shouldNotifyPage)
                 page->postMessageToInjectedBundle("WebsiteDataScanForTopPrivatelyControlledDomainsFinished", nullptr);
@@ -767,7 +779,7 @@
 
 void WebProcessProxy::didFinishLaunching(ProcessLauncher* launcher, IPC::Connection::Identifier connectionIdentifier)
 {
-    RELEASE_ASSERT(RunLoop::isMain());
+    RELEASE_ASSERT(isMainThreadOrCheckDisabled());
 
     ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to