Title: [273784] trunk
Revision
273784
Author
mmaxfi...@apple.com
Date
2021-03-02 19:05:42 -0800 (Tue, 02 Mar 2021)

Log Message

REGRESSION(r270691): It's impossible to use MobileAsset fonts on macOS
https://bugs.webkit.org/show_bug.cgi?id=222582
<rdar://problem/74877450>

Reviewed by Per Arne Vollan.

Source/WebKit:

Simply apply the iOS codepath to macOS.

There is also an additional change here to the Mac sandbox.
On Big Sur and earlier, before this patch, com.apple.mobileassetd was allowed,
and com.apple.mobileassetd.v2 was disallowed. After this patch, they both are
allowed, but only with the com.apple.webkit.extension.mach extension.
On other OSes, before this patch, nothing was allowed, whereas after this patch,
only com.apple.mobileassetd.v2 is allowed with the com.apple.webkit.extension.mach
extension.

Test: WebKit.MobileAssetSandboxCheck

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _grantAccessToAssetServices]):
(-[WKWebView _revokeAccessToAssetServices]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _grantAccessToAssetServices]): Deleted.
(-[WKWebView _revokeAccessToAssetServices]): Deleted.
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::grantAccessToAssetServices):
(WebKit::WebPageProxy::revokeAccessToAssetServices):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::grantAccessToAssetServices): Deleted.
(WebKit::WebPageProxy::revokeAccessToAssetServices): Deleted.
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::revokeAccessToAssetServices):
* WebProcess/com.apple.WebProcess.sb.in:
* WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::grantAccessToAssetServices):
(WebKit::WebProcess::revokeAccessToAssetServices):
* WebProcess/playstation/WebProcessPlayStation.cpp:
(WebKit::WebProcess::grantAccessToAssetServices):
(WebKit::WebProcess::revokeAccessToAssetServices):
* WebProcess/win/WebProcessWin.cpp:
(WebKit::WebProcess::grantAccessToAssetServices):
(WebKit::WebProcess::revokeAccessToAssetServices):

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit/MobileAssetSandboxCheck.mm: Copied from Source/WebKit/WebProcess/win/WebProcessWin.cpp.
(TEST):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (273783 => 273784)


--- trunk/Source/WebKit/ChangeLog	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/ChangeLog	2021-03-03 03:05:42 UTC (rev 273784)
@@ -1,3 +1,52 @@
+2021-03-02  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        REGRESSION(r270691): It's impossible to use MobileAsset fonts on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=222582
+        <rdar://problem/74877450>
+
+        Reviewed by Per Arne Vollan.
+
+        Simply apply the iOS codepath to macOS.
+
+        There is also an additional change here to the Mac sandbox.
+        On Big Sur and earlier, before this patch, com.apple.mobileassetd was allowed,
+        and com.apple.mobileassetd.v2 was disallowed. After this patch, they both are
+        allowed, but only with the com.apple.webkit.extension.mach extension.
+        On other OSes, before this patch, nothing was allowed, whereas after this patch,
+        only com.apple.mobileassetd.v2 is allowed with the com.apple.webkit.extension.mach
+        extension.
+
+        Test: WebKit.MobileAssetSandboxCheck
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _grantAccessToAssetServices]):
+        (-[WKWebView _revokeAccessToAssetServices]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/API/ios/WKWebViewIOS.mm:
+        (-[WKWebView _grantAccessToAssetServices]): Deleted.
+        (-[WKWebView _revokeAccessToAssetServices]): Deleted.
+        * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+        (WebKit::WebPageProxy::grantAccessToAssetServices):
+        (WebKit::WebPageProxy::revokeAccessToAssetServices):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::grantAccessToAssetServices): Deleted.
+        (WebKit::WebPageProxy::revokeAccessToAssetServices): Deleted.
+        * WebProcess/WebProcess.h:
+        * WebProcess/WebProcess.messages.in:
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::revokeAccessToAssetServices):
+        * WebProcess/com.apple.WebProcess.sb.in:
+        * WebProcess/glib/WebProcessGLib.cpp:
+        (WebKit::WebProcess::grantAccessToAssetServices):
+        (WebKit::WebProcess::revokeAccessToAssetServices):
+        * WebProcess/playstation/WebProcessPlayStation.cpp:
+        (WebKit::WebProcess::grantAccessToAssetServices):
+        (WebKit::WebProcess::revokeAccessToAssetServices):
+        * WebProcess/win/WebProcessWin.cpp:
+        (WebKit::WebProcess::grantAccessToAssetServices):
+        (WebKit::WebProcess::revokeAccessToAssetServices):
+
 2021-03-02  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [iOS] Image extraction should install image overlay content

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (273783 => 273784)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2021-03-03 03:05:42 UTC (rev 273784)
@@ -2167,6 +2167,18 @@
     return wrapper(_page->loadFile(URL.absoluteString, readAccessURL.absoluteString));
 }
 
+- (void)_grantAccessToAssetServices
+{
+    if (_page)
+        _page->grantAccessToAssetServices();
+}
+
+- (void)_revokeAccessToAssetServices
+{
+    if (_page)
+        _page->revokeAccessToAssetServices();
+}
+
 - (NSArray *)_certificateChain
 {
     if (WebKit::WebFrameProxy* mainFrame = _page->mainFrame())

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (273783 => 273784)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2021-03-03 03:05:42 UTC (rev 273784)
@@ -432,6 +432,9 @@
 */
 - (WKNavigation *)loadSimulatedRequest:(NSURLRequest *)request withResponseHTMLString:(NSString *)string WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 
+- (void)_grantAccessToAssetServices WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(14.0));
+- (void)_revokeAccessToAssetServices WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(14.0));
+
 @end
 
 #if TARGET_OS_IPHONE
@@ -536,9 +539,6 @@
 
 - (UIView *)_fullScreenPlaceholderView WK_API_AVAILABLE(ios(12.0));
 
-- (void)_grantAccessToAssetServices WK_API_AVAILABLE(ios(14.0));
-- (void)_revokeAccessToAssetServices WK_API_AVAILABLE(ios(14.0));
-
 - (void)_willOpenAppLink WK_API_AVAILABLE(ios(14.0));
 
 - (void)_isNavigatingToAppBoundDomain:(void(^)(BOOL))completionHandler WK_API_AVAILABLE(ios(14.0));

Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (273783 => 273784)


--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2021-03-03 03:05:42 UTC (rev 273784)
@@ -3240,22 +3240,6 @@
     return nil;
 }
 
-- (void)_grantAccessToAssetServices
-{
-#if PLATFORM(IOS)
-    if (_page)
-        _page->grantAccessToAssetServices();
-#endif
-}
-
-- (void)_revokeAccessToAssetServices
-{
-#if PLATFORM(IOS)
-    if (_page)
-        _page->revokeAccessToAssetServices();
-#endif
-}
-
 - (void)_willOpenAppLink
 {
     if (_page)

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (273783 => 273784)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm	2021-03-03 03:05:42 UTC (rev 273784)
@@ -42,6 +42,7 @@
 #import "WebPage.h"
 #import "WebPageMessages.h"
 #import "WebPasteboardProxy.h"
+#import "WebProcessMessages.h"
 #import "WebProcessProxy.h"
 #import "WebsiteDataStore.h"
 #import "WKErrorInternal.h"
@@ -618,6 +619,18 @@
     sendWithAsyncReply(Messages::WebPage::LastNavigationWasAppBound(), WTFMove(completionHandler));
 }
 
+void WebPageProxy::grantAccessToAssetServices()
+{
+    SandboxExtension::Handle mobileAssetHandleV2;
+    SandboxExtension::createHandleForMachLookup("com.apple.mobileassetd.v2"_s, WTF::nullopt, mobileAssetHandleV2);
+    process().send(Messages::WebProcess::GrantAccessToAssetServices(mobileAssetHandleV2), 0);
+}
+
+void WebPageProxy::revokeAccessToAssetServices()
+{
+    process().send(Messages::WebProcess::RevokeAccessToAssetServices(), 0);
+}
+
 } // namespace WebKit
 
 #if USE(APPLE_INTERNAL_SDK)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (273783 => 273784)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-03-03 03:05:42 UTC (rev 273784)
@@ -1772,10 +1772,8 @@
     bool hasQueuedKeyEvent() const;
     const NativeWebKeyboardEvent& firstQueuedKeyEvent() const;
 
-#if PLATFORM(IOS)
     void grantAccessToAssetServices();
     void revokeAccessToAssetServices();
-#endif
 
 #if PLATFORM(COCOA)
     void grantAccessToPreferenceService();

Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (273783 => 273784)


--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2021-03-03 03:05:42 UTC (rev 273784)
@@ -1542,20 +1542,6 @@
 }
 #endif
 
-#if PLATFORM(IOS)
-void WebPageProxy::grantAccessToAssetServices()
-{
-    SandboxExtension::Handle mobileAssetHandleV2;
-    SandboxExtension::createHandleForMachLookup("com.apple.mobileassetd.v2"_s, WTF::nullopt, mobileAssetHandleV2);
-    process().send(Messages::WebProcess::GrantAccessToAssetServices(mobileAssetHandleV2), 0);
-}
-
-void WebPageProxy::revokeAccessToAssetServices()
-{
-    process().send(Messages::WebProcess::RevokeAccessToAssetServices(), 0);
-}
-#endif
-
 void WebPageProxy::willPerformPasteCommand()
 {
     grantAccessToCurrentPasteboardData(UIPasteboardNameGeneral);

Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (273783 => 273784)


--- trunk/Source/WebKit/WebProcess/WebProcess.h	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h	2021-03-03 03:05:42 UTC (rev 273784)
@@ -339,10 +339,8 @@
     bool removeServiceWorkerRegistration(WebCore::ServiceWorkerRegistrationIdentifier);
 #endif
 
-#if PLATFORM(IOS)
     void grantAccessToAssetServices(WebKit::SandboxExtension::Handle&& mobileAssetV2Handle);
     void revokeAccessToAssetServices();
-#endif
 
 #if PLATFORM(MAC)
     void updatePageScreenProperties();
@@ -702,9 +700,7 @@
     WebCore::ThirdPartyCookieBlockingMode m_thirdPartyCookieBlockingMode { WebCore::ThirdPartyCookieBlockingMode::All };
 #endif
 
-#if PLATFORM(IOS)
     RefPtr<SandboxExtension> m_assetServiceV2Extension;
-#endif
 
 #if PLATFORM(COCOA)
     HashCountedSet<String> m_pendingPasteboardWriteCounts;

Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (273783 => 273784)


--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2021-03-03 03:05:42 UTC (rev 273784)
@@ -166,10 +166,8 @@
     SendResourceLoadStatisticsDataImmediately() -> () Async
 #endif
 
-#if PLATFORM(IOS)
     GrantAccessToAssetServices(WebKit::SandboxExtension::Handle mobileAssetV2Handle)
     RevokeAccessToAssetServices()
-#endif
 
 #if PLATFORM(COCOA)
     UnblockServicesRequiredByAccessibility(WebKit::SandboxExtension::HandleArray handleArray)

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (273783 => 273784)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2021-03-03 03:05:42 UTC (rev 273784)
@@ -1129,7 +1129,6 @@
 }
 #endif
 
-#if PLATFORM(IOS)
 void WebProcess::grantAccessToAssetServices(WebKit::SandboxExtension::Handle&& mobileAssetV2Handle)
 {
     if (m_assetServiceV2Extension)
@@ -1145,7 +1144,6 @@
     m_assetServiceV2Extension->revoke();
     m_assetServiceV2Extension = nullptr;
 }
-#endif
 
 void WebProcess::setScreenProperties(const ScreenProperties& properties)
 {

Modified: trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in (273783 => 273784)


--- trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in	2021-03-03 03:05:42 UTC (rev 273784)
@@ -1098,8 +1098,18 @@
 
 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 110000
 (allow mach-lookup
-    (global-name "com.apple.mobileassetd")
-)
+    (require-all
+        (extension "com.apple.webkit.extension.mach")
+        (global-name
+            "com.apple.mobileassetd"
+            "com.apple.mobileassetd.v2"
+)))
+#else
+(allow mach-lookup
+    (require-all
+        (extension "com.apple.webkit.extension.mach")
+        (global-name "com.apple.mobileassetd.v2")
+))
 #endif
 
 ;; Various services required by AppKit and other frameworks

Modified: trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp (273783 => 273784)


--- trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp	2021-03-03 03:05:42 UTC (rev 273784)
@@ -128,4 +128,12 @@
 }
 #endif
 
+void WebProcess::grantAccessToAssetServices(WebKit::SandboxExtension::Handle&&)
+{
+}
+
+void WebProcess::revokeAccessToAssetServices()
+{
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/playstation/WebProcessPlayStation.cpp (273783 => 273784)


--- trunk/Source/WebKit/WebProcess/playstation/WebProcessPlayStation.cpp	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/WebProcess/playstation/WebProcessPlayStation.cpp	2021-03-03 03:05:42 UTC (rev 273784)
@@ -44,4 +44,12 @@
 {
 }
 
+void WebProcess::grantAccessToAssetServices(WebKit::SandboxExtension::Handle&&)
+{
+}
+
+void WebProcess::revokeAccessToAssetServices()
+{
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/win/WebProcessWin.cpp (273783 => 273784)


--- trunk/Source/WebKit/WebProcess/win/WebProcessWin.cpp	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Source/WebKit/WebProcess/win/WebProcessWin.cpp	2021-03-03 03:05:42 UTC (rev 273784)
@@ -51,4 +51,12 @@
 {
 }
 
+void WebProcess::grantAccessToAssetServices(WebKit::SandboxExtension::Handle&&)
+{
+}
+
+void WebProcess::revokeAccessToAssetServices()
+{
+}
+
 } // namespace WebKit

Modified: trunk/Tools/ChangeLog (273783 => 273784)


--- trunk/Tools/ChangeLog	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Tools/ChangeLog	2021-03-03 03:05:42 UTC (rev 273784)
@@ -1,3 +1,15 @@
+2021-03-02  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        REGRESSION(r270691): It's impossible to use MobileAsset fonts on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=222582
+        <rdar://problem/74877450>
+
+        Reviewed by Per Arne Vollan.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit/MobileAssetSandboxCheck.mm: Copied from Source/WebKit/WebProcess/win/WebProcessWin.cpp.
+        (TEST):
+
 2021-03-02  Sam Weinig  <wei...@apple.com>
 
         Reduce the size of extended colors by storing the color space in free bits of the owning Color

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (273783 => 273784)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2021-03-03 02:30:33 UTC (rev 273783)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2021-03-03 03:05:42 UTC (rev 273784)
@@ -118,6 +118,7 @@
 		1CB2F27E24F88A52000A5BC1 /* orthogonal-flow-available-size.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1CB2F27D24F883BE000A5BC1 /* orthogonal-flow-available-size.html */; };
 		1CC80CEA2474F249004DC489 /* idempotent-mode-autosizing-only-honors-percentages.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1CC80CE92474F1F7004DC489 /* idempotent-mode-autosizing-only-honors-percentages.html */; };
 		1CE6FAC32320267C00E48F6E /* rich-color-filtered.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1CE6FAC12320264F00E48F6E /* rich-color-filtered.html */; };
+		1CF087D825ED7F73004148CB /* MobileAssetSandboxCheck.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF087D725ED7F73004148CB /* MobileAssetSandboxCheck.mm */; };
 		1CF59AE221E68925006E37EC /* ForceLightAppearanceInBundle_Bundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF59AE021E68925006E37EC /* ForceLightAppearanceInBundle_Bundle.mm */; };
 		1CF59AE321E68932006E37EC /* ForceLightAppearanceInBundle.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF59ADF21E68925006E37EC /* ForceLightAppearanceInBundle.mm */; };
 		1CF59AE521E6977D006E37EC /* dark-mode.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1CF59AE421E696FB006E37EC /* dark-mode.html */; };
@@ -1818,6 +1819,7 @@
 		1CB9BC371A67482300FE5678 /* WeakPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeakPtr.cpp; sourceTree = "<group>"; };
 		1CC80CE92474F1F7004DC489 /* idempotent-mode-autosizing-only-honors-percentages.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "idempotent-mode-autosizing-only-honors-percentages.html"; sourceTree = "<group>"; };
 		1CE6FAC12320264F00E48F6E /* rich-color-filtered.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "rich-color-filtered.html"; sourceTree = "<group>"; };
+		1CF087D725ED7F73004148CB /* MobileAssetSandboxCheck.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MobileAssetSandboxCheck.mm; sourceTree = "<group>"; };
 		1CF0D3781BBF2F3D00B4EF54 /* WKRetainPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKRetainPtr.cpp; sourceTree = "<group>"; };
 		1CF59ADF21E68925006E37EC /* ForceLightAppearanceInBundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ForceLightAppearanceInBundle.mm; sourceTree = "<group>"; };
 		1CF59AE021E68925006E37EC /* ForceLightAppearanceInBundle_Bundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ForceLightAppearanceInBundle_Bundle.mm; sourceTree = "<group>"; };
@@ -3214,6 +3216,7 @@
 				E394AE6E23F2303E005B4936 /* GrantAccessToMobileAssets.mm */,
 				E34A6D182412DE390012AB6E /* GrantAccessToPreferencesService.mm */,
 				E35B908123F60DD0000011FF /* LocalizedDeviceModel.mm */,
+				1CF087D725ED7F73004148CB /* MobileAssetSandboxCheck.mm */,
 				C104BC1E2547237100C078C9 /* OverrideAppleLanguagesPreference.mm */,
 				E325C90623E3870200BC7D3B /* PictureInPictureSupport.mm */,
 				C15CBB3E23FB177A00300CC7 /* PreferenceChanges.mm */,
@@ -5429,6 +5432,7 @@
 				5165FE04201EE620009F7EC3 /* MessagePortProviders.mm in Sources */,
 				51EB126224CA6B66000CB030 /* MicrosoftXboxOne.mm in Sources */,
 				A5B149DE1F5A19EA00C6DAFF /* MIMETypeRegistry.cpp in Sources */,
+				1CF087D825ED7F73004148CB /* MobileAssetSandboxCheck.mm in Sources */,
 				51CD1C6C1B38CE4300142CA5 /* ModalAlerts.mm in Sources */,
 				7C83E0B61D0A64B300FEBCF3 /* ModalAlertsSPI.cpp in Sources */,
 				7CCE7F011A411AE600447C4C /* MouseMoveAfterCrash.cpp in Sources */,

Copied: trunk/Tools/TestWebKitAPI/Tests/WebKit/MobileAssetSandboxCheck.mm (from rev 273783, trunk/Source/WebKit/WebProcess/win/WebProcessWin.cpp) (0 => 273784)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit/MobileAssetSandboxCheck.mm	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/MobileAssetSandboxCheck.mm	2021-03-03 03:05:42 UTC (rev 273784)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#import "config.h"
+
+#if WK_HAVE_C_SPI
+
+#import "PlatformUtilities.h"
+#import "TestWKWebView.h"
+#import <WebKit/WKWebViewPrivate.h>
+
+TEST(WebKit, MobileAssetSandboxCheck)
+{
+    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    auto context = adoptWK(TestWebKitAPI::Util::createContextForInjectedBundleTest("InternalsInjectedBundleTest"));
+    configuration.get().processPool = (WKProcessPool *)context.get();
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get() addToWindow:YES]);
+
+    auto sandboxAccess = [&] {
+        return [webView stringByEvaluatingJavaScript:@"window.internals.hasSandboxMachLookupAccessToXPCServiceName('com.apple.WebKit.WebContent', 'com.apple.mobileassetd.v2')"].boolValue;
+    };
+
+    ASSERT_FALSE(sandboxAccess());
+
+    [webView _grantAccessToAssetServices];
+
+    ASSERT_TRUE(sandboxAccess());
+}
+
+#endif // WK_HAVE_C_SPI
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to