script: Feature-gate all crown support. (#35055)

* script: Feature-gate all crown support.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Use cfg(crown) instead of a cargo feature.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-01-18 16:36:15 -05:00 committed by GitHub
parent 1bd34a5781
commit 875e387004
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
223 changed files with 442 additions and 417 deletions

View file

@ -13,7 +13,7 @@ pub fn dom_struct(args: TokenStream, input: TokenStream) -> TokenStream {
} }
let attributes = quote! { let attributes = quote! {
#[derive(deny_public_fields::DenyPublicFields, domobject_derive::DomObject, JSTraceable, MallocSizeOf)] #[derive(deny_public_fields::DenyPublicFields, domobject_derive::DomObject, JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
#[repr(C)] #[repr(C)]
}; };

View file

@ -13,6 +13,7 @@ name = "script"
path = "lib.rs" path = "lib.rs"
[features] [features]
crown = ['js/crown']
debugmozjs = ['js/debugmozjs'] debugmozjs = ['js/debugmozjs']
jitspew = ['js/jitspew'] jitspew = ['js/jitspew']
profilemozjs = ['js/profilemozjs'] profilemozjs = ['js/profilemozjs']
@ -23,6 +24,9 @@ refcell_backtrace = ["accountable-refcell"]
webxr = ["webxr-api"] webxr = ["webxr-api"]
webgpu = [] webgpu = []
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(crown)'] }
[build-dependencies] [build-dependencies]
phf_codegen = "0.11" phf_codegen = "0.11"
phf_shared = "0.11" phf_shared = "0.11"
@ -72,7 +76,7 @@ image = { workspace = true }
indexmap = { workspace = true } indexmap = { workspace = true }
ipc-channel = { workspace = true } ipc-channel = { workspace = true }
itertools = { workspace = true } itertools = { workspace = true }
js = { package = "mozjs", git = "https://github.com/servo/mozjs", features = ["crown"] } js = { package = "mozjs", git = "https://github.com/servo/mozjs" }
jstraceable_derive = { path = "../jstraceable_derive" } jstraceable_derive = { path = "../jstraceable_derive" }
keyboard-types = { workspace = true } keyboard-types = { workspace = true }
libc = { workspace = true } libc = { workspace = true }

View file

@ -37,7 +37,7 @@ use crate::script_runtime::CanGc;
/// The set of animations for a document. /// The set of animations for a document.
#[derive(Default, JSTraceable, MallocSizeOf)] #[derive(Default, JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct Animations { pub(crate) struct Animations {
/// The map of nodes to their animation states. /// The map of nodes to their animation states.
#[no_trace] #[no_trace]

View file

@ -267,7 +267,7 @@ impl TransmitBodyConnectHandler {
/// The handler of read promises of body streams used in /// The handler of read promises of body streams used in
/// <https://fetch.spec.whatwg.org/#concept-request-transmit-body>. /// <https://fetch.spec.whatwg.org/#concept-request-transmit-body>.
#[derive(Clone, JSTraceable, MallocSizeOf)] #[derive(Clone, JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
struct TransmitBodyPromiseHandler { struct TransmitBodyPromiseHandler {
#[ignore_malloc_size_of = "Channels are hard"] #[ignore_malloc_size_of = "Channels are hard"]
#[no_trace] #[no_trace]
@ -605,7 +605,7 @@ impl Callback for ConsumeBodyPromiseRejectionHandler {
impl js::gc::Rootable for ConsumeBodyPromiseHandler {} impl js::gc::Rootable for ConsumeBodyPromiseHandler {}
#[derive(Clone, JSTraceable, MallocSizeOf)] #[derive(Clone, JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
/// The promise handler used to consume the body, /// The promise handler used to consume the body,
/// <https://fetch.spec.whatwg.org/#concept-body-consume-body> /// <https://fetch.spec.whatwg.org/#concept-body-consume-body>
struct ConsumeBodyPromiseHandler { struct ConsumeBodyPromiseHandler {
@ -645,7 +645,7 @@ impl ConsumeBodyPromiseHandler {
impl Callback for ConsumeBodyPromiseHandler { impl Callback for ConsumeBodyPromiseHandler {
/// Continuing Step 4 of <https://fetch.spec.whatwg.org/#concept-body-consume-body> /// Continuing Step 4 of <https://fetch.spec.whatwg.org/#concept-body-consume-body>
/// Step 3 of <https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream>. /// Step 3 of <https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream>.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn callback(&self, cx: JSContext, v: HandleValue, _realm: InRealm, can_gc: CanGc) { fn callback(&self, cx: JSContext, v: HandleValue, _realm: InRealm, can_gc: CanGc) {
let stream = self let stream = self
.stream .stream
@ -711,7 +711,7 @@ impl Callback for ConsumeBodyPromiseHandler {
} }
// https://fetch.spec.whatwg.org/#concept-body-consume-body // https://fetch.spec.whatwg.org/#concept-body-consume-body
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn consume_body<T: BodyMixin + DomObject>( pub(crate) fn consume_body<T: BodyMixin + DomObject>(
object: &T, object: &T,
body_type: BodyType, body_type: BodyType,

View file

@ -60,7 +60,7 @@ use crate::dom::textmetrics::TextMetrics;
use crate::script_runtime::CanGc; use crate::script_runtime::CanGc;
use crate::unpremultiplytable::UNPREMULTIPLY_TABLE; use crate::unpremultiplytable::UNPREMULTIPLY_TABLE;
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
#[derive(Clone, JSTraceable, MallocSizeOf)] #[derive(Clone, JSTraceable, MallocSizeOf)]
#[allow(dead_code)] #[allow(dead_code)]
pub(crate) enum CanvasFillOrStrokeStyle { pub(crate) enum CanvasFillOrStrokeStyle {
@ -79,7 +79,7 @@ impl CanvasFillOrStrokeStyle {
} }
} }
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
#[derive(Clone, JSTraceable, MallocSizeOf)] #[derive(Clone, JSTraceable, MallocSizeOf)]
pub(crate) struct CanvasContextState { pub(crate) struct CanvasContextState {
global_alpha: f64, global_alpha: f64,
@ -138,7 +138,7 @@ impl CanvasContextState {
} }
} }
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
pub(crate) struct CanvasState { pub(crate) struct CanvasState {
#[ignore_malloc_size_of = "Defined in ipc-channel"] #[ignore_malloc_size_of = "Defined in ipc-channel"]
@ -959,7 +959,7 @@ impl CanvasState {
self.send_canvas_2d_msg(Canvas2dMsg::SaveContext); self.send_canvas_2d_msg(Canvas2dMsg::SaveContext);
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
// https://html.spec.whatwg.org/multipage/#dom-context-2d-restore // https://html.spec.whatwg.org/multipage/#dom-context-2d-restore
pub(crate) fn restore(&self) { pub(crate) fn restore(&self) {
let mut saved_states = self.saved_states.borrow_mut(); let mut saved_states = self.saved_states.borrow_mut();

View file

@ -216,7 +216,7 @@ pub(crate) fn handle_get_attribute_style(
reply.send(Some(msg)).unwrap(); reply.send(Some(msg)).unwrap();
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn handle_get_stylesheet_style( pub(crate) fn handle_get_stylesheet_style(
documents: &DocumentCollection, documents: &DocumentCollection,
pipeline: PipelineId, pipeline: PipelineId,
@ -263,7 +263,7 @@ pub(crate) fn handle_get_stylesheet_style(
reply.send(msg).unwrap(); reply.send(msg).unwrap();
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn handle_get_selectors( pub(crate) fn handle_get_selectors(
documents: &DocumentCollection, documents: &DocumentCollection,
pipeline: PipelineId, pipeline: PipelineId,

View file

@ -18,7 +18,7 @@ use crate::dom::window::Window;
/// This is stored as a mapping of [`PipelineId`] to [`Document`], but for updating the /// This is stored as a mapping of [`PipelineId`] to [`Document`], but for updating the
/// rendering, [`Document`]s should be processed in order via [`Self::documents_in_order`]. /// rendering, [`Document`]s should be processed in order via [`Self::documents_in_order`].
#[derive(JSTraceable)] #[derive(JSTraceable)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct DocumentCollection { pub(crate) struct DocumentCollection {
map: HashMapTracedValues<PipelineId, Dom<Document>>, map: HashMapTracedValues<PipelineId, Dom<Document>>,
} }
@ -92,7 +92,7 @@ impl DocumentCollection {
} }
impl Default for DocumentCollection { impl Default for DocumentCollection {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn default() -> Self { fn default() -> Self {
Self { Self {
map: HashMapTracedValues::new(), map: HashMapTracedValues::new(),
@ -100,7 +100,7 @@ impl Default for DocumentCollection {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) struct DocumentsIter<'a> { pub(crate) struct DocumentsIter<'a> {
iter: hash_map::Iter<'a, PipelineId, Dom<Document>>, iter: hash_map::Iter<'a, PipelineId, Dom<Document>>,
} }

View file

@ -30,7 +30,7 @@ pub(crate) enum LoadType {
/// created via DocumentLoader::fetch_async) are always removed by the time /// created via DocumentLoader::fetch_async) are always removed by the time
/// that the owner is destroyed. /// that the owner is destroyed.
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct LoadBlocker { pub(crate) struct LoadBlocker {
/// The document whose load event is blocked by this object existing. /// The document whose load event is blocked by this object existing.
doc: Dom<Document>, doc: Dom<Document>,

View file

@ -94,7 +94,7 @@ impl AbstractRangeMethods<crate::DomTypeHolder> for AbstractRange {
} }
#[derive(DenyPublicFields, JSTraceable, MallocSizeOf)] #[derive(DenyPublicFields, JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct BoundaryPoint { pub(crate) struct BoundaryPoint {
node: MutDom<Node>, node: MutDom<Node>,
offset: Cell<u32>, offset: Cell<u32>,
@ -123,7 +123,7 @@ impl BoundaryPoint {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
impl PartialOrd for BoundaryPoint { impl PartialOrd for BoundaryPoint {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
bp_position( bp_position(
@ -135,7 +135,7 @@ impl PartialOrd for BoundaryPoint {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
impl PartialEq for BoundaryPoint { impl PartialEq for BoundaryPoint {
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
self.node.get() == other.node.get() && self.offset.get() == other.offset.get() self.node.get() == other.node.get() && self.offset.get() == other.offset.get()

View file

@ -37,7 +37,7 @@ pub(crate) struct AnalyserNode {
} }
impl AnalyserNode { impl AnalyserNode {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited( pub(crate) fn new_inherited(
_: &Window, _: &Window,
context: &BaseAudioContext, context: &BaseAudioContext,
@ -100,7 +100,7 @@ impl AnalyserNode {
Self::new_with_proto(window, None, context, options, can_gc) Self::new_with_proto(window, None, context, options, can_gc)
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_with_proto( pub(crate) fn new_with_proto(
window: &Window, window: &Window,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -59,7 +59,7 @@ pub(crate) struct AudioBuffer {
} }
impl AudioBuffer { impl AudioBuffer {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited( pub(crate) fn new_inherited(
number_of_channels: u32, number_of_channels: u32,
length: u32, length: u32,
@ -98,7 +98,7 @@ impl AudioBuffer {
) )
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_with_proto( fn new_with_proto(
global: &Window, global: &Window,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -43,7 +43,7 @@ pub(crate) struct AudioBufferSourceNode {
} }
impl AudioBufferSourceNode { impl AudioBufferSourceNode {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_inherited( fn new_inherited(
window: &Window, window: &Window,
context: &BaseAudioContext, context: &BaseAudioContext,
@ -105,7 +105,7 @@ impl AudioBufferSourceNode {
Self::new_with_proto(window, None, context, options, can_gc) Self::new_with_proto(window, None, context, options, can_gc)
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_with_proto( fn new_with_proto(
window: &Window, window: &Window,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -47,7 +47,7 @@ pub(crate) struct AudioContext {
} }
impl AudioContext { impl AudioContext {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
// https://webaudio.github.io/web-audio-api/#AudioContext-constructors // https://webaudio.github.io/web-audio-api/#AudioContext-constructors
fn new_inherited( fn new_inherited(
options: &AudioContextOptions, options: &AudioContextOptions,
@ -82,7 +82,7 @@ impl AudioContext {
}) })
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new( fn new(
window: &Window, window: &Window,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -38,7 +38,7 @@ impl AudioDestinationNode {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
global: &GlobalScope, global: &GlobalScope,
context: &BaseAudioContext, context: &BaseAudioContext,

View file

@ -153,7 +153,7 @@ impl AudioListener {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
context: &BaseAudioContext, context: &BaseAudioContext,

View file

@ -66,7 +66,8 @@ impl AudioParam {
} }
} }
#[allow(crown::unrooted_must_root, clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
context: &BaseAudioContext, context: &BaseAudioContext,

View file

@ -26,7 +26,7 @@ pub(crate) struct AudioScheduledSourceNode {
} }
impl AudioScheduledSourceNode { impl AudioScheduledSourceNode {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited( pub(crate) fn new_inherited(
node_type: AudioNodeInit, node_type: AudioNodeInit,
context: &BaseAudioContext, context: &BaseAudioContext,

View file

@ -112,7 +112,7 @@ pub(crate) struct BaseAudioContext {
} }
impl BaseAudioContext { impl BaseAudioContext {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited( pub(crate) fn new_inherited(
options: BaseAudioContextOptions, options: BaseAudioContextOptions,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -196,9 +196,9 @@ impl BaseAudioContext {
/// does not take a list of promises to fulfill. Callers cannot just pop /// does not take a list of promises to fulfill. Callers cannot just pop
/// the front list off of `in_flight_resume_promises_queue` and later fulfill /// the front list off of `in_flight_resume_promises_queue` and later fulfill
/// the promises because that would mean putting /// the promises because that would mean putting
/// `#[allow(crown::unrooted_must_root)]` on even more functions, potentially /// `#[cfg_attr(crown, allow(crown::unrooted_must_root))]` on even more functions, potentially
/// hiding actual safety bugs. /// hiding actual safety bugs.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn fulfill_in_flight_resume_promises<F>(&self, f: F) fn fulfill_in_flight_resume_promises<F>(&self, f: F)
where where
F: FnOnce(), F: FnOnce(),

View file

@ -41,7 +41,7 @@ pub(crate) enum ExceptionHandling {
/// A common base class for representing IDL callback function and /// A common base class for representing IDL callback function and
/// callback interface types. /// callback interface types.
#[derive(JSTraceable)] #[derive(JSTraceable)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct CallbackObject { pub(crate) struct CallbackObject {
/// The underlying `JSObject`. /// The underlying `JSObject`.
callback: Heap<*mut JSObject>, callback: Heap<*mut JSObject>,
@ -62,7 +62,7 @@ pub(crate) struct CallbackObject {
} }
impl CallbackObject { impl CallbackObject {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
// These are used by the bindings and do not need `default()` functions. // These are used by the bindings and do not need `default()` functions.
#[allow(clippy::new_without_default)] #[allow(clippy::new_without_default)]
fn new() -> CallbackObject { fn new() -> CallbackObject {
@ -128,14 +128,14 @@ pub(crate) trait CallbackContainer {
/// A common base class for representing IDL callback function types. /// A common base class for representing IDL callback function types.
#[derive(JSTraceable, PartialEq)] #[derive(JSTraceable, PartialEq)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct CallbackFunction { pub(crate) struct CallbackFunction {
object: CallbackObject, object: CallbackObject,
} }
impl CallbackFunction { impl CallbackFunction {
/// Create a new `CallbackFunction` for this object. /// Create a new `CallbackFunction` for this object.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
// These are used by the bindings and do not need `default()` functions. // These are used by the bindings and do not need `default()` functions.
#[allow(clippy::new_without_default)] #[allow(clippy::new_without_default)]
pub(crate) fn new() -> CallbackFunction { pub(crate) fn new() -> CallbackFunction {
@ -158,7 +158,7 @@ impl CallbackFunction {
/// A common base class for representing IDL callback interface types. /// A common base class for representing IDL callback interface types.
#[derive(JSTraceable, PartialEq)] #[derive(JSTraceable, PartialEq)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct CallbackInterface { pub(crate) struct CallbackInterface {
object: CallbackObject, object: CallbackObject,
} }
@ -260,7 +260,7 @@ pub(crate) struct CallSetup {
impl CallSetup { impl CallSetup {
/// Performs the setup needed to make a call. /// Performs the setup needed to make a call.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new<T: CallbackContainer>( pub(crate) fn new<T: CallbackContainer>(
callback: &T, callback: &T,
handling: ExceptionHandling, handling: ExceptionHandling,

View file

@ -2725,8 +2725,11 @@ def DomTypes(descriptors, descriptorProvider, dictionaries, callbacks, typedefs,
traits += [f"crate::dom::bindings::codegen::Bindings::{namespace}::{iface_name}Methods<Self>"] traits += [f"crate::dom::bindings::codegen::Bindings::{namespace}::{iface_name}Methods<Self>"]
isPromise = firstCap(iface_name) == "Promise" isPromise = firstCap(iface_name) == "Promise"
elements += [ elements += [
CGGeneric(" #[crown::unrooted_must_root_lint::must_root]\n"), CGGeneric(" #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]\n"),
CGGeneric(" #[crown::unrooted_must_root_lint::allow_unrooted_in_rc]\n" if isPromise else ""), CGGeneric(
" #[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_in_rc)]\n"
if isPromise else ""
),
CGGeneric(f" type {firstCap(iface_name)}: {' + '.join(traits)};\n") CGGeneric(f" type {firstCap(iface_name)}: {' + '.join(traits)};\n")
] ]
elements += [CGGeneric("}\n")] elements += [CGGeneric("}\n")]
@ -3017,7 +3020,8 @@ class CGWrapMethod(CGAbstractMethod):
Argument('CanGc', '_can_gc')] Argument('CanGc', '_can_gc')]
retval = f'DomRoot<{descriptor.concreteType}>' retval = f'DomRoot<{descriptor.concreteType}>'
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args, CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args,
pub=True, unsafe=True, extra_decorators=['#[allow(crown::unrooted_must_root)]']) pub=True, unsafe=True,
extra_decorators=['#[cfg_attr(crown, allow(crown::unrooted_must_root))]'])
def definition_body(self): def definition_body(self):
unforgeable = CopyLegacyUnforgeablePropertiesToInstance(self.descriptor) unforgeable = CopyLegacyUnforgeablePropertiesToInstance(self.descriptor)
@ -3109,7 +3113,8 @@ class CGWrapGlobalMethod(CGAbstractMethod):
Argument(f"Box<{descriptor.concreteType}>", 'object')] Argument(f"Box<{descriptor.concreteType}>", 'object')]
retval = f'DomRoot<{descriptor.concreteType}>' retval = f'DomRoot<{descriptor.concreteType}>'
CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args, CGAbstractMethod.__init__(self, descriptor, 'Wrap', retval, args,
pub=True, unsafe=True, extra_decorators=['#[allow(crown::unrooted_must_root)]']) pub=True, unsafe=True,
extra_decorators=['#[cfg_attr(crown, allow(crown::unrooted_must_root))]'])
self.properties = properties self.properties = properties
def definition_body(self): def definition_body(self):
@ -7037,7 +7042,7 @@ class CGDictionary(CGThing):
default = "" default = ""
mustRoot = "" mustRoot = ""
if self.membersNeedTracing(): if self.membersNeedTracing():
mustRoot = "#[crown::unrooted_must_root_lint::must_root]\n" mustRoot = "#[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]\n"
# We can't unconditionally derive Default here, because union types can have unique # We can't unconditionally derive Default here, because union types can have unique
# default values provided for each usage. Instead, whenever possible we re-use the empty() # default values provided for each usage. Instead, whenever possible we re-use the empty()
@ -7628,8 +7633,8 @@ class CGCallback(CGClass):
constructors=self.getConstructors(), constructors=self.getConstructors(),
methods=realMethods, methods=realMethods,
decorators="#[derive(JSTraceable, PartialEq)]\n" decorators="#[derive(JSTraceable, PartialEq)]\n"
"#[allow(crown::unrooted_must_root)]\n" "#[cfg_attr(crown, allow(crown::unrooted_must_root))]\n"
"#[crown::unrooted_must_root_lint::allow_unrooted_interior]") "#[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_interior)]")
def getConstructors(self): def getConstructors(self):
return [ClassConstructor( return [ClassConstructor(

View file

@ -55,7 +55,7 @@ pub(crate) trait Castable: IDLInterface + DomObject + Sized {
#[allow(missing_docs)] #[allow(missing_docs)]
pub(crate) trait HasParent { pub(crate) trait HasParent {
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
type Parent; type Parent;
fn as_parent(&self) -> &Self::Parent; fn as_parent(&self) -> &Self::Parent;
} }

View file

@ -83,7 +83,7 @@ impl TrustedPromise {
/// Create a new `TrustedPromise` instance from an existing DOM object. The object will /// Create a new `TrustedPromise` instance from an existing DOM object. The object will
/// be prevented from being GCed for the duration of the resulting `TrustedPromise` object's /// be prevented from being GCed for the duration of the resulting `TrustedPromise` object's
/// lifetime. /// lifetime.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new(promise: Rc<Promise>) -> TrustedPromise { pub(crate) fn new(promise: Rc<Promise>) -> TrustedPromise {
LIVE_REFERENCES.with(|r| { LIVE_REFERENCES.with(|r| {
let r = r.borrow(); let r = r.borrow();
@ -133,7 +133,7 @@ impl TrustedPromise {
} }
/// A task which will reject the promise. /// A task which will reject the promise.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn reject_task(self, error: Error) -> impl TaskOnce { pub(crate) fn reject_task(self, error: Error) -> impl TaskOnce {
let this = self; let this = self;
task!(reject_promise: move || { task!(reject_promise: move || {
@ -143,7 +143,7 @@ impl TrustedPromise {
} }
/// A task which will resolve the promise. /// A task which will resolve the promise.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn resolve_task<T>(self, value: T) -> impl TaskOnce pub(crate) fn resolve_task<T>(self, value: T) -> impl TaskOnce
where where
T: ToJSValConvertible + Send, T: ToJSValConvertible + Send,
@ -160,7 +160,7 @@ impl TrustedPromise {
/// shared among threads for use in asynchronous operations. The underlying /// shared among threads for use in asynchronous operations. The underlying
/// DOM object is guaranteed to live at least as long as the last outstanding /// DOM object is guaranteed to live at least as long as the last outstanding
/// `Trusted<T>` instance. /// `Trusted<T>` instance.
#[crown::unrooted_must_root_lint::allow_unrooted_interior] #[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_interior)]
#[derive(MallocSizeOf)] #[derive(MallocSizeOf)]
pub(crate) struct Trusted<T: DomObject> { pub(crate) struct Trusted<T: DomObject> {
/// A pointer to the Rust DOM object of type T, but void to allow /// A pointer to the Rust DOM object of type T, but void to allow
@ -226,7 +226,7 @@ impl<T: DomObject> Clone for Trusted<T> {
/// The set of live, pinned DOM objects that are currently prevented /// The set of live, pinned DOM objects that are currently prevented
/// from being garbage collected due to outstanding references. /// from being garbage collected due to outstanding references.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) struct LiveDOMReferences { pub(crate) struct LiveDOMReferences {
// keyed on pointer to Rust DOM object // keyed on pointer to Rust DOM object
reflectable_table: RefCell<HashMap<*const libc::c_void, Weak<TrustedReference>>>, reflectable_table: RefCell<HashMap<*const libc::c_void, Weak<TrustedReference>>>,
@ -250,7 +250,7 @@ impl LiveDOMReferences {
}); });
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn addref_promise(&self, promise: Rc<Promise>) { fn addref_promise(&self, promise: Rc<Promise>) {
let mut table = self.promise_table.borrow_mut(); let mut table = self.promise_table.borrow_mut();
table.entry(&*promise).or_default().push(promise) table.entry(&*promise).or_default().push(promise)
@ -301,7 +301,7 @@ fn remove_nulls<K: Eq + Hash + Clone, V>(table: &mut HashMap<K, Weak<V>>) {
} }
/// A JSTraceDataOp for tracing reflectors held in LIVE_REFERENCES /// A JSTraceDataOp for tracing reflectors held in LIVE_REFERENCES
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) unsafe fn trace_refcounted_objects(tracer: *mut JSTracer) { pub(crate) unsafe fn trace_refcounted_objects(tracer: *mut JSTracer) {
trace!("tracing live refcounted references"); trace!("tracing live refcounted references");
LIVE_REFERENCES.with(|r| { LIVE_REFERENCES.with(|r| {

View file

@ -43,16 +43,16 @@ where
} }
/// A struct to store a reference to the reflector of a DOM object. /// A struct to store a reference to the reflector of a DOM object.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
#[derive(MallocSizeOf)] #[derive(MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
// If you're renaming or moving this field, update the path in plugins::reflector as well // If you're renaming or moving this field, update the path in plugins::reflector as well
pub(crate) struct Reflector { pub(crate) struct Reflector {
#[ignore_malloc_size_of = "defined and measured in rust-mozjs"] #[ignore_malloc_size_of = "defined and measured in rust-mozjs"]
object: Heap<*mut JSObject>, object: Heap<*mut JSObject>,
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
impl PartialEq for Reflector { impl PartialEq for Reflector {
fn eq(&self, other: &Reflector) -> bool { fn eq(&self, other: &Reflector) -> bool {
self.object.get() == other.object.get() self.object.get() == other.object.get()

View file

@ -43,8 +43,8 @@ use crate::dom::bindings::trace::{trace_reflector, JSTraceable};
use crate::dom::node::Node; use crate::dom::node::Node;
/// A rooted value. /// A rooted value.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
#[crown::unrooted_must_root_lint::allow_unrooted_interior] #[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_interior)]
pub(crate) struct Root<T: StableTraceObject> { pub(crate) struct Root<T: StableTraceObject> {
/// The value to root. /// The value to root.
value: T, value: T,
@ -59,7 +59,7 @@ where
/// Create a new stack-bounded root for the provided value. /// Create a new stack-bounded root for the provided value.
/// It cannot outlive its associated `RootCollection`, and it gives /// It cannot outlive its associated `RootCollection`, and it gives
/// out references which cannot outlive this new `Root`. /// out references which cannot outlive this new `Root`.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) unsafe fn new(value: T) -> Self { pub(crate) unsafe fn new(value: T) -> Self {
unsafe fn add_to_root_list(object: *const dyn JSTraceable) -> *const RootCollection { unsafe fn add_to_root_list(object: *const dyn JSTraceable) -> *const RootCollection {
assert_in_script(); assert_in_script();
@ -99,7 +99,7 @@ where
// The JSTraceable impl for Reflector doesn't actually do anything, // The JSTraceable impl for Reflector doesn't actually do anything,
// so we need this shenanigan to actually trace the reflector of the // so we need this shenanigan to actually trace the reflector of the
// T pointer in Dom<T>. // T pointer in Dom<T>.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
struct ReflectorStackRoot(Reflector); struct ReflectorStackRoot(Reflector);
unsafe impl JSTraceable for ReflectorStackRoot { unsafe impl JSTraceable for ReflectorStackRoot {
unsafe fn trace(&self, tracer: *mut JSTracer) { unsafe fn trace(&self, tracer: *mut JSTracer) {
@ -118,7 +118,7 @@ where
// The JSTraceable impl for Reflector doesn't actually do anything, // The JSTraceable impl for Reflector doesn't actually do anything,
// so we need this shenanigan to actually trace the reflector of the // so we need this shenanigan to actually trace the reflector of the
// T pointer in Dom<T>. // T pointer in Dom<T>.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
struct MaybeUnreflectedStackRoot<T>(T); struct MaybeUnreflectedStackRoot<T>(T);
unsafe impl<T> JSTraceable for MaybeUnreflectedStackRoot<T> unsafe impl<T> JSTraceable for MaybeUnreflectedStackRoot<T>
where where
@ -197,7 +197,7 @@ impl<T: DomObject> DomRoot<T> {
/// ///
/// This should never be used to create on-stack values. Instead these values should always /// This should never be used to create on-stack values. Instead these values should always
/// end up as members of other DOM objects. /// end up as members of other DOM objects.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn as_traced(&self) -> Dom<T> { pub(crate) fn as_traced(&self) -> Dom<T> {
Dom::from_ref(self) Dom::from_ref(self)
} }
@ -335,7 +335,7 @@ where
/// on the stack, the `Dom<T>` can point to freed memory. /// on the stack, the `Dom<T>` can point to freed memory.
/// ///
/// This should only be used as a field in other DOM objects. /// This should only be used as a field in other DOM objects.
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct Dom<T> { pub(crate) struct Dom<T> {
ptr: ptr::NonNull<T>, ptr: ptr::NonNull<T>,
} }
@ -364,7 +364,7 @@ impl<T> Dom<T> {
impl<T: DomObject> Dom<T> { impl<T: DomObject> Dom<T> {
/// Create a `Dom<T>` from a `&T` /// Create a `Dom<T>` from a `&T`
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn from_ref(obj: &T) -> Dom<T> { pub(crate) fn from_ref(obj: &T) -> Dom<T> {
assert_in_script(); assert_in_script();
Dom { Dom {
@ -403,7 +403,7 @@ unsafe impl<T: DomObject> JSTraceable for Dom<T> {
} }
/// A traced reference to a DOM object that may not be reflected yet. /// A traced reference to a DOM object that may not be reflected yet.
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct MaybeUnreflectedDom<T> { pub(crate) struct MaybeUnreflectedDom<T> {
ptr: ptr::NonNull<T>, ptr: ptr::NonNull<T>,
} }
@ -412,7 +412,7 @@ impl<T> MaybeUnreflectedDom<T>
where where
T: DomObject, T: DomObject,
{ {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) unsafe fn from_box(value: Box<T>) -> Self { pub(crate) unsafe fn from_box(value: Box<T>) -> Self {
Self { Self {
ptr: Box::leak(value).into(), ptr: Box::leak(value).into(),
@ -444,7 +444,7 @@ where
/// An unrooted reference to a DOM object for use in layout. `Layout*Helpers` /// An unrooted reference to a DOM object for use in layout. `Layout*Helpers`
/// traits must be implemented on this. /// traits must be implemented on this.
#[crown::unrooted_must_root_lint::allow_unrooted_interior] #[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_interior)]
pub(crate) struct LayoutDom<'dom, T> { pub(crate) struct LayoutDom<'dom, T> {
value: &'dom T, value: &'dom T,
} }
@ -533,7 +533,7 @@ impl<T> Hash for LayoutDom<'_, T> {
impl<T> Clone for Dom<T> { impl<T> Clone for Dom<T> {
#[inline] #[inline]
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn clone(&self) -> Self { fn clone(&self) -> Self {
assert_in_script(); assert_in_script();
Dom { ptr: self.ptr } Dom { ptr: self.ptr }
@ -566,7 +566,7 @@ impl LayoutDom<'_, Node> {
/// ///
/// This should only be used as a field in other DOM objects; see warning /// This should only be used as a field in other DOM objects; see warning
/// on `Dom<T>`. /// on `Dom<T>`.
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
#[derive(JSTraceable)] #[derive(JSTraceable)]
pub(crate) struct MutDom<T: DomObject> { pub(crate) struct MutDom<T: DomObject> {
val: UnsafeCell<Dom<T>>, val: UnsafeCell<Dom<T>>,
@ -629,7 +629,7 @@ pub(crate) fn assert_in_layout() {
/// ///
/// This should only be used as a field in other DOM objects; see warning /// This should only be used as a field in other DOM objects; see warning
/// on `Dom<T>`. /// on `Dom<T>`.
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
#[derive(JSTraceable)] #[derive(JSTraceable)]
pub(crate) struct MutNullableDom<T: DomObject> { pub(crate) struct MutNullableDom<T: DomObject> {
ptr: UnsafeCell<Option<Dom<T>>>, ptr: UnsafeCell<Option<Dom<T>>>,
@ -663,14 +663,14 @@ impl<T: DomObject> MutNullableDom<T> {
/// Retrieve a copy of the inner optional `Dom<T>` as `LayoutDom<T>`. /// Retrieve a copy of the inner optional `Dom<T>` as `LayoutDom<T>`.
/// For use by layout, which can't use safe types like Temporary. /// For use by layout, which can't use safe types like Temporary.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) unsafe fn get_inner_as_layout(&self) -> Option<LayoutDom<T>> { pub(crate) unsafe fn get_inner_as_layout(&self) -> Option<LayoutDom<T>> {
assert_in_layout(); assert_in_layout();
(*self.ptr.get()).as_ref().map(|js| js.to_layout()) (*self.ptr.get()).as_ref().map(|js| js.to_layout())
} }
/// Get a rooted value out of this object /// Get a rooted value out of this object
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn get(&self) -> Option<DomRoot<T>> { pub(crate) fn get(&self) -> Option<DomRoot<T>> {
assert_in_script(); assert_in_script();
unsafe { ptr::read(self.ptr.get()).map(|o| DomRoot::from_ref(&*o)) } unsafe { ptr::read(self.ptr.get()).map(|o| DomRoot::from_ref(&*o)) }
@ -705,7 +705,7 @@ impl<T: DomObject> PartialEq<Option<&T>> for MutNullableDom<T> {
} }
impl<T: DomObject> Default for MutNullableDom<T> { impl<T: DomObject> Default for MutNullableDom<T> {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn default() -> MutNullableDom<T> { fn default() -> MutNullableDom<T> {
assert_in_script(); assert_in_script();
MutNullableDom { MutNullableDom {
@ -727,7 +727,7 @@ impl<T: DomObject> MallocSizeOf for MutNullableDom<T> {
/// ///
/// This should only be used as a field in other DOM objects; see warning /// This should only be used as a field in other DOM objects; see warning
/// on `Dom<T>`. /// on `Dom<T>`.
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct DomOnceCell<T: DomObject> { pub(crate) struct DomOnceCell<T: DomObject> {
ptr: OnceCell<Dom<T>>, ptr: OnceCell<Dom<T>>,
} }
@ -738,7 +738,7 @@ where
{ {
/// Retrieve a copy of the current inner value. If it is `None`, it is /// Retrieve a copy of the current inner value. If it is `None`, it is
/// initialized with the result of `cb` first. /// initialized with the result of `cb` first.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn init_once<F>(&self, cb: F) -> &T pub(crate) fn init_once<F>(&self, cb: F) -> &T
where where
F: FnOnce() -> DomRoot<T>, F: FnOnce() -> DomRoot<T>,
@ -749,7 +749,7 @@ where
} }
impl<T: DomObject> Default for DomOnceCell<T> { impl<T: DomObject> Default for DomOnceCell<T> {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn default() -> DomOnceCell<T> { fn default() -> DomOnceCell<T> {
assert_in_script(); assert_in_script();
DomOnceCell { DomOnceCell {
@ -765,7 +765,7 @@ impl<T: DomObject> MallocSizeOf for DomOnceCell<T> {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
unsafe impl<T: DomObject> JSTraceable for DomOnceCell<T> { unsafe impl<T: DomObject> JSTraceable for DomOnceCell<T> {
unsafe fn trace(&self, trc: *mut JSTracer) { unsafe fn trace(&self, trc: *mut JSTracer) {
if let Some(ptr) = self.ptr.get() { if let Some(ptr) = self.ptr.get() {

View file

@ -21,7 +21,7 @@ enum StackEntryKind {
Entry, Entry,
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
#[derive(JSTraceable)] #[derive(JSTraceable)]
struct StackEntry { struct StackEntry {
global: Dom<GlobalScope>, global: Dom<GlobalScope>,

View file

@ -116,7 +116,7 @@ unsafe impl<T> CustomTraceable for Sender<T> {
/// ///
/// SAFETY: Inner type must not impl JSTraceable /// SAFETY: Inner type must not impl JSTraceable
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] #[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[crown::trace_in_no_trace_lint::must_not_have_traceable] #[cfg_attr(crown, crown::trace_in_no_trace_lint::must_not_have_traceable)]
pub(crate) struct NoTrace<T>(pub(crate) T); pub(crate) struct NoTrace<T>(pub(crate) T);
impl<T: Display> Display for NoTrace<T> { impl<T: Display> Display for NoTrace<T> {
@ -146,7 +146,7 @@ impl<T: MallocSizeOf> MallocSizeOf for NoTrace<T> {
/// HashMap wrapper, that has non-jsmanaged keys /// HashMap wrapper, that has non-jsmanaged keys
/// ///
/// Not all methods are reexposed, but you can access inner type via .0 /// Not all methods are reexposed, but you can access inner type via .0
#[crown::trace_in_no_trace_lint::must_not_have_traceable(0)] #[cfg_attr(crown, crown::trace_in_no_trace_lint::must_not_have_traceable(0))]
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub(crate) struct HashMapTracedValues<K, V, S = RandomState>(pub(crate) HashMap<K, V, S>); pub(crate) struct HashMapTracedValues<K, V, S = RandomState>(pub(crate) HashMap<K, V, S>);
@ -289,7 +289,7 @@ pub(crate) fn trace_jsval(tracer: *mut JSTracer, description: &str, val: &Heap<J
} }
/// Trace the `JSObject` held by `reflector`. /// Trace the `JSObject` held by `reflector`.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Reflector) { pub(crate) fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Reflector) {
trace!("tracing reflector {}", description); trace!("tracing reflector {}", description);
trace_object(tracer, description, reflector.rootable()) trace_object(tracer, description, reflector.rootable())
@ -490,7 +490,7 @@ where
/// If you have GC things like *mut JSObject or JSVal, use rooted!. /// If you have GC things like *mut JSObject or JSVal, use rooted!.
/// If you have an arbitrary number of DomObjects to root, use rooted_vec!. /// If you have an arbitrary number of DomObjects to root, use rooted_vec!.
/// If you know what you're doing, use this. /// If you know what you're doing, use this.
#[crown::unrooted_must_root_lint::allow_unrooted_interior] #[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_interior)]
pub(crate) struct RootedTraceableBox<T: JSTraceable + 'static>(js::gc::RootedTraceableBox<T>); pub(crate) struct RootedTraceableBox<T: JSTraceable + 'static>(js::gc::RootedTraceableBox<T>);
unsafe impl<T: JSTraceable + 'static> JSTraceable for RootedTraceableBox<T> { unsafe impl<T: JSTraceable + 'static> JSTraceable for RootedTraceableBox<T> {

View file

@ -33,14 +33,14 @@ use crate::dom::bindings::trace::JSTraceable;
pub(crate) const DOM_WEAK_SLOT: u32 = 1; pub(crate) const DOM_WEAK_SLOT: u32 = 1;
/// A weak reference to a JS-managed DOM object. /// A weak reference to a JS-managed DOM object.
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
#[crown::unrooted_must_root_lint::allow_unrooted_interior] #[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_interior)]
pub(crate) struct WeakRef<T: WeakReferenceable> { pub(crate) struct WeakRef<T: WeakReferenceable> {
ptr: ptr::NonNull<WeakBox<T>>, ptr: ptr::NonNull<WeakBox<T>>,
} }
/// The inner box of weak references, public for the finalization in codegen. /// The inner box of weak references, public for the finalization in codegen.
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct WeakBox<T: WeakReferenceable> { pub(crate) struct WeakBox<T: WeakReferenceable> {
/// The reference count. When it reaches zero, the `value` field should /// The reference count. When it reaches zero, the `value` field should
/// have already been set to `None`. The pointee contributes one to the count. /// have already been set to `None`. The pointee contributes one to the count.
@ -218,7 +218,7 @@ unsafe impl<T: WeakReferenceable> JSTraceable for MutableWeakRef<T> {
/// A vector of weak references. On tracing, the vector retains /// A vector of weak references. On tracing, the vector retains
/// only references which still point to live objects. /// only references which still point to live objects.
#[crown::unrooted_must_root_lint::allow_unrooted_interior] #[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_interior)]
#[derive(MallocSizeOf)] #[derive(MallocSizeOf)]
pub(crate) struct WeakRefVec<T: WeakReferenceable> { pub(crate) struct WeakRefVec<T: WeakReferenceable> {
vec: Vec<WeakRef<T>>, vec: Vec<WeakRef<T>>,
@ -268,7 +268,7 @@ impl<T: WeakReferenceable> DerefMut for WeakRefVec<T> {
/// An entry of a vector of weak references. Passed to the closure /// An entry of a vector of weak references. Passed to the closure
/// given to `WeakRefVec::update`. /// given to `WeakRefVec::update`.
#[crown::unrooted_must_root_lint::allow_unrooted_interior] #[cfg_attr(crown, crown::unrooted_must_root_lint::allow_unrooted_interior)]
pub(crate) struct WeakRefEntry<'a, T: WeakReferenceable> { pub(crate) struct WeakRefEntry<'a, T: WeakReferenceable> {
vec: &'a mut WeakRefVec<T>, vec: &'a mut WeakRefVec<T>,
index: &'a mut usize, index: &'a mut usize,

View file

@ -41,7 +41,7 @@ pub(crate) struct BiquadFilterNode {
} }
impl BiquadFilterNode { impl BiquadFilterNode {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited( pub(crate) fn new_inherited(
window: &Window, window: &Window,
context: &BaseAudioContext, context: &BaseAudioContext,
@ -123,7 +123,7 @@ impl BiquadFilterNode {
Self::new_with_proto(window, None, context, options, can_gc) Self::new_with_proto(window, None, context, options, can_gc)
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_with_proto( fn new_with_proto(
window: &Window, window: &Window,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -59,7 +59,7 @@ impl Blob {
dom_blob dom_blob
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited(blob_impl: &BlobImpl) -> Blob { pub(crate) fn new_inherited(blob_impl: &BlobImpl) -> Blob {
Blob { Blob {
reflector_: Reflector::new(), reflector_: Reflector::new(),

View file

@ -118,7 +118,7 @@ impl<T> BluetoothContext<T>
where where
T: AsyncBluetoothListener + DomObject, T: AsyncBluetoothListener + DomObject,
{ {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn response(&mut self, response: BluetoothResponseResult, can_gc: CanGc) { fn response(&mut self, response: BluetoothResponseResult, can_gc: CanGc) {
let promise = self.promise.take().expect("bt promise is missing").root(); let promise = self.promise.take().expect("bt promise is missing").root();
@ -753,7 +753,7 @@ impl PermissionAlgorithm for Bluetooth {
// NOTE: Step 3. is in BluetoothPermissionResult's `handle_response` function. // NOTE: Step 3. is in BluetoothPermissionResult's `handle_response` function.
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
// https://webbluetoothcg.github.io/web-bluetooth/#revoke-bluetooth-access // https://webbluetoothcg.github.io/web-bluetooth/#revoke-bluetooth-access
fn permission_revoke( fn permission_revoke(
_descriptor: &BluetoothPermissionDescriptor, _descriptor: &BluetoothPermissionDescriptor,

View file

@ -35,7 +35,7 @@ use crate::dom::promise::Promise;
use crate::realms::InRealm; use crate::realms::InRealm;
use crate::script_runtime::CanGc; use crate::script_runtime::CanGc;
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
struct AttributeInstanceMap { struct AttributeInstanceMap {
service_map: DomRefCell<HashMap<String, Dom<BluetoothRemoteGATTService>>>, service_map: DomRefCell<HashMap<String, Dom<BluetoothRemoteGATTService>>>,
@ -194,7 +194,7 @@ impl BluetoothDevice {
} }
// https://webbluetoothcg.github.io/web-bluetooth/#clean-up-the-disconnected-device // https://webbluetoothcg.github.io/web-bluetooth/#clean-up-the-disconnected-device
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn clean_up_disconnected_device(&self, can_gc: CanGc) { pub(crate) fn clean_up_disconnected_device(&self, can_gc: CanGc) {
// Step 1. // Step 1.
self.get_gatt().set_connected(false); self.get_gatt().set_connected(false);
@ -230,7 +230,7 @@ impl BluetoothDevice {
} }
// https://webbluetoothcg.github.io/web-bluetooth/#garbage-collect-the-connection // https://webbluetoothcg.github.io/web-bluetooth/#garbage-collect-the-connection
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn garbage_collect_the_connection(&self) -> ErrorResult { pub(crate) fn garbage_collect_the_connection(&self) -> ErrorResult {
// Step 1: TODO: Check if other systems using this device. // Step 1: TODO: Check if other systems using this device.

View file

@ -35,7 +35,7 @@ pub(crate) struct BluetoothPermissionResult {
} }
impl BluetoothPermissionResult { impl BluetoothPermissionResult {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_inherited(status: &PermissionStatus) -> BluetoothPermissionResult { fn new_inherited(status: &PermissionStatus) -> BluetoothPermissionResult {
let result = BluetoothPermissionResult { let result = BluetoothPermissionResult {
status: PermissionStatus::new_inherited(status.get_query()), status: PermissionStatus::new_inherited(status.get_query()),
@ -76,7 +76,7 @@ impl BluetoothPermissionResult {
self.status.State() self.status.State()
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn set_devices(&self, devices: Vec<Dom<BluetoothDevice>>) { pub(crate) fn set_devices(&self, devices: Vec<Dom<BluetoothDevice>>) {
*self.devices.borrow_mut() = devices; *self.devices.borrow_mut() = devices;
} }

View file

@ -167,7 +167,7 @@ impl CanvasRenderingContext2DMethods<crate::DomTypeHolder> for CanvasRenderingCo
self.canvas_state.save() self.canvas_state.save()
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
// https://html.spec.whatwg.org/multipage/#dom-context-2d-restore // https://html.spec.whatwg.org/multipage/#dom-context-2d-restore
fn Restore(&self) { fn Restore(&self) {
self.canvas_state.restore() self.canvas_state.restore()

View file

@ -27,7 +27,7 @@ pub(crate) struct ChannelMergerNode {
} }
impl ChannelMergerNode { impl ChannelMergerNode {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited( pub(crate) fn new_inherited(
_: &Window, _: &Window,
context: &BaseAudioContext, context: &BaseAudioContext,
@ -66,7 +66,7 @@ impl ChannelMergerNode {
Self::new_with_proto(window, None, context, options, can_gc) Self::new_with_proto(window, None, context, options, can_gc)
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_with_proto( fn new_with_proto(
window: &Window, window: &Window,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -26,7 +26,7 @@ pub(crate) struct ChannelSplitterNode {
} }
impl ChannelSplitterNode { impl ChannelSplitterNode {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited( pub(crate) fn new_inherited(
_: &Window, _: &Window,
context: &BaseAudioContext, context: &BaseAudioContext,
@ -68,7 +68,7 @@ impl ChannelSplitterNode {
Self::new_with_proto(window, None, context, options, can_gc) Self::new_with_proto(window, None, context, options, can_gc)
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_with_proto( fn new_with_proto(
window: &Window, window: &Window,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -31,7 +31,7 @@ const MAX_LOG_DEPTH: usize = 10;
const MAX_LOG_CHILDREN: usize = 15; const MAX_LOG_CHILDREN: usize = 15;
/// <https://developer.mozilla.org/en-US/docs/Web/API/Console> /// <https://developer.mozilla.org/en-US/docs/Web/API/Console>
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct Console; pub(crate) struct Console;
impl Console { impl Console {

View file

@ -30,7 +30,7 @@ pub(crate) struct ConstantSourceNode {
} }
impl ConstantSourceNode { impl ConstantSourceNode {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_inherited( fn new_inherited(
window: &Window, window: &Window,
context: &BaseAudioContext, context: &BaseAudioContext,
@ -72,7 +72,7 @@ impl ConstantSourceNode {
Self::new_with_proto(window, None, context, options, can_gc) Self::new_with_proto(window, None, context, options, can_gc)
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_with_proto( fn new_with_proto(
window: &Window, window: &Window,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -34,7 +34,7 @@ impl CSSFontFaceRule {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,

View file

@ -37,7 +37,7 @@ impl CSSImportRule {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,

View file

@ -40,7 +40,7 @@ impl CSSKeyframeRule {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,

View file

@ -44,7 +44,7 @@ impl CSSKeyframesRule {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,

View file

@ -40,7 +40,7 @@ impl CSSLayerBlockRule {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,

View file

@ -38,7 +38,7 @@ impl CSSLayerStatementRule {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,

View file

@ -38,7 +38,7 @@ impl CSSMediaRule {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,

View file

@ -35,7 +35,7 @@ impl CSSNamespaceRule {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,

View file

@ -38,7 +38,7 @@ pub(crate) struct CSSRule {
} }
impl CSSRule { impl CSSRule {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited(parent_stylesheet: &CSSStyleSheet) -> CSSRule { pub(crate) fn new_inherited(parent_stylesheet: &CSSStyleSheet) -> CSSRule {
CSSRule { CSSRule {
reflector_: Reflector::new(), reflector_: Reflector::new(),

View file

@ -53,7 +53,7 @@ pub(crate) enum RulesSource {
} }
impl CSSRuleList { impl CSSRuleList {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited( pub(crate) fn new_inherited(
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,
rules: RulesSource, rules: RulesSource,
@ -82,7 +82,7 @@ impl CSSRuleList {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,

View file

@ -43,7 +43,7 @@ pub(crate) struct CSSStyleDeclaration {
} }
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) enum CSSStyleOwner { pub(crate) enum CSSStyleOwner {
Element(Dom<Element>), Element(Dom<Element>),
CSSRule( CSSRule(
@ -215,7 +215,7 @@ fn remove_property(decls: &mut PropertyDeclarationBlock, id: &PropertyId) -> boo
} }
impl CSSStyleDeclaration { impl CSSStyleDeclaration {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited( pub(crate) fn new_inherited(
owner: CSSStyleOwner, owner: CSSStyleOwner,
pseudo: Option<PseudoElement>, pseudo: Option<PseudoElement>,
@ -229,7 +229,7 @@ impl CSSStyleDeclaration {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
global: &Window, global: &Window,
owner: CSSStyleOwner, owner: CSSStyleOwner,

View file

@ -45,7 +45,7 @@ impl CSSStyleRule {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,

View file

@ -50,7 +50,7 @@ impl CSSStyleSheet {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
owner: &Element, owner: &Element,

View file

@ -37,7 +37,7 @@ impl CSSSupportsRule {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
parent_stylesheet: &CSSStyleSheet, parent_stylesheet: &CSSStyleSheet,

View file

@ -334,7 +334,8 @@ fn get_callback(
} }
impl CustomElementRegistryMethods<crate::DomTypeHolder> for CustomElementRegistry { impl CustomElementRegistryMethods<crate::DomTypeHolder> for CustomElementRegistry {
#[allow(unsafe_code, crown::unrooted_must_root)] #[allow(unsafe_code)]
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define> /// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
fn Define( fn Define(
&self, &self,
@ -973,7 +974,7 @@ pub(crate) fn try_upgrade_element(element: &Element) {
} }
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) enum CustomElementReaction { pub(crate) enum CustomElementReaction {
Upgrade(#[ignore_malloc_size_of = "Rc"] Rc<CustomElementDefinition>), Upgrade(#[ignore_malloc_size_of = "Rc"] Rc<CustomElementDefinition>),
Callback( Callback(
@ -1028,7 +1029,7 @@ enum BackupElementQueueFlag {
/// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack> /// <https://html.spec.whatwg.org/multipage/#custom-element-reactions-stack>
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct CustomElementReactionStack { pub(crate) struct CustomElementReactionStack {
stack: DomRefCell<Vec<ElementQueue>>, stack: DomRefCell<Vec<ElementQueue>>,
backup_queue: ElementQueue, backup_queue: ElementQueue,
@ -1233,7 +1234,7 @@ impl CustomElementReactionStack {
/// <https://html.spec.whatwg.org/multipage/#element-queue> /// <https://html.spec.whatwg.org/multipage/#element-queue>
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
struct ElementQueue { struct ElementQueue {
queue: DomRefCell<VecDeque<Dom<Element>>>, queue: DomRefCell<VecDeque<Dom<Element>>>,
} }

View file

@ -24,7 +24,7 @@ use crate::microtask::Microtask;
use crate::script_runtime::CanGc; use crate::script_runtime::CanGc;
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) struct DefaultTeeReadRequestMicrotask { pub(crate) struct DefaultTeeReadRequestMicrotask {
#[ignore_malloc_size_of = "mozjs"] #[ignore_malloc_size_of = "mozjs"]
chunk: Box<Heap<JSVal>>, chunk: Box<Heap<JSVal>>,
@ -60,7 +60,7 @@ pub(crate) struct DefaultTeeReadRequest {
} }
impl DefaultTeeReadRequest { impl DefaultTeeReadRequest {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
stream: &ReadableStream, stream: &ReadableStream,
branch_1: &ReadableStream, branch_1: &ReadableStream,

View file

@ -59,7 +59,7 @@ pub(crate) struct DefaultTeeUnderlyingSource {
impl DefaultTeeUnderlyingSource { impl DefaultTeeUnderlyingSource {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[allow(clippy::redundant_allocation)] #[allow(clippy::redundant_allocation)]
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
reader: &ReadableStreamDefaultReader, reader: &ReadableStreamDefaultReader,
stream: &ReadableStream, stream: &ReadableStream,
@ -106,7 +106,7 @@ impl DefaultTeeUnderlyingSource {
/// <https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaulttee> /// <https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaulttee>
/// Let pullAlgorithm be the following steps: /// Let pullAlgorithm be the following steps:
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn pull_algorithm(&self, can_gc: CanGc) -> Option<Result<Rc<Promise>, Error>> { pub(crate) fn pull_algorithm(&self, can_gc: CanGc) -> Option<Result<Rc<Promise>, Error>> {
// If reading is true, // If reading is true,
if self.reading.get() { if self.reading.get() {

View file

@ -29,7 +29,7 @@ pub(crate) struct DissimilarOriginLocation {
} }
impl DissimilarOriginLocation { impl DissimilarOriginLocation {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_inherited(window: &DissimilarOriginWindow) -> DissimilarOriginLocation { fn new_inherited(window: &DissimilarOriginWindow) -> DissimilarOriginLocation {
DissimilarOriginLocation { DissimilarOriginLocation {
reflector: Reflector::new(), reflector: Reflector::new(),

View file

@ -240,7 +240,7 @@ pub(crate) enum IsHTMLDocument {
} }
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
enum FocusTransaction { enum FocusTransaction {
/// No focus operation is in effect. /// No focus operation is in effect.
NotInTransaction, NotInTransaction,
@ -3152,7 +3152,7 @@ impl Document {
self.webgpu_contexts.clone() self.webgpu_contexts.clone()
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
#[cfg(feature = "webgpu")] #[cfg(feature = "webgpu")]
pub(crate) fn update_rendering_of_webgpu_canvases(&self) { pub(crate) fn update_rendering_of_webgpu_canvases(&self) {
self.webgpu_contexts self.webgpu_contexts
@ -4178,7 +4178,7 @@ impl Document {
/// Add a stylesheet owned by `owner` to the list of document sheets, in the /// Add a stylesheet owned by `owner` to the list of document sheets, in the
/// correct tree position. /// correct tree position.
#[allow(crown::unrooted_must_root)] // Owner needs to be rooted already necessarily. #[cfg_attr(crown, allow(crown::unrooted_must_root))] // Owner needs to be rooted already necessarily.
pub(crate) fn add_stylesheet(&self, owner: &Element, sheet: Arc<Stylesheet>) { pub(crate) fn add_stylesheet(&self, owner: &Element, sheet: Arc<Stylesheet>) {
let stylesheets = &mut *self.stylesheets.borrow_mut(); let stylesheets = &mut *self.stylesheets.borrow_mut();
let insertion_point = stylesheets let insertion_point = stylesheets
@ -4215,7 +4215,7 @@ impl Document {
} }
/// Remove a stylesheet owned by `owner` from the list of document sheets. /// Remove a stylesheet owned by `owner` from the list of document sheets.
#[allow(crown::unrooted_must_root)] // Owner needs to be rooted already necessarily. #[cfg_attr(crown, allow(crown::unrooted_must_root))] // Owner needs to be rooted already necessarily.
pub(crate) fn remove_stylesheet(&self, owner: &Element, stylesheet: &Arc<Stylesheet>) { pub(crate) fn remove_stylesheet(&self, owner: &Element, stylesheet: &Arc<Stylesheet>) {
let cloned_stylesheet = stylesheet.clone(); let cloned_stylesheet = stylesheet.clone();
self.window self.window
@ -4241,7 +4241,7 @@ impl Document {
}) })
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn drain_pending_restyles(&self) -> Vec<(TrustedNodeAddress, PendingRestyle)> { pub(crate) fn drain_pending_restyles(&self) -> Vec<(TrustedNodeAddress, PendingRestyle)> {
self.pending_restyles self.pending_restyles
.borrow_mut() .borrow_mut()
@ -5878,7 +5878,7 @@ impl AnimationFrameCallback {
} }
#[derive(Default, JSTraceable, MallocSizeOf)] #[derive(Default, JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
struct PendingInOrderScriptVec { struct PendingInOrderScriptVec {
scripts: DomRefCell<VecDeque<PendingScript>>, scripts: DomRefCell<VecDeque<PendingScript>>,
} }
@ -5916,7 +5916,7 @@ impl PendingInOrderScriptVec {
} }
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
struct PendingScript { struct PendingScript {
element: Dom<HTMLScriptElement>, element: Dom<HTMLScriptElement>,
// TODO(sagudev): could this be all no_trace? // TODO(sagudev): could this be all no_trace?

View file

@ -29,7 +29,7 @@ use crate::script_runtime::CanGc;
use crate::stylesheet_set::StylesheetSetRef; use crate::stylesheet_set::StylesheetSetRef;
#[derive(Clone, JSTraceable, MallocSizeOf)] #[derive(Clone, JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct StyleSheetInDocument { pub(crate) struct StyleSheetInDocument {
#[ignore_malloc_size_of = "Arc"] #[ignore_malloc_size_of = "Arc"]
#[no_trace] #[no_trace]
@ -82,7 +82,7 @@ impl ::style::stylesheets::StylesheetInDocument for StyleSheetInDocument {
} }
// https://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin // https://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
pub(crate) struct DocumentOrShadowRoot { pub(crate) struct DocumentOrShadowRoot {
window: Dom<Window>, window: Dom<Window>,
@ -218,7 +218,7 @@ impl DocumentOrShadowRoot {
} }
/// Remove a stylesheet owned by `owner` from the list of document sheets. /// Remove a stylesheet owned by `owner` from the list of document sheets.
#[allow(crown::unrooted_must_root)] // Owner needs to be rooted already necessarily. #[cfg_attr(crown, allow(crown::unrooted_must_root))] // Owner needs to be rooted already necessarily.
pub(crate) fn remove_stylesheet( pub(crate) fn remove_stylesheet(
owner: &Element, owner: &Element,
s: &Arc<Stylesheet>, s: &Arc<Stylesheet>,
@ -239,7 +239,7 @@ impl DocumentOrShadowRoot {
/// Add a stylesheet owned by `owner` to the list of document sheets, in the /// Add a stylesheet owned by `owner` to the list of document sheets, in the
/// correct tree position. /// correct tree position.
#[allow(crown::unrooted_must_root)] // Owner needs to be rooted already necessarily. #[cfg_attr(crown, allow(crown::unrooted_must_root))] // Owner needs to be rooted already necessarily.
pub(crate) fn add_stylesheet( pub(crate) fn add_stylesheet(
owner: &Element, owner: &Element,
mut stylesheets: StylesheetSetRef<StyleSheetInDocument>, mut stylesheets: StylesheetSetRef<StyleSheetInDocument>,

View file

@ -38,7 +38,7 @@ impl DocumentType {
system_id: system_id.unwrap_or_default(), system_id: system_id.unwrap_or_default(),
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
name: DOMString, name: DOMString,
public_id: Option<DOMString>, public_id: Option<DOMString>,

View file

@ -38,7 +38,7 @@ impl DOMMatrix {
Self::new_with_proto(global, None, is2D, matrix, can_gc) Self::new_with_proto(global, None, is2D, matrix, can_gc)
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_with_proto( fn new_with_proto(
global: &GlobalScope, global: &GlobalScope,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -55,7 +55,7 @@ impl DOMMatrixReadOnly {
Self::new_with_proto(global, None, is2D, matrix, can_gc) Self::new_with_proto(global, None, is2D, matrix, can_gc)
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_with_proto( fn new_with_proto(
global: &GlobalScope, global: &GlobalScope,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -74,7 +74,7 @@ impl DOMRectMethods<crate::DomTypeHolder> for DOMRect {
} }
// https://drafts.fxtf.org/geometry/#dom-domrect-fromrect // https://drafts.fxtf.org/geometry/#dom-domrect-fromrect
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> DomRoot<DOMRect> { fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> DomRoot<DOMRect> {
let rect = create_a_domrectreadonly_from_the_dictionary(other); let rect = create_a_domrectreadonly_from_the_dictionary(other);

View file

@ -89,7 +89,7 @@ impl DOMRectReadOnlyMethods<crate::DomTypeHolder> for DOMRectReadOnly {
} }
// https://drafts.fxtf.org/geometry/#dom-domrectreadonly-fromrect // https://drafts.fxtf.org/geometry/#dom-domrectreadonly-fromrect
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> DomRoot<DOMRectReadOnly> { fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> DomRoot<DOMRectReadOnly> {
let dom_rect = create_a_domrectreadonly_from_the_dictionary(other); let dom_rect = create_a_domrectreadonly_from_the_dictionary(other);
@ -158,7 +158,7 @@ impl DOMRectReadOnlyMethods<crate::DomTypeHolder> for DOMRectReadOnly {
} }
/// <https://drafts.fxtf.org/geometry/#ref-for-create-a-domrectreadonly-from-the-dictionary> /// <https://drafts.fxtf.org/geometry/#ref-for-create-a-domrectreadonly-from-the-dictionary>
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(super) fn create_a_domrectreadonly_from_the_dictionary(other: &DOMRectInit) -> DOMRectReadOnly { pub(super) fn create_a_domrectreadonly_from_the_dictionary(other: &DOMRectInit) -> DOMRectReadOnly {
// NOTE: We trivially combine all three steps into one // NOTE: We trivially combine all three steps into one

View file

@ -31,7 +31,7 @@ pub(crate) struct DynamicModuleOwner {
} }
impl DynamicModuleOwner { impl DynamicModuleOwner {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_inherited(promise: Rc<Promise>, id: DynamicModuleId) -> Self { fn new_inherited(promise: Rc<Promise>, id: DynamicModuleId) -> Self {
DynamicModuleOwner { DynamicModuleOwner {
reflector_: Reflector::new(), reflector_: Reflector::new(),
@ -40,7 +40,7 @@ impl DynamicModuleOwner {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
global: &GlobalScope, global: &GlobalScope,
promise: Rc<Promise>, promise: Rc<Promise>,

View file

@ -4462,7 +4462,7 @@ impl ElementPerformFullscreenEnter {
} }
impl TaskOnce for ElementPerformFullscreenEnter { impl TaskOnce for ElementPerformFullscreenEnter {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn run_once(self) { fn run_once(self) {
let element = self.element.root(); let element = self.element.root();
let promise = self.promise.root(); let promise = self.promise.root();
@ -4507,7 +4507,7 @@ impl ElementPerformFullscreenExit {
} }
impl TaskOnce for ElementPerformFullscreenExit { impl TaskOnce for ElementPerformFullscreenExit {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn run_once(self) { fn run_once(self) {
let element = self.element.root(); let element = self.element.root();
let document = element.owner_document(); let document = element.owner_document();

View file

@ -95,7 +95,7 @@ pub(crate) struct Event {
/// An element on an [event path](https://dom.spec.whatwg.org/#event-path) /// An element on an [event path](https://dom.spec.whatwg.org/#event-path)
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct EventPathSegment { pub(crate) struct EventPathSegment {
/// <https://dom.spec.whatwg.org/#event-path-invocation-target> /// <https://dom.spec.whatwg.org/#event-path-invocation-target>
invocation_target: Dom<EventTarget>, invocation_target: Dom<EventTarget>,
@ -211,7 +211,7 @@ impl Event {
} }
/// <https://dom.spec.whatwg.org/#concept-event-path-append> /// <https://dom.spec.whatwg.org/#concept-event-path-append>
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn append_to_path( pub(crate) fn append_to_path(
&self, &self,
invocation_target: &EventTarget, invocation_target: &EventTarget,

View file

@ -31,7 +31,7 @@ pub(crate) struct File {
} }
impl File { impl File {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_inherited(blob_impl: &BlobImpl, name: DOMString, modified: Option<SystemTime>) -> File { fn new_inherited(blob_impl: &BlobImpl, name: DOMString, modified: Option<SystemTime>) -> File {
File { File {
blob: Blob::new_inherited(blob_impl), blob: Blob::new_inherited(blob_impl),
@ -51,7 +51,7 @@ impl File {
Self::new_with_proto(global, None, blob_impl, name, modified, can_gc) Self::new_with_proto(global, None, blob_impl, name, modified, can_gc)
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_with_proto( fn new_with_proto(
global: &GlobalScope, global: &GlobalScope,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -21,7 +21,7 @@ pub(crate) struct FileList {
} }
impl FileList { impl FileList {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_inherited(files: Vec<Dom<File>>) -> FileList { fn new_inherited(files: Vec<Dom<File>>) -> FileList {
FileList { FileList {
reflector_: Reflector::new(), reflector_: Reflector::new(),
@ -29,7 +29,7 @@ impl FileList {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new(window: &Window, files: Vec<DomRoot<File>>) -> DomRoot<FileList> { pub(crate) fn new(window: &Window, files: Vec<DomRoot<File>>) -> DomRoot<FileList> {
reflect_dom_object( reflect_dom_object(
Box::new(FileList::new_inherited( Box::new(FileList::new_inherited(

View file

@ -104,7 +104,7 @@ impl FormDataMethods<crate::DomTypeHolder> for FormData {
.push((NoTrace(LocalName::from(name.0)), datum)); .push((NoTrace(LocalName::from(name.0)), datum));
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
// https://xhr.spec.whatwg.org/#dom-formdata-append // https://xhr.spec.whatwg.org/#dom-formdata-append
fn Append_(&self, name: USVString, blob: &Blob, filename: Option<USVString>) { fn Append_(&self, name: USVString, blob: &Blob, filename: Option<USVString>) {
let datum = FormDatum { let datum = FormDatum {
@ -188,7 +188,7 @@ impl FormDataMethods<crate::DomTypeHolder> for FormData {
)); ));
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
// https://xhr.spec.whatwg.org/#dom-formdata-set // https://xhr.spec.whatwg.org/#dom-formdata-set
fn Set_(&self, name: USVString, blob: &Blob, filename: Option<USVString>) { fn Set_(&self, name: USVString, blob: &Blob, filename: Option<USVString>) {
let file = self.create_an_entry(blob, filename, CanGc::note()); let file = self.create_an_entry(blob, filename, CanGc::note());

View file

@ -31,7 +31,7 @@ pub(crate) struct GainNode {
} }
impl GainNode { impl GainNode {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited( pub(crate) fn new_inherited(
window: &Window, window: &Window,
context: &BaseAudioContext, context: &BaseAudioContext,
@ -74,7 +74,7 @@ impl GainNode {
Self::new_with_proto(window, None, context, options, can_gc) Self::new_with_proto(window, None, context, options, can_gc)
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_with_proto( fn new_with_proto(
window: &Window, window: &Window,
proto: Option<HandleObject>, proto: Option<HandleObject>,

View file

@ -19,7 +19,7 @@ pub(crate) struct GamepadButtonList {
} }
impl GamepadButtonList { impl GamepadButtonList {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
fn new_inherited(list: &[&GamepadButton]) -> GamepadButtonList { fn new_inherited(list: &[&GamepadButton]) -> GamepadButtonList {
GamepadButtonList { GamepadButtonList {
reflector_: Reflector::new(), reflector_: Reflector::new(),

View file

@ -447,7 +447,7 @@ enum BlobResult {
/// Data representing a message-port managed by this global. /// Data representing a message-port managed by this global.
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) struct ManagedMessagePort { pub(crate) struct ManagedMessagePort {
/// The DOM port. /// The DOM port.
dom_port: Dom<MessagePort>, dom_port: Dom<MessagePort>,
@ -467,7 +467,7 @@ pub(crate) struct ManagedMessagePort {
/// State representing whether this global is currently managing broadcast channels. /// State representing whether this global is currently managing broadcast channels.
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) enum BroadcastChannelState { pub(crate) enum BroadcastChannelState {
/// The broadcast-channel router id for this global, and a queue of managed channels. /// The broadcast-channel router id for this global, and a queue of managed channels.
/// Step 9, "sort destinations" /// Step 9, "sort destinations"
@ -484,7 +484,7 @@ pub(crate) enum BroadcastChannelState {
/// State representing whether this global is currently managing messageports. /// State representing whether this global is currently managing messageports.
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
pub(crate) enum MessagePortState { pub(crate) enum MessagePortState {
/// The message-port router id for this global, and a map of managed ports. /// The message-port router id for this global, and a map of managed ports.
Managed( Managed(

View file

@ -61,7 +61,7 @@ impl HTMLAnchorElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -258,7 +258,7 @@ impl HTMLAreaElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -36,7 +36,7 @@ impl HTMLAudioElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -35,7 +35,7 @@ impl HTMLBaseElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -40,7 +40,7 @@ impl HTMLBodyElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -28,7 +28,7 @@ impl HTMLBRElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -69,7 +69,7 @@ impl HTMLButtonElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -105,7 +105,7 @@ impl EncodedImageType {
} }
} }
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
#[derive(Clone, JSTraceable, MallocSizeOf)] #[derive(Clone, JSTraceable, MallocSizeOf)]
pub(crate) enum CanvasContext { pub(crate) enum CanvasContext {
Placeholder(Dom<OffscreenCanvasRenderingContext2D>), Placeholder(Dom<OffscreenCanvasRenderingContext2D>),
@ -140,7 +140,7 @@ impl HTMLCanvasElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -69,7 +69,7 @@ pub(crate) struct HTMLCollection {
} }
impl HTMLCollection { impl HTMLCollection {
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new_inherited( pub(crate) fn new_inherited(
root: &Node, root: &Node,
filter: Box<dyn CollectionFilter + 'static>, filter: Box<dyn CollectionFilter + 'static>,
@ -99,7 +99,7 @@ impl HTMLCollection {
Self::new(window, root, Box::new(NoFilter)) Self::new(window, root, Box::new(NoFilter))
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
window: &Window, window: &Window,
root: &Node, root: &Node,

View file

@ -30,7 +30,7 @@ impl HTMLDataElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -32,7 +32,7 @@ impl HTMLDataListElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -39,7 +39,7 @@ impl HTMLDetailsElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -36,7 +36,7 @@ impl HTMLDialogElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -28,7 +28,7 @@ impl HTMLDirectoryElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -30,7 +30,7 @@ impl HTMLDivElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -28,7 +28,7 @@ impl HTMLDListElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -87,7 +87,7 @@ impl HTMLElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -28,7 +28,7 @@ impl HTMLEmbedElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -53,7 +53,7 @@ impl HTMLFieldSetElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -42,7 +42,7 @@ impl HTMLFontElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -131,7 +131,7 @@ impl HTMLFormElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -28,7 +28,7 @@ impl HTMLFrameElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -31,7 +31,7 @@ impl HTMLFrameSetElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -35,7 +35,7 @@ impl HTMLHeadElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -41,7 +41,7 @@ impl HTMLHeadingElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -35,7 +35,7 @@ impl HTMLHRElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -30,7 +30,7 @@ impl HTMLHtmlElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
localName: LocalName, localName: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -468,7 +468,7 @@ impl HTMLIFrameElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

View file

@ -144,7 +144,7 @@ enum ImageRequestPhase {
Current, Current,
} }
#[derive(JSTraceable, MallocSizeOf)] #[derive(JSTraceable, MallocSizeOf)]
#[crown::unrooted_must_root_lint::must_root] #[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
struct ImageRequest { struct ImageRequest {
state: State, state: State,
#[no_trace] #[no_trace]
@ -1324,7 +1324,7 @@ impl HTMLImageElement {
} }
} }
#[allow(crown::unrooted_must_root)] #[cfg_attr(crown, allow(crown::unrooted_must_root))]
pub(crate) fn new( pub(crate) fn new(
local_name: LocalName, local_name: LocalName,
prefix: Option<Prefix>, prefix: Option<Prefix>,

Some files were not shown because too many files have changed in this diff Show more