REGRESSION (r231107): MoviStar+ launches to a blank black screen
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Aug 2018 03:57:07 +0000 (03:57 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Aug 2018 03:57:07 +0000 (03:57 +0000)
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: https://svn.webkit.org/repository/webkit/trunk@234447 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/platform/RuntimeApplicationChecks.h
Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
Source/WebKit/Shared/WebProcessCreationParameters.cpp
Source/WebKit/Shared/WebProcessCreationParameters.h
Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm

index 87b34c3..96d494d 100644 (file)
@@ -1,3 +1,25 @@
+2018-07-31  Alex Christensen  <achristensen@webkit.org>
+
+        REGRESSION (r231107): MoviStar+ launches to a blank black screen
+        https://bugs.webkit.org/show_bug.cgi?id=188139
+
+        Reviewed by Brent Fulgham.
+
+        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):
+
 2018-07-31  Myles C. Maxfield  <mmaxfield@apple.com>
 
         [Cocoa] Addressing post-review comments on r234158
index 1c2d1dc..0525bf6 100644 (file)
@@ -50,6 +50,7 @@
 #include "ResourceError.h"
 #include "ResourceRequest.h"
 #include "ResourceTiming.h"
+#include "RuntimeApplicationChecks.h"
 #include "RuntimeEnabledFeatures.h"
 #include "SchemeRegistry.h"
 #include "SecurityOrigin.h"
 #include <wtf/Assertions.h>
 #include <wtf/Ref.h>
 
+#if PLATFORM(IOS)
+#include <wtf/spi/darwin/dyldSPI.h>
+#endif
+
 namespace WebCore {
 
 void DocumentThreadableLoader::loadResourceSynchronously(Document& document, ResourceRequest&& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options, RefPtr<SecurityOrigin>&& origin, std::unique_ptr<ContentSecurityPolicy>&& contentSecurityPolicy)
@@ -179,7 +184,13 @@ void DocumentThreadableLoader::makeCrossOriginAccessRequest(ResourceRequest&& re
 {
     ASSERT(m_options.mode == FetchOptions::Mode::Cors);
 
-    if ((m_options.preflightPolicy == PreflightPolicy::Consider && isSimpleCrossOriginAccessRequest(request.httpMethod(), request.httpHeaderFields())) || m_options.preflightPolicy == PreflightPolicy::Prevent || shouldPerformSecurityChecks()) {
+#if PLATFORM(IOS)
+    bool needsPreflightQuirk = IOSApplication::isMoviStarPlus() && applicationSDKVersion() < DYLD_IOS_VERSION_12_0 && (m_options.preflightPolicy == PreflightPolicy::Consider || m_options.preflightPolicy == PreflightPolicy::Force);
+#else
+    bool needsPreflightQuirk = false;
+#endif
+
+    if ((m_options.preflightPolicy == PreflightPolicy::Consider && isSimpleCrossOriginAccessRequest(request.httpMethod(), request.httpHeaderFields())) || m_options.preflightPolicy == PreflightPolicy::Prevent || (shouldPerformSecurityChecks() && !needsPreflightQuirk)) {
         if (checkURLSchemeAsCORSEnabled(request.url()))
             makeSimpleCrossOriginAccessRequest(WTFMove(request));
     } else {
@@ -194,7 +205,7 @@ void DocumentThreadableLoader::makeCrossOriginAccessRequest(ResourceRequest&& re
             }
         }
 #endif
-        if (!checkURLSchemeAsCORSEnabled(request.url()))
+        if (!needsPreflightQuirk && !checkURLSchemeAsCORSEnabled(request.url()))
             return;
 
         m_simpleRequest = false;
index 94e28f8..90d0a7f 100644 (file)
@@ -42,6 +42,9 @@ inline bool isInWebProcess() { return true; }
 
 bool isInWebProcess();
 
+WEBCORE_EXPORT void setApplicationSDKVersion(uint32_t);
+uint32_t applicationSDKVersion();
+
 WEBCORE_EXPORT void setApplicationBundleIdentifier(const String&);
 String applicationBundleIdentifier();
 
@@ -86,6 +89,7 @@ bool isIBooksStorytime();
 WEBCORE_EXPORT bool isTheSecretSocietyHiddenMystery();
 WEBCORE_EXPORT bool isCardiogram();
 WEBCORE_EXPORT bool isNike();
+bool isMoviStarPlus();
 
 } // IOSApplication
 
index 571454e..00250a7 100644 (file)
@@ -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 @@ void setApplicationBundleIdentifier(const String& bundleIdentifier)
     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 @@ bool IOSApplication::isNike()
     return isNike;
 }
 
+bool IOSApplication::isMoviStarPlus()
+{
+    static bool isMoviStarPlus = applicationBundleIsEqualTo("com.prisatv.yomvi"_s);
+    return isMoviStarPlus;
+}
+    
 #endif
 
 } // namespace WebCore
index 780d506..6de00e5 100644 (file)
@@ -1,3 +1,28 @@
+2018-07-31  Alex Christensen  <achristensen@webkit.org>
+
+        REGRESSION (r231107): MoviStar+ launches to a blank black screen
+        https://bugs.webkit.org/show_bug.cgi?id=188139
+
+        Reviewed by Brent Fulgham.
+
+        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):
+
 2018-07-31  Ryosuke Niwa  <rniwa@webkit.org>
 
         Add configuration for automatic process pre-warming
index 4fe2f83..36f23c9 100644 (file)
@@ -69,6 +69,7 @@ void NetworkProcessCreationParameters::encode(IPC::Encoder& encoder) const
 #if PLATFORM(COCOA)
     encoder << parentProcessName;
     encoder << uiProcessBundleIdentifier;
+    encoder << uiProcessSDKVersion;
     encoder << sourceApplicationBundleIdentifier;
     encoder << sourceApplicationSecondaryIdentifier;
 #if PLATFORM(IOS)
@@ -183,6 +184,8 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc
         return false;
     if (!decoder.decode(result.uiProcessBundleIdentifier))
         return false;
+    if (!decoder.decode(result.uiProcessSDKVersion))
+        return false;
     if (!decoder.decode(result.sourceApplicationBundleIdentifier))
         return false;
     if (!decoder.decode(result.sourceApplicationSecondaryIdentifier))
index 12ffb50..da0b19f 100644 (file)
@@ -82,6 +82,7 @@ struct NetworkProcessCreationParameters {
 #if PLATFORM(COCOA)
     String parentProcessName;
     String uiProcessBundleIdentifier;
+    uint32_t uiProcessSDKVersion { 0 };
     String sourceApplicationBundleIdentifier;
     String sourceApplicationSecondaryIdentifier;
 #if PLATFORM(IOS)
index e316cef..5bc7498 100644 (file)
@@ -74,6 +74,7 @@ static void initializeNetworkSettings()
 void NetworkProcess::platformInitializeNetworkProcessCocoa(const NetworkProcessCreationParameters& parameters)
 {
     WebCore::setApplicationBundleIdentifier(parameters.uiProcessBundleIdentifier);
+    WebCore::setApplicationSDKVersion(parameters.uiProcessSDKVersion);
 
 #if PLATFORM(IOS)
     SandboxExtension::consumePermanently(parameters.cookieStorageDirectoryExtensionHandle);
index 1da887a..4752837 100644 (file)
@@ -103,6 +103,7 @@ void WebProcessCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << defaultRequestTimeoutInterval;
 #if PLATFORM(COCOA)
     encoder << uiProcessBundleIdentifier;
+    encoder << uiProcessSDKVersion;
 #endif
     encoder << presentingApplicationPID;
 #if PLATFORM(COCOA)
@@ -319,6 +320,8 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat
 #if PLATFORM(COCOA)
     if (!decoder.decode(parameters.uiProcessBundleIdentifier))
         return false;
+    if (!decoder.decode(parameters.uiProcessSDKVersion))
+        return false;
 #endif
     if (!decoder.decode(parameters.presentingApplicationPID))
         return false;
index 1205fb7..22ea8aa 100644 (file)
@@ -146,6 +146,7 @@ struct WebProcessCreationParameters {
 
 #if PLATFORM(COCOA)
     String uiProcessBundleIdentifier;
+    uint32_t uiProcessSDKVersion { 0 };
 #endif
 
     ProcessID presentingApplicationPID { 0 };
index e2b0119..47cda5f 100644 (file)
@@ -52,6 +52,7 @@
 #import <pal/spi/cocoa/NSKeyedArchiverSPI.h>
 #import <sys/param.h>
 #import <wtf/ProcessPrivilege.h>
+#import <wtf/spi/darwin/dyldSPI.h>
 
 #if PLATFORM(IOS)
 #import "WebMemoryPressureHandlerIOS.h"
@@ -205,6 +206,7 @@ void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters&
     SandboxExtension::createHandleWithoutResolvingPath(parameters.uiProcessBundleResourcePath, SandboxExtension::Type::ReadOnly, parameters.uiProcessBundleResourcePathExtensionHandle);
 
     parameters.uiProcessBundleIdentifier = String([[NSBundle mainBundle] bundleIdentifier]);
+    parameters.uiProcessSDKVersion = dyld_get_program_sdk_version();
 
 #if PLATFORM(IOS)
     if (!m_resolvedPaths.cookieStorageDirectory.isEmpty())
@@ -291,6 +293,7 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara
 {
     parameters.parentProcessName = [[NSProcessInfo processInfo] processName];
     parameters.uiProcessBundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
+    parameters.uiProcessSDKVersion = dyld_get_program_sdk_version();
 
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
 
index 010355f..e3d7a00 100644 (file)
@@ -124,6 +124,8 @@ void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&& par
 #endif
 
     WebCore::setApplicationBundleIdentifier(parameters.uiProcessBundleIdentifier);
+    WebCore::setApplicationSDKVersion(parameters.uiProcessSDKVersion);
+
     SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier);
 
 #if ENABLE(SANDBOX_EXTENSIONS)