Use safe JSContext in MicrotaskQueue

This commit is contained in:
marmeladema 2019-07-27 17:45:17 +01:00
parent b18fa8b8a7
commit 6d444afd9e
4 changed files with 27 additions and 39 deletions

View file

@ -172,6 +172,7 @@ unsafe extern "C" fn enqueue_promise_job(
_allocation_site: HandleObject,
incumbent_global: HandleObject,
) -> bool {
let cx = JSContext::from_ptr(cx);
wrap_panic(
AssertUnwindSafe(|| {
let microtask_queue = &*(extra as *const MicrotaskQueue);
@ -179,7 +180,7 @@ unsafe extern "C" fn enqueue_promise_job(
let pipeline = global.pipeline_id();
microtask_queue.enqueue(
Microtask::Promise(EnqueuedPromiseCallback {
callback: PromiseJobCallback::new(JSContext::from_ptr(cx), job.get()),
callback: PromiseJobCallback::new(cx, job.get()),
pipeline,
}),
cx,