mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Report exceptions for async script executions to webdriver (#27041)
Improving the accuracy of the async script execution for our webdriver implementation allows us to run many more webdriver tests without timeouts, which should help with https://github.com/web-platform-tests/wpt/issues/24257. Specification: * https://w3c.github.io/webdriver/#dfn-clone-an-object * https://w3c.github.io/webdriver/#execute-async-script --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #27036 and fix #27035 and fix #27031. - [x] There are tests for these changes (but we don't run them in CI yet) --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
cbc363bedd
commit
dc0c067c9b
7 changed files with 115 additions and 36 deletions
|
@ -1216,15 +1216,26 @@ impl WindowMethods<crate::DomTypeHolder> for Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn WebdriverCallback(&self, cx: JSContext, val: HandleValue) {
|
||||
let rv = unsafe { jsval_to_webdriver(*cx, &self.globalscope, val) };
|
||||
fn WebdriverCallback(&self, cx: JSContext, val: HandleValue, realm: InRealm, can_gc: CanGc) {
|
||||
let rv = jsval_to_webdriver(cx, &self.globalscope, val, realm, can_gc);
|
||||
let opt_chan = self.webdriver_script_chan.borrow_mut().take();
|
||||
if let Some(chan) = opt_chan {
|
||||
chan.send(rv).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
fn WebdriverException(&self, cx: JSContext, val: HandleValue, realm: InRealm, can_gc: CanGc) {
|
||||
let rv = jsval_to_webdriver(cx, &self.globalscope, val, realm, can_gc);
|
||||
let opt_chan = self.webdriver_script_chan.borrow_mut().take();
|
||||
if let Some(chan) = opt_chan {
|
||||
if let Ok(rv) = rv {
|
||||
chan.send(Err(WebDriverJSError::JSException(rv))).unwrap();
|
||||
} else {
|
||||
chan.send(rv).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn WebdriverTimeout(&self) {
|
||||
let opt_chan = self.webdriver_script_chan.borrow_mut().take();
|
||||
if let Some(chan) = opt_chan {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue