[Webkit-unassigned] [Bug 224422] New: REGRESSION(r275262) [WebDriver] Make automation JS code aware of injected script headers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Apr 11 21:08:15 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=224422

            Bug ID: 224422
           Summary: REGRESSION(r275262) [WebDriver] Make automation JS
                    code aware of injected script headers
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebDriver
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: lmoura at igalia.com
                CC: bburg at apple.com

https://trac.webkit.org/changeset/275262/webkit changed the injected scripts to have the "//# sourceURL=__InjectedScript_*.js" header.

This led to about 1.5k WebDriver tests to fail. Most (all?) of them with the following error:

E           JavascriptErrorException: javascript error (500): Unexpected keyword 'function'. Expected ')' to end a compound expression.                                                                    

body       = {'using': 'css selector', 'value': 'input'}
err        = <JavascriptErrorException http_status=500>
method     = 'POST'
response   = <Response status=500 error=<JavascriptErrorException http_status=500>>
self       = <Session bb6344e1-8a15-487d-b05c-0cdc06fc85ce>
timeout    = None
url        = 'session/bb6344e1-8a15-487d-b05c-0cdc06fc85ce/element'

When evaluating the following expression in the test:

element = session.find.css("input", all=False)

The issue happens due to WebAutomationSessionProxy.js wrapping the executing code in "(async <CODE>)". With the header, this resulted in the following code:

```
(async //# __injectedScript...
 function (...) {...})
```

And the "Unexpected keyword" error appeared.

A candidate fix is to skip the header lines from the function code before wrapping it in async. Patch in the next comment.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210412/7b158453/attachment.htm>


More information about the webkit-unassigned mailing list