diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-08-19 02:10:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-19 02:10:41 -0400 |
commit | 00a9f307733fa98cea8160e96d404bce9a871c09 (patch) | |
tree | 25c48c3c8ab49b9329db18d90253e902a4bb33d5 /components/script/script_thread.rs | |
parent | 3658a8cc591ef4ca827ce1cda9565a1bca7d7b3c (diff) | |
parent | d7b9fede99eaaf854e78a2e544595ea8439baecf (diff) | |
download | servo-00a9f307733fa98cea8160e96d404bce9a871c09.tar.gz servo-00a9f307733fa98cea8160e96d404bce9a871c09.zip |
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 -->
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 8347113791e..e5bfd5ebe8f 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -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(), } } |