Skip to content
Permalink
Browse files
Web Automation: use a more informative key to indicate automation ava…
…ilability

https://bugs.webkit.org/show_bug.cgi?id=197377
<rdar://problem/50258069>

Reviewed by Devin Rousso.

The existing WIRAutomationEnabledKey does not encode uncertainty.
Add a new key that provides an 'Unknown' state, and prefer to use it.

Since an application's initial listing is sent from a background dispatch queue
on Cocoa platforms, this can race with main thread initialization that sets up
RemoteInspector::Client. Therefore, the initial listing may not properly represent
the client's capabilites because the client is not yet available. Allowing for
an "Unknown" state that is later upgraded to Available or Not Available makes it
possible to work around this potential race.

* inspector/remote/RemoteInspectorConstants.h:
* inspector/remote/cocoa/RemoteInspectorCocoa.mm:
(Inspector::RemoteInspector::pushListingsNow):


Canonical link: https://commits.webkit.org/211613@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244791 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
burg committed Apr 30, 2019
1 parent 02fc185 commit 11d3040dd794cba44c7a4252439fe5a464b07a39
Showing 3 changed files with 36 additions and 0 deletions.
@@ -1,3 +1,25 @@
2019-04-30 Brian Burg <bburg@apple.com>

Web Automation: use a more informative key to indicate automation availability
https://bugs.webkit.org/show_bug.cgi?id=197377
<rdar://problem/50258069>

Reviewed by Devin Rousso.

The existing WIRAutomationEnabledKey does not encode uncertainty.
Add a new key that provides an 'Unknown' state, and prefer to use it.

Since an application's initial listing is sent from a background dispatch queue
on Cocoa platforms, this can race with main thread initialization that sets up
RemoteInspector::Client. Therefore, the initial listing may not properly represent
the client's capabilites because the client is not yet available. Allowing for
an "Unknown" state that is later upgraded to Available or Not Available makes it
possible to work around this potential race.

* inspector/remote/RemoteInspectorConstants.h:
* inspector/remote/cocoa/RemoteInspectorCocoa.mm:
(Inspector::RemoteInspector::pushListingsNow):

2019-04-30 Keith Miller <keith_miller@apple.com>

Fix failing ARM64E wasm tests
@@ -68,6 +68,7 @@
#define WIRListingMessage @"WIRListingMessage"
#define WIRListingKey @"WIRListingKey"
#define WIRRemoteAutomationEnabledKey @"WIRRemoteAutomationEnabledKey"
#define WIRAutomationAvailabilityKey @"WIRAutomationAvailabilityKey"
#define WIRDestinationKey @"WIRDestinationKey"
#define WIRConnectionDiedMessage @"WIRConnectionDiedMessage"
#define WIRTypeKey @"WIRTypeKey"
@@ -77,6 +78,11 @@
#define WIRTypeAutomation @"WIRTypeAutomation"
#define WIRAutomaticallyPause @"WIRAutomaticallyPause"

// Allowed values for WIRAutomationAvailabilityKey.
#define WIRAutomationAvailabilityNotAvailable @"WIRAutomationAvailabilityNotAvailable"
#define WIRAutomationAvailabilityAvailable @"WIRAutomationAvailabilityAvailable"
#define WIRAutomationAvailabilityUnknown @"WIRAutomationAvailabilityUnknown"

#define WIRAutomaticInspectionEnabledKey @"WIRAutomaticInspectionEnabledKey"
#define WIRAutomaticInspectionSessionIdentifierKey @"WIRAutomaticInspectionSessionIdentifierKey"
#define WIRAutomaticInspectionConfigurationMessage @"WIRAutomaticInspectionConfigurationMessage"
@@ -454,6 +454,14 @@ static bool globalAutomaticInspectionState()
RetainPtr<NSMutableDictionary> message = adoptNS([[NSMutableDictionary alloc] init]);
[message setObject:listings.get() forKey:WIRListingKey];

if (!m_clientCapabilities)
[message setObject:WIRAutomationAvailabilityUnknown forKey:WIRAutomationAvailabilityKey];
else if (m_clientCapabilities->remoteAutomationAllowed)
[message setObject:WIRAutomationAvailabilityAvailable forKey:WIRAutomationAvailabilityKey];
else
[message setObject:WIRAutomationAvailabilityNotAvailable forKey:WIRAutomationAvailabilityKey];

// COMPATIBILITY(iOS 13): this key is deprecated and not used by newer versions of webinspectord.
BOOL isAllowed = m_clientCapabilities && m_clientCapabilities->remoteAutomationAllowed;
[message setObject:@(isAllowed) forKey:WIRRemoteAutomationEnabledKey];

0 comments on commit 11d3040

Please sign in to comment.