mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #14344 - asajeffrey:script-thread-new-layout-use-incomplete-loads, r=jdm
Script thread creating layout thread should use the incomplete loads <!-- Please describe your changes on the following line: --> When a script thread creates a new layout thread, it does so by sending a message to an existing layout thread asking it to spawn. At the moment, we're only looking at the completed loads for that layout thread, so we can get a panic if two loads happen in quick succession. The temporary fix is to look for the layout thread in the incomplete loads too. --- <!-- 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 #14333. - [X] These changes do not require tests because it fixes a panic. <!-- 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/14344) <!-- Reviewable:end -->
This commit is contained in:
commit
99c4821485
1 changed files with 6 additions and 2 deletions
|
@ -1201,10 +1201,14 @@ impl ScriptThread {
|
|||
});
|
||||
|
||||
// Pick a layout thread, any layout thread
|
||||
match self.documents.borrow().iter().next() {
|
||||
let current_layout_chan = self.documents.borrow().iter().next()
|
||||
.map(|(_, document)| document.window().layout_chan().clone())
|
||||
.or_else(|| self.incomplete_loads.borrow().first().map(|load| load.layout_chan.clone()));
|
||||
|
||||
match current_layout_chan {
|
||||
None => panic!("Layout attached to empty script thread."),
|
||||
// Tell the layout thread factory to actually spawn the thread.
|
||||
Some((_, document)) => document.window().layout_chan().send(msg).unwrap(),
|
||||
Some(layout_chan) => layout_chan.send(msg).unwrap(),
|
||||
};
|
||||
|
||||
// Kick off the fetch for the new resource.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue