Changeset 244791 in webkit


Ignore:
Timestamp:
Apr 30, 2019 11:38:16 AM (5 years ago)
Author:
BJ Burg
Message:

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):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r244783 r244791  
     12019-04-30  Brian Burg  <bburg@apple.com>
     2
     3        Web Automation: use a more informative key to indicate automation availability
     4        https://bugs.webkit.org/show_bug.cgi?id=197377
     5        <rdar://problem/50258069>
     6
     7        Reviewed by Devin Rousso.
     8
     9        The existing WIRAutomationEnabledKey does not encode uncertainty.
     10        Add a new key that provides an 'Unknown' state, and prefer to use it.
     11
     12        Since an application's initial listing is sent from a background dispatch queue
     13        on Cocoa platforms, this can race with main thread initialization that sets up
     14        RemoteInspector::Client. Therefore, the initial listing may not properly represent
     15        the client's capabilites because the client is not yet available. Allowing for
     16        an "Unknown" state that is later upgraded to Available or Not Available makes it
     17        possible to work around this potential race.
     18
     19        * inspector/remote/RemoteInspectorConstants.h:
     20        * inspector/remote/cocoa/RemoteInspectorCocoa.mm:
     21        (Inspector::RemoteInspector::pushListingsNow):
     22
    1232019-04-30  Keith Miller  <keith_miller@apple.com>
    224
  • trunk/Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h

    r232833 r244791  
    6969#define WIRListingKey                           @"WIRListingKey"
    7070#define WIRRemoteAutomationEnabledKey           @"WIRRemoteAutomationEnabledKey"
     71#define WIRAutomationAvailabilityKey            @"WIRAutomationAvailabilityKey"
    7172#define WIRDestinationKey                       @"WIRDestinationKey"
    7273#define WIRConnectionDiedMessage                @"WIRConnectionDiedMessage"
     
    7778#define WIRTypeAutomation                       @"WIRTypeAutomation"
    7879#define WIRAutomaticallyPause                   @"WIRAutomaticallyPause"
     80
     81// Allowed values for WIRAutomationAvailabilityKey.
     82#define WIRAutomationAvailabilityNotAvailable     @"WIRAutomationAvailabilityNotAvailable"
     83#define WIRAutomationAvailabilityAvailable        @"WIRAutomationAvailabilityAvailable"
     84#define WIRAutomationAvailabilityUnknown          @"WIRAutomationAvailabilityUnknown"
    7985
    8086#define WIRAutomaticInspectionEnabledKey           @"WIRAutomaticInspectionEnabledKey"
  • trunk/Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm

    r244657 r244791  
    455455    [message setObject:listings.get() forKey:WIRListingKey];
    456456
     457    if (!m_clientCapabilities)
     458        [message setObject:WIRAutomationAvailabilityUnknown forKey:WIRAutomationAvailabilityKey];
     459    else if (m_clientCapabilities->remoteAutomationAllowed)
     460        [message setObject:WIRAutomationAvailabilityAvailable forKey:WIRAutomationAvailabilityKey];
     461    else
     462        [message setObject:WIRAutomationAvailabilityNotAvailable forKey:WIRAutomationAvailabilityKey];
     463
     464    // COMPATIBILITY(iOS 13): this key is deprecated and not used by newer versions of webinspectord.
    457465    BOOL isAllowed = m_clientCapabilities && m_clientCapabilities->remoteAutomationAllowed;
    458466    [message setObject:@(isAllowed) forKey:WIRRemoteAutomationEnabledKey];
Note: See TracChangeset for help on using the changeset viewer.