Modified: branches/safari-606.1.36.0-branch/Source/WebCore/platform/Timer.cpp (234906 => 234907)
--- branches/safari-606.1.36.0-branch/Source/WebCore/platform/Timer.cpp 2018-08-15 23:46:13 UTC (rev 234906)
+++ branches/safari-606.1.36.0-branch/Source/WebCore/platform/Timer.cpp 2018-08-15 23:46:34 UTC (rev 234907)
@@ -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 PLATFORM(IOS) || PLATFORM(MAC)
+#include <wtf/spi/darwin/dyldSPI.h>
+#endif
+
namespace WebCore {
class TimerHeapReference;
@@ -184,6 +189,17 @@
// ----------------
+static bool shouldSuppressThreadSafetyCheck()
+{
+#if PLATFORM(IOS)
+ return WebThreadIsEnabled() || applicationSDKVersion() < DYLD_IOS_VERSION_12_0;
+#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)
Modified: branches/safari-606.1.36.0-branch/Source/WebKit/UIProcess/Cocoa/VersionChecks.h (234906 => 234907)
--- branches/safari-606.1.36.0-branch/Source/WebKit/UIProcess/Cocoa/VersionChecks.h 2018-08-15 23:46:13 UTC (rev 234906)
+++ branches/safari-606.1.36.0-branch/Source/WebKit/UIProcess/Cocoa/VersionChecks.h 2018-08-15 23:46:34 UTC (rev 234907)
@@ -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.1.36.0-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp (234906 => 234907)
--- branches/safari-606.1.36.0-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp 2018-08-15 23:46:13 UTC (rev 234906)
+++ branches/safari-606.1.36.0-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp 2018-08-15 23:46:34 UTC (rev 234907)
@@ -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);