Bug 259594 - Web Automation: Parse WebAutomationSessionProxy as a built-in to get guaranteed non-user-overridden JSC built-ins
Summary: Web Automation: Parse WebAutomationSessionProxy as a built-in to get guarante...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebDriver (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-07-28 07:15 PDT by Sam Sneddon [:gsnedders]
Modified: 2023-07-28 07:15 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Sneddon [:gsnedders] 2023-07-28 07:15:35 PDT
rdar://110740489

See also bug 152294 which did similar for the Web Inspector injected script.

Something like this will fail each test:

@pytest.mark.parametrize("expression", [
    ("Promise.prototype.finally"),
    ("Promise.race"),
    ("window.Promise"),
    ("JSON.stringify"),
])
def test_callback(session, expression):
    session.url = "about:blank"
    response = execute_async_script(session, f"""
        let callback = arguments[0];
        delete {expression};
        callback('foobar');
        """)
    assert_success(response, "foobar")

Bug 204151 practically made this worse by introducing all the references to Promises on the common-path, and it's this case (and specifically with Promise.prototype.finally deleted) which was reported as rdar://110740489.