Skip to content

Commit

Permalink
When a script thread looks for a current layout thread, it should loo…
Browse files Browse the repository at this point in the history
…k in the incomplete loads.
  • Loading branch information
Alan Jeffrey committed Nov 23, 2016
1 parent 5946f75 commit fb6cefc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/script/script_thread.rs
Expand Up @@ -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.
Expand Down

0 comments on commit fb6cefc

Please sign in to comment.