use ThreadSafeJSContext instead of ContextForRequestInterrupt (#33769)

* use `ThreadSafeJSContext` instead of `ContextForRequestInterrupt`

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* use servo/mozjs

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
Samson 2024-10-10 11:43:51 +02:00 committed by GitHub
parent 61a930402d
commit 7cd73ef4a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 53 additions and 89 deletions

View file

@ -29,7 +29,7 @@ use crate::dom::serviceworkerglobalscope::{
ServiceWorkerControlMsg, ServiceWorkerGlobalScope, ServiceWorkerScriptMsg,
};
use crate::dom::serviceworkerregistration::longest_prefix_match;
use crate::script_runtime::{CanGc, ContextForRequestInterrupt};
use crate::script_runtime::{CanGc, ThreadSafeJSContext};
enum Message {
FromResource(CustomResponseMediator),
@ -103,7 +103,7 @@ impl Drop for ServiceWorkerRegistration {
self.context
.take()
.expect("No context to request interrupt.")
.request_interrupt();
.request_interrupt_callback();
// TODO: Step 1, 2 and 3.
if self
@ -134,7 +134,7 @@ struct ServiceWorkerRegistration {
/// A handle to join on the worker thread.
join_handle: Option<JoinHandle<()>>,
/// A context to request an interrupt.
context: Option<ContextForRequestInterrupt>,
context: Option<ThreadSafeJSContext>,
/// The closing flag for the worker.
closing: Option<Arc<AtomicBool>>,
}
@ -157,7 +157,7 @@ impl ServiceWorkerRegistration {
&mut self,
join_handle: JoinHandle<()>,
control_sender: Sender<ServiceWorkerControlMsg>,
context: ContextForRequestInterrupt,
context: ThreadSafeJSContext,
closing: Arc<AtomicBool>,
) {
assert!(self.join_handle.is_none());
@ -454,7 +454,7 @@ fn update_serviceworker(
ServiceWorker,
JoinHandle<()>,
Sender<ServiceWorkerControlMsg>,
ContextForRequestInterrupt,
ThreadSafeJSContext,
Arc<AtomicBool>,
) {
let (sender, receiver) = unbounded();