mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Auto merge of #27163 - alarsyo:23053-layout-queries-disconnected-frames-panic, r=jdm
Return Option for Window's layout channel <!-- Please describe your changes on the following line: --> `Window::layout_chan()` now returns an `Option<Sender<Msg>>`, returning `None` if the window is dead. FIX #26969 FIX #26429 FIX #21208 FIX #19092 FIX #22559 FIX #22584 FIX #22652 --- <!-- 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 #23053 <!-- Either: --> - [x] There are tests for these changes <!-- 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. --> This is my first contribution, I'm trying to figure things out! This fix passes the test case shown in #23053, however I don't know what the behavior should be in `Document` and `ScriptThread` if `Window::is_alive()` is false : simply ignore it, don't do anything ? Or is this something that should not happen now that we return false in `Window::force_reflow()` ? I'm not sure about the directory where the test case should go, any advice?
This commit is contained in:
commit
8916a42180
5 changed files with 84 additions and 32 deletions
|
@ -804,10 +804,10 @@ impl Document {
|
|||
self.quirks_mode.set(mode);
|
||||
|
||||
if mode == QuirksMode::Quirks {
|
||||
self.window
|
||||
.layout_chan()
|
||||
.send(Msg::SetQuirksMode(mode))
|
||||
.unwrap();
|
||||
match self.window.layout_chan() {
|
||||
Some(chan) => chan.send(Msg::SetQuirksMode(mode)).unwrap(),
|
||||
None => warn!("Layout channel unavailable"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3724,13 +3724,15 @@ impl Document {
|
|||
})
|
||||
.cloned();
|
||||
|
||||
self.window
|
||||
.layout_chan()
|
||||
.send(Msg::AddStylesheet(
|
||||
sheet.clone(),
|
||||
insertion_point.as_ref().map(|s| s.sheet.clone()),
|
||||
))
|
||||
.unwrap();
|
||||
match self.window.layout_chan() {
|
||||
Some(chan) => chan
|
||||
.send(Msg::AddStylesheet(
|
||||
sheet.clone(),
|
||||
insertion_point.as_ref().map(|s| s.sheet.clone()),
|
||||
))
|
||||
.unwrap(),
|
||||
None => return warn!("Layout channel unavailable"),
|
||||
}
|
||||
|
||||
DocumentOrShadowRoot::add_stylesheet(
|
||||
owner,
|
||||
|
@ -3744,10 +3746,10 @@ impl Document {
|
|||
/// Remove a stylesheet owned by `owner` from the list of document sheets.
|
||||
#[allow(unrooted_must_root)] // Owner needs to be rooted already necessarily.
|
||||
pub fn remove_stylesheet(&self, owner: &Element, s: &Arc<Stylesheet>) {
|
||||
self.window
|
||||
.layout_chan()
|
||||
.send(Msg::RemoveStylesheet(s.clone()))
|
||||
.unwrap();
|
||||
match self.window.layout_chan() {
|
||||
Some(chan) => chan.send(Msg::RemoveStylesheet(s.clone())).unwrap(),
|
||||
None => return warn!("Layout channel unavailable"),
|
||||
}
|
||||
|
||||
DocumentOrShadowRoot::remove_stylesheet(
|
||||
owner,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue