Auto merge of #23951 - georgeroman:return_errorstatus_from_webdriverhandlers, r=jdm

Return ErrorStatus from webdriver_handlers

<!-- Please describe your changes on the following line: -->
With `webdriver 0.40`, `ErrorStatus` implements `Deserialize`. Now we can accommodate for multiple errors occuring in `webdriver_handlers`.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

<!-- Either: -->

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23951)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-08-19 02:10:41 -04:00 committed by GitHub
commit 00a9f30773
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 482 additions and 438 deletions

View file

@ -687,6 +687,9 @@ pub struct ScriptThread {
/// A mechanism to force the compositor's event loop to process events.
event_loop_waker: Option<Box<dyn EventLoopWaker>>,
/// A set of all nodes ever created in this script thread
node_ids: DomRefCell<HashSet<String>>,
}
/// In the event of thread panic, all data on the stack runs its destructor. However, there
@ -1183,6 +1186,25 @@ impl ScriptThread {
})
}
pub fn save_node_id(node_id: String) {
SCRIPT_THREAD_ROOT.with(|root| {
if let Some(script_thread) = root.get() {
let script_thread = unsafe { &*script_thread };
script_thread.node_ids.borrow_mut().insert(node_id);
}
})
}
pub fn has_node_id(node_id: &str) -> bool {
SCRIPT_THREAD_ROOT.with(|root| match root.get() {
Some(script_thread) => {
let script_thread = unsafe { &*script_thread };
script_thread.node_ids.borrow().contains(node_id)
},
None => false,
})
}
/// Creates a new script thread.
pub fn new(
state: InitialScriptState,
@ -1315,6 +1337,8 @@ impl ScriptThread {
user_agent,
player_context: state.player_context,
event_loop_waker: state.event_loop_waker,
node_ids: Default::default(),
}
}