mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Simplify processing of deferred scripts
It is now done on-demand when a deferred script finished loading, and when the page source finished loading.
This commit is contained in:
parent
abdb390da8
commit
e9feb20775
2 changed files with 11 additions and 6 deletions
|
@ -1547,9 +1547,15 @@ impl Document {
|
|||
loader.finish_load(&load);
|
||||
}
|
||||
|
||||
if let LoadType::Stylesheet(_) = load {
|
||||
self.process_deferred_scripts();
|
||||
self.process_pending_parsing_blocking_script();
|
||||
match load {
|
||||
LoadType::Stylesheet(_) => {
|
||||
self.process_deferred_scripts();
|
||||
self.process_pending_parsing_blocking_script();
|
||||
},
|
||||
LoadType::PageSource(_) => {
|
||||
self.process_deferred_scripts();
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
if !self.loader.borrow().is_blocked() && !self.loader.borrow().events_inhibited() {
|
||||
|
@ -1638,7 +1644,7 @@ impl Document {
|
|||
}
|
||||
|
||||
/// https://html.spec.whatwg.org/multipage/#the-end step 3.
|
||||
pub fn process_deferred_scripts(&self) {
|
||||
fn process_deferred_scripts(&self) {
|
||||
if self.ready_state.get() != DocumentReadyState::Interactive {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -359,9 +359,8 @@ impl ServoParser {
|
|||
window.reflow(ReflowGoal::ForDisplay, ReflowQueryType::NoQuery, ReflowReason::FirstLoad);
|
||||
}
|
||||
|
||||
// Steps 3-12 are in other castles, namely process_deferred_scripts and finish_load.
|
||||
// Steps 3-12 are in another castle, namely finish_load.
|
||||
let url = self.tokenizer.borrow().url().clone();
|
||||
self.document.process_deferred_scripts();
|
||||
self.document.finish_load(LoadType::PageSource(url));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue