mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Auto merge of #23544 - georgeroman:fix_borrow_mut_error_in_webdriver, r=asajeffrey
Fix already borrowed error in webdriver <!-- Please describe your changes on the following line: --> --- <!-- 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 - [X] These changes fix #23535 <!-- 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/23544) <!-- Reviewable:end -->
This commit is contained in:
commit
b3eed5b5bd
2 changed files with 46 additions and 41 deletions
|
@ -1834,6 +1834,22 @@ impl ScriptThread {
|
|||
}
|
||||
|
||||
fn handle_webdriver_msg(&self, pipeline_id: PipelineId, msg: WebDriverScriptCommand) {
|
||||
// https://github.com/servo/servo/issues/23535
|
||||
// These two messages need different treatment since the JS script might mutate
|
||||
// `self.documents`, which would conflict with the immutable borrow of it that
|
||||
// occurs for the rest of the messages
|
||||
match msg {
|
||||
WebDriverScriptCommand::ExecuteScript(script, reply) => {
|
||||
let window = { self.documents.borrow().find_window(pipeline_id) };
|
||||
return webdriver_handlers::handle_execute_script(window, script, reply);
|
||||
},
|
||||
WebDriverScriptCommand::ExecuteAsyncScript(script, reply) => {
|
||||
let window = { self.documents.borrow().find_window(pipeline_id) };
|
||||
return webdriver_handlers::handle_execute_async_script(window, script, reply);
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
|
||||
let documents = self.documents.borrow();
|
||||
match msg {
|
||||
WebDriverScriptCommand::AddCookie(params, reply) => {
|
||||
|
@ -1842,9 +1858,6 @@ impl ScriptThread {
|
|||
WebDriverScriptCommand::DeleteCookies(reply) => {
|
||||
webdriver_handlers::handle_delete_cookies(&*documents, pipeline_id, reply)
|
||||
},
|
||||
WebDriverScriptCommand::ExecuteScript(script, reply) => {
|
||||
webdriver_handlers::handle_execute_script(&*documents, pipeline_id, script, reply)
|
||||
},
|
||||
WebDriverScriptCommand::FindElementCSS(selector, reply) => {
|
||||
webdriver_handlers::handle_find_element_css(
|
||||
&*documents,
|
||||
|
@ -1937,14 +1950,7 @@ impl ScriptThread {
|
|||
WebDriverScriptCommand::GetTitle(reply) => {
|
||||
webdriver_handlers::handle_get_title(&*documents, pipeline_id, reply)
|
||||
},
|
||||
WebDriverScriptCommand::ExecuteAsyncScript(script, reply) => {
|
||||
webdriver_handlers::handle_execute_async_script(
|
||||
&*documents,
|
||||
pipeline_id,
|
||||
script,
|
||||
reply,
|
||||
)
|
||||
},
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue