Repository: servo/servo
File: components/script/script_thread.rs (Rust)

Code before:
                final_url,
                encoding_hint_from_content_type,
                can_gc,
            );
        } else {
            ServoParser::parse_html_document(
                &document,
                None,
                final_url,
                encoding_hint_from_content_type,
                incomplete.load_data.container_document_encoding,
                can_gc,
            );
        }

        if incomplete.activity == DocumentActivity::FullyActive {
            window.resume(can_gc);
        } else {
            window.suspend(can_gc);
        }

        if incomplete.throttled {
            window.set_throttled(true);
        }

        // Initializing [`VisualViewport`] here allow us to monitor it's changes as soon as possible.
        window.init_visual_viewport(can_gc);

        document.get_current_parser().unwrap()
    }

    fn notify_devtools(
        &self,
        title: DOMString,
        url: ServoUrl,
        is_top_level_global: bool,
        (browsing_context_id, pipeline_id, worker_id, webview_id): (
            BrowsingContextId,
            PipelineId,
            Option<WorkerId>,
            WebViewId,
        ),
    ) {
        if let Some(ref chan) = self.senders.devtools_server_sender {
            let page_info = DevtoolsPageInfo {
                title: String::from(title),
                url,
                is_top_level_global,
            };
            chan.send(ScriptToDevtoolsControlMsg::NewGlobal(
                (browsing_context_id, pipeline_id, worker_id, webview_id),

Review comment (suggestion):
```suggestion
        // Initializing [`VisualViewport`] here allow us to monitor its changes as soon as possible.
```

Code after:
            ),
        );

        document.set_https_state(metadata.https_state);
        document.set_navigation_start(incomplete.navigation_start);

        if is_html_document == IsHTMLDocument::NonHTMLDocument {
            ServoParser::parse_xml_document(
                &document,
                None,
                final_url,
                encoding_hint_from_content_type,
                can_gc,
            );
        } else {
            ServoParser::parse_html_document(
                &document,
                None,
                final_url,
                encoding_hint_from_content_type,
                incomplete.load_data.container_document_encoding,
                can_gc,
            );
        }

        if incomplete.activity == DocumentActivity::FullyActive {
            window.resume(can_gc);
        } else {
            window.suspend(can_gc);
        }

        if incomplete.throttled {
            window.set_throttled(true);
        }

        document.get_current_parser().unwrap()
    }

    fn notify_devtools(
        &self,
        title: DOMString,
        url: ServoUrl,
        is_top_level_global: bool,
        (browsing_context_id, pipeline_id, worker_id, webview_id): (
            BrowsingContextId,
            PipelineId,
            Option<WorkerId>,
            WebViewId,
        ),
    ) {
        if let Some(ref chan) = self.senders.devtools_server_sender {