aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/promise.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/promise.rs')
-rw-r--r--components/script/dom/promise.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs
index 41c40fce556..bf475e95ceb 100644
--- a/components/script/dom/promise.rs
+++ b/components/script/dom/promise.rs
@@ -41,7 +41,7 @@ use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
use crate::script_thread::ScriptThread;
#[dom_struct]
-#[crown::unrooted_must_root_lint::allow_unrooted_in_rc]
+#[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_in_rc)]
pub(crate) struct Promise {
reflector: Reflector,
/// Since Promise values are natively reference counted without the knowledge of
@@ -105,7 +105,8 @@ impl Promise {
Promise::new_with_js_promise(self.reflector().get_jsobject(), cx)
}
- #[allow(unsafe_code, crown::unrooted_must_root)]
+ #[allow(unsafe_code)]
+ #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_with_js_promise(obj: HandleObject, cx: SafeJSContext) -> Rc<Promise> {
unsafe {
assert!(IsPromiseObject(obj));
@@ -146,7 +147,8 @@ impl Promise {
}
}
- #[allow(crown::unrooted_must_root, unsafe_code)]
+ #[allow(unsafe_code)]
+ #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_resolved(
global: &GlobalScope,
cx: SafeJSContext,
@@ -162,7 +164,8 @@ impl Promise {
}
}
- #[allow(crown::unrooted_must_root, unsafe_code)]
+ #[allow(unsafe_code)]
+ #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_rejected(
global: &GlobalScope,
cx: SafeJSContext,
@@ -192,7 +195,8 @@ impl Promise {
self.resolve(cx, v.handle());
}
- #[allow(crown::unrooted_must_root, unsafe_code)]
+ #[allow(unsafe_code)]
+ #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn resolve(&self, cx: SafeJSContext, value: HandleValue) {
unsafe {
if !ResolvePromise(*cx, self.promise_obj(), value) {
@@ -226,7 +230,8 @@ impl Promise {
self.reject(cx, v.handle());
}
- #[allow(crown::unrooted_must_root, unsafe_code)]
+ #[allow(unsafe_code)]
+ #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn reject(&self, cx: SafeJSContext, value: HandleValue) {
unsafe {
if !RejectPromise(*cx, self.promise_obj(), value) {