mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Prevent moving CanGc values between threads/tasks (#33902)
* Make CanGc non-sendable, and add documentation. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Update CanGc usage to fix usages that were moved between threads/tasks. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
a58da5aa83
commit
b85093ad74
10 changed files with 69 additions and 89 deletions
|
@ -294,7 +294,6 @@ impl ServiceWorkerGlobalScope {
|
|||
control_receiver: Receiver<ServiceWorkerControlMsg>,
|
||||
context_sender: Sender<ThreadSafeJSContext>,
|
||||
closing: Arc<AtomicBool>,
|
||||
can_gc: CanGc,
|
||||
) -> JoinHandle<()> {
|
||||
let ScopeThings {
|
||||
script_url,
|
||||
|
@ -384,7 +383,7 @@ impl ServiceWorkerGlobalScope {
|
|||
scope.execute_script(DOMString::from(source));
|
||||
}
|
||||
|
||||
global.dispatch_activate(can_gc);
|
||||
global.dispatch_activate(CanGc::note());
|
||||
let reporter_name = format!("service-worker-reporter-{}", random::<u64>());
|
||||
scope
|
||||
.upcast::<GlobalScope>()
|
||||
|
@ -398,7 +397,7 @@ impl ServiceWorkerGlobalScope {
|
|||
// which happens after the closing flag is set to true,
|
||||
// or until the worker has run beyond its allocated time.
|
||||
while !scope.is_closing() && !global.has_timed_out() {
|
||||
run_worker_event_loop(&*global, None, can_gc);
|
||||
run_worker_event_loop(&*global, None, CanGc::note());
|
||||
}
|
||||
},
|
||||
reporter_name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue