diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-10-16 01:11:31 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-16 08:11:31 +0000 |
commit | 30abb99287790c2653821cc469ecd891b89ab57c (patch) | |
tree | 9d9187cd6a0ca7133096315044b24dcf75871a65 /components/script/dom/workerglobalscope.rs | |
parent | ed959d7a1a2a584803f689ce8d92f7d0c3c0d48b (diff) | |
download | servo-30abb99287790c2653821cc469ecd891b89ab57c.tar.gz servo-30abb99287790c2653821cc469ecd891b89ab57c.zip |
clippy: Add safety documentation and clean up unsafe methods (#33748)
This change:
1. Adds safety documentation where it was missing.
2. Limits the scope of unsafe code in some cases to where it is actually
unsafe.
3. Converts some free functions to associated functions and methods,
thereby making them more likely to be called safely.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script/dom/workerglobalscope.rs')
-rw-r--r-- | components/script/dom/workerglobalscope.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 91d21feb945..2e77790cdcf 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -54,9 +54,7 @@ use crate::dom::workerlocation::WorkerLocation; use crate::dom::workernavigator::WorkerNavigator; use crate::fetch; use crate::realms::{enter_realm, InRealm}; -use crate::script_runtime::{ - get_reports, CanGc, CommonScriptMsg, JSContext, Runtime, ScriptChan, ScriptPort, -}; +use crate::script_runtime::{CanGc, CommonScriptMsg, JSContext, Runtime, ScriptChan, ScriptPort}; use crate::task::TaskCanceller; use crate::task_source::dom_manipulation::DOMManipulationTaskSource; use crate::task_source::file_reading::FileReadingTaskSource; @@ -539,8 +537,7 @@ impl WorkerGlobalScope { CommonScriptMsg::Task(_, task, _, _) => task.run_box(), CommonScriptMsg::CollectReports(reports_chan) => { let cx = self.get_cx(); - let path_seg = format!("url({})", self.get_url()); - let reports = unsafe { get_reports(*cx, path_seg) }; + let reports = cx.get_reports(format!("url({})", self.get_url())); reports_chan.send(reports); }, } |