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

Code before:
    ) {
        let Some(document) = self.documents.borrow().find_document(pipeline_id) else {
            warn!("Input event sent to closed pipeline {pipeline_id}.");
            let _ = self
                .senders
                .pipeline_to_embedder_sender
                .send(EmbedderMsg::InputEventHandled(
                    webview_id,
                    event.event.id,
                    Default::default(),
                ));
            return;
        };
        document.event_handler().note_pending_input_event(event);
    }

    fn set_accessibility_active(&self, active: bool) {
        if !(pref!(accessibility_enabled)) {
            return;
        }

        self.accessibility_active.replace(active);
        for (_, document) in self.documents.borrow().iter() {
            let window = document.window();
            let layout = window.layout();
            layout.set_accessibility_active(active);
        }
    }

    /// Handle a "navigate an iframe" message from the constellation.
    fn handle_navigate_iframe(
        &self,
        parent_pipeline_id: PipelineId,
        browsing_context_id: BrowsingContextId,
        load_data: LoadData,
        history_handling: NavigationHistoryBehavior,
        can_gc: CanGc,
    ) {
        let iframe = self
            .documents
            .borrow()
            .find_iframe(parent_pipeline_id, browsing_context_id);
        if let Some(iframe) = iframe {
            iframe.navigate_or_reload_child_browsing_context(load_data, history_handling, can_gc);
        }
    }

    /// Turn javascript: URL into JS code to eval, according to the steps in
    /// <https://html.spec.whatwg.org/multipage/#javascript-protocol>
    pub(crate) fn eval_js_url(global_scope: &GlobalScope, load_data: &mut LoadData, can_gc: CanGc) {
        // This slice of the URL’s serialization is equivalent to (5.) to (7.):

Review comment (suggestion):
Nit:

```suggestion
            document.window().layout().set_accessibility_active(active);
```

Code after:
    ) {
        let Some(document) = self.documents.borrow().find_document(pipeline_id) else {
            warn!("Input event sent to closed pipeline {pipeline_id}.");
            let _ = self
                .senders
                .pipeline_to_embedder_sender
                .send(EmbedderMsg::InputEventHandled(
                    webview_id,
                    event.event.id,
                    Default::default(),
                ));
            return;
        };
        document.event_handler().note_pending_input_event(event);
    }

    fn set_accessibility_active(&self, active: bool) {
        if !(pref!(accessibility_enabled)) {
            return;
        }

        let old_value = self.accessibility_active.replace(active);
        if active == old_value {
            return;
        }

        for (_, document) in self.documents.borrow().iter() {
            document.window().layout().set_accessibility_active(active);
        }
    }

    /// Handle a "navigate an iframe" message from the constellation.
    fn handle_navigate_iframe(
        &self,
        parent_pipeline_id: PipelineId,
        browsing_context_id: BrowsingContextId,
        load_data: LoadData,
        history_handling: NavigationHistoryBehavior,
        can_gc: CanGc,
    ) {
        let iframe = self
            .documents
            .borrow()
            .find_iframe(parent_pipeline_id, browsing_context_id);
        if let Some(iframe) = iframe {
            iframe.navigate_or_reload_child_browsing_context(load_data, history_handling, can_gc);
        }
    }

    /// Turn javascript: URL into JS code to eval, according to the steps in
    /// <https://html.spec.whatwg.org/multipage/#javascript-protocol>