Title: [258447] trunk/Source
Revision
258447
Author
mmaxfi...@apple.com
Date
2020-03-13 16:33:33 -0700 (Fri, 13 Mar 2020)

Log Message

[Cocoa] Push applicationSDKVersion() down from WebCore into WTF
https://bugs.webkit.org/show_bug.cgi?id=209030

Reviewed by Simon Fraser.

Source/_javascript_Core:

dyld_get_program_sdk_version() gives you the wrong answer in the Web Process (or at least
not the answer you actually want). There are already facilities for the UI Process to tell
the Web Process what the real value is, but those functions are currently in WebCore,
which is inaccessible to WTF. This patch is in preparation for
https://bugs.webkit.org/show_bug.cgi?id=208969 which needs to know this information in WTF.

I also found a few places which were calling dyld_get_program_sdk_version() in _javascript_Core
and WebCore (which is wrong because those libraries exist in the Web Process), and have fixed
them up to use applicationSDKVersion() instead.

* API/JSWrapperMap.mm:
(supportsInitMethodConstructors):

Source/WebCore:

* html/HTMLObjectElement.cpp:
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
* platform/RuntimeApplicationChecks.h:
* platform/Timer.cpp:
(WebCore::shouldSuppressThreadSafetyCheck):
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::applicationSDKVersionOverride): Deleted.
(WebCore::setApplicationSDKVersion): Deleted.
(WebCore::applicationSDKVersion): Deleted.

Source/WebKit:

* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
* Shared/WebPreferencesDefaultValues.cpp:
(WebKit::defaultCSSOMViewScrollingAPIEnabled):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

Source/WTF:

* WTF.xcodeproj/project.pbxproj:
* wtf/PlatformMac.cmake:
* wtf/cocoa/RuntimeApplicationChecksCocoa.cpp: Added.
* wtf/cocoa/RuntimeApplicationChecksCocoa.h: Added.
(WTF::applicationSDKVersionOverride):
(WTF::setApplicationSDKVersion):
(WTF::applicationSDKVersion):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSWrapperMap.mm (258446 => 258447)


--- trunk/Source/_javascript_Core/API/JSWrapperMap.mm	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/_javascript_Core/API/JSWrapperMap.mm	2020-03-13 23:33:33 UTC (rev 258447)
@@ -40,8 +40,11 @@
 #import "WeakGCMap.h"
 #import "WeakGCMapInlines.h"
 #import <wtf/Vector.h>
-#import <wtf/spi/darwin/dyldSPI.h>
 
+#if PLATFORM(COCOA)
+#import <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
+#endif
+
 #include <mach-o/dyld.h>
 
 #if PLATFORM(APPLETV)
@@ -720,7 +723,7 @@
     // base our check on what SDK was used to build the application.
     static uint32_t programSDKVersion = 0;
     if (!programSDKVersion)
-        programSDKVersion = dyld_get_program_sdk_version();
+        programSDKVersion = applicationSDKVersion();
 
     return programSDKVersion >= firstSDKVersionWithInitConstructorSupport;
 #endif

Modified: trunk/Source/_javascript_Core/ChangeLog (258446 => 258447)


--- trunk/Source/_javascript_Core/ChangeLog	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-03-13 23:33:33 UTC (rev 258447)
@@ -1,3 +1,23 @@
+2020-03-13  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Push applicationSDKVersion() down from WebCore into WTF
+        https://bugs.webkit.org/show_bug.cgi?id=209030
+
+        Reviewed by Simon Fraser.
+
+        dyld_get_program_sdk_version() gives you the wrong answer in the Web Process (or at least
+        not the answer you actually want). There are already facilities for the UI Process to tell
+        the Web Process what the real value is, but those functions are currently in WebCore,
+        which is inaccessible to WTF. This patch is in preparation for
+        https://bugs.webkit.org/show_bug.cgi?id=208969 which needs to know this information in WTF.
+
+        I also found a few places which were calling dyld_get_program_sdk_version() in _javascript_Core
+        and WebCore (which is wrong because those libraries exist in the Web Process), and have fixed
+        them up to use applicationSDKVersion() instead.
+
+        * API/JSWrapperMap.mm:
+        (supportsInitMethodConstructors):
+
 2020-03-13  Yusuke Suzuki  <ysuz...@apple.com>
 
         [JSC] Reload CodeBlock or suppress GC while setting up calls

Modified: trunk/Source/WTF/ChangeLog (258446 => 258447)


--- trunk/Source/WTF/ChangeLog	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WTF/ChangeLog	2020-03-13 23:33:33 UTC (rev 258447)
@@ -1,3 +1,18 @@
+2020-03-13  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Push applicationSDKVersion() down from WebCore into WTF
+        https://bugs.webkit.org/show_bug.cgi?id=209030
+
+        Reviewed by Simon Fraser.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/PlatformMac.cmake:
+        * wtf/cocoa/RuntimeApplicationChecksCocoa.cpp: Added.
+        * wtf/cocoa/RuntimeApplicationChecksCocoa.h: Added.
+        (WTF::applicationSDKVersionOverride):
+        (WTF::setApplicationSDKVersion):
+        (WTF::applicationSDKVersion):
+
 2020-03-11  Jer Noble  <jer.no...@apple.com>
 
         Adopt AVSampleBufferVideoOutput

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (258446 => 258447)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2020-03-13 23:33:33 UTC (rev 258447)
@@ -61,6 +61,7 @@
 		1C181C931D307AB800F5FA16 /* UTextProviderUTF16.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C8D1D307AB800F5FA16 /* UTextProviderUTF16.cpp */; };
 		1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp */; };
 		1C503BE623AAE0AE0072E66B /* LanguageCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C503BE523AAE0AE0072E66B /* LanguageCocoa.mm */; };
+		1CA85CA9241B0B260071C2F5 /* RuntimeApplicationChecksCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CA85CA8241B0B260071C2F5 /* RuntimeApplicationChecksCocoa.cpp */; };
 		1FA47C8A152502DA00568D1B /* WebCoreThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1FA47C88152502DA00568D1B /* WebCoreThread.cpp */; };
 		2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CCD892915C0390200285083 /* GregorianDateTime.cpp */; };
 		2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CDED0EE18115C38004DBA70 /* RunLoopCF.cpp */; };
@@ -344,6 +345,8 @@
 		1C181C951D30800A00F5FA16 /* TextBreakIteratorInternalICUCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextBreakIteratorInternalICUCocoa.cpp; sourceTree = "<group>"; };
 		1C503BE423AADEEA0072E66B /* NSLocaleSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSLocaleSPI.h; sourceTree = "<group>"; };
 		1C503BE523AAE0AE0072E66B /* LanguageCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LanguageCocoa.mm; sourceTree = "<group>"; };
+		1CA85CA7241B0B110071C2F5 /* RuntimeApplicationChecksCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RuntimeApplicationChecksCocoa.h; sourceTree = "<group>"; };
+		1CA85CA8241B0B260071C2F5 /* RuntimeApplicationChecksCocoa.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RuntimeApplicationChecksCocoa.cpp; sourceTree = "<group>"; };
 		1CCDB1491E566626006C73C0 /* TextBreakIteratorCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextBreakIteratorCF.h; sourceTree = "<group>"; };
 		1CCDB14D1E566898006C73C0 /* TextBreakIteratorICU.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextBreakIteratorICU.h; sourceTree = "<group>"; };
 		1CCDB1511E566BC5006C73C0 /* CFStringSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFStringSPI.h; sourceTree = "<group>"; };
@@ -1516,6 +1519,8 @@
 				5CC0EE872162BC2200A1A842 /* NSURLExtras.h */,
 				5CC0EE882162BC2200A1A842 /* NSURLExtras.mm */,
 				E392FA2622E92BFF00ECDC73 /* ResourceUsageCocoa.cpp */,
+				1CA85CA8241B0B260071C2F5 /* RuntimeApplicationChecksCocoa.cpp */,
+				1CA85CA7241B0B110071C2F5 /* RuntimeApplicationChecksCocoa.h */,
 				A30D412C1F0DE0BA00B71954 /* SoftLinking.h */,
 				EB61EDC62409CCC0001EFE36 /* SystemTracingCocoa.cpp */,
 				5CC0EE862162BC2200A1A842 /* URLCocoa.mm */,
@@ -1699,6 +1704,7 @@
 				2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */,
 				2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */,
 				A3EE5C3E21FFAC7D00FABD61 /* RunLoopTimerCF.cpp in Sources */,
+				1CA85CA9241B0B260071C2F5 /* RuntimeApplicationChecksCocoa.cpp in Sources */,
 				A3EE5C3D21FFAC7D00FABD61 /* SchedulePairCF.cpp in Sources */,
 				A3EE5C4021FFACA200FABD61 /* SchedulePairMac.mm in Sources */,
 				0F66B28E1DC97BAB004A1D3F /* Seconds.cpp in Sources */,

Modified: trunk/Source/WTF/wtf/PlatformMac.cmake (258446 => 258447)


--- trunk/Source/WTF/wtf/PlatformMac.cmake	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WTF/wtf/PlatformMac.cmake	2020-03-13 23:33:33 UTC (rev 258447)
@@ -16,6 +16,7 @@
     cocoa/CrashReporter.h
     cocoa/Entitlements.h
     cocoa/NSURLExtras.h
+    cocoa/RuntimeApplicationChecksCocoa.h
     cocoa/SoftLinking.h
 
     darwin/WeakLinking.h
@@ -65,6 +66,7 @@
     cocoa/MemoryPressureHandlerCocoa.mm
     cocoa/NSURLExtras.mm
     cocoa/ResourceUsageCocoa.cpp
+    cocoa/RuntimeApplicationChecksCocoa.cpp
     cocoa/SystemTracingCocoa.cpp
     cocoa/URLCocoa.mm
     cocoa/WorkQueueCocoa.cpp

Added: trunk/Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.cpp (0 => 258447)


--- trunk/Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.cpp	                        (rev 0)
+++ trunk/Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.cpp	2020-03-13 23:33:33 UTC (rev 258447)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011-2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
+
+#include <wtf/NeverDestroyed.h>
+#include <wtf/Optional.h>
+
+namespace WTF {
+
+static Optional<uint32_t>& applicationSDKVersionOverride()
+{
+    static NeverDestroyed<Optional<uint32_t>> version;
+    return version;
+}
+
+void setApplicationSDKVersion(uint32_t version)
+{
+    applicationSDKVersionOverride() = version;
+}
+
+uint32_t applicationSDKVersion()
+{
+    if (applicationSDKVersionOverride())
+        return *applicationSDKVersionOverride();
+    return dyld_get_program_sdk_version();
+}
+
+}

Added: trunk/Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h (0 => 258447)


--- trunk/Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h	2020-03-13 23:33:33 UTC (rev 258447)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2009-2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/Forward.h>
+
+// This contains the values with which to compare the return value of applicationSDKVersion().
+#include <wtf/spi/darwin/dyldSPI.h>
+
+namespace WTF {
+
+// dyld_get_program_sdk_version() gives you the wrong answer in any process other than the UI process.
+// These functions are hooked up to give you the right answer.
+WTF_EXPORT_PRIVATE void setApplicationSDKVersion(uint32_t);
+WTF_EXPORT_PRIVATE uint32_t applicationSDKVersion();
+
+}
+
+using WTF::setApplicationSDKVersion;
+using WTF::applicationSDKVersion;

Modified: trunk/Source/WebCore/ChangeLog (258446 => 258447)


--- trunk/Source/WebCore/ChangeLog	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WebCore/ChangeLog	2020-03-13 23:33:33 UTC (rev 258447)
@@ -1,3 +1,23 @@
+2020-03-13  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Push applicationSDKVersion() down from WebCore into WTF
+        https://bugs.webkit.org/show_bug.cgi?id=209030
+
+        Reviewed by Simon Fraser.
+
+        * html/HTMLObjectElement.cpp:
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
+        * platform/RuntimeApplicationChecks.h:
+        * platform/Timer.cpp:
+        (WebCore::shouldSuppressThreadSafetyCheck):
+        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
+        (WebCore::applicationSDKVersionOverride): Deleted.
+        (WebCore::setApplicationSDKVersion): Deleted.
+        (WebCore::applicationSDKVersion): Deleted.
+
 2020-03-13  Jiewen Tan  <jiewen_...@apple.com>
 
         [WebAuthn] Customize a bit more on the macOS LocalAuthentication prompt

Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (258446 => 258447)


--- trunk/Source/WebCore/html/HTMLObjectElement.cpp	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp	2020-03-13 23:33:33 UTC (rev 258447)
@@ -54,7 +54,6 @@
 
 #if PLATFORM(IOS_FAMILY)
 #include "RuntimeApplicationChecks.h"
-#include <wtf/spi/darwin/dyldSPI.h>
 #endif
 
 namespace WebCore {

Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (258446 => 258447)


--- trunk/Source/WebCore/html/MediaElementSession.cpp	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp	2020-03-13 23:33:33 UTC (rev 258447)
@@ -54,7 +54,7 @@
 #if PLATFORM(IOS_FAMILY)
 #include "AudioSession.h"
 #include "RuntimeApplicationChecks.h"
-#include <wtf/spi/darwin/dyldSPI.h>
+#include <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
 #endif
 
 namespace WebCore {
@@ -738,7 +738,7 @@
 #if PLATFORM(IOS_FAMILY)
     if (IOSApplication::isIBooks())
         return !m_element.hasAttributeWithoutSynchronization(HTMLNames::webkit_playsinlineAttr) && !m_element.hasAttributeWithoutSynchronization(HTMLNames::playsinlineAttr);
-    if (dyld_get_program_sdk_version() < DYLD_IOS_VERSION_10_0)
+    if (applicationSDKVersion() < DYLD_IOS_VERSION_10_0)
         return !m_element.hasAttributeWithoutSynchronization(HTMLNames::webkit_playsinlineAttr);
 #endif
 

Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (258446 => 258447)


--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp	2020-03-13 23:33:33 UTC (rev 258447)
@@ -64,7 +64,7 @@
 #include <wtf/Ref.h>
 
 #if PLATFORM(IOS_FAMILY)
-#include <wtf/spi/darwin/dyldSPI.h>
+#include <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
 #endif
 
 namespace WebCore {

Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.h (258446 => 258447)


--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2020-03-13 23:33:33 UTC (rev 258447)
@@ -43,9 +43,6 @@
 bool isInWebProcess();
 bool isInNetworkProcess();
 
-WEBCORE_EXPORT void setApplicationSDKVersion(uint32_t);
-WEBCORE_EXPORT uint32_t applicationSDKVersion();
-
 WEBCORE_EXPORT void setApplicationBundleIdentifier(const String&);
 WEBCORE_EXPORT String applicationBundleIdentifier();
 WEBCORE_EXPORT void clearApplicationBundleIdentifierTestingOverride();

Modified: trunk/Source/WebCore/platform/Timer.cpp (258446 => 258447)


--- trunk/Source/WebCore/platform/Timer.cpp	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WebCore/platform/Timer.cpp	2020-03-13 23:33:33 UTC (rev 258447)
@@ -37,7 +37,7 @@
 #include <wtf/Vector.h>
 
 #if PLATFORM(COCOA)
-#include <wtf/spi/darwin/dyldSPI.h>
+#include <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
 #endif
 
 namespace WebCore {

Modified: trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm (258446 => 258447)


--- trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2020-03-13 23:33:33 UTC (rev 258447)
@@ -75,24 +75,6 @@
 #endif
 }
 
-static Optional<uint32_t>& applicationSDKVersionOverride()
-{
-    static NeverDestroyed<Optional<uint32_t>> version;
-    return version;
-}
-
-void setApplicationSDKVersion(uint32_t version)
-{
-    applicationSDKVersionOverride() = version;
-}
-
-uint32_t applicationSDKVersion()
-{
-    if (applicationSDKVersionOverride())
-        return *applicationSDKVersionOverride();
-    return dyld_get_program_sdk_version();
-}
-
 bool isInWebProcess()
 {
     static bool mainBundleIsWebProcess = [[[NSBundle mainBundle] bundleIdentifier] hasPrefix:@"com.apple.WebKit.WebContent"];

Modified: trunk/Source/WebKit/ChangeLog (258446 => 258447)


--- trunk/Source/WebKit/ChangeLog	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WebKit/ChangeLog	2020-03-13 23:33:33 UTC (rev 258447)
@@ -1,3 +1,17 @@
+2020-03-13  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Push applicationSDKVersion() down from WebCore into WTF
+        https://bugs.webkit.org/show_bug.cgi?id=209030
+
+        Reviewed by Simon Fraser.
+
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
+        * Shared/WebPreferencesDefaultValues.cpp:
+        (WebKit::defaultCSSOMViewScrollingAPIEnabled):
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+
 2020-03-13  Brent Fulgham  <bfulg...@apple.com>
 
         Remove unused IPC function UserMediaCaptureManagerProxy::SetMuted

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (258446 => 258447)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm	2020-03-13 23:33:33 UTC (rev 258447)
@@ -45,6 +45,7 @@
 #import <wtf/CallbackAggregator.h>
 #import <wtf/ProcessPrivilege.h>
 #import <wtf/RetainPtr.h>
+#import <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
 
 namespace WebKit {
 
@@ -71,7 +72,7 @@
 void NetworkProcess::platformInitializeNetworkProcessCocoa(const NetworkProcessCreationParameters& parameters)
 {
     WebCore::setApplicationBundleIdentifier(parameters.uiProcessBundleIdentifier);
-    WebCore::setApplicationSDKVersion(parameters.uiProcessSDKVersion);
+    setApplicationSDKVersion(parameters.uiProcessSDKVersion);
 
 #if HAVE(HSTS_STORAGE_PATH)
     if (!parameters.hstsStorageDirectory.isNull()) {

Modified: trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp (258446 => 258447)


--- trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WebKit/Shared/WebPreferencesDefaultValues.cpp	2020-03-13 23:33:33 UTC (rev 258447)
@@ -28,14 +28,11 @@
 #include <WebCore/RuntimeApplicationChecks.h>
 
 #if PLATFORM(COCOA)
+#include "VersionChecks.h"
 #include <pal/spi/cocoa/FeatureFlagsSPI.h>
-#include <wtf/spi/darwin/dyldSPI.h>
+#include <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
 #endif
 
-#if PLATFORM(IOS_FAMILY)
-#include "VersionChecks.h"
-#endif
-
 namespace WebKit {
 
 bool defaultPassiveTouchListenersAsDefaultOnDocument()
@@ -50,7 +47,7 @@
 bool defaultCSSOMViewScrollingAPIEnabled()
 {
 #if PLATFORM(IOS_FAMILY)
-    if (WebCore::IOSApplication::isIMDb() && WebCore::applicationSDKVersion() < DYLD_IOS_VERSION_13_0)
+    if (WebCore::IOSApplication::isIMDb() && applicationSDKVersion() < DYLD_IOS_VERSION_13_0)
         return false;
 #endif
     return true;

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (258446 => 258447)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-03-13 23:33:23 UTC (rev 258446)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-03-13 23:33:33 UTC (rev 258447)
@@ -83,6 +83,7 @@
 #import <wtf/FileSystem.h>
 #import <wtf/ProcessPrivilege.h>
 #import <wtf/cocoa/NSURLExtras.h>
+#import <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
 
 #if ENABLE(REMOTE_INSPECTOR)
 #include <_javascript_Core/RemoteInspector.h>
@@ -173,7 +174,7 @@
 #endif
 
     WebCore::setApplicationBundleIdentifier(parameters.uiProcessBundleIdentifier);
-    WebCore::setApplicationSDKVersion(parameters.uiProcessSDKVersion);
+    setApplicationSDKVersion(parameters.uiProcessSDKVersion);
 
     m_uiProcessBundleIdentifier = parameters.uiProcessBundleIdentifier;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to