Move unsafe to the wrap method for global objects (#38896)

The method now doesn't need unsafe in its signature because it no longer
accepts unsafe pointers as arguments. We move the unsafe marker to the
method itself.

Testing: I opened the browser and went to google.com; I ran some WPT
(IndexedDB) tests.
Fixes: #38361

---------

Signed-off-by: criskell <96352451+criskell@users.noreply.github.com>
This commit is contained in:
criskell 2025-08-25 19:02:55 -03:00 committed by GitHub
parent b9dc228e51
commit 9082217272
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 41 additions and 75 deletions

View file

@ -325,7 +325,6 @@ impl DedicatedWorkerGlobalScope {
control_receiver: Receiver<DedicatedWorkerControlMsg>,
insecure_requests_policy: InsecureRequestsPolicy,
) -> DomRoot<DedicatedWorkerGlobalScope> {
let cx = runtime.cx();
let scope = Box::new(DedicatedWorkerGlobalScope::new_inherited(
init,
worker_name,
@ -344,12 +343,10 @@ impl DedicatedWorkerGlobalScope {
control_receiver,
insecure_requests_policy,
));
unsafe {
DedicatedWorkerGlobalScopeBinding::Wrap::<crate::DomTypeHolder>(
SafeJSContext::from_ptr(cx),
scope,
)
}
DedicatedWorkerGlobalScopeBinding::Wrap::<crate::DomTypeHolder>(
GlobalScope::get_cx(),
scope,
)
}
/// <https://html.spec.whatwg.org/multipage/#run-a-worker>
@ -430,7 +427,6 @@ impl DedicatedWorkerGlobalScope {
Runtime::new_with_parent(Some(parent), Some(task_source))
};
let debugger_global = DebuggerGlobalScope::new(
&runtime,
pipeline_id,
init.to_devtools_sender.clone(),
init.from_devtools_sender