mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add CanGc argument to reflect_dom_object (#34606)
* applied mach fmt Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Refinements Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> Modified reflect_dom_object signature and all its calls Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * fix function calls when parameter is passed up Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> --------- Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
This commit is contained in:
parent
471d3572b7
commit
0e9746fbbe
207 changed files with 570 additions and 101 deletions
|
@ -14,6 +14,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::{DomRoot, MutDom};
|
||||
use crate::dom::document::Document;
|
||||
use crate::dom::node::{Node, ShadowIncluding};
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct AbstractRange {
|
||||
|
@ -51,6 +52,7 @@ impl AbstractRange {
|
|||
end_offset,
|
||||
)),
|
||||
document.window(),
|
||||
CanGc::note(),
|
||||
);
|
||||
abstractrange
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
|||
use crate::dom::bindings::reflector::reflect_dom_object;
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct AudioDestinationNode {
|
||||
|
@ -44,7 +45,7 @@ impl AudioDestinationNode {
|
|||
options: &AudioNodeOptions,
|
||||
) -> DomRoot<AudioDestinationNode> {
|
||||
let node = AudioDestinationNode::new_inherited(context, options);
|
||||
reflect_dom_object(Box::new(node), global)
|
||||
reflect_dom_object(Box::new(node), global, CanGc::note())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ use crate::dom::bindings::num::Finite;
|
|||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct AudioListener {
|
||||
|
@ -153,9 +154,13 @@ impl AudioListener {
|
|||
}
|
||||
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
pub fn new(window: &Window, context: &BaseAudioContext) -> DomRoot<AudioListener> {
|
||||
pub fn new(
|
||||
window: &Window,
|
||||
context: &BaseAudioContext,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<AudioListener> {
|
||||
let node = AudioListener::new_inherited(window, context);
|
||||
reflect_dom_object(Box::new(node), window)
|
||||
reflect_dom_object(Box::new(node), window, can_gc)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ use crate::dom::bindings::num::Finite;
|
|||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct AudioParam {
|
||||
|
@ -87,7 +88,7 @@ impl AudioParam {
|
|||
min_value,
|
||||
max_value,
|
||||
);
|
||||
reflect_dom_object(Box::new(audio_param), window)
|
||||
reflect_dom_object(Box::new(audio_param), window, CanGc::note())
|
||||
}
|
||||
|
||||
fn message_node(&self, message: AudioNodeMessage) {
|
||||
|
|
|
@ -13,6 +13,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct AudioTrack {
|
||||
|
@ -57,6 +58,7 @@ impl AudioTrack {
|
|||
id, kind, label, language, track_list,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ impl AudioTrackList {
|
|||
reflect_dom_object(
|
||||
Box::new(AudioTrackList::new_inherited(tracks, media_element)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -341,7 +341,8 @@ impl BaseAudioContextMethods<crate::DomTypeHolder> for BaseAudioContext {
|
|||
fn Listener(&self) -> DomRoot<AudioListener> {
|
||||
let global = self.global();
|
||||
let window = global.as_window();
|
||||
self.listener.or_init(|| AudioListener::new(window, self))
|
||||
self.listener
|
||||
.or_init(|| AudioListener::new(window, self, CanGc::note()))
|
||||
}
|
||||
|
||||
// https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-onstatechange
|
||||
|
|
|
@ -16,6 +16,7 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#beforeunloadevent
|
||||
#[dom_struct]
|
||||
|
@ -33,7 +34,11 @@ impl BeforeUnloadEvent {
|
|||
}
|
||||
|
||||
pub fn new_uninitialized(window: &Window) -> DomRoot<BeforeUnloadEvent> {
|
||||
reflect_dom_object(Box::new(BeforeUnloadEvent::new_inherited()), window)
|
||||
reflect_dom_object(
|
||||
Box::new(BeforeUnloadEvent::new_inherited()),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn new(
|
||||
|
|
|
@ -72,7 +72,7 @@ impl<T: DomObjectIteratorWrap + JSTraceable + Iterable> IterableIterator<T> {
|
|||
iterable: Dom::from_ref(iterable),
|
||||
index: Cell::new(0),
|
||||
});
|
||||
reflect_dom_object(iterator, &*iterable.global())
|
||||
reflect_dom_object(iterator, &*iterable.global(), CanGc::note())
|
||||
}
|
||||
|
||||
/// Return the next value from the iterable object.
|
||||
|
|
|
@ -19,21 +19,13 @@ use crate::script_runtime::{CanGc, JSContext};
|
|||
|
||||
/// Create the reflector for a new DOM object and yield ownership to the
|
||||
/// reflector.
|
||||
pub fn reflect_dom_object<T, U>(obj: Box<T>, global: &U) -> DomRoot<T>
|
||||
pub fn reflect_dom_object<T, U>(obj: Box<T>, global: &U, can_gc: CanGc) -> DomRoot<T>
|
||||
where
|
||||
T: DomObject + DomObjectWrap,
|
||||
U: DerivedFrom<GlobalScope>,
|
||||
{
|
||||
let global_scope = global.upcast();
|
||||
unsafe {
|
||||
T::WRAP(
|
||||
GlobalScope::get_cx(),
|
||||
global_scope,
|
||||
None,
|
||||
obj,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
unsafe { T::WRAP(GlobalScope::get_cx(), global_scope, None, obj, can_gc) }
|
||||
}
|
||||
|
||||
pub fn reflect_dom_object_with_proto<T, U>(
|
||||
|
|
|
@ -152,7 +152,7 @@ impl Bluetooth {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<Bluetooth> {
|
||||
reflect_dom_object(Box::new(Bluetooth::new_inherited()), global)
|
||||
reflect_dom_object(Box::new(Bluetooth::new_inherited()), global, CanGc::note())
|
||||
}
|
||||
|
||||
fn get_bluetooth_thread(&self) -> IpcSender<BluetoothRequest> {
|
||||
|
|
|
@ -8,6 +8,7 @@ use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBi
|
|||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#characteristicproperties
|
||||
#[dom_struct]
|
||||
|
@ -78,6 +79,7 @@ impl BluetoothCharacteristicProperties {
|
|||
writableAuxiliaries,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ impl BluetoothDevice {
|
|||
reflect_dom_object(
|
||||
Box::new(BluetoothDevice::new_inherited(id, name, context)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ impl BluetoothPermissionResult {
|
|||
reflect_dom_object(
|
||||
Box::new(BluetoothPermissionResult::new_inherited(status)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ impl BluetoothRemoteGATTCharacteristic {
|
|||
instance_id,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ impl BluetoothRemoteGATTDescriptor {
|
|||
instance_id,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ impl BluetoothRemoteGATTServer {
|
|||
reflect_dom_object(
|
||||
Box::new(BluetoothRemoteGATTServer::new_inherited(device)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ impl BluetoothRemoteGATTService {
|
|||
device, uuid, isPrimary, instanceID,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,11 @@ impl CanvasGradient {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, style: CanvasGradientStyle) -> DomRoot<CanvasGradient> {
|
||||
reflect_dom_object(Box::new(CanvasGradient::new_inherited(style)), global)
|
||||
reflect_dom_object(
|
||||
Box::new(CanvasGradient::new_inherited(style)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::canvasgradient::ToFillOrStrokeStyle;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#canvaspattern
|
||||
#[dom_struct]
|
||||
|
@ -61,6 +62,7 @@ impl CanvasPattern {
|
|||
origin_clean,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
pub fn origin_is_clean(&self) -> bool {
|
||||
|
|
|
@ -64,7 +64,7 @@ impl CanvasRenderingContext2D {
|
|||
Some(canvas),
|
||||
size,
|
||||
));
|
||||
reflect_dom_object(boxed, global)
|
||||
reflect_dom_object(boxed, global, CanGc::note())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#concept-canvas-set-bitmap-dimensions
|
||||
|
|
|
@ -14,6 +14,7 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
|||
use crate::dom::bindings::str::{DOMString, USVString};
|
||||
use crate::dom::serviceworker::ServiceWorker;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct Client {
|
||||
|
@ -39,7 +40,11 @@ impl Client {
|
|||
}
|
||||
|
||||
pub fn new(window: &Window) -> DomRoot<Client> {
|
||||
reflect_dom_object(Box::new(Client::new_inherited(window.get_url())), window)
|
||||
reflect_dom_object(
|
||||
Box::new(Client::new_inherited(window.get_url())),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn creation_url(&self) -> ServoUrl {
|
||||
|
|
|
@ -32,7 +32,11 @@ impl CompositionEvent {
|
|||
}
|
||||
|
||||
pub fn new_uninitialized(window: &Window) -> DomRoot<CompositionEvent> {
|
||||
reflect_dom_object(Box::new(CompositionEvent::new_inherited()), window)
|
||||
reflect_dom_object(
|
||||
Box::new(CompositionEvent::new_inherited()),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
|
|
@ -17,7 +17,7 @@ use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::subtlecrypto::SubtleCrypto;
|
||||
use crate::script_runtime::JSContext;
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto
|
||||
#[dom_struct]
|
||||
|
@ -38,7 +38,7 @@ impl Crypto {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<Crypto> {
|
||||
reflect_dom_object(Box::new(Crypto::new_inherited()), global)
|
||||
reflect_dom_object(Box::new(Crypto::new_inherited()), global, CanGc::note())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::js::conversions::ToJSValConvertible;
|
||||
use crate::script_runtime::JSContext;
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
|
||||
/// The underlying cryptographic data this key represents
|
||||
#[allow(dead_code)]
|
||||
|
@ -96,6 +96,7 @@ impl CryptoKey {
|
|||
handle,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
);
|
||||
|
||||
object.algorithm_object.set(algorithm_object.get());
|
||||
|
|
|
@ -13,6 +13,7 @@ use crate::dom::bindings::str::DOMString;
|
|||
use crate::dom::cssrule::{CSSRule, SpecificCSSRule};
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSFontFaceRule {
|
||||
|
@ -45,6 +46,7 @@ impl CSSFontFaceRule {
|
|||
fontfacerule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ use crate::dom::bindings::str::DOMString;
|
|||
use crate::dom::cssrule::{CSSRule, SpecificCSSRule};
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSImportRule {
|
||||
|
@ -45,6 +46,7 @@ impl CSSImportRule {
|
|||
reflect_dom_object(
|
||||
Box::new(Self::new_inherited(parent_stylesheet, import_rule)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ use crate::dom::cssrule::{CSSRule, SpecificCSSRule};
|
|||
use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner};
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSKeyframeRule {
|
||||
|
@ -51,6 +52,7 @@ impl CSSKeyframeRule {
|
|||
keyframerule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ use crate::dom::cssrule::{CSSRule, SpecificCSSRule};
|
|||
use crate::dom::cssrulelist::{CSSRuleList, RulesSource};
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSKeyframesRule {
|
||||
|
@ -55,6 +56,7 @@ impl CSSKeyframesRule {
|
|||
keyframesrule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ use crate::dom::cssgroupingrule::CSSGroupingRule;
|
|||
use crate::dom::cssrule::SpecificCSSRule;
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSLayerBlockRule {
|
||||
|
@ -51,6 +52,7 @@ impl CSSLayerBlockRule {
|
|||
layerblockrule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ use crate::dom::bindings::utils::to_frozen_array;
|
|||
use crate::dom::cssrule::{CSSRule, SpecificCSSRule};
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::JSContext as SafeJSContext;
|
||||
use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSLayerStatementRule {
|
||||
|
@ -50,6 +50,7 @@ impl CSSLayerStatementRule {
|
|||
layerstatementrule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ use crate::dom::cssrule::SpecificCSSRule;
|
|||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::medialist::MediaList;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSMediaRule {
|
||||
|
@ -46,6 +47,7 @@ impl CSSMediaRule {
|
|||
reflect_dom_object(
|
||||
Box::new(CSSMediaRule::new_inherited(parent_stylesheet, mediarule)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ use crate::dom::bindings::str::DOMString;
|
|||
use crate::dom::cssrule::{CSSRule, SpecificCSSRule};
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSNamespaceRule {
|
||||
|
@ -46,6 +47,7 @@ impl CSSNamespaceRule {
|
|||
namespacerule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ use crate::dom::cssrule::CSSRule;
|
|||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::htmlelement::HTMLElement;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
use crate::stylesheet_loader::StylesheetLoader;
|
||||
|
||||
unsafe_no_jsmanaged_fields!(RulesSource);
|
||||
|
@ -87,6 +88,7 @@ impl CSSRuleList {
|
|||
reflect_dom_object(
|
||||
Box::new(CSSRuleList::new_inherited(parent_stylesheet, rules)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -244,6 +244,7 @@ impl CSSStyleDeclaration {
|
|||
modification_access,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ use crate::dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration
|
|||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::node::{stylesheets_owner_from_node, Node};
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSStyleRule {
|
||||
|
@ -53,6 +54,7 @@ impl CSSStyleRule {
|
|||
reflect_dom_object(
|
||||
Box::new(CSSStyleRule::new_inherited(parent_stylesheet, stylerule)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ use crate::dom::medialist::MediaList;
|
|||
use crate::dom::node::{stylesheets_owner_from_node, Node};
|
||||
use crate::dom::stylesheet::StyleSheet;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSStyleSheet {
|
||||
|
@ -64,6 +65,7 @@ impl CSSStyleSheet {
|
|||
owner, type_, href, title, stylesheet,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSStyleValue {
|
||||
|
@ -27,7 +28,11 @@ impl CSSStyleValue {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, value: String) -> DomRoot<CSSStyleValue> {
|
||||
reflect_dom_object(Box::new(CSSStyleValue::new_inherited(value)), global)
|
||||
reflect_dom_object(
|
||||
Box::new(CSSStyleValue::new_inherited(value)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use crate::dom::cssconditionrule::CSSConditionRule;
|
|||
use crate::dom::cssrule::SpecificCSSRule;
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct CSSSupportsRule {
|
||||
|
@ -48,6 +49,7 @@ impl CSSSupportsRule {
|
|||
supportsrule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ impl CustomElementRegistry {
|
|||
reflect_dom_object(
|
||||
Box::new(CustomElementRegistry::new_inherited(window)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ use crate::dom::bindings::str::DOMString;
|
|||
use crate::dom::file::File;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::drag_data_store::Kind;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct DataTransferItem {
|
||||
|
@ -34,7 +35,11 @@ impl DataTransferItem {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, item: Kind) -> DomRoot<DataTransferItem> {
|
||||
reflect_dom_object(Box::new(DataTransferItem::new_inherited(item)), global)
|
||||
reflect_dom_object(
|
||||
Box::new(DataTransferItem::new_inherited(item)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ use crate::dom::datatransferitem::DataTransferItem;
|
|||
use crate::dom::file::File;
|
||||
use crate::dom::window::Window;
|
||||
use crate::drag_data_store::{Binary, DragDataStore, Kind, Mode, PlainString};
|
||||
use crate::script_runtime::JSContext;
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct DataTransferItemList {
|
||||
|
@ -46,6 +46,7 @@ impl DataTransferItemList {
|
|||
reflect_dom_object(
|
||||
Box::new(DataTransferItemList::new_inherited(data_store)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::bindings::str::{DOMString, USVString};
|
||||
use crate::dom::dissimilaroriginwindow::DissimilarOriginWindow;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
/// Represents a dissimilar-origin `Location` that exists in another script thread.
|
||||
///
|
||||
|
@ -40,6 +41,7 @@ impl DissimilarOriginLocation {
|
|||
reflect_dom_object(
|
||||
Box::new(DissimilarOriginLocation::new_inherited(window)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,7 +148,11 @@ impl DOMException {
|
|||
pub fn new(global: &GlobalScope, code: DOMErrorName) -> DomRoot<DOMException> {
|
||||
let (message, name) = DOMException::get_error_data_by_code(code);
|
||||
|
||||
reflect_dom_object(Box::new(DOMException::new_inherited(message, name)), global)
|
||||
reflect_dom_object(
|
||||
Box::new(DOMException::new_inherited(message, name)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
// not an IDL stringifier, used internally
|
||||
|
|
|
@ -47,7 +47,11 @@ impl DOMImplementation {
|
|||
|
||||
pub fn new(document: &Document) -> DomRoot<DOMImplementation> {
|
||||
let window = document.window();
|
||||
reflect_dom_object(Box::new(DOMImplementation::new_inherited(document)), window)
|
||||
reflect_dom_object(
|
||||
Box::new(DOMImplementation::new_inherited(document)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ impl DOMRectMethods<crate::DomTypeHolder> for DOMRect {
|
|||
fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> DomRoot<DOMRect> {
|
||||
let rect = create_a_domrectreadonly_from_the_dictionary(other);
|
||||
|
||||
reflect_dom_object(Box::new(Self { rect }), global)
|
||||
reflect_dom_object(Box::new(Self { rect }), global, CanGc::note())
|
||||
}
|
||||
|
||||
// https://drafts.fxtf.org/geometry/#dom-domrect-x
|
||||
|
|
|
@ -93,7 +93,7 @@ impl DOMRectReadOnlyMethods<crate::DomTypeHolder> for DOMRectReadOnly {
|
|||
fn FromRect(global: &GlobalScope, other: &DOMRectInit) -> DomRoot<DOMRectReadOnly> {
|
||||
let dom_rect = create_a_domrectreadonly_from_the_dictionary(other);
|
||||
|
||||
reflect_dom_object(Box::new(dom_rect), global)
|
||||
reflect_dom_object(Box::new(dom_rect), global, CanGc::note())
|
||||
}
|
||||
|
||||
// https://drafts.fxtf.org/geometry/#dom-domrectreadonly-x
|
||||
|
|
|
@ -9,6 +9,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct DOMStringList {
|
||||
|
@ -27,7 +28,11 @@ impl DOMStringList {
|
|||
|
||||
#[allow(unused)]
|
||||
pub fn new(window: &Window, strings: Vec<DOMString>) -> DomRoot<DOMStringList> {
|
||||
reflect_dom_object(Box::new(DOMStringList::new_inherited(strings)), window)
|
||||
reflect_dom_object(
|
||||
Box::new(DOMStringList::new_inherited(strings)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,11 @@ impl DOMStringMap {
|
|||
|
||||
pub fn new(element: &HTMLElement) -> DomRoot<DOMStringMap> {
|
||||
let window = window_from_node(element);
|
||||
reflect_dom_object(Box::new(DOMStringMap::new_inherited(element)), &*window)
|
||||
reflect_dom_object(
|
||||
Box::new(DOMStringMap::new_inherited(element)),
|
||||
&*window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ impl DOMTokenList {
|
|||
supported_tokens,
|
||||
)),
|
||||
&*window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::promise::Promise;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
/// An unique id for dynamic module
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, PartialEq)]
|
||||
|
@ -44,6 +45,7 @@ impl DynamicModuleOwner {
|
|||
reflect_dom_object(
|
||||
Box::new(DynamicModuleOwner::new_inherited(promise, id)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,11 @@ impl ElementInternals {
|
|||
|
||||
pub fn new(element: &HTMLElement) -> DomRoot<ElementInternals> {
|
||||
let global = window_from_node(element);
|
||||
reflect_dom_object(Box::new(ElementInternals::new_inherited(element)), &*global)
|
||||
reflect_dom_object(
|
||||
Box::new(ElementInternals::new_inherited(element)),
|
||||
&*global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
fn is_target_form_associated(&self) -> bool {
|
||||
|
|
|
@ -11,6 +11,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::file::File;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
// https://w3c.github.io/FileAPI/#dfn-filelist
|
||||
#[dom_struct]
|
||||
|
@ -35,6 +36,7 @@ impl FileList {
|
|||
files.iter().map(|r| Dom::from_ref(&**r)).collect(),
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ use crate::dom::bindings::num::Finite;
|
|||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GamepadButton {
|
||||
|
@ -34,6 +35,7 @@ impl GamepadButton {
|
|||
reflect_dom_object(
|
||||
Box::new(GamepadButton::new_inherited(pressed, touched)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::{Dom, DomRoot, DomSlice};
|
||||
use crate::dom::gamepadbutton::GamepadButton;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
// https://w3c.github.io/gamepad/#gamepadbutton-interface
|
||||
#[dom_struct]
|
||||
|
@ -27,7 +28,11 @@ impl GamepadButtonList {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope, list: &[&GamepadButton]) -> DomRoot<GamepadButtonList> {
|
||||
reflect_dom_object(Box::new(GamepadButtonList::new_inherited(list)), global)
|
||||
reflect_dom_object(
|
||||
Box::new(GamepadButtonList::new_inherited(list)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::Bindings::GamepadPoseBinding::GamepadPoseMeth
|
|||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::JSContext;
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct GamepadPose {
|
||||
|
@ -45,7 +45,11 @@ impl GamepadPose {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<GamepadPose> {
|
||||
reflect_dom_object(Box::new(GamepadPose::new_inherited()), global)
|
||||
reflect_dom_object(
|
||||
Box::new(GamepadPose::new_inherited()),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,11 @@ impl History {
|
|||
}
|
||||
|
||||
pub fn new(window: &Window) -> DomRoot<History> {
|
||||
reflect_dom_object(Box::new(History::new_inherited(window)), window)
|
||||
reflect_dom_object(
|
||||
Box::new(History::new_inherited(window)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ use crate::dom::bindings::xmlname::namespace_from_domstring;
|
|||
use crate::dom::element::Element;
|
||||
use crate::dom::node::{document_from_node, Node};
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
pub trait CollectionFilter: JSTraceable {
|
||||
fn filter<'a>(&self, elem: &'a Element, root: &'a Node) -> bool;
|
||||
|
@ -107,6 +108,7 @@ impl HTMLCollection {
|
|||
reflect_dom_object(
|
||||
Box::new(HTMLCollection::new_inherited(root, filter)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ use crate::dom::htmlformelement::HTMLFormElement;
|
|||
use crate::dom::node::Node;
|
||||
use crate::dom::radionodelist::RadioNodeList;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct HTMLFormControlsCollection {
|
||||
|
@ -48,6 +49,7 @@ impl HTMLFormControlsCollection {
|
|||
reflect_dom_object(
|
||||
Box::new(HTMLFormControlsCollection::new_inherited(form, filter)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ impl HTMLOptionsCollection {
|
|||
reflect_dom_object(
|
||||
Box::new(HTMLOptionsCollection::new_inherited(select, filter)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ use crate::dom::bindings::error::Fallible;
|
|||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct ImageBitmap {
|
||||
|
@ -43,7 +44,7 @@ impl ImageBitmap {
|
|||
//assigning to a variable the return object of new_inherited
|
||||
let imagebitmap = Box::new(ImageBitmap::new_inherited(width, height));
|
||||
|
||||
Ok(reflect_dom_object(imagebitmap, global))
|
||||
Ok(reflect_dom_object(imagebitmap, global, CanGc::note()))
|
||||
}
|
||||
|
||||
pub fn set_bitmap_data(&self, data: Vec<u8>) {
|
||||
|
|
|
@ -58,7 +58,11 @@ impl Location {
|
|||
}
|
||||
|
||||
pub fn new(window: &Window) -> DomRoot<Location> {
|
||||
reflect_dom_object(Box::new(Location::new_inherited(window)), window)
|
||||
reflect_dom_object(
|
||||
Box::new(Location::new_inherited(window)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Navigate the relevant `Document`'s browsing context.
|
||||
|
|
|
@ -663,6 +663,7 @@ macro_rules! impl_performance_entry_struct(
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::performanceentry::PerformanceEntry;
|
||||
use crate::script_runtime::CanGc;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -687,7 +688,7 @@ macro_rules! impl_performance_entry_struct(
|
|||
start_time: CrossProcessInstant,
|
||||
duration: Duration) -> DomRoot<$struct> {
|
||||
let entry = $struct::new_inherited(name, start_time, duration);
|
||||
reflect_dom_object(Box::new(entry), global)
|
||||
reflect_dom_object(Box::new(entry), global, CanGc::note())
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -13,6 +13,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct MediaDeviceInfo {
|
||||
|
@ -51,6 +52,7 @@ impl MediaDeviceInfo {
|
|||
device_id, kind, label, group_id,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,11 @@ impl MediaDevices {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<MediaDevices> {
|
||||
reflect_dom_object(Box::new(MediaDevices::new_inherited()), global)
|
||||
reflect_dom_object(
|
||||
Box::new(MediaDevices::new_inherited()),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct MediaError {
|
||||
|
@ -25,7 +26,11 @@ impl MediaError {
|
|||
}
|
||||
|
||||
pub fn new(window: &Window, code: u16) -> DomRoot<MediaError> {
|
||||
reflect_dom_object(Box::new(MediaError::new_inherited(code)), window)
|
||||
reflect_dom_object(
|
||||
Box::new(MediaError::new_inherited(code)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ use crate::dom::bindings::root::{Dom, DomRoot};
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct MediaList {
|
||||
|
@ -50,6 +51,7 @@ impl MediaList {
|
|||
reflect_dom_object(
|
||||
Box::new(MediaList::new_inherited(parent_stylesheet, media_queries)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ use crate::dom::bindings::root::{Dom, DomRoot};
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::document::Document;
|
||||
use crate::dom::eventtarget::EventTarget;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
pub enum MediaQueryListMatchState {
|
||||
Same,
|
||||
|
@ -49,6 +50,7 @@ impl MediaQueryList {
|
|||
reflect_dom_object(
|
||||
Box::new(MediaQueryList::new_inherited(document, media_query_list)),
|
||||
document.window(),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,11 @@ impl MediaSession {
|
|||
}
|
||||
|
||||
pub fn new(window: &Window) -> DomRoot<MediaSession> {
|
||||
reflect_dom_object(Box::new(MediaSession::new_inherited()), window)
|
||||
reflect_dom_object(
|
||||
Box::new(MediaSession::new_inherited()),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn register_media_instance(&self, media_instance: &HTMLMediaElement) {
|
||||
|
|
|
@ -12,6 +12,7 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::eventtarget::EventTarget;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct MediaStreamTrack {
|
||||
|
@ -38,7 +39,11 @@ impl MediaStreamTrack {
|
|||
id: MediaStreamId,
|
||||
ty: MediaStreamType,
|
||||
) -> DomRoot<MediaStreamTrack> {
|
||||
reflect_dom_object(Box::new(MediaStreamTrack::new_inherited(id, ty)), global)
|
||||
reflect_dom_object(
|
||||
Box::new(MediaStreamTrack::new_inherited(id, ty)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn id(&self) -> MediaStreamId {
|
||||
|
|
|
@ -54,7 +54,11 @@ impl MessagePort {
|
|||
/// <https://html.spec.whatwg.org/multipage/#create-a-new-messageport-object>
|
||||
pub fn new(owner: &GlobalScope) -> DomRoot<MessagePort> {
|
||||
let port_id = MessagePortId::new();
|
||||
reflect_dom_object(Box::new(MessagePort::new_inherited(port_id)), owner)
|
||||
reflect_dom_object(
|
||||
Box::new(MessagePort::new_inherited(port_id)),
|
||||
owner,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Create a new port for an incoming transfer-received one.
|
||||
|
@ -71,6 +75,7 @@ impl MessagePort {
|
|||
entangled_port: RefCell::new(entangled_port),
|
||||
}),
|
||||
owner,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::mimetype::MimeType;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct MimeTypeArray {
|
||||
|
@ -24,7 +25,11 @@ impl MimeTypeArray {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<MimeTypeArray> {
|
||||
reflect_dom_object(Box::new(MimeTypeArray::new_inherited()), global)
|
||||
reflect_dom_object(
|
||||
Box::new(MimeTypeArray::new_inherited()),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::node::{window_from_node, Node};
|
||||
use crate::dom::nodelist::NodeList;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct MutationRecord {
|
||||
|
@ -45,7 +46,7 @@ impl MutationRecord {
|
|||
None,
|
||||
None,
|
||||
));
|
||||
reflect_dom_object(record, &*window_from_node(target))
|
||||
reflect_dom_object(record, &*window_from_node(target), CanGc::note())
|
||||
}
|
||||
|
||||
pub fn character_data_mutated(
|
||||
|
@ -65,6 +66,7 @@ impl MutationRecord {
|
|||
None,
|
||||
)),
|
||||
&*window_from_node(target),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -93,6 +95,7 @@ impl MutationRecord {
|
|||
prev_sibling,
|
||||
)),
|
||||
&*window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use crate::dom::bindings::str::DOMString;
|
|||
use crate::dom::bindings::xmlname::namespace_from_domstring;
|
||||
use crate::dom::element::Element;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct NamedNodeMap {
|
||||
|
@ -31,7 +32,11 @@ impl NamedNodeMap {
|
|||
}
|
||||
|
||||
pub fn new(window: &Window, elem: &Element) -> DomRoot<NamedNodeMap> {
|
||||
reflect_dom_object(Box::new(NamedNodeMap::new_inherited(elem)), window)
|
||||
reflect_dom_object(
|
||||
Box::new(NamedNodeMap::new_inherited(elem)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ impl NavigationPreloadManager {
|
|||
registration: &ServiceWorkerRegistration,
|
||||
) -> DomRoot<NavigationPreloadManager> {
|
||||
let manager = NavigationPreloadManager::new_inherited(registration);
|
||||
reflect_dom_object(Box::new(manager), global)
|
||||
reflect_dom_object(Box::new(manager), global, CanGc::note())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ impl Navigator {
|
|||
}
|
||||
|
||||
pub fn new(window: &Window) -> DomRoot<Navigator> {
|
||||
reflect_dom_object(Box::new(Navigator::new_inherited()), window)
|
||||
reflect_dom_object(Box::new(Navigator::new_inherited()), window, CanGc::note())
|
||||
}
|
||||
|
||||
#[cfg(feature = "webxr")]
|
||||
|
|
|
@ -16,6 +16,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::{Dom, DomRoot, MutDom};
|
||||
use crate::dom::document::Document;
|
||||
use crate::dom::node::Node;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct NodeIterator {
|
||||
|
@ -52,6 +53,7 @@ impl NodeIterator {
|
|||
reflect_dom_object(
|
||||
Box::new(NodeIterator::new_inherited(root_node, what_to_show, filter)),
|
||||
document.window(),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ use crate::dom::htmlelement::HTMLElement;
|
|||
use crate::dom::htmlformelement::HTMLFormElement;
|
||||
use crate::dom::node::{ChildrenMutation, Node};
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[derive(JSTraceable, MallocSizeOf)]
|
||||
#[crown::unrooted_must_root_lint::must_root]
|
||||
|
@ -46,7 +47,11 @@ impl NodeList {
|
|||
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
pub fn new(window: &Window, list_type: NodeListType) -> DomRoot<NodeList> {
|
||||
reflect_dom_object(Box::new(NodeList::new_inherited(list_type)), window)
|
||||
reflect_dom_object(
|
||||
Box::new(NodeList::new_inherited(list_type)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn new_simple_list<T>(window: &Window, iter: T) -> DomRoot<NodeList>
|
||||
|
|
|
@ -59,7 +59,7 @@ impl OffscreenCanvasRenderingContext2D {
|
|||
let boxed = Box::new(OffscreenCanvasRenderingContext2D::new_inherited(
|
||||
global, canvas, htmlcanvas,
|
||||
));
|
||||
reflect_dom_object(boxed, global)
|
||||
reflect_dom_object(boxed, global, CanGc::note())
|
||||
}
|
||||
|
||||
pub fn set_canvas_bitmap_dimensions(&self, size: Size2D<u64>) {
|
||||
|
|
|
@ -51,6 +51,7 @@ impl PaintRenderingContext2D {
|
|||
reflect_dom_object(
|
||||
Box::new(PaintRenderingContext2D::new_inherited(global)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ use crate::dom::bindings::num::Finite;
|
|||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct PaintSize {
|
||||
|
@ -32,7 +33,11 @@ impl PaintSize {
|
|||
global: &PaintWorkletGlobalScope,
|
||||
size: Size2D<f32, CSSPixel>,
|
||||
) -> DomRoot<PaintSize> {
|
||||
reflect_dom_object(Box::new(PaintSize::new_inherited(size)), global)
|
||||
reflect_dom_object(
|
||||
Box::new(PaintSize::new_inherited(size)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -171,6 +171,7 @@ impl Performance {
|
|||
reflect_dom_object(
|
||||
Box::new(Performance::new_inherited(navigation_start)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
|||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct PerformanceEntry {
|
||||
|
@ -53,7 +54,7 @@ impl PerformanceEntry {
|
|||
duration: Duration,
|
||||
) -> DomRoot<PerformanceEntry> {
|
||||
let entry = PerformanceEntry::new_inherited(name, entry_type, Some(start_time), duration);
|
||||
reflect_dom_object(Box::new(entry), global)
|
||||
reflect_dom_object(Box::new(entry), global, CanGc::note())
|
||||
}
|
||||
|
||||
pub fn entry_type(&self) -> &DOMString {
|
||||
|
|
|
@ -11,6 +11,7 @@ use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::Wind
|
|||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct PerformanceNavigation {
|
||||
|
@ -25,7 +26,11 @@ impl PerformanceNavigation {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<PerformanceNavigation> {
|
||||
reflect_dom_object(Box::new(PerformanceNavigation::new_inherited()), global)
|
||||
reflect_dom_object(
|
||||
Box::new(PerformanceNavigation::new_inherited()),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use crate::dom::bindings::root::{Dom, DomRoot};
|
|||
use crate::dom::document::Document;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::performanceresourcetiming::{InitiatorType, PerformanceResourceTiming};
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
// https://w3c.github.io/navigation-timing/#dom-performancenavigationtiming
|
||||
|
@ -55,6 +56,7 @@ impl PerformanceNavigationTiming {
|
|||
document,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ use crate::dom::bindings::str::DOMString;
|
|||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::performance::PerformanceEntryList;
|
||||
use crate::dom::performanceentry::PerformanceEntry;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct PerformanceObserverEntryList {
|
||||
|
@ -33,7 +34,7 @@ impl PerformanceObserverEntryList {
|
|||
entries: PerformanceEntryList,
|
||||
) -> DomRoot<PerformanceObserverEntryList> {
|
||||
let observer_entry_list = PerformanceObserverEntryList::new_inherited(entries);
|
||||
reflect_dom_object(Box::new(observer_entry_list), global)
|
||||
reflect_dom_object(Box::new(observer_entry_list), global, CanGc::note())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::performanceentry::PerformanceEntry;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct PerformancePaintTiming {
|
||||
|
@ -47,6 +48,6 @@ impl PerformancePaintTiming {
|
|||
start_time: CrossProcessInstant,
|
||||
) -> DomRoot<PerformancePaintTiming> {
|
||||
let entry = PerformancePaintTiming::new_inherited(metric_type, start_time);
|
||||
reflect_dom_object(Box::new(entry), global)
|
||||
reflect_dom_object(Box::new(entry), global, CanGc::note())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::performanceentry::PerformanceEntry;
|
||||
|
||||
use crate::script_runtime::CanGc;
|
||||
// TODO UA may choose to limit how many resources are included as PerformanceResourceTiming objects
|
||||
// recommended minimum is 150, can be changed by setResourceTimingBufferSize in performance
|
||||
// https://w3c.github.io/resource-timing/#sec-extensions-performance-interface
|
||||
|
@ -168,6 +168,7 @@ impl PerformanceResourceTiming {
|
|||
resource_timing,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,11 @@ impl Permissions {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<Permissions> {
|
||||
reflect_dom_object(Box::new(Permissions::new_inherited()), global)
|
||||
reflect_dom_object(
|
||||
Box::new(Permissions::new_inherited()),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
// https://w3c.github.io/permissions/#dom-permissions-query
|
||||
|
|
|
@ -14,6 +14,7 @@ use crate::dom::bindings::reflector::reflect_dom_object;
|
|||
use crate::dom::bindings::root::DomRoot;
|
||||
use crate::dom::eventtarget::EventTarget;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
// https://w3c.github.io/permissions/#permissionstatus
|
||||
#[dom_struct]
|
||||
|
@ -36,6 +37,7 @@ impl PermissionStatus {
|
|||
reflect_dom_object(
|
||||
Box::new(PermissionStatus::new_inherited(query.name)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::bindings::str::DOMString;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::plugin::Plugin;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct PluginArray {
|
||||
|
@ -24,7 +25,11 @@ impl PluginArray {
|
|||
}
|
||||
|
||||
pub fn new(global: &GlobalScope) -> DomRoot<PluginArray> {
|
||||
reflect_dom_object(Box::new(PluginArray::new_inherited()), global)
|
||||
reflect_dom_object(
|
||||
Box::new(PluginArray::new_inherited()),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ impl PromiseNativeHandler {
|
|||
reject,
|
||||
}),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ use crate::dom::htmlinputelement::{HTMLInputElement, InputType};
|
|||
use crate::dom::node::Node;
|
||||
use crate::dom::nodelist::{NodeList, NodeListType, RadioList, RadioListMode};
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct RadioNodeList {
|
||||
|
@ -33,7 +34,11 @@ impl RadioNodeList {
|
|||
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
pub fn new(window: &Window, list_type: NodeListType) -> DomRoot<RadioNodeList> {
|
||||
reflect_dom_object(Box::new(RadioNodeList::new_inherited(list_type)), window)
|
||||
reflect_dom_object(
|
||||
Box::new(RadioNodeList::new_inherited(list_type)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn new_controls_except_image_inputs(
|
||||
|
|
|
@ -78,6 +78,7 @@ impl ReadableStream {
|
|||
reflect_dom_object(
|
||||
Box::new(ReadableStream::new_inherited(external_underlying_source)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -105,6 +105,7 @@ impl RTCDataChannel {
|
|||
servo_media_id,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
);
|
||||
|
||||
peer_connection.register_data_channel(rtc_data_channel.servo_media_id, &rtc_data_channel);
|
||||
|
|
|
@ -29,7 +29,7 @@ impl RTCRtpSender {
|
|||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope) -> DomRoot<Self> {
|
||||
reflect_dom_object(Box::new(Self::new_inherited()), global)
|
||||
reflect_dom_object(Box::new(Self::new_inherited()), global, CanGc::note())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
|||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::rtcrtpsender::RTCRtpSender;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct RTCRtpTransceiver {
|
||||
|
@ -35,7 +36,11 @@ impl RTCRtpTransceiver {
|
|||
global: &GlobalScope,
|
||||
direction: RTCRtpTransceiverDirection,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(Box::new(Self::new_inherited(global, direction)), global)
|
||||
reflect_dom_object(
|
||||
Box::new(Self::new_inherited(global, direction)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ use crate::dom::bindings::num::Finite;
|
|||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct Screen {
|
||||
|
@ -30,7 +31,11 @@ impl Screen {
|
|||
}
|
||||
|
||||
pub fn new(window: &Window) -> DomRoot<Screen> {
|
||||
reflect_dom_object(Box::new(Screen::new_inherited(window)), window)
|
||||
reflect_dom_object(
|
||||
Box::new(Screen::new_inherited(window)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
fn screen_size(&self) -> Size2D<u32, CSSPixel> {
|
||||
|
|
|
@ -53,6 +53,7 @@ impl Selection {
|
|||
reflect_dom_object(
|
||||
Box::new(Selection::new_inherited(document)),
|
||||
&*document.global(),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ impl ServiceWorker {
|
|||
worker_id,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue