WebKit Bugzilla
Attachment 341803 Details for
Bug 186204
: [Cocoa] Web Automation: include browser name and version in listing for automation targets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed Fix
bug-186204-20180601164050.patch (text/plain), 11.48 KB, created by
BJ Burg
on 2018-06-01 16:40:50 PDT
(
hide
)
Description:
Proposed Fix
Filename:
MIME Type:
Creator:
BJ Burg
Created:
2018-06-01 16:40:50 PDT
Size:
11.48 KB
patch
obsolete
>Subversion Revision: 232417 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 92185c85dc0048570d539a674b2cc31dbe8e33ac..dccd6c93fad1151960166971c7d5ee0e8cff253e 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,18 @@ >+2018-06-01 Brian Burg <bburg@apple.com> >+ >+ [Cocoa] Web Automation: include browser name and version in listing for automation targets >+ https://bugs.webkit.org/show_bug.cgi?id=186204 >+ <rdar://problem/36950423> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Ask the client what the reported browser name and version should be, then >+ send this as part of the listing for an automation target. >+ >+ * inspector/remote/RemoteInspectorConstants.h: >+ * inspector/remote/cocoa/RemoteInspectorCocoa.mm: >+ (Inspector::RemoteInspector::listingForAutomationTarget const): >+ > 2018-06-01 Wenson Hsieh <wenson_hsieh@apple.com> > > Fix the watchOS build after r232385 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 81d2c51125e4eb892900d7390c1ca3cf2bd83317..7aac19dc80aa18ed7bbab6077d1fdb156d327d3d 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,13 @@ >+2018-06-01 Brian Burg <bburg@apple.com> >+ >+ [Cocoa] Web Automation: include browser name and version in listing for automation targets >+ https://bugs.webkit.org/show_bug.cgi?id=186204 >+ <rdar://problem/36950423> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * wtf/spi/cf/CFBundleSPI.h: Add needed infoDictionary key values. >+ > 2018-05-31 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r232212. >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 4411aa9a8cb02ef096344008cc2070490225d2d0..a88b87a1e0cc69280b548462da8ab1b0483a2050 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,25 @@ >+2018-06-01 Brian Burg <bburg@apple.com> >+ >+ [Cocoa] Web Automation: include browser name and version in listing for automation targets >+ https://bugs.webkit.org/show_bug.cgi?id=186204 >+ <rdar://problem/36950423> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a new delegate method that allows the client to set the name and version >+ of the browser as returned in the 'browserName' and 'browserVersion' capabilities. >+ If the delegate methods are not implemented, try to get this information from >+ the main bundle. >+ >+ In the RWI protocol, these fields are added to automation target listings. >+ >+ * UIProcess/API/Cocoa/_WKAutomationDelegate.h: >+ * UIProcess/Cocoa/AutomationClient.h: >+ * UIProcess/Cocoa/AutomationClient.mm: >+ (WebKit::AutomationClient::AutomationClient): >+ (WebKit::AutomationClient::browserName const): >+ (WebKit::AutomationClient::browserVersion const): >+ > 2018-06-01 Chris Dumez <cdumez@apple.com> > > Regression(r230876): Swipe navigation snapshot may get removed too early >diff --git a/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h b/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h >index 17896e032cd76b448bcbcc730c06f85167a2c6ee..b947efdb48dfef42b9c5cf9d7466204af5d8241c 100644 >--- a/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h >+++ b/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h >@@ -84,6 +84,8 @@ > #define WIRAutomaticInspectionCandidateMessage @"WIRAutomaticInspectionCandidateMessage" > > #define WIRAutomationTargetIsPairedKey @"WIRAutomationTargetIsPairedKey" >+#define WIRAutomationTargetNameKey @"WIRAutomationTargetNameKey" >+#define WIRAutomationTargetVersionKey @"WIRAutomationTargetVersionKey" > #define WIRSessionIdentifierKey @"WIRSessionIdentifierKey" > #define WIRSessionCapabilitiesKey @"WIRSessionCapabilitiesKey" > #define WIRAutomationSessionRequestMessage @"WIRAutomationSessionRequestMessage" >diff --git a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm >index fcaf4af225e5ec2ebbf6b59dc3bb170bddd9d093..c7b451e087fb3c9a1e47579af032f6834a58cb5d 100644 >--- a/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm >+++ b/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm >@@ -427,6 +427,10 @@ RetainPtr<NSDictionary> RemoteInspector::listingForAutomationTarget(const Remote > [listing setObject:target.name() forKey:WIRSessionIdentifierKey]; > [listing setObject:WIRTypeAutomation forKey:WIRTypeKey]; > [listing setObject:@(target.isPaired()) forKey:WIRAutomationTargetIsPairedKey]; >+ if (m_clientCapabilities) { >+ [listing setObject:m_clientCapabilities->browserName forKey:WIRAutomationTargetNameKey]; >+ [listing setObject:m_clientCapabilities->browserVersion forKey:WIRAutomationTargetVersionKey]; >+ } > > if (auto connectionToTarget = m_targetConnectionMap.get(target.targetIdentifier())) > [listing setObject:connectionToTarget->connectionIdentifier() forKey:WIRConnectionIdentifierKey]; >diff --git a/Source/WTF/wtf/spi/cf/CFBundleSPI.h b/Source/WTF/wtf/spi/cf/CFBundleSPI.h >index c089e175bbf4837debffa934627a129bc7076306..1da60efb91f9d4f40a6059fc8fc95a700eb042c6 100644 >--- a/Source/WTF/wtf/spi/cf/CFBundleSPI.h >+++ b/Source/WTF/wtf/spi/cf/CFBundleSPI.h >@@ -36,6 +36,9 @@ > > WTF_EXTERN_C_BEGIN > >+extern const CFStringRef _kCFBundleDisplayNameKey; >+extern const CFStringRef _kCFBundleShortVersionStringKey; >+ > void _CFBundleSetupXPCBootstrap(xpc_object_t bootstrap); > > CFBundleRef _CFBundleCreateUnique(CFAllocatorRef, CFURLRef bundleURL); >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationDelegate.h b/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationDelegate.h >index 1cd233c7d3ea0879627d30669972494a6fd68c9f..db6fb92113dffe58cb641bf1becd555ee2d4ffde 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationDelegate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationDelegate.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -32,8 +32,11 @@ > > @protocol _WKAutomationDelegate <NSObject> > @optional >-- (BOOL)_processPoolAllowsRemoteAutomation:(WKProcessPool *)processPool; >-- (void)_processPool:(WKProcessPool *)processPool didRequestAutomationSessionWithIdentifier:(NSString *)identifier configuration:(_WKAutomationSessionConfiguration *)configuration; >+- (BOOL)_processPoolAllowsRemoteAutomation:(WKProcessPool *)processPool WK_API_AVAILABLE(macosx(10.13), ios(11.0)); >+- (void)_processPool:(WKProcessPool *)processPool didRequestAutomationSessionWithIdentifier:(NSString *)identifier configuration:(_WKAutomationSessionConfiguration *)configuration WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); >+ >+- (NSString *)_processPoolBrowserNameForAutomation:(WKProcessPool *)processPool WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); >+- (NSString *)_processPoolBrowserVersionForAutomation:(WKProcessPool *)processPool WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); > @end > > #endif // WK_API_ENABLED >diff --git a/Source/WebKit/UIProcess/Cocoa/AutomationClient.h b/Source/WebKit/UIProcess/Cocoa/AutomationClient.h >index 4f64b42cfb1cd39d490a48204077356c42177764..7c9250b0feb7ca7aaa6d2f499fdb6e560e57969a 100644 >--- a/Source/WebKit/UIProcess/Cocoa/AutomationClient.h >+++ b/Source/WebKit/UIProcess/Cocoa/AutomationClient.h >@@ -54,6 +54,8 @@ private: > // RemoteInspector::Client > bool remoteAutomationAllowed() const override; > void requestAutomationSession(const String& sessionIdentifier) override; >+ String browserName() const override; >+ String browserVersion() const override; > > WKProcessPool *m_processPool; > WeakObjCPtr<id <_WKAutomationDelegate>> m_delegate; >@@ -61,6 +63,8 @@ private: > struct { > bool allowsRemoteAutomation : 1; > bool requestAutomationSession : 1; >+ bool browserNameForAutomation : 1; >+ bool browserVersionForAutomation : 1; > } m_delegateMethods; > }; > >diff --git a/Source/WebKit/UIProcess/Cocoa/AutomationClient.mm b/Source/WebKit/UIProcess/Cocoa/AutomationClient.mm >index a7018d60431e019c702b41cd52569636c58b3704..8cf4ec89695116c2eeadf5315c6a6430bda13ba8 100644 >--- a/Source/WebKit/UIProcess/Cocoa/AutomationClient.mm >+++ b/Source/WebKit/UIProcess/Cocoa/AutomationClient.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -35,6 +35,7 @@ > #import "_WKAutomationSessionConfiguration.h" > #import <JavaScriptCore/RemoteInspector.h> > #import <JavaScriptCore/RemoteInspectorConstants.h> >+#import <wtf/spi/cf/CFBundleSPI.h> > #import <wtf/text/WTFString.h> > > using namespace Inspector; >@@ -47,6 +48,8 @@ AutomationClient::AutomationClient(WKProcessPool *processPool, id <_WKAutomation > { > m_delegateMethods.allowsRemoteAutomation = [delegate respondsToSelector:@selector(_processPoolAllowsRemoteAutomation:)]; > m_delegateMethods.requestAutomationSession = [delegate respondsToSelector:@selector(_processPool:didRequestAutomationSessionWithIdentifier:configuration:)]; >+ m_delegateMethods.browserNameForAutomation = [delegate respondsToSelector:@selector(_processPoolBrowserNameForAutomation:)]; >+ m_delegateMethods.browserVersionForAutomation = [delegate respondsToSelector:@selector(_processPoolBrowserVersionForAutomation:)]; > > RemoteInspector::singleton().setClient(this); > } >@@ -56,11 +59,15 @@ AutomationClient::~AutomationClient() > RemoteInspector::singleton().setClient(nullptr); > } > >+// MARK: API::AutomationClient >+ > void AutomationClient::didRequestAutomationSession(WebKit::WebProcessPool*, const String& sessionIdentifier) > { > requestAutomationSession(sessionIdentifier); > } > >+// MARK: RemoteInspector::Client >+ > bool AutomationClient::remoteAutomationAllowed() const > { > if (m_delegateMethods.allowsRemoteAutomation) >@@ -75,6 +82,28 @@ void AutomationClient::requestAutomationSession(const String& sessionIdentifier) > requestAutomationSessionWithCapabilities(retainedIdentifier, nil); > } > >+String AutomationClient::browserName() const >+{ >+ if (m_delegateMethods.browserNameForAutomation) >+ return [m_delegate.get() _processPoolBrowserNameForAutomation:m_processPool]; >+ >+ // Fall back to using the unlocalized app name (i.e., 'Safari'). >+ NSBundle *appBundle = [NSBundle mainBundle]; >+ NSString *displayName = appBundle.infoDictionary[(__bridge NSString *)_kCFBundleDisplayNameKey]; >+ NSString *readableName = appBundle.infoDictionary[(__bridge NSString *)kCFBundleNameKey]; >+ return displayName ?: readableName; >+} >+ >+String AutomationClient::browserVersion() const >+{ >+ if (m_delegateMethods.browserVersionForAutomation) >+ return [m_delegate.get() _processPoolBrowserVersionForAutomation:m_processPool]; >+ >+ // Fall back to using the app short version (i.e., '11.1.1'). >+ NSBundle *appBundle = [NSBundle mainBundle]; >+ return appBundle.infoDictionary[(__bridge NSString *)_kCFBundleShortVersionStringKey]; >+} >+ > void AutomationClient::requestAutomationSessionWithCapabilities(NSString *sessionIdentifier, NSDictionary *forwardedCapabilities) > { > _WKAutomationSessionConfiguration *configuration = [[[_WKAutomationSessionConfiguration alloc] init] autorelease];
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186204
: 341803 |
341839