Title: [235703] branches/safari-606-branch/Source
Revision
235703
Author
[email protected]
Date
2018-09-05 14:52:43 -0700 (Wed, 05 Sep 2018)

Log Message

Cherry-pick r234905. rdar://problem/44144059

    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):

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

Modified Paths

Diff

Modified: branches/safari-606-branch/Source/WebCore/ChangeLog (235702 => 235703)


--- branches/safari-606-branch/Source/WebCore/ChangeLog	2018-09-05 21:52:40 UTC (rev 235702)
+++ branches/safari-606-branch/Source/WebCore/ChangeLog	2018-09-05 21:52:43 UTC (rev 235703)
@@ -1,5 +1,55 @@
 2018-09-05  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r234905. rdar://problem/44144059
+
+    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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234905 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-09-05  Babak Shafiei  <[email protected]>
+
         Cherry-pick r234890. rdar://problem/44144063
 
     Remove failing assertion introduced in r234873

Modified: branches/safari-606-branch/Source/WebCore/platform/Timer.cpp (235702 => 235703)


--- branches/safari-606-branch/Source/WebCore/platform/Timer.cpp	2018-09-05 21:52:40 UTC (rev 235702)
+++ branches/safari-606-branch/Source/WebCore/platform/Timer.cpp	2018-09-05 21:52:43 UTC (rev 235703)
@@ -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: branches/safari-606-branch/Source/WebKit/ChangeLog (235702 => 235703)


--- branches/safari-606-branch/Source/WebKit/ChangeLog	2018-09-05 21:52:40 UTC (rev 235702)
+++ branches/safari-606-branch/Source/WebKit/ChangeLog	2018-09-05 21:52:43 UTC (rev 235703)
@@ -1,5 +1,65 @@
 2018-09-05  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r234905. rdar://problem/44144059
+
+    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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234905 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-09-05  Babak Shafiei  <[email protected]>
+
         Cherry-pick r234896. rdar://problem/44144086
 
     NetworkCORSPreflightChecker should proceed in case of ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested even though the WebKit app is not implementing the didReceiveAuthenticationChallenge/didReceiveAuthenticationChallengeInFrame callback

Modified: branches/safari-606-branch/Source/WebKit/UIProcess/Cocoa/VersionChecks.h (235702 => 235703)


--- branches/safari-606-branch/Source/WebKit/UIProcess/Cocoa/VersionChecks.h	2018-09-05 21:52:40 UTC (rev 235702)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/Cocoa/VersionChecks.h	2018-09-05 21:52:43 UTC (rev 235703)
@@ -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: branches/safari-606-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp (235702 => 235703)


--- branches/safari-606-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp	2018-09-05 21:52:40 UTC (rev 235702)
+++ branches/safari-606-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp	2018-09-05 21:52:43 UTC (rev 235703)
@@ -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());
@@ -210,7 +222,7 @@
 
 void WebProcessProxy::shutDown()
 {
-    RELEASE_ASSERT(RunLoop::isMain());
+    RELEASE_ASSERT(isMainThreadOrCheckDisabled());
 
     shutDownProcess();
 
@@ -251,7 +263,7 @@
 void WebProcessProxy::deleteWebsiteDataForTopPrivatelyControlledDomainsInAllPersistentDataStores(OptionSet<WebsiteDataType> dataTypes, Vector<String>&& topPrivatelyControlledDomains, bool shouldNotifyPage, Function<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(Function<void(HashSet<String>)>&& completionHandler)
@@ -299,7 +311,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);
@@ -313,7 +325,7 @@
 void WebProcessProxy::topPrivatelyControlledDomainsWithWebsiteData(OptionSet<WebsiteDataType> dataTypes, bool shouldNotifyPage, Function<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(Function<void(HashSet<String>&&)>&& completionHandler)
@@ -361,7 +373,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);
@@ -756,7 +768,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