Bug 233015

Summary: [Cocoa] Web Inspector: fix bundle identifier lookup for enabling remote inspection
Product: WebKit Reporter: Blaze Burg <bburg>
Component: Web InspectorAssignee: Blaze Burg <bburg>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, darin, ews-watchlist, hi, inspector-bugzilla-changes, joepeck, pangle, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch v1.0
none
Patch v1.1
none
Patch v1.2
none
Patch for Landing none

Blaze Burg
Reported 2021-11-11 14:21:10 PST
.
Attachments
Patch v1.0 (1.70 KB, patch)
2021-11-11 14:24 PST, Blaze Burg
no flags
Patch v1.1 (5.87 KB, patch)
2021-11-11 15:12 PST, Blaze Burg
no flags
Patch v1.2 (5.77 KB, patch)
2021-11-15 12:39 PST, Blaze Burg
no flags
Patch for Landing (5.79 KB, patch)
2021-11-30 10:44 PST, Blaze Burg
no flags
Blaze Burg
Comment 1 2021-11-11 14:21:39 PST
Blaze Burg
Comment 2 2021-11-11 14:24:49 PST
Created attachment 444001 [details] Patch v1.0
Blaze Burg
Comment 3 2021-11-11 15:12:36 PST
Created attachment 444008 [details] Patch v1.1
Darin Adler
Comment 4 2021-11-11 17:05:14 PST
Comment on attachment 444008 [details] Patch v1.1 View in context: https://bugs.webkit.org/attachment.cgi?id=444008&action=review > Source/WebKit/UIProcess/Inspector/WebInspectorUtilities.h:48 > +String bundleIdentifierForSandboxBroker(); I think this should return a CFStringRef. Also, could return ASCIILiteral if you really want to stick with WTF instead of platform-specific.
Patrick Angle
Comment 5 2021-11-12 11:09:29 PST
Comment on attachment 444008 [details] Patch v1.1 View in context: https://bugs.webkit.org/attachment.cgi?id=444008&action=review > Source/WebKit/UIProcess/Inspector/WebInspectorUtilities.cpp:119 > + auto sandboxBrokerBundleIdentifier = "com.apple.Safari.SandboxBroker"_s; Nit: Now that this logic is in a standalone function, can we just return the correct string inside the conditionals instead of setting a local variable?
Blaze Burg
Comment 6 2021-11-15 12:39:09 PST
Created attachment 444296 [details] Patch v1.2
Darin Adler
Comment 7 2021-11-15 14:37:17 PST
Comment on attachment 444296 [details] Patch v1.2 View in context: https://bugs.webkit.org/attachment.cgi?id=444296&action=review > Source/WebKit/UIProcess/Cocoa/WebInspectorPreferenceObserver.mm:53 > + String sandboxBrokerBundleIdentifier = WebKit::bundleIdentifierForSandboxBroker(); I suggest not involving WTF::String at all: 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 %@.", sandboxBrokerBundleIdentifier);
Darin Adler
Comment 8 2021-11-15 17:07:13 PST
Comment on attachment 444296 [details] Patch v1.2 View in context: https://bugs.webkit.org/attachment.cgi?id=444296&action=review > Source/WebKit/UIProcess/Inspector/WebInspectorUtilities.cpp:122 > + 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"); One other thought: Since bundle identifiers are not case sensitive, it might be safer to call equalLettersIgnoringASCIICase instead of using ==.
Blaze Burg
Comment 9 2021-11-30 10:44:01 PST
Created attachment 445440 [details] Patch for Landing
Joseph Pecoraro
Comment 10 2021-11-30 10:53:10 PST
Comment on attachment 445440 [details] Patch for Landing View in context: https://bugs.webkit.org/attachment.cgi?id=445440&action=review > Source/WebKit/UIProcess/Inspector/WebInspectorUtilities.cpp:119 > + if (WebCore::applicationBundleIdentifier() == "com.apple.SafariTechnologyPreview"_s) Perhaps avoid calling `WebCore::applicationBundleIdentifier` twice with a local? Is the result always `applicationBundleIdentifier() + ".SandboxBroker"?
EWS
Comment 11 2021-11-30 12:10:40 PST
Committed r286314 (244673@main): <https://commits.webkit.org/244673@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 445440 [details].
Note You need to log in before you can comment on or make changes to this bug.