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

Code before:
        };
        let debugger_global = DebuggerGlobalScope::new(
            PipelineId::new(),
            senders.devtools_server_sender.clone(),
            senders.devtools_client_to_script_thread_sender.clone(),
            senders.memory_profiler_sender.clone(),
            senders.time_profiler_sender.clone(),
            script_to_constellation_chan,
            senders.pipeline_to_embedder_sender.clone(),
            state.resource_threads.clone(),
            state.storage_threads.clone(),
            #[cfg(feature = "webgpu")]
            gpu_id_hub.clone(),
            CanGc::note(),
        );

        debugger_global.execute(CanGc::note());

        let user_contents_for_manager_id =
            FxHashMap::from_iter(state.user_contents_for_manager_id.into_iter().map(
                |(user_content_manager_id, user_contents)| {
                    (user_content_manager_id, Rc::new(user_contents))
                },
            ));

        Rc::new_cyclic(|weak_script_thread| ScriptThread {
            documents: DomRefCell::new(DocumentCollection::default()),
            last_render_opportunity_time: Default::default(),
            window_proxies: Default::default(),
            incomplete_loads: DomRefCell::new(vec![]),
            incomplete_parser_contexts: IncompleteParserContexts(RefCell::new(vec![])),
            senders,
            receivers,
            image_cache_factory,
            resource_threads: state.resource_threads,
            storage_threads: state.storage_threads,
            task_queue,
            background_hang_monitor,
            closing,
            timer_scheduler: Default::default(),
            microtask_queue,
            js_runtime,
            closed_pipelines: DomRefCell::new(FxHashSet::default()),
            mutation_observers: Default::default(),
            system_font_service: Arc::new(state.system_font_service.to_proxy()),
            webgl_chan: state.webgl_chan,
            #[cfg(feature = "webxr")]
            webxr_registry: state.webxr_registry,
            worklet_thread_pool: Default::default(),
            docs_with_no_blocking_loads: Default::default(),
            custom_element_reaction_stack: Rc::new(CustomElementReactionStack::new()),

Review comment (suggestion):
```suggestion
        Rc::new_cyclic(|weak_script_thread| Self {
```

Code after:
            pipeline_id: debugger_pipeline_id,
        };
        let debugger_global = DebuggerGlobalScope::new(
            PipelineId::new(),
            senders.devtools_server_sender.clone(),
            senders.devtools_client_to_script_thread_sender.clone(),
            senders.memory_profiler_sender.clone(),
            senders.time_profiler_sender.clone(),
            script_to_constellation_chan,
            senders.pipeline_to_embedder_sender.clone(),
            state.resource_threads.clone(),
            state.storage_threads.clone(),
            #[cfg(feature = "webgpu")]
            gpu_id_hub.clone(),
            CanGc::note(),
        );

        debugger_global.execute(CanGc::note());

        let user_contents_for_manager_id =
            FxHashMap::from_iter(state.user_contents_for_manager_id.into_iter().map(
                |(user_content_manager_id, user_contents)| {
                    (user_content_manager_id, Rc::new(user_contents))
                },
            ));

        Rc::new_cyclic(|weak_script_thread| Self {
            documents: DomRefCell::new(DocumentCollection::default()),
            last_render_opportunity_time: Default::default(),
            window_proxies: Default::default(),
            incomplete_loads: DomRefCell::new(vec![]),
            incomplete_parser_contexts: IncompleteParserContexts(RefCell::new(vec![])),
            senders,
            receivers,
            image_cache_factory,
            resource_threads: state.resource_threads,
            storage_threads: state.storage_threads,
            task_queue,
            background_hang_monitor,
            closing,
            timer_scheduler: Default::default(),
            microtask_queue,
            js_runtime,
            closed_pipelines: DomRefCell::new(FxHashSet::default()),
            mutation_observers: Default::default(),
            system_font_service: Arc::new(state.system_font_service.to_proxy()),
            webgl_chan: state.webgl_chan,
            #[cfg(feature = "webxr")]
            webxr_registry: state.webxr_registry,
            worklet_thread_pool: Default::default(),
            docs_with_no_blocking_loads: Default::default(),