Auto merge of #27015 - paulrouget:delayedLoad, r=nox

Send LoadStart event when the actual pipeline is loading

The LoadStart event would be fired too early. This makes the devtools crash if we were to start the devtools on LoadStart (which should be possible).

Using the actual document load start event instead of relying on the constellation.
This commit is contained in:
bors-servo 2020-06-22 07:10:56 -04:00 committed by GitHub
commit 7c6cab0b35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 20 deletions

View file

@ -1317,10 +1317,6 @@ where
"no replacement"
},
);
self.handle_load_start_msg(
change.top_level_browsing_context_id,
change.browsing_context_id,
);
self.pending_changes.push(change);
}
@ -3626,18 +3622,6 @@ where
}
}
fn handle_load_start_msg(
&mut self,
top_level_browsing_context_id: TopLevelBrowsingContextId,
browsing_context_id: BrowsingContextId,
) {
if browsing_context_id == top_level_browsing_context_id {
// Notify embedder top level document started loading.
self.embedder_proxy
.send((Some(top_level_browsing_context_id), EmbedderMsg::LoadStart));
}
}
fn handle_load_complete_msg(
&mut self,
top_level_browsing_context_id: TopLevelBrowsingContextId,
@ -3680,10 +3664,6 @@ where
// Notify embedder and compositor top level document finished loading.
self.compositor_proxy
.send(ToCompositorMsg::LoadComplete(top_level_browsing_context_id));
self.embedder_proxy.send((
Some(top_level_browsing_context_id),
EmbedderMsg::LoadComplete,
));
}
} else {
self.handle_subframe_loaded(pipeline_id);

View file

@ -997,9 +997,15 @@ impl Document {
pub fn set_ready_state(&self, state: DocumentReadyState) {
match state {
DocumentReadyState::Loading => {
if self.window().is_top_level() {
self.send_to_embedder(EmbedderMsg::LoadStart);
}
update_with_current_time_ms(&self.dom_loading);
},
DocumentReadyState::Complete => {
if self.window().is_top_level() {
self.send_to_embedder(EmbedderMsg::LoadComplete);
}
update_with_current_time_ms(&self.dom_complete);
},
DocumentReadyState::Interactive => update_with_current_time_ms(&self.dom_interactive),