mirror of
https://github.com/servo/servo.git
synced 2025-06-13 02:44:29 +00:00
Auto merge of #11791 - craftytrickster:11712/pipeline-lookup, r=asajeffrey
Pipeline lookup in webdriver Fixes #11712 <!-- Please describe your changes on the following line: --> Removed a method that seemed to duplicate already existing functionality, and returned BrowsingContextErrors in the web_handler file where panics were previously occurring. I am not sure if I like all the unwrapping that occurs in the script thread, but the current methods are not set up to return Option/Result. Also, should line the method on line 37 `find_node_by_unique_id` of components/script/webdriver_handlers.rs return None if the context is not found like I have it currently? Or should it return a `Result<Option...>` instead? <!-- 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 #11712 . <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because I simply removed a method that duplicated already existing functionality. On the other part, I added better error sending instead of forcing a panic, which does not require testing to my knowledge. <!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11791) <!-- Reviewable:end -->
This commit is contained in:
commit
a94b92f8c4
7 changed files with 89 additions and 54 deletions
|
@ -1073,7 +1073,10 @@ impl ScriptThread {
|
|||
|
||||
fn handle_resize(&self, id: PipelineId, size: WindowSizeData, size_type: WindowSizeType) {
|
||||
if let Some(ref context) = self.find_child_context(id) {
|
||||
let window = context.active_window();
|
||||
let window = match context.find(id) {
|
||||
Some(browsing_context) => browsing_context.active_window(),
|
||||
None => return warn!("Message sent to closed pipeline {}.", id),
|
||||
};
|
||||
window.set_resize_event(size, size_type);
|
||||
return;
|
||||
}
|
||||
|
@ -2211,15 +2214,6 @@ fn shut_down_layout(context_tree: &BrowsingContext) {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: remove this function, as it's a source of panic.
|
||||
pub fn get_browsing_context(context: &BrowsingContext,
|
||||
pipeline_id: PipelineId)
|
||||
-> Root<BrowsingContext> {
|
||||
context.find(pipeline_id).expect("ScriptThread: received an event \
|
||||
message for a layout channel that is not associated with this script thread.\
|
||||
This is a bug.")
|
||||
}
|
||||
|
||||
fn dom_last_modified(tm: &Tm) -> String {
|
||||
tm.to_local().strftime("%m/%d/%Y %H:%M:%S").unwrap().to_string()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue