Diff
Modified: trunk/Source/WebKit/ChangeLog (270034 => 270035)
--- trunk/Source/WebKit/ChangeLog 2020-11-19 17:26:00 UTC (rev 270034)
+++ trunk/Source/WebKit/ChangeLog 2020-11-19 17:32:25 UTC (rev 270035)
@@ -1,5 +1,29 @@
2020-11-19 Per Arne Vollan <pvol...@apple.com>
+ [macOS] Issue sandbox extension to Web Inspector service
+ https://bugs.webkit.org/show_bug.cgi?id=219041
+ <rdar://problem/71495287>
+
+ Reviewed by Brent Fulgham.
+
+ In preparation of blocking this service in the WebContent process, a sandbox extension should be issued if Safari's Develop menu is enabled.
+ This extension will also be dynamically issued to all WebContent processes, if the Develop menu preference changes, by observing this
+ preference.
+
+ * UIProcess/Cocoa/WebInspectorPreferenceObserver.h: Added.
+ * UIProcess/Cocoa/WebInspectorPreferenceObserver.mm: Added.
+ (+[WKWebInspectorPreferenceObserver sharedInstance]):
+ (-[WKWebInspectorPreferenceObserver init]):
+ (-[WKWebInspectorPreferenceObserver observeValueForKeyPath:ofObject:change:context:]):
+ * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+ (WebKit::WebProcessPool::platformInitialize):
+ * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+ (WebKit::WebProcessProxy::enableRemoteInspectorIfNeeded):
+ * UIProcess/WebProcessPool.h:
+ * WebKit.xcodeproj/project.pbxproj:
+
+2020-11-19 Per Arne Vollan <pvol...@apple.com>
+
[macOS] Issue sandbox extension to audio service if Media in the GPU process is not enabled
https://bugs.webkit.org/show_bug.cgi?id=219051
<rdar://problem/71500898>
Added: trunk/Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.h (0 => 270035)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.h (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.h 2020-11-19 17:32:25 UTC (rev 270035)
@@ -0,0 +1,29 @@
+/*
+* 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.
+*/
+
+@interface WKWebInspectorPreferenceObserver : NSObject
++ (id)sharedInstance;
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey, id> *)change context:(void *)context;
+@end
Added: trunk/Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.mm (0 => 270035)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.mm (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.mm 2020-11-19 17:32:25 UTC (rev 270035)
@@ -0,0 +1,80 @@
+/*
+* 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 "WebInspectorPreferenceObserver.h"
+
+#import "WebProcessPool.h"
+
+#import <wtf/RetainPtr.h>
+
+@interface WKWebInspectorPreferenceObserver ()
+{
+@private
+ RetainPtr<NSUserDefaults> m_userDefaults;
+}
+@end
+
+@implementation WKWebInspectorPreferenceObserver
+
++ (id)sharedInstance
+{
+ static WKWebInspectorPreferenceObserver *instance = nil;
+
+ if (!instance)
+ instance = [[[self class] alloc] init];
+
+ return instance;
+}
+
+- (instancetype)init
+{
+ if (!(self = [super init]))
+ return nil;
+
+ m_userDefaults = adoptNS([[NSUserDefaults alloc] initWithSuiteName:@"com.apple.Safari.SandboxBroker"]);
+ if (!m_userDefaults) {
+ WTFLogAlways("Could not init user defaults instance for domain com.apple.Safari.SandboxBroker.");
+ return self;
+ }
+ [m_userDefaults.get() addObserver:self forKeyPath:@"ShowDevelopMenu" options:NSKeyValueObservingOptionNew context:nil];
+
+
+ return self;
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey, id> *)change context:(void *)context
+{
+ dispatch_async(dispatch_get_main_queue(), ^{
+ for (auto* pool : WebKit::WebProcessPool::allProcessPools()) {
+ for (size_t i = 0; i < pool->processes().size(); ++i) {
+ auto process = pool->processes()[i];
+ process->enableRemoteInspectorIfNeeded();
+ }
+ }
+ });
+}
+
+@end
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (270034 => 270035)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-11-19 17:26:00 UTC (rev 270034)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm 2020-11-19 17:32:25 UTC (rev 270035)
@@ -79,6 +79,7 @@
#endif
#if PLATFORM(MAC)
+#import "WebInspectorPreferenceObserver.h"
#import <QuartzCore/CARemoteLayerServer.h>
#import <pal/spi/mac/NSApplicationSPI.h>
#else
@@ -178,6 +179,10 @@
});
}
#endif
+
+#if PLATFORM(MAC)
+ [WKWebInspectorPreferenceObserver sharedInstance];
+#endif
}
#if PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm (270034 => 270035)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm 2020-11-19 17:26:00 UTC (rev 270034)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm 2020-11-19 17:32:25 UTC (rev 270035)
@@ -210,8 +210,13 @@
#if ENABLE(REMOTE_INSPECTOR)
void WebProcessProxy::enableRemoteInspectorIfNeeded()
{
+#if PLATFORM(IOS_FAMILY)
if (!CFPreferencesGetAppIntegerValue(WIRRemoteInspectorEnabledKey, WIRRemoteInspectorDomainName, nullptr))
return;
+#else
+ if (!CFPreferencesGetAppIntegerValue(CFSTR("ShowDevelopMenu"), CFSTR("com.apple.Safari.SandboxBroker"), nullptr))
+ return;
+#endif
SandboxExtension::Handle handle;
auto auditToken = connection() ? connection()->getAuditToken() : WTF::nullopt;
if (SandboxExtension::createHandleForMachLookup("com.apple.webinspector"_s, auditToken, handle))
Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (270034 => 270035)
--- trunk/Source/WebKit/UIProcess/WebProcessPool.h 2020-11-19 17:26:00 UTC (rev 270034)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h 2020-11-19 17:32:25 UTC (rev 270035)
@@ -64,7 +64,10 @@
OBJC_CLASS NSSet;
OBJC_CLASS NSString;
OBJC_CLASS WKPreferenceObserver;
+#if PLATFORM(MAC)
+OBJC_CLASS WKWebInspectorPreferenceObserver;
#endif
+#endif
#if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
#include "DisplayLink.h"
@@ -647,6 +650,7 @@
RetainPtr<NSObject> m_scrollerStyleNotificationObserver;
#endif
RetainPtr<NSObject> m_deactivationObserver;
+ RetainPtr<WKWebInspectorPreferenceObserver> m_webInspectorPreferenceObserver;
std::unique_ptr<HighPerformanceGraphicsUsageSampler> m_highPerformanceGraphicsUsageSampler;
std::unique_ptr<PerActivityStateCPUUsageSampler> m_perActivityStateCPUUsageSampler;
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (270034 => 270035)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-11-19 17:26:00 UTC (rev 270034)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-11-19 17:32:25 UTC (rev 270035)
@@ -1741,6 +1741,7 @@
C1663E5B24AEAA2F00C6A3B2 /* LaunchServicesDatabaseXPCConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = C1663E5A24AEA74200C6A3B2 /* LaunchServicesDatabaseXPCConstants.h */; };
C1710CF724AA643200D7C112 /* LaunchServicesDatabaseObserver.mm in Sources */ = {isa = PBXBuildFile; fileRef = C1710CF624AA643200D7C112 /* LaunchServicesDatabaseObserver.mm */; };
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 */; };
C1E123BA20A11573002646F4 /* PDFContextMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = C1E123B920A11572002646F4 /* PDFContextMenu.h */; };
C517388112DF8F4F00EE3F47 /* DragControllerAction.h in Headers */ = {isa = PBXBuildFile; fileRef = C517388012DF8F4F00EE3F47 /* DragControllerAction.h */; };
@@ -5175,6 +5176,8 @@
C181735E205839F600DFDA65 /* DrawingAreaMac.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingAreaMac.cpp; sourceTree = "<group>"; };
C18173602058424700DFDA65 /* DisplayLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DisplayLink.h; sourceTree = "<group>"; };
C1817362205844A900DFDA65 /* DisplayLink.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayLink.cpp; sourceTree = "<group>"; };
+ C18F3A13256332A600797E66 /* WebInspectorPreferenceObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebInspectorPreferenceObserver.h; sourceTree = "<group>"; };
+ C18F3A142563334300797E66 /* WebInspectorPreferenceObserver.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebInspectorPreferenceObserver.mm; sourceTree = "<group>"; };
C18FB51D242F9F76007E9875 /* WebSleepDisablerClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSleepDisablerClient.cpp; sourceTree = "<group>"; };
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>"; };
@@ -6528,6 +6531,8 @@
52D5A1AA1C57494E00DE34A3 /* VideoFullscreenManagerProxy.h */,
52D5A1AB1C57494E00DE34A3 /* VideoFullscreenManagerProxy.messages.in */,
52D5A1AC1C57494E00DE34A3 /* VideoFullscreenManagerProxy.mm */,
+ C18F3A13256332A600797E66 /* WebInspectorPreferenceObserver.h */,
+ C18F3A142563334300797E66 /* WebInspectorPreferenceObserver.mm */,
1AC0273E196622D600C12B75 /* WebPageProxyCocoa.mm */,
7C4694CB1A4B510A00AD5845 /* WebPasteboardProxyCocoa.mm */,
A3937B6123CD1B9B005B2A2E /* WebPreferencesCocoa.mm */,
@@ -13427,6 +13432,7 @@
933E835B23A1B75000DEF289 /* WebIDBServerMessageReceiver.cpp in Sources */,
FEDBDCD61E68D20000A59F8F /* WebInspectorInterruptDispatcherMessageReceiver.cpp in Sources */,
1C8E2A351277852400BC7BD0 /* WebInspectorMessageReceiver.cpp in Sources */,
+ C18F3A152563334300797E66 /* WebInspectorPreferenceObserver.mm in Sources */,
1CA8B945127C882A00576C2B /* WebInspectorProxyMessageReceiver.cpp in Sources */,
9979659F25310A4900B31AE3 /* WebInspectorUIExtensionControllerMessageReceiver.cpp in Sources */,
1CBBE4A019B66C53006B7D81 /* WebInspectorUIMessageReceiver.cpp in Sources */,
Modified: trunk/Tools/ChangeLog (270034 => 270035)
--- trunk/Tools/ChangeLog 2020-11-19 17:26:00 UTC (rev 270034)
+++ trunk/Tools/ChangeLog 2020-11-19 17:32:25 UTC (rev 270035)
@@ -1,3 +1,15 @@
+2020-11-19 Per Arne Vollan <pvol...@apple.com>
+
+ [macOS] Issue sandbox extension to Web Inspector service
+ https://bugs.webkit.org/show_bug.cgi?id=219041
+ <rdar://problem/71495287>
+
+ Reviewed by Brent Fulgham.
+
+ Allow MiniBrowser to read preferences from the domain com.apple.Safari.SandboxBroker.
+
+ * MiniBrowser/MiniBrowser.entitlements:
+
2020-11-19 Alexey Proskuryakov <a...@apple.com>
Make block-spammers autoinstall requests
Modified: trunk/Tools/MiniBrowser/MiniBrowser.entitlements (270034 => 270035)
--- trunk/Tools/MiniBrowser/MiniBrowser.entitlements 2020-11-19 17:26:00 UTC (rev 270034)
+++ trunk/Tools/MiniBrowser/MiniBrowser.entitlements 2020-11-19 17:32:25 UTC (rev 270035)
@@ -24,6 +24,10 @@
</array>
<key>com.apple.security.device.camera</key>
<true/>
+ <key>com.apple.security.temporary-exception.shared-preference.read-only</key>
+ <array>
+ <string>com.apple.Safari.SandboxBroker</string>
+ </array>
<key>com.apple.security.device.microphone</key>
<true/>
</dict>