diff options
author | Linus Groh <mail@linusgroh.de> | 2023-04-20 17:41:32 +0100 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-04-20 14:41:31 -0400 |
commit | e6be5c37c0ef16b2545ac2bd9cabfb74836a1622 (patch) | |
tree | 20a4f7d35c49778767dd83ec9502a9bb7294399b /Userland/Services | |
parent | 84a231d4e51c7729480bb33e9bb342449272c01e (diff) | |
download | serenity-e6be5c37c0ef16b2545ac2bd9cabfb74836a1622.zip |
LibWeb/WebDriver: Handle WindowProxy in internal_json_clone_algorithm()
To test:
```console
curl http://0.0.0.0:8000/session \
-H 'Content-Type: application/json' \
-d '{"capabilities": {}}'
curl http://0.0.0.0:8000/session/0/execute/sync \
-H 'Content-Type: application/json' \
-d '{"script": "return window;", "args": []}'
```
Which should result in:
```json
{
"value": {
"window-fcc6-11e5-b4f8-330a88ab9d7f":
"86307df6-e2f1-4175-85cb-77295ff90898"
}
}
```
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/WebContent/WebDriverConnection.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index 7b3401b0cd..f718189823 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -1460,6 +1460,8 @@ Messages::WebDriverClient::ExecuteScriptResponse WebDriverConnection::execute_sc case Web::WebDriver::ExecuteScriptResultType::PromiseRejected: case Web::WebDriver::ExecuteScriptResultType::JavaScriptError: return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::JavascriptError, "Script returned an error", move(result.value)); + case Web::WebDriver::ExecuteScriptResultType::BrowsingContextDiscarded: + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::StaleElementReference, "Browsing context has been discarded", move(result.value)); } VERIFY_NOT_REACHED(); @@ -1492,6 +1494,8 @@ Messages::WebDriverClient::ExecuteAsyncScriptResponse WebDriverConnection::execu case Web::WebDriver::ExecuteScriptResultType::PromiseRejected: case Web::WebDriver::ExecuteScriptResultType::JavaScriptError: return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::JavascriptError, "Script returned an error", move(result.value)); + case Web::WebDriver::ExecuteScriptResultType::BrowsingContextDiscarded: + return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::StaleElementReference, "Browsing context has been discarded", move(result.value)); } VERIFY_NOT_REACHED(); |