Make Promise::resolve_native actually sound

We shouldn't have to pass a raw JSContext pointer, and to enter the
promise's context's compartment by hand.
This commit is contained in:
Anthony Ramine 2017-09-21 16:00:48 +02:00
parent 658dc8a501
commit 5addc2dfa3
17 changed files with 42 additions and 53 deletions

View file

@ -316,10 +316,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
// Step 16, 16.3
if let Some(promise) = self.when_defined.borrow_mut().remove(&name) {
// 16.1
let cx = promise.global().get_cx();
// 16.2
promise.resolve_native(cx, &UndefinedValue());
promise.resolve_native(&UndefinedValue());
}
Ok(())
}
@ -353,7 +350,7 @@ impl CustomElementRegistryMethods for CustomElementRegistry {
// Step 2
if self.definitions.borrow().contains_key(&name) {
let promise = Promise::new(global_scope);
promise.resolve_native(global_scope.get_cx(), &UndefinedValue());
promise.resolve_native(&UndefinedValue());
return promise
}