mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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:
parent
658dc8a501
commit
5addc2dfa3
17 changed files with 42 additions and 53 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue