Bug 179979

Summary: WebDriver: handle user prompts shown while executing scripts
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebDriverAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, ews-watchlist, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 179999    
Attachments:
Description Flags
Patch bburg: review+

Description Carlos Garcia Campos 2017-11-23 08:20:20 PST
15.2 Executing Script

The rules to execute a function body are as follows. The algorithm will return success with the JSON representation of the function’s return value, or an error if the evaluation of the function results in a JavaScript exception being thrown or at any point during its execution an unhandled user prompt appears.

If at any point during the algorithm a user prompt appears, the user prompt handler must be invoked. If its return value is an error, it must immediately return with that error and abort all subsequent substeps of this algorithm.

https://w3c.github.io/webdriver/webdriver-spec.html#executing-script
Comment 1 Carlos Garcia Campos 2017-11-23 08:26:18 PST
Created attachment 327505 [details]
Patch

I wrote tests for this, I'll upgrade wpt tests as soon as the patch lands. See https://github.com/w3c/web-platform-tests/pull/8413
Comment 2 EWS Watchlist 2017-11-23 08:27:56 PST
Attachment 327505 [details] did not pass style-queue:


ERROR: Source/WebDriver/Session.h:130:  Extra space before ( in function call  [whitespace/parens] [4]
ERROR: Source/WebDriver/Session.cpp:194:  Extra space before ( in function call  [whitespace/parens] [4]
Total errors found: 2 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Carlos Garcia Campos 2017-12-01 05:27:55 PST
Ping Brian.
Comment 4 BJ Burg 2017-12-01 09:59:15 PST
Comment on attachment 327505 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=327505&action=review

r=me!

> Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp:569
> +            for (auto id : m_evaluateJavaScriptFunctionCallbacks.keys()) {

Nit: s/id/key/g
Comment 5 Carlos Garcia Campos 2017-12-02 07:13:39 PST
Committed r225448: <https://trac.webkit.org/changeset/225448>
Comment 6 Radar WebKit Bug Importer 2017-12-02 07:14:21 PST
<rdar://problem/35814557>