mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Support an equivalent of Trusted<T> for Rc<Promise> objects named TrustedPromise.
This commit is contained in:
parent
27d44c8d10
commit
498ccd41e8
7 changed files with 145 additions and 10 deletions
|
@ -79,6 +79,14 @@ impl Promise {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code, unrooted_must_root)]
|
||||
pub fn duplicate(&self) -> Rc<Promise> {
|
||||
let cx = self.global().r().get_cx();
|
||||
unsafe {
|
||||
Promise::new_with_js_promise(self.reflector().get_jsobject(), cx)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code, unrooted_must_root)]
|
||||
unsafe fn new_with_js_promise(obj: HandleObject, cx: *mut JSContext) -> Rc<Promise> {
|
||||
assert!(IsPromiseObject(obj));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue