Replace script_plugins with a clippy like rustc driver (named crown) (#30508)

* Remove script_plugins

* Use crown instead of script_plugins

* crown_is_not_used

* Use crown in command base

* bootstrap crown

* tidy happy

* disable sccache

* Bring crown in tree

* Install crown from tree

* fix windows ci

* fix warning

* fix mac

libscript_plugins.dylib is not available anymore

* Update components/script/lib.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* Update for nightly-2023-03-18

Mostly just based off https://github.com/servo/servo/pull/30630

* Always install crown

it's slow only when there is new version

* Run crown test with `mach test-unit`

* Small fixups; better trace_in_no_trace tests

* Better doc

* crown in config.toml

* Fix tidy for real

* no sccache on rustc_wrapper

* document rustc overrides

* fixup of compiletest

* Make a few minor comment adjustments

* Fix a typo in python/servo/platform/base.py

Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>

* Proper test types

* Ignore tidy on crown/tests

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Samson 2023-12-01 16:50:52 +01:00 committed by GitHub
parent 20a73721de
commit 604979e367
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
231 changed files with 881 additions and 680 deletions

View file

@ -42,3 +42,4 @@ MACOSX_DEPLOYMENT_TARGET = "10.10"
[build]
rustdocflags = ["--document-private-items"]
rustc = "crown"

View file

@ -54,7 +54,6 @@ env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CCACHE: "sccache"
CARGO_INCREMENTAL: 0

View file

@ -47,7 +47,6 @@ env:
RUST_BACKTRACE: 1
SHELL: /bin/bash
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
CCACHE: "sccache"
CARGO_INCREMENTAL: 0
@ -136,7 +135,7 @@ jobs:
NIGHTLY_REPO_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }}
NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds
- name: Build package for target
run: gtar -czf target.tar.gz target/${{ inputs.profile }}/servo target/${{ inputs.profile }}/*.dylib target/${{ inputs.profile }}/lib/*.dylib resources
run: gtar -czf target.tar.gz target/${{ inputs.profile }}/servo target/${{ inputs.profile }}/lib/*.dylib resources
- name: Upload package for target
uses: actions/upload-artifact@v3
with:

View file

@ -73,10 +73,15 @@ jobs:
choco install wixtoolset
echo "C:\\Program Files (x86)\\WiX Toolset v3.11\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Bootstrap
env:
# We need to override the rustc set in cargo/config.toml, because at
# this point crown is not installed yet.
RUSTC: "rustc"
run: |
python -m pip install --upgrade pip virtualenv
python mach fetch
python mach bootstrap-gstreamer
cargo install --path support/crown
- name: Build (${{ inputs.profile }})
run: python mach build --${{ inputs.profile }}
- name: Copy resources

106
Cargo.lock generated
View file

@ -891,6 +891,29 @@ dependencies = [
"memchr",
]
[[package]]
name = "compiletest_rs"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7225fee1bcf9247bb3a1b1a2d7ecfe2f7a990e549a09d766a257a4ae30dac0d6"
dependencies = [
"diff",
"filetime",
"getopts",
"lazy_static",
"libc",
"log",
"miow",
"regex",
"rustfix",
"serde",
"serde_derive",
"serde_json",
"tempfile",
"tester",
"winapi",
]
[[package]]
name = "compositing"
version = "0.0.1"
@ -1152,6 +1175,14 @@ dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "crown"
version = "0.1.0"
dependencies = [
"compiletest_rs",
"once_cell",
]
[[package]]
name = "crunchy"
version = "0.2.2"
@ -1360,6 +1391,12 @@ dependencies = [
"uuid",
]
[[package]]
name = "diff"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "digest"
version = "0.10.7"
@ -1693,6 +1730,18 @@ dependencies = [
"simd-adler32",
]
[[package]]
name = "filetime"
version = "0.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0"
dependencies = [
"cfg-if 1.0.0",
"libc",
"redox_syscall 0.3.5",
"windows-sys 0.48.0",
]
[[package]]
name = "fixedbitset"
version = "0.1.9"
@ -3597,6 +3646,15 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "miow"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
dependencies = [
"winapi",
]
[[package]]
name = "mozangle"
version = "0.4.0"
@ -4661,6 +4719,18 @@ dependencies = [
"semver",
]
[[package]]
name = "rustfix"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecd2853d9e26988467753bd9912c3a126f642d05d229a4b53f5752ee36c56481"
dependencies = [
"anyhow",
"log",
"serde",
"serde_json",
]
[[package]]
name = "rustix"
version = "0.38.25"
@ -4803,7 +4873,6 @@ dependencies = [
"ref_filter_map",
"regex",
"script_layout_interface",
"script_plugins",
"script_traits",
"selectors",
"serde",
@ -4869,17 +4938,6 @@ dependencies = [
"webrender_api",
]
[[package]]
name = "script_plugins"
version = "0.0.1"
[[package]]
name = "script_plugins_tests"
version = "0.0.1"
dependencies = [
"script_plugins",
]
[[package]]
name = "script_tests"
version = "0.0.1"
@ -5910,6 +5968,17 @@ dependencies = [
"utf-8",
]
[[package]]
name = "term"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f"
dependencies = [
"dirs-next",
"rustversion",
"winapi",
]
[[package]]
name = "termcolor"
version = "1.4.0"
@ -5919,6 +5988,19 @@ dependencies = [
"winapi-util",
]
[[package]]
name = "tester"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89e8bf7e0eb2dd7b4228cc1b6821fc5114cd6841ae59f652a85488c016091e5f"
dependencies = [
"cfg-if 1.0.0",
"getopts",
"libc",
"num_cpus",
"term",
]
[[package]]
name = "textwrap"
version = "0.16.0"

View file

@ -6,6 +6,7 @@ members = [
"ports/libsimpleservo/capi/",
"ports/libsimpleservo/jniapi/",
"tests/unit/*",
"support/crown",
]
default-members = ["ports/servoshell"]
exclude = [".cargo"]

View file

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

View file

@ -16,9 +16,6 @@ path = "lib.rs"
debugmozjs = ['js/debugmozjs']
jitspew = ['js/jitspew']
profilemozjs = ['js/profilemozjs']
unrooted_must_root_lint = ["script_plugins/unrooted_must_root_lint"]
trace_in_no_trace_lint = ["script_plugins/trace_in_no_trace_lint"]
default = ["unrooted_must_root_lint", "trace_in_no_trace_lint"]
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
js_backtrace = []
refcell_backtrace = ["accountable-refcell"]
@ -88,7 +85,6 @@ range = { path = "../range" }
ref_filter_map = "1.0.1"
regex = { workspace = true }
script_layout_interface = { workspace = true }
script_plugins = { path = "../script_plugins" }
script_traits = { workspace = true }
selectors = { path = "../selectors", features = ["shmem"] }
serde = { workspace = true, features = ["derive"] }

View file

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

View file

@ -715,7 +715,7 @@ impl Callback for ConsumeBodyPromiseHandler {
}
// https://fetch.spec.whatwg.org/#concept-body-consume-body
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn consume_body<T: BodyMixin + DomObject>(object: &T, body_type: BodyType) -> Rc<Promise> {
let in_realm_proof = AlreadyInRealm::assert();
let promise = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof));
@ -739,7 +739,7 @@ pub fn consume_body<T: BodyMixin + DomObject>(object: &T, body_type: BodyType) -
}
// https://fetch.spec.whatwg.org/#concept-body-consume-body
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn consume_body_with_promise<T: BodyMixin + DomObject>(
object: &T,
body_type: BodyType,

View file

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

View file

@ -172,7 +172,7 @@ is where we actually call the SpiderMonkey trace hooks:
```rust
/// Trace the `JSObject` held by `reflector`.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Reflector) {
trace!("tracing reflector {}", description);
trace_object(tracer, description, reflector.rootable())

View file

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

View file

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

View file

@ -63,7 +63,7 @@ pub struct AudioBuffer {
}
impl AudioBuffer {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
#[allow(unsafe_code)]
pub fn new_inherited(number_of_channels: u32, length: u32, sample_rate: f32) -> AudioBuffer {
let vec = (0..number_of_channels).map(|_| Heap::default()).collect();
@ -95,7 +95,7 @@ impl AudioBuffer {
)
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn new_with_proto(
global: &Window,
proto: Option<HandleObject>,

View file

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

View file

@ -46,7 +46,7 @@ pub struct AudioContext {
}
impl AudioContext {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
// https://webaudio.github.io/web-audio-api/#AudioContext-constructors
fn new_inherited(options: &AudioContextOptions, pipeline_id: PipelineId) -> AudioContext {
// Steps 1-3.
@ -78,7 +78,7 @@ impl AudioContext {
}
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn new(
window: &Window,
proto: Option<HandleObject>,

View file

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

View file

@ -142,7 +142,7 @@ impl AudioListener {
}
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn new(window: &Window, context: &BaseAudioContext) -> DomRoot<AudioListener> {
let node = AudioListener::new_inherited(window, context);
reflect_dom_object(Box::new(node), window)

View file

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

View file

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

View file

@ -109,7 +109,7 @@ pub struct BaseAudioContext {
}
impl BaseAudioContext {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn new_inherited(
options: BaseAudioContextOptions,
pipeline_id: PipelineId,
@ -193,9 +193,9 @@ impl BaseAudioContext {
/// 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 promises because that would mean putting
/// `#[allow(unrooted_must_root)]` on even more functions, potentially
/// `#[allow(crown::unrooted_must_root)]` on even more functions, potentially
/// hiding actual safety bugs.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn fulfill_in_flight_resume_promises<F>(&self, f: F)
where
F: FnOnce(),

View file

@ -42,7 +42,7 @@ pub enum ExceptionHandling {
/// A common base class for representing IDL callback function and
/// callback interface types.
#[derive(JSTraceable)]
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
pub struct CallbackObject {
/// The underlying `JSObject`.
callback: Heap<*mut JSObject>,
@ -63,14 +63,14 @@ pub struct CallbackObject {
}
impl Default for CallbackObject {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn default() -> CallbackObject {
CallbackObject::new()
}
}
impl CallbackObject {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn new() -> CallbackObject {
CallbackObject {
callback: Heap::default(),
@ -133,14 +133,14 @@ pub trait CallbackContainer {
/// A common base class for representing IDL callback function types.
#[derive(JSTraceable, PartialEq)]
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
pub struct CallbackFunction {
object: CallbackObject,
}
impl CallbackFunction {
/// Create a new `CallbackFunction` for this object.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn new() -> CallbackFunction {
CallbackFunction {
object: CallbackObject::new(),
@ -161,7 +161,7 @@ impl CallbackFunction {
/// A common base class for representing IDL callback interface types.
#[derive(JSTraceable, PartialEq)]
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
pub struct CallbackInterface {
object: CallbackObject,
}
@ -241,7 +241,7 @@ pub struct CallSetup {
impl CallSetup {
/// Performs the setup needed to make a call.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn new<T: CallbackContainer>(callback: &T, handling: ExceptionHandling) -> CallSetup {
let global = unsafe { GlobalScope::from_object(callback.callback()) };
if let Some(window) = global.downcast::<Window>() {

View file

@ -6906,7 +6906,7 @@ class CGDictionary(CGThing):
derive = ["JSTraceable"]
mustRoot = ""
if self.membersNeedTracing():
mustRoot = "#[unrooted_must_root_lint::must_root]\n"
mustRoot = "#[crown::unrooted_must_root_lint::must_root]\n"
if not self.hasRequiredFields(self.dictionary):
derive += ["Default"]
@ -7450,7 +7450,7 @@ class CGCallback(CGClass):
constructors=self.getConstructors(),
methods=realMethods,
decorators="#[derive(JSTraceable, PartialEq)]\n"
"#[unrooted_must_root_lint::allow_unrooted_interior]")
"#[crown::unrooted_must_root_lint::allow_unrooted_interior]")
def getConstructors(self):
return [ClassConstructor(

View file

@ -165,7 +165,7 @@ pub mod xmlname;
/// Generated JS-Rust bindings.
#[allow(missing_docs, non_snake_case)]
pub mod codegen {
#[allow(dead_code, unrooted_must_root)]
#[allow(dead_code, crown::unrooted_must_root)]
pub mod Bindings {
include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs"));
}

View file

@ -80,7 +80,7 @@ impl TrustedPromise {
/// 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
/// lifetime.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn new(promise: Rc<Promise>) -> TrustedPromise {
LIVE_REFERENCES.with(|ref r| {
let r = r.borrow();
@ -130,7 +130,7 @@ impl TrustedPromise {
}
/// A task which will reject the promise.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn reject_task(self, error: Error) -> impl TaskOnce {
let this = self;
task!(reject_promise: move || {
@ -140,7 +140,7 @@ impl TrustedPromise {
}
/// A task which will resolve the promise.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn resolve_task<T>(self, value: T) -> impl TaskOnce
where
T: ToJSValConvertible + Send,
@ -157,7 +157,7 @@ impl TrustedPromise {
/// shared among threads for use in asynchronous operations. The underlying
/// DOM object is guaranteed to live at least as long as the last outstanding
/// `Trusted<T>` instance.
#[unrooted_must_root_lint::allow_unrooted_interior]
#[crown::unrooted_must_root_lint::allow_unrooted_interior]
pub struct Trusted<T: DomObject> {
/// A pointer to the Rust DOM object of type T, but void to allow
/// sending `Trusted<T>` between threads, regardless of T's sendability.
@ -220,7 +220,7 @@ impl<T: DomObject> Clone for Trusted<T> {
/// The set of live, pinned DOM objects that are currently prevented
/// from being garbage collected due to outstanding references.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub struct LiveDOMReferences {
// keyed on pointer to Rust DOM object
reflectable_table: RefCell<HashMap<*const libc::c_void, Weak<TrustedReference>>>,
@ -244,7 +244,7 @@ impl LiveDOMReferences {
});
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn addref_promise(&self, promise: Rc<Promise>) {
let mut table = self.promise_table.borrow_mut();
table.entry(&*promise).or_insert(vec![]).push(promise)
@ -294,7 +294,7 @@ fn remove_nulls<K: Eq + Hash + Clone, V>(table: &mut HashMap<K, Weak<V>>) {
}
/// A JSTraceDataOp for tracing reflectors held in LIVE_REFERENCES
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub unsafe fn trace_refcounted_objects(tracer: *mut JSTracer) {
info!("tracing live refcounted references");
LIVE_REFERENCES.with(|ref r| {

View file

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

View file

@ -44,8 +44,8 @@ use crate::dom::bindings::trace::{trace_reflector, JSTraceable};
use crate::dom::node::Node;
/// A rooted value.
#[allow(unrooted_must_root)]
#[unrooted_must_root_lint::allow_unrooted_interior]
#[allow(crown::unrooted_must_root)]
#[crown::unrooted_must_root_lint::allow_unrooted_interior]
pub struct Root<T: StableTraceObject> {
/// The value to root.
value: T,
@ -60,7 +60,7 @@ where
/// Create a new stack-bounded root for the provided value.
/// It cannot outlive its associated `RootCollection`, and it gives
/// out references which cannot outlive this new `Root`.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub unsafe fn new(value: T) -> Self {
unsafe fn add_to_root_list(object: *const dyn JSTraceable) -> *const RootCollection {
assert_in_script();
@ -92,7 +92,7 @@ where
// The JSTraceable impl for Reflector doesn't actually do anything,
// so we need this shenanigan to actually trace the reflector of the
// T pointer in Dom<T>.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
struct ReflectorStackRoot(Reflector);
unsafe impl JSTraceable for ReflectorStackRoot {
unsafe fn trace(&self, tracer: *mut JSTracer) {
@ -111,7 +111,7 @@ where
// The JSTraceable impl for Reflector doesn't actually do anything,
// so we need this shenanigan to actually trace the reflector of the
// T pointer in Dom<T>.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
struct MaybeUnreflectedStackRoot<T>(T);
unsafe impl<T> JSTraceable for MaybeUnreflectedStackRoot<T>
where
@ -316,7 +316,7 @@ where
/// on the stack, the `Dom<T>` can point to freed memory.
///
/// This should only be used as a field in other DOM objects.
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
pub struct Dom<T> {
ptr: ptr::NonNull<T>,
}
@ -341,7 +341,7 @@ impl<T> Dom<T> {
impl<T: DomObject> Dom<T> {
/// Create a Dom<T> from a &T
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn from_ref(obj: &T) -> Dom<T> {
assert_in_script();
Dom {
@ -375,7 +375,7 @@ unsafe impl<T: DomObject> JSTraceable for Dom<T> {
}
/// A traced reference to a DOM object that may not be reflected yet.
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
pub struct MaybeUnreflectedDom<T> {
ptr: ptr::NonNull<T>,
}
@ -384,7 +384,7 @@ impl<T> MaybeUnreflectedDom<T>
where
T: DomObject,
{
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub unsafe fn from_box(value: Box<T>) -> Self {
Self {
ptr: Box::leak(value).into(),
@ -416,7 +416,7 @@ where
/// An unrooted reference to a DOM object for use in layout. `Layout*Helpers`
/// traits must be implemented on this.
#[unrooted_must_root_lint::allow_unrooted_interior]
#[crown::unrooted_must_root_lint::allow_unrooted_interior]
pub struct LayoutDom<'dom, T> {
value: &'dom T,
}
@ -505,7 +505,7 @@ impl<T> Hash for LayoutDom<'_, T> {
impl<T> Clone for Dom<T> {
#[inline]
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn clone(&self) -> Self {
assert_in_script();
Dom {
@ -539,7 +539,7 @@ impl LayoutDom<'_, Node> {
///
/// This should only be used as a field in other DOM objects; see warning
/// on `Dom<T>`.
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
#[derive(JSTraceable)]
pub struct MutDom<T: DomObject> {
val: UnsafeCell<Dom<T>>,
@ -602,7 +602,7 @@ pub(crate) fn assert_in_layout() {
///
/// This should only be used as a field in other DOM objects; see warning
/// on `Dom<T>`.
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
#[derive(JSTraceable)]
pub struct MutNullableDom<T: DomObject> {
ptr: UnsafeCell<Option<Dom<T>>>,
@ -636,14 +636,14 @@ impl<T: DomObject> MutNullableDom<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.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub unsafe fn get_inner_as_layout(&self) -> Option<LayoutDom<T>> {
assert_in_layout();
(*self.ptr.get()).as_ref().map(|js| js.to_layout())
}
/// Get a rooted value out of this object
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn get(&self) -> Option<DomRoot<T>> {
assert_in_script();
unsafe { ptr::read(self.ptr.get()).map(|o| DomRoot::from_ref(&*o)) }
@ -678,7 +678,7 @@ impl<'a, T: DomObject> PartialEq<Option<&'a T>> for MutNullableDom<T> {
}
impl<T: DomObject> Default for MutNullableDom<T> {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn default() -> MutNullableDom<T> {
assert_in_script();
MutNullableDom {
@ -700,7 +700,7 @@ impl<T: DomObject> MallocSizeOf for MutNullableDom<T> {
///
/// This should only be used as a field in other DOM objects; see warning
/// on `Dom<T>`.
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
pub struct DomOnceCell<T: DomObject> {
ptr: OnceCell<Dom<T>>,
}
@ -711,7 +711,7 @@ where
{
/// Retrieve a copy of the current inner value. If it is `None`, it is
/// initialized with the result of `cb` first.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn init_once<F>(&self, cb: F) -> &T
where
F: FnOnce() -> DomRoot<T>,
@ -722,7 +722,7 @@ where
}
impl<T: DomObject> Default for DomOnceCell<T> {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn default() -> DomOnceCell<T> {
assert_in_script();
DomOnceCell {
@ -738,7 +738,7 @@ impl<T: DomObject> MallocSizeOf for DomOnceCell<T> {
}
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
unsafe impl<T: DomObject> JSTraceable for DomOnceCell<T> {
unsafe fn trace(&self, trc: *mut JSTracer) {
if let Some(ptr) = self.ptr.get() {

View file

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

View file

@ -100,7 +100,7 @@ unsafe impl<T: JSTraceable> CustomTraceable for OnceCell<T> {
///
/// SAFETY: Inner type must not impl JSTraceable
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[trace_in_no_trace_lint::must_not_have_traceable]
#[crown::trace_in_no_trace_lint::must_not_have_traceable]
pub struct NoTrace<T>(pub T);
impl<T: Display> Display for NoTrace<T> {
@ -130,7 +130,7 @@ impl<T: MallocSizeOf> MallocSizeOf for NoTrace<T> {
/// HashMap wrapper, that has non-jsmanaged keys
///
/// Not all methods are reexposed, but you can access inner type via .0
#[trace_in_no_trace_lint::must_not_have_traceable(0)]
#[crown::trace_in_no_trace_lint::must_not_have_traceable(0)]
#[derive(Clone, Debug)]
pub struct HashMapTracedValues<K, V, S = RandomState>(pub HashMap<K, V, S>);
@ -276,7 +276,7 @@ pub fn trace_jsval(tracer: *mut JSTracer, description: &str, val: &Heap<JSVal>)
}
/// Trace the `JSObject` held by `reflector`.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Reflector) {
trace!("tracing reflector {}", description);
trace_object(tracer, description, reflector.rootable())
@ -482,7 +482,7 @@ pub use js::gc::RootedTraceableSet;
/// 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 know what you're doing, use this.
#[unrooted_must_root_lint::allow_unrooted_interior]
#[crown::unrooted_must_root_lint::allow_unrooted_interior]
pub struct RootedTraceableBox<T: JSTraceable + 'static>(js::gc::RootedTraceableBox<T>);
unsafe impl<T: JSTraceable + 'static> JSTraceable for RootedTraceableBox<T> {
@ -547,9 +547,9 @@ impl<T: JSTraceable> DerefMut for RootedTraceableBox<T> {
/// Guaranteed to be empty when not rooted.
/// Usage: `rooted_vec!(let mut v);` or if you have an
/// iterator of `DomRoot`s, `rooted_vec!(let v <- iterator);`.
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
#[derive(JSTraceable)]
#[unrooted_must_root_lint::allow_unrooted_interior]
#[crown::unrooted_must_root_lint::allow_unrooted_interior]
pub struct RootableVec<T: JSTraceable> {
v: Vec<T>,
}
@ -562,7 +562,7 @@ impl<T: JSTraceable> RootableVec<T> {
}
/// A vector of items that are rooted for the lifetime 'a.
#[unrooted_must_root_lint::allow_unrooted_interior]
#[crown::unrooted_must_root_lint::allow_unrooted_interior]
pub struct RootedVec<'a, T: 'static + JSTraceable> {
root: &'a mut RootableVec<T>,
}

View file

@ -33,14 +33,14 @@ use crate::dom::bindings::trace::JSTraceable;
pub const DOM_WEAK_SLOT: u32 = 1;
/// A weak reference to a JS-managed DOM object.
#[allow(unrooted_must_root)]
#[unrooted_must_root_lint::allow_unrooted_interior]
#[allow(crown::unrooted_must_root)]
#[crown::unrooted_must_root_lint::allow_unrooted_interior]
pub struct WeakRef<T: WeakReferenceable> {
ptr: ptr::NonNull<WeakBox<T>>,
}
/// The inner box of weak references, public for the finalization in codegen.
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
pub struct WeakBox<T: WeakReferenceable> {
/// The reference count. When it reaches zero, the `value` field should
/// 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
/// only references which still point to live objects.
#[unrooted_must_root_lint::allow_unrooted_interior]
#[crown::unrooted_must_root_lint::allow_unrooted_interior]
#[derive(MallocSizeOf)]
pub struct WeakRefVec<T: WeakReferenceable> {
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
/// given to `WeakRefVec::update`.
#[unrooted_must_root_lint::allow_unrooted_interior]
#[crown::unrooted_must_root_lint::allow_unrooted_interior]
pub struct WeakRefEntry<'a, T: WeakReferenceable> {
vec: &'a mut WeakRefVec<T>,
index: &'a mut usize,

View file

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

View file

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

View file

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

View file

@ -187,7 +187,7 @@ impl BluetoothDevice {
}
// https://webbluetoothcg.github.io/web-bluetooth/#clean-up-the-disconnected-device
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn clean_up_disconnected_device(&self) {
// Step 1.
self.get_gatt().set_connected(false);
@ -223,7 +223,7 @@ impl BluetoothDevice {
}
// https://webbluetoothcg.github.io/web-bluetooth/#garbage-collect-the-connection
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn garbage_collect_the_connection(&self) -> ErrorResult {
// Step 1: TODO: Check if other systems using this device.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -52,7 +52,7 @@ pub enum RulesSource {
}
impl CSSRuleList {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn new_inherited(parent_stylesheet: &CSSStyleSheet, rules: RulesSource) -> CSSRuleList {
let guard = parent_stylesheet.shared_lock().read();
let dom_rules = match rules {
@ -78,7 +78,7 @@ impl CSSRuleList {
}
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn new(
window: &Window,
parent_stylesheet: &CSSStyleSheet,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -224,7 +224,7 @@ pub enum IsHTMLDocument {
}
#[derive(JSTraceable, MallocSizeOf)]
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
enum FocusTransaction {
/// No focus operation is in effect.
NotInTransaction,
@ -2878,7 +2878,7 @@ impl Document {
.or_insert_with(|| Dom::from_ref(context));
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn flush_dirty_webgpu_canvases(&self) {
self.dirty_webgpu_contexts
.borrow_mut()
@ -3817,7 +3817,7 @@ impl Document {
/// Add a stylesheet owned by `owner` to the list of document sheets, in the
/// correct tree position.
#[allow(unrooted_must_root)] // Owner needs to be rooted already necessarily.
#[allow(crown::unrooted_must_root)] // Owner needs to be rooted already necessarily.
pub fn add_stylesheet(&self, owner: &Element, sheet: Arc<Stylesheet>) {
let stylesheets = &mut *self.stylesheets.borrow_mut();
let insertion_point = stylesheets
@ -3850,7 +3850,7 @@ impl Document {
}
/// Remove a stylesheet owned by `owner` from the list of document sheets.
#[allow(unrooted_must_root)] // Owner needs to be rooted already necessarily.
#[allow(crown::unrooted_must_root)] // Owner needs to be rooted already necessarily.
pub fn remove_stylesheet(&self, owner: &Element, s: &Arc<Stylesheet>) {
match self.window.layout_chan() {
Some(chan) => chan.send(Msg::RemoveStylesheet(s.clone())).unwrap(),
@ -3876,7 +3876,7 @@ impl Document {
})
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn drain_pending_restyles(&self) -> Vec<(TrustedNodeAddress, PendingRestyle)> {
self.pending_restyles
.borrow_mut()
@ -5358,7 +5358,7 @@ impl AnimationFrameCallback {
}
#[derive(Default, JSTraceable, MallocSizeOf)]
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
struct PendingInOrderScriptVec {
scripts: DomRefCell<VecDeque<PendingScript>>,
}
@ -5396,7 +5396,7 @@ impl PendingInOrderScriptVec {
}
#[derive(JSTraceable, MallocSizeOf)]
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
struct PendingScript {
element: Dom<HTMLScriptElement>,
// TODO(sagudev): could this be all no_trace?

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -3769,7 +3769,7 @@ impl ElementPerformFullscreenEnter {
}
impl TaskOnce for ElementPerformFullscreenEnter {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn run_once(self) {
let element = self.element.root();
let promise = self.promise.root();
@ -3820,7 +3820,7 @@ impl ElementPerformFullscreenExit {
}
impl TaskOnce for ElementPerformFullscreenExit {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn run_once(self) {
let element = self.element.root();
let document = document_from_node(&*element);

View file

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

View file

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

View file

@ -92,7 +92,7 @@ impl FormDataMethods for FormData {
.push((NoTrace(LocalName::from(name.0)), datum));
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
// https://xhr.spec.whatwg.org/#dom-formdata-append
fn Append_(&self, name: USVString, blob: &Blob, filename: Option<USVString>) {
let datum = FormDatum {
@ -173,7 +173,7 @@ impl FormDataMethods for FormData {
));
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
// https://xhr.spec.whatwg.org/#dom-formdata-set
fn Set_(&self, name: USVString, blob: &Blob, filename: Option<USVString>) {
let mut data = self.data.borrow_mut();

View file

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

View file

@ -19,7 +19,7 @@ pub struct GamepadButtonList {
// TODO: support gamepad discovery
#[allow(dead_code)]
impl GamepadButtonList {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn new_inherited(list: &[&GamepadButton]) -> GamepadButtonList {
GamepadButtonList {
reflector_: Reflector::new(),

View file

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

View file

@ -54,7 +54,7 @@ struct WGPUResponse<T: AsyncWGPUListener + DomObject> {
}
impl<T: AsyncWGPUListener + DomObject> WGPUResponse<T> {
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn response(self, response: WebGPUResponseResult) {
let promise = self.trusted.root();
self.receiver.root().handle_response(response, &promise);

View file

@ -126,7 +126,7 @@ impl FromStr for GPUFeatureName {
}
// this error is wrong because if we inline Self::Key and Self::Value all errors are gone
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
impl Setlike for GPUSupportedFeatures {
type Key = DOMString;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -52,7 +52,7 @@ use crate::script_runtime::JSContext;
const DEFAULT_WIDTH: u32 = 300;
const DEFAULT_HEIGHT: u32 = 150;
#[unrooted_must_root_lint::must_root]
#[crown::unrooted_must_root_lint::must_root]
#[derive(Clone, JSTraceable, MallocSizeOf)]
pub enum CanvasContext {
Context2d(Dom<CanvasRenderingContext2D>),
@ -79,7 +79,7 @@ impl HTMLCanvasElement {
}
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn new(
local_name: LocalName,
prefix: Option<Prefix>,

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -327,7 +327,7 @@ impl HTMLInputElement {
}
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
pub fn new(
local_name: LocalName,
prefix: Option<Prefix>,
@ -2066,7 +2066,7 @@ impl HTMLInputElement {
}
}
#[allow(unrooted_must_root)]
#[allow(crown::unrooted_must_root)]
fn selection(&self) -> TextControlSelection<Self> {
TextControlSelection::new(&self, &self.textinput)
}

View file

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

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