Title: [286314] trunk/Source/WebKit
- Revision
- 286314
- Author
- [email protected]
- Date
- 2021-11-30 12:10:32 -0800 (Tue, 30 Nov 2021)
Log Message
[Cocoa] Web Inspector: fix bundle identifier lookup for enabling remote inspection
https://bugs.webkit.org/show_bug.cgi?id=233015
<rdar://85277115>
Reviewed by Darin Adler.
* UIProcess/Inspector/WebInspectorUtilities.h:
* UIProcess/Inspector/WebInspectorUtilities.cpp:
(WebKit::bundleIdentifierForSandboxBroker):
To avoid repeating the logic, extract this code to a helper.
* UIProcess/Cocoa/WebInspectorPreferenceObserver.mm:
(-[WKWebInspectorPreferenceObserver init]):
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::shouldEnableRemoteInspector):
Use the helper method.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (286313 => 286314)
--- trunk/Source/WebKit/ChangeLog 2021-11-30 20:08:27 UTC (rev 286313)
+++ trunk/Source/WebKit/ChangeLog 2021-11-30 20:10:32 UTC (rev 286314)
@@ -1,3 +1,22 @@
+2021-11-30 BJ Burg <[email protected]>
+
+ [Cocoa] Web Inspector: fix bundle identifier lookup for enabling remote inspection
+ https://bugs.webkit.org/show_bug.cgi?id=233015
+ <rdar://85277115>
+
+ Reviewed by Darin Adler.
+
+ * UIProcess/Inspector/WebInspectorUtilities.h:
+ * UIProcess/Inspector/WebInspectorUtilities.cpp:
+ (WebKit::bundleIdentifierForSandboxBroker):
+ To avoid repeating the logic, extract this code to a helper.
+
+ * UIProcess/Cocoa/WebInspectorPreferenceObserver.mm:
+ (-[WKWebInspectorPreferenceObserver init]):
+ * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+ (WebKit::WebProcessProxy::shouldEnableRemoteInspector):
+ Use the helper method.
+
2021-11-30 Brent Fulgham <[email protected]>
Correct serialization error in _WKApplicationManifestIcon
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.mm (286313 => 286314)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.mm 2021-11-30 20:08:27 UTC (rev 286313)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.mm 2021-11-30 20:10:32 UTC (rev 286314)
@@ -1,5 +1,5 @@
/*
-* Copyright (C) 2020 Apple Inc. All rights reserved.
+* Copyright (C) 2020-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
@@ -26,9 +26,10 @@
#import "config.h"
#import "WebInspectorPreferenceObserver.h"
+#import "WebInspectorUtilities.h"
#import "WebProcessPool.h"
-
#import <wtf/RetainPtr.h>
+#import <wtf/cocoa/TypeCastsCocoa.h>
@interface WKWebInspectorPreferenceObserver ()
{
@@ -50,9 +51,10 @@
if (!(self = [super init]))
return nil;
- m_userDefaults = adoptNS([[NSUserDefaults alloc] initWithSuiteName:@"com.apple.Safari.SandboxBroker"]);
+ auto sandboxBrokerBundleIdentifier = WebKit::bundleIdentifierForSandboxBroker();
+ m_userDefaults = adoptNS([[NSUserDefaults alloc] initWithSuiteName:bridge_cast(sandboxBrokerBundleIdentifier)]);
if (!m_userDefaults) {
- WTFLogAlways("Could not init user defaults instance for domain com.apple.Safari.SandboxBroker.");
+ WTFLogAlways("Could not init user defaults instance for domain %s.", sandboxBrokerBundleIdentifier);
return self;
}
[m_userDefaults.get() addObserver:self forKeyPath:@"ShowDevelopMenu" options:NSKeyValueObservingOptionNew context:nil];
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm (286313 => 286314)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm 2021-11-30 20:08:27 UTC (rev 286313)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm 2021-11-30 20:10:32 UTC (rev 286314)
@@ -52,6 +52,7 @@
#endif
#if ENABLE(REMOTE_INSPECTOR)
+#import "WebInspectorUtilities.h"
#import <_javascript_Core/RemoteInspectorConstants.h>
#endif
@@ -204,10 +205,7 @@
#if PLATFORM(IOS_FAMILY)
return CFPreferencesGetAppIntegerValue(WIRRemoteInspectorEnabledKey, WIRRemoteInspectorDomainName, nullptr);
#else
- auto sandboxBrokerBundleIdentifier = CFSTR("com.apple.Safari.SandboxBroker");
- if (WebCore::applicationBundleIdentifier() == "com.apple.SafariTechnologyPreview"_s)
- sandboxBrokerBundleIdentifier = CFSTR("com.apple.SafariTechnologyPreview.SandboxBroker");
- return CFPreferencesGetAppIntegerValue(CFSTR("ShowDevelopMenu"), sandboxBrokerBundleIdentifier, nullptr);
+ return CFPreferencesGetAppIntegerValue(CFSTR("ShowDevelopMenu"), bundleIdentifierForSandboxBroker(), nullptr);
#endif
}
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUtilities.cpp (286313 => 286314)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUtilities.cpp 2021-11-30 20:08:27 UTC (rev 286313)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUtilities.cpp 2021-11-30 20:10:32 UTC (rev 286314)
@@ -31,6 +31,7 @@
#include "WebPageProxy.h"
#include "WebProcessPool.h"
#include "WebProcessProxy.h"
+#include <WebCore/RuntimeApplicationChecks.h>
#include <wtf/HashMap.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/WeakHashSet.h>
@@ -112,4 +113,16 @@
return pageLevelMap().contains(&webPage);
}
+#if PLATFORM(COCOA)
+CFStringRef bundleIdentifierForSandboxBroker()
+{
+ if (WebCore::applicationBundleIdentifier() == "com.apple.SafariTechnologyPreview"_s)
+ return CFSTR("com.apple.SafariTechnologyPreview.SandboxBroker");
+ if (WebCore::applicationBundleIdentifier() == "com.apple.Safari.automation"_s)
+ return CFSTR("com.apple.Safari.automation.SandboxBroker");
+
+ return CFSTR("com.apple.Safari.SandboxBroker");
+}
+#endif // PLATFORM(COCOA)
+
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUtilities.h (286313 => 286314)
--- trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUtilities.h 2021-11-30 20:08:27 UTC (rev 286313)
+++ trunk/Source/WebKit/UIProcess/Inspector/WebInspectorUtilities.h 2021-11-30 20:10:32 UTC (rev 286314)
@@ -44,4 +44,8 @@
bool isInspectorProcessPool(WebProcessPool&);
bool isInspectorPage(WebPageProxy&);
+#if PLATFORM(COCOA)
+CFStringRef bundleIdentifierForSandboxBroker();
+#endif
+
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes