aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_runtime.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-08-08 22:21:19 -0400
committerGitHub <noreply@github.com>2019-08-08 22:21:19 -0400
commitda559d47b93854e4c7d4acf0a0d2029a9e643794 (patch)
treedc4ca99a5b09804cf93e01c71953c7fe4556cf57 /components/script/script_runtime.rs
parent337703e03f3c9cc515de2613a56faac04df49a7d (diff)
parent357b6c54ff053fdd9e17832c06d7acdcbcb07991 (diff)
downloadservo-da559d47b93854e4c7d4acf0a0d2029a9e643794.tar.gz
servo-da559d47b93854e4c7d4acf0a0d2029a9e643794.zip
Auto merge of #23872 - marmeladema:issue-20377, r=jdm
Make DOM bindings methods not take raw JSContext pointers. Part 2. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #20377 <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23872) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_runtime.rs')
-rw-r--r--components/script/script_runtime.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs
index fb94d30fafd..a460d1af1b5 100644
--- a/components/script/script_runtime.rs
+++ b/components/script/script_runtime.rs
@@ -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,
@@ -201,7 +202,8 @@ unsafe extern "C" fn promise_rejection_tracker(
// TODO: Step 2 - If script's muted errors is true, terminate these steps.
// Step 3.
- let global = GlobalScope::from_context(cx);
+ let cx = JSContext::from_ptr(cx);
+ let global = GlobalScope::from_context(*cx);
wrap_panic(
AssertUnwindSafe(|| {
@@ -281,7 +283,7 @@ pub fn notify_about_rejected_promises(global: &GlobalScope) {
.iter()
.map(|promise| {
let promise =
- Promise::new_with_js_promise(Handle::from_raw(promise.handle()), *cx);
+ Promise::new_with_js_promise(Handle::from_raw(promise.handle()), cx);
TrustedPromise::new(promise)
})