REGRESSION (r231107): MoviStar+ launches to a blank black screen
https://bugs.webkit.org/show_bug.cgi?id=188139

Reviewed by Brent Fulgham.

Source/WebCore:

For this app, revert behavior to how it was before r231107 with a linked-on-or-before check.
r231107 increased our fetch spec conformance, which we intend to keep.  This makes a low-risk
targeted fix that will fix the affected app until they update.  

I manually verified this fixes the app.

* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::applicationSDKVersionOverride):
(WebCore::setApplicationSDKVersion):
(WebCore::applicationSDKVersion):
(WebCore::IOSApplication::isMoviStarPlus):

Source/WebKit:

Add infrastructure to check UIProcess SDK from the WebProcess and NetworkProcess for linked-on-or-after checks.

* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@234447 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/RuntimeApplicationChecks.h b/Source/WebCore/platform/RuntimeApplicationChecks.h
index 94e28f8..90d0a7f 100644
--- a/Source/WebCore/platform/RuntimeApplicationChecks.h
+++ b/Source/WebCore/platform/RuntimeApplicationChecks.h
@@ -42,6 +42,9 @@
 
 bool isInWebProcess();
 
+WEBCORE_EXPORT void setApplicationSDKVersion(uint32_t);
+uint32_t applicationSDKVersion();
+
 WEBCORE_EXPORT void setApplicationBundleIdentifier(const String&);
 String applicationBundleIdentifier();
 
@@ -86,6 +89,7 @@
 WEBCORE_EXPORT bool isTheSecretSocietyHiddenMystery();
 WEBCORE_EXPORT bool isCardiogram();
 WEBCORE_EXPORT bool isNike();
+bool isMoviStarPlus();
 
 } // IOSApplication
 
diff --git a/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm b/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
index 571454e..00250a7 100644
--- a/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
+++ b/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
@@ -31,6 +31,7 @@
 #import <Foundation/NSBundle.h>
 #import <wtf/NeverDestroyed.h>
 #import <wtf/RunLoop.h>
+#import <wtf/spi/darwin/dyldSPI.h>
 #import <wtf/text/WTFString.h>
 
 namespace WebCore {
@@ -65,6 +66,24 @@
     applicationBundleIdentifierOverride() = bundleIdentifier;
 }
 
+static std::optional<uint32_t>& applicationSDKVersionOverride()
+{
+    static NeverDestroyed<std::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] isEqualToString:@"com.apple.WebKit.WebContent.Development"]
@@ -254,6 +273,12 @@
     return isNike;
 }
 
+bool IOSApplication::isMoviStarPlus()
+{
+    static bool isMoviStarPlus = applicationBundleIsEqualTo("com.prisatv.yomvi"_s);
+    return isMoviStarPlus;
+}
+    
 #endif
 
 } // namespace WebCore