webdriver: Allow script thread to fail to send response for ExecuteScript (#38054)

When script thread executes script sent from webdriver, if an alert
appears, webdriver can stop waiting for the script response and process
the next command.

This PR allows script thread to fail to send response for
`ExecuteScript` if the channel is closed.

cc: @xiaochengh

Signed-off-by: batu_hoang <hoang.binh.trong@huawei.com>
This commit is contained in:
batu_hoang 2025-07-15 12:14:03 +08:00 committed by GitHub
parent 1cd249dfe9
commit aa098ba2a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 28 deletions

View file

@ -528,12 +528,17 @@ pub(crate) fn handle_execute_script(
Err(WebDriverJSError::JSError)
};
reply.send(result).unwrap();
if reply.send(result).is_err() {
info!("Webdriver might already be released by embedder before reply is sent");
};
},
None => {
reply
if reply
.send(Err(WebDriverJSError::BrowsingContextNotFound))
.unwrap();
.is_err()
{
info!("Webdriver might already be released by embedder before reply is sent");
};
},
}
}

View file

@ -1,25 +1,6 @@
[execute.py]
expected: TIMEOUT
[test_no_browsing_context]
expected: FAIL
[test_opening_new_window_keeps_current_window_handle]
expected: FAIL
[test_abort_by_user_prompt[alert\]]
expected: FAIL
[test_abort_by_user_prompt[confirm\]]
expected: FAIL
[test_abort_by_user_prompt[prompt\]]
expected: FAIL
[test_abort_by_user_prompt_twice[alert\]]
expected: FAIL
[test_abort_by_user_prompt_twice[confirm\]]
expected: FAIL
[test_abort_by_user_prompt_twice[prompt\]]
expected: FAIL

View file

@ -1,6 +0,0 @@
[switch.py]
[test_finds_exising_user_prompt_after_tab_switch[confirm\]]
expected: ERROR
[test_finds_exising_user_prompt_after_tab_switch[prompt\]]
expected: ERROR