Title: [270219] trunk/Source
Revision
270219
Author
[email protected]
Date
2020-11-28 09:05:21 -0800 (Sat, 28 Nov 2020)

Log Message

[macOS] Set application information in the Networking process on behalf of the WebContent process
https://bugs.webkit.org/show_bug.cgi?id=218052
<rdar://problem/70586405>

Reviewed by Brent Fulgham.

Source/WebCore/PAL:

Declare function to create ASN from an audit token.

* pal/spi/cocoa/LaunchServicesSPI.h:

Source/WebKit:

In preparation for blocking Launch Services in the WebContent process' sandbox, application information for the process
should be set in the Networking process.

* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* NetworkProcess/mac/NetworkConnectionToWebProcessMac.mm: Added.
(WebKit::NetworkConnectionToWebProcess::updateActivePages):
* Scripts/process-entitlements.sh:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::activePagesOrigins):
(WebKit::WebProcess::updateActivePages):
(WebKit::WebProcess::getActivePagesOriginsForTesting):
* WebProcess/com.apple.WebProcess.sb.in:

Source/WTF:

Add define to enable this feature.

* wtf/PlatformEnableCocoa.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (270218 => 270219)


--- trunk/Source/WTF/ChangeLog	2020-11-28 14:40:54 UTC (rev 270218)
+++ trunk/Source/WTF/ChangeLog	2020-11-28 17:05:21 UTC (rev 270219)
@@ -1,3 +1,15 @@
+2020-11-28  Per Arne Vollan  <[email protected]>
+
+        [macOS] Set application information in the Networking process on behalf of the WebContent process
+        https://bugs.webkit.org/show_bug.cgi?id=218052
+        <rdar://problem/70586405>
+
+        Reviewed by Brent Fulgham.
+
+        Add define to enable this feature.
+
+        * wtf/PlatformEnableCocoa.h:
+
 2020-11-26  Fujii Hironori  <[email protected]>
 
         [WinCairo] Enable GPU process

Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (270218 => 270219)


--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2020-11-28 14:40:54 UTC (rev 270218)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h	2020-11-28 17:05:21 UTC (rev 270219)
@@ -629,3 +629,7 @@
 #if !defined(ENABLE_WKPDFVIEW) && (PLATFORM(IOS) || (PLATFORM(MACCATALYST) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000))
 #define ENABLE_WKPDFVIEW 1
 #endif
+
+#if !defined(ENABLE_SET_WEBCONTENT_PROCESS_INFORMATION_IN_NETWORK_PROCESS) && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 120000
+#define ENABLE_SET_WEBCONTENT_PROCESS_INFORMATION_IN_NETWORK_PROCESS 1
+#endif

Modified: trunk/Source/WebCore/PAL/ChangeLog (270218 => 270219)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-11-28 14:40:54 UTC (rev 270218)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-11-28 17:05:21 UTC (rev 270219)
@@ -1,3 +1,15 @@
+2020-11-28  Per Arne Vollan  <[email protected]>
+
+        [macOS] Set application information in the Networking process on behalf of the WebContent process
+        https://bugs.webkit.org/show_bug.cgi?id=218052
+        <rdar://problem/70586405>
+
+        Reviewed by Brent Fulgham.
+
+        Declare function to create ASN from an audit token.
+
+        * pal/spi/cocoa/LaunchServicesSPI.h:
+
 2020-11-17  Per Arne Vollan  <[email protected]>
 
         [macOS] Perform AX TCC check in the UI process

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h (270218 => 270219)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h	2020-11-28 14:40:54 UTC (rev 270218)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/LaunchServicesSPI.h	2020-11-28 17:05:21 UTC (rev 270219)
@@ -108,6 +108,7 @@
 extern const CFStringRef _kLSDisplayNameKey;
 
 LSASNRef _LSGetCurrentApplicationASN();
+LSASNRef _LSCopyLSASNForAuditToken(LSSessionID, audit_token_t);
 OSStatus _LSSetApplicationInformationItem(LSSessionID, LSASNRef, CFStringRef keyToSetRef, CFTypeRef valueToSetRef, CFDictionaryRef* newInformationDictRef);
 CFTypeRef _LSCopyApplicationInformationItem(LSSessionID, LSASNRef, CFTypeRef);
 

Modified: trunk/Source/WebKit/ChangeLog (270218 => 270219)


--- trunk/Source/WebKit/ChangeLog	2020-11-28 14:40:54 UTC (rev 270218)
+++ trunk/Source/WebKit/ChangeLog	2020-11-28 17:05:21 UTC (rev 270219)
@@ -1,5 +1,29 @@
 2020-11-28  Per Arne Vollan  <[email protected]>
 
+        [macOS] Set application information in the Networking process on behalf of the WebContent process
+        https://bugs.webkit.org/show_bug.cgi?id=218052
+        <rdar://problem/70586405>
+
+        Reviewed by Brent Fulgham.
+
+        In preparation for blocking Launch Services in the WebContent process' sandbox, application information for the process
+        should be set in the Networking process.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * NetworkProcess/mac/NetworkConnectionToWebProcessMac.mm: Added.
+        (WebKit::NetworkConnectionToWebProcess::updateActivePages):
+        * Scripts/process-entitlements.sh:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+        (WebKit::activePagesOrigins):
+        (WebKit::WebProcess::updateActivePages):
+        (WebKit::WebProcess::getActivePagesOriginsForTesting):
+        * WebProcess/com.apple.WebProcess.sb.in:
+
+2020-11-28  Per Arne Vollan  <[email protected]>
+
         [macOS] Issue sandbox extension to icon services when starting a drag operation
         https://bugs.webkit.org/show_bug.cgi?id=219159
         <rdar://problem/71585876>

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h (270218 => 270219)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h	2020-11-28 14:40:54 UTC (rev 270218)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h	2020-11-28 17:05:21 UTC (rev 270219)
@@ -253,6 +253,10 @@
 
     void setCORSDisablingPatterns(WebCore::PageIdentifier, Vector<String>&&);
 
+#if PLATFORM(MAC)
+    void updateActivePages(const String& name, const Vector<String>& activePagesOrigins, audit_token_t);
+#endif
+
 #if USE(LIBWEBRTC)
     NetworkRTCProvider& rtcProvider();
 #endif

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in (270218 => 270219)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in	2020-11-28 14:40:54 UTC (rev 270218)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in	2020-11-28 17:05:21 UTC (rev 270219)
@@ -98,4 +98,7 @@
     DidDeliverMessagePortMessages(uint64_t messageBatchIdentifier)
     RegisterURLSchemesAsCORSEnabled(Vector<String> schemes);
     SetCORSDisablingPatterns(WebCore::PageIdentifier pageIdentifier, Vector<String> patterns)
+#if PLATFORM(MAC)
+    UpdateActivePages(String name, Vector<String> activePagesOrigins, audit_token_t auditToken)
+#endif
 }

Added: trunk/Source/WebKit/NetworkProcess/mac/NetworkConnectionToWebProcessMac.mm (0 => 270219)


--- trunk/Source/WebKit/NetworkProcess/mac/NetworkConnectionToWebProcessMac.mm	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/mac/NetworkConnectionToWebProcessMac.mm	2020-11-28 17:05:21 UTC (rev 270219)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#import "config.h"
+#import "NetworkConnectionToWebProcess.h"
+
+#import <pal/spi/cocoa/LaunchServicesSPI.h>
+#import <wtf/cocoa/VectorCocoa.h>
+
+namespace WebKit {
+
+#if PLATFORM(MAC)
+void NetworkConnectionToWebProcess::updateActivePages(const String& overrideDisplayName, const Vector<String>& activePagesOrigins, audit_token_t auditToken)
+{
+    auto asn = adoptCF(_LSCopyLSASNForAuditToken(kLSDefaultSessionID, auditToken));
+    if (!overrideDisplayName)
+        _LSSetApplicationInformationItem(kLSDefaultSessionID, asn.get(), CFSTR("LSActivePageUserVisibleOriginsKey"), (__bridge CFArrayRef)createNSArray(activePagesOrigins).get(), nullptr);
+    else
+        _LSSetApplicationInformationItem(kLSDefaultSessionID, asn.get(), _kLSDisplayNameKey, overrideDisplayName.createCFString().get(), nullptr);
+}
+#endif
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/Scripts/process-entitlements.sh (270218 => 270219)


--- trunk/Source/WebKit/Scripts/process-entitlements.sh	2020-11-28 14:40:54 UTC (rev 270218)
+++ trunk/Source/WebKit/Scripts/process-entitlements.sh	2020-11-28 17:05:21 UTC (rev 270219)
@@ -82,6 +82,9 @@
             plistbuddy Add :com.apple.private.tcc.manager.check-by-audit-token:0 string kTCCServiceWebKitIntelligentTrackingPrevention
         fi
 
+        plistbuddy Add :com.apple.private.launchservices.allowedtochangethesekeysinotherapplications array
+        plistbuddy Add :com.apple.private.launchservices.allowedtochangethesekeysinotherapplications:0 string LSActivePageUserVisibleOriginsKey
+        plistbuddy Add :com.apple.private.launchservices.allowedtochangethesekeysinotherapplications:1 string LSDisplayName
         plistbuddy Add :com.apple.private.webkit.use-xpc-endpoint bool YES
         plistbuddy Add :com.apple.rootless.storage.WebKitNetworkingSandbox bool YES
     fi

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (270218 => 270219)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-11-28 14:40:54 UTC (rev 270218)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-11-28 17:05:21 UTC (rev 270219)
@@ -1775,6 +1775,7 @@
 		C18173612058424700DFDA65 /* DisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = C18173602058424700DFDA65 /* DisplayLink.h */; };
 		C18F3A152563334300797E66 /* WebInspectorPreferenceObserver.mm in Sources */ = {isa = PBXBuildFile; fileRef = C18F3A142563334300797E66 /* WebInspectorPreferenceObserver.mm */; };
 		C1A152D724E5A29A00978C8B /* HandleXPCEndpointMessages.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1A152D624E5A29A00978C8B /* HandleXPCEndpointMessages.mm */; };
+		C1C1B30F2540F50D00D9100B /* NetworkConnectionToWebProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1C1B30E2540F45600D9100B /* NetworkConnectionToWebProcessMac.mm */; };
 		C1E123BA20A11573002646F4 /* PDFContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = C1E123B920A11572002646F4 /* PDFContextMenu.h */; };
 		C517388112DF8F4F00EE3F47 /* DragControllerAction.h in Headers */ = {isa = PBXBuildFile; fileRef = C517388012DF8F4F00EE3F47 /* DragControllerAction.h */; };
 		C54256B518BEC18C00DE4179 /* WKDateTimeInputControl.h in Headers */ = {isa = PBXBuildFile; fileRef = C54256AF18BEC18B00DE4179 /* WKDateTimeInputControl.h */; };
@@ -5246,6 +5247,7 @@
 		C18FB51E242F9F77007E9875 /* WebSleepDisablerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSleepDisablerClient.h; sourceTree = "<group>"; };
 		C1A152D524E5A1D200978C8B /* HandleXPCEndpointMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HandleXPCEndpointMessages.h; sourceTree = "<group>"; };
 		C1A152D624E5A29A00978C8B /* HandleXPCEndpointMessages.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = HandleXPCEndpointMessages.mm; sourceTree = "<group>"; };
+		C1C1B30E2540F45600D9100B /* NetworkConnectionToWebProcessMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkConnectionToWebProcessMac.mm; sourceTree = "<group>"; };
 		C1E123B920A11572002646F4 /* PDFContextMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDFContextMenu.h; sourceTree = "<group>"; };
 		C1ED723724A5690E003F6CD3 /* NetworkProcessProxyCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkProcessProxyCocoa.mm; sourceTree = "<group>"; };
 		C517388012DF8F4F00EE3F47 /* DragControllerAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragControllerAction.h; sourceTree = "<group>"; };
@@ -8127,6 +8129,7 @@
 			isa = PBXGroup;
 			children = (
 				E17AE2C116B9C139001C42F1 /* com.apple.WebKit.NetworkProcess.sb.in */,
+				C1C1B30E2540F45600D9100B /* NetworkConnectionToWebProcessMac.mm */,
 				51A8A6151627F3F9000D90E9 /* NetworkProcessMac.mm */,
 				E1B78472163F253E0007B692 /* RemoteNetworkingContext.mm */,
 			);
@@ -11013,8 +11016,8 @@
 				5790A66C25679EB70077C5A7 /* _WKPublicKeyCredentialDescriptor.h in Headers */,
 				5790A656256799DA0077C5A7 /* _WKPublicKeyCredentialEntity.h in Headers */,
 				5790A66225679C860077C5A7 /* _WKPublicKeyCredentialParameters.h in Headers */,
+				5790A65A25679B260077C5A7 /* _WKPublicKeyCredentialRelyingPartyEntity.h in Headers */,
 				5790A6782567A0CD0077C5A7 /* _WKPublicKeyCredentialRequestOptions.h in Headers */,
-				5790A65A25679B260077C5A7 /* _WKPublicKeyCredentialRelyingPartyEntity.h in Headers */,
 				5790A65E25679C110077C5A7 /* _WKPublicKeyCredentialUserEntity.h in Headers */,
 				1A9E328D182165A900F5D04C /* _WKRemoteObjectInterface.h in Headers */,
 				1AABFE3A1829C1ED005B070E /* _WKRemoteObjectInterfaceInternal.h in Headers */,
@@ -13206,8 +13209,8 @@
 				5790A66D25679EB70077C5A7 /* _WKPublicKeyCredentialDescriptor.mm in Sources */,
 				5790A657256799DA0077C5A7 /* _WKPublicKeyCredentialEntity.mm in Sources */,
 				5790A66325679C860077C5A7 /* _WKPublicKeyCredentialParameters.mm in Sources */,
+				5790A65B25679B260077C5A7 /* _WKPublicKeyCredentialRelyingPartyEntity.mm in Sources */,
 				5790A6792567A0CD0077C5A7 /* _WKPublicKeyCredentialRequestOptions.mm in Sources */,
-				5790A65B25679B260077C5A7 /* _WKPublicKeyCredentialRelyingPartyEntity.mm in Sources */,
 				5790A65F25679C110077C5A7 /* _WKPublicKeyCredentialUserEntity.mm in Sources */,
 				49FBEFFD239B011D00BD032F /* _WKResourceLoadStatisticsFirstParty.mm in Sources */,
 				49FBEFFF239B012F00BD032F /* _WKResourceLoadStatisticsThirdParty.mm in Sources */,
@@ -13262,6 +13265,7 @@
 				2D913444212CF9F000128AFD /* NetscapePlugin.cpp in Sources */,
 				2D92A796212B6ADA00F493FD /* NetscapePluginModule.cpp in Sources */,
 				2D913445212CF9F000128AFD /* NetscapePluginStream.cpp in Sources */,
+				C1C1B30F2540F50D00D9100B /* NetworkConnectionToWebProcessMac.mm in Sources */,
 				51DD9F2816367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp in Sources */,
 				52F060E11654318500F3281B /* NetworkContentRuleListManagerMessageReceiver.cpp in Sources */,
 				51F060E11654318500F3283F /* NetworkMDNSRegisterMessageReceiver.cpp in Sources */,

Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (270218 => 270219)


--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-11-28 14:40:54 UTC (rev 270218)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-11-28 17:05:21 UTC (rev 270219)
@@ -29,6 +29,8 @@
 #import "LegacyCustomProtocolManager.h"
 #import "LogInitialization.h"
 #import "Logging.h"
+#import "NetworkConnectionToWebProcessMessages.h"
+#import "NetworkProcessConnection.h"
 #import "ObjCObjectGraph.h"
 #import "ProcessAssertion.h"
 #import "SandboxExtension.h"
@@ -306,6 +308,9 @@
     // check in with Launch Services
     [NSApplication _accessibilityInitialize];
 
+    // Update process name while holding the Launch Services sandbox extension
+    updateProcessName();
+
     // FIXME: (<rdar://problem/70345312): Notify LaunchServices that we will be disconnecting.
     if (launchServicesExtension)
         launchServicesExtension->revoke();
@@ -373,8 +378,6 @@
         PAL::softLinkMediaToolboxFigPhotoDecompressionSetHardwareCutoff(kPALFigPhotoContainerFormat_JFIF, INT_MAX);
 #endif
 
-    updateProcessName();
-    
     SystemSoundManager::singleton().setSystemSoundDelegate(makeUnique<WebSystemSoundDelegate>());
 
 #if PLATFORM(MAC)
@@ -430,6 +433,17 @@
         break;
     }
 
+#if ENABLE(SET_WEBCONTENT_PROCESS_INFORMATION_IN_NETWORK_PROCESS)
+    audit_token_t auditToken = { 0 };
+    mach_msg_type_number_t info_size = TASK_AUDIT_TOKEN_COUNT;
+    kern_return_t err = task_info(mach_task_self(), TASK_AUDIT_TOKEN, reinterpret_cast<integer_t *>(&auditToken), &info_size);
+    if (err != KERN_SUCCESS) {
+        WTFLogAlways("Unable to get audit token for self: 0x%x", err);
+        return;
+    }
+    String displayName = applicationName.get();
+    m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::UpdateActivePages(displayName, Vector<String>(), auditToken), 0);
+#else
     RunLoop::main().dispatch([this, applicationName = WTFMove(applicationName)] {
         // Note that it is important for _RegisterApplication() to have been called before setting the display name.
         auto error = _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, (CFStringRef)applicationName.get(), nullptr);
@@ -444,6 +458,7 @@
         ASSERT(!actualApplicationName.isEmpty());
 #endif
     });
+#endif // ENABLE(SET_WEBCONTENT_PROCESS_INFORMATION_IN_NETWORK_PROCESS)
 #endif // PLATFORM(MAC)
 }
 
@@ -677,29 +692,40 @@
 #endif
 
 #if PLATFORM(MAC)
-
-static RetainPtr<NSArray<NSString *>> activePagesOrigins(const HashMap<PageIdentifier, RefPtr<WebPage>>& pageMap)
+static Vector<String> activePagesOrigins(const HashMap<PageIdentifier, RefPtr<WebPage>>& pageMap)
 {
-    return createNSArray(pageMap.values(), [] (auto& page) -> NSString * {
+    Vector<String> origins;
+    for (auto& page : pageMap.values()) {
         if (page->usesEphemeralSession())
-            return nil;
+            continue;
 
         NSURL *originAsURL = origin(*page);
         if (!originAsURL)
-            return nil;
+            continue;
 
-        return WTF::userVisibleString(originAsURL);
-    });
+        origins.append(WTF::userVisibleString(originAsURL));
+    }
+    return origins;
 }
-
 #endif
 
 void WebProcess::updateActivePages(const String& overrideDisplayName)
 {
 #if PLATFORM(MAC)
+#if ENABLE(SET_WEBCONTENT_PROCESS_INFORMATION_IN_NETWORK_PROCESS)
+    audit_token_t auditToken = { 0 };
+    mach_msg_type_number_t info_size = TASK_AUDIT_TOKEN_COUNT;
+    kern_return_t err = task_info(mach_task_self(), TASK_AUDIT_TOKEN, reinterpret_cast<integer_t *>(&auditToken), &info_size);
+    if (err != KERN_SUCCESS) {
+        WTFLogAlways("Unable to get audit token for self: 0x%x", err);
+        return;
+    }
+
+    m_networkProcessConnection->connection().send(Messages::NetworkConnectionToWebProcess::UpdateActivePages(overrideDisplayName, activePagesOrigins(m_pageMap), auditToken), 0);
+#else
     if (!overrideDisplayName) {
         RunLoop::main().dispatch([activeOrigins = activePagesOrigins(m_pageMap)] {
-            _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), CFSTR("LSActivePageUserVisibleOriginsKey"), (__bridge CFArrayRef)activeOrigins.get(), nullptr);
+            _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), CFSTR("LSActivePageUserVisibleOriginsKey"), (__bridge CFArrayRef)createNSArray(activeOrigins).get(), nullptr);
         });
     } else {
         RunLoop::main().dispatch([name = overrideDisplayName.createCFString()] {
@@ -707,12 +733,13 @@
         });
     }
 #endif
+#endif
 }
 
 void WebProcess::getActivePagesOriginsForTesting(CompletionHandler<void(Vector<String>&&)>&& completionHandler)
 {
 #if PLATFORM(MAC)
-    completionHandler(makeVector<String>(activePagesOrigins(m_pageMap).get()));
+    completionHandler(activePagesOrigins(m_pageMap));
 #else
     completionHandler({ });
 #endif

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


--- trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in	2020-11-28 14:40:54 UTC (rev 270218)
+++ trunk/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in	2020-11-28 17:05:21 UTC (rev 270219)
@@ -921,7 +921,9 @@
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000
     (with report) (with telemetry-backtrace)
 #endif
+#if !ENABLE(SET_WEBCONTENT_PROCESS_INFORMATION_IN_NETWORK_PROCESS)
     (global-name "com.apple.coreservices.launchservicesd")
+#endif
     (global-name "com.apple.iconservices")
     (global-name "com.apple.iconservices.store")
     (global-name "com.apple.tccd.system")
@@ -1209,6 +1211,7 @@
 (deny mach-lookup (with telemetry-backtrace)
     (global-name "com.apple.containermanagerd")
     (global-name "com.apple.cookied")
+    (global-name "com.apple.coreservices.launchservicesd")
 )
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to