mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Propagate CanGc
arguments through callers in constructors (#35541)
Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
This commit is contained in:
parent
5465bfc2af
commit
863d2ce871
260 changed files with 986 additions and 603 deletions
|
@ -255,7 +255,7 @@ impl TransmitBodyConnectHandler {
|
|||
});
|
||||
|
||||
let handler =
|
||||
PromiseNativeHandler::new(&global, Some(promise_handler), Some(rejection_handler));
|
||||
PromiseNativeHandler::new(&global, Some(promise_handler), Some(rejection_handler), CanGc::note());
|
||||
|
||||
let realm = enter_realm(&*global);
|
||||
let comp = InRealm::Entered(&realm);
|
||||
|
@ -704,8 +704,12 @@ impl Callback for ConsumeBodyPromiseHandler {
|
|||
result_promise: self.result_promise.clone(),
|
||||
});
|
||||
|
||||
let handler =
|
||||
PromiseNativeHandler::new(&global, Some(promise_handler), Some(rejection_handler));
|
||||
let handler = PromiseNativeHandler::new(
|
||||
&global,
|
||||
Some(promise_handler),
|
||||
Some(rejection_handler),
|
||||
can_gc,
|
||||
);
|
||||
|
||||
let realm = enter_realm(&*global);
|
||||
let comp = InRealm::Entered(&realm);
|
||||
|
@ -792,6 +796,7 @@ fn consume_body_with_promise<T: BodyMixin + DomObject>(
|
|||
&object.global(),
|
||||
promise_handler.take().map(|h| Box::new(h) as Box<_>),
|
||||
Some(rejection_handler),
|
||||
can_gc,
|
||||
);
|
||||
// We are already in a realm and a script.
|
||||
read_promise.append_native_handler(&handler, comp, can_gc);
|
||||
|
|
|
@ -852,6 +852,7 @@ impl CanvasState {
|
|||
CanvasGradient::new(
|
||||
global,
|
||||
CanvasGradientStyle::Linear(LinearGradientStyle::new(*x0, *y0, *x1, *y1, Vec::new())),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -882,6 +883,7 @@ impl CanvasState {
|
|||
*r1,
|
||||
Vec::new(),
|
||||
)),
|
||||
CanGc::note(),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -939,6 +941,7 @@ impl CanvasState {
|
|||
image_size,
|
||||
rep,
|
||||
self.is_origin_clean(image),
|
||||
CanGc::note(),
|
||||
)))
|
||||
} else {
|
||||
Err(Error::Syntax)
|
||||
|
@ -1079,6 +1082,7 @@ impl CanvasState {
|
|||
metrics.hanging_baseline.into(),
|
||||
metrics.alphabetic_baseline.into(),
|
||||
metrics.ideographic_baseline.into(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ impl AbstractRange {
|
|||
start_offset: u32,
|
||||
end_container: &Node,
|
||||
end_offset: u32,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<AbstractRange> {
|
||||
let abstractrange = reflect_dom_object(
|
||||
Box::new(AbstractRange::new_inherited(
|
||||
|
@ -52,7 +53,7 @@ impl AbstractRange {
|
|||
end_offset,
|
||||
)),
|
||||
document.window(),
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
);
|
||||
abstractrange
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ impl AudioBufferSourceNode {
|
|||
*options.playbackRate,
|
||||
f32::MIN,
|
||||
f32::MAX,
|
||||
CanGc::note(),
|
||||
);
|
||||
let detune = AudioParam::new(
|
||||
window,
|
||||
|
@ -79,6 +80,7 @@ impl AudioBufferSourceNode {
|
|||
*options.detune,
|
||||
f32::MIN,
|
||||
f32::MAX,
|
||||
CanGc::note(),
|
||||
);
|
||||
let node = AudioBufferSourceNode {
|
||||
source_node,
|
||||
|
|
|
@ -43,9 +43,10 @@ impl AudioDestinationNode {
|
|||
global: &GlobalScope,
|
||||
context: &BaseAudioContext,
|
||||
options: &AudioNodeOptions,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<AudioDestinationNode> {
|
||||
let node = AudioDestinationNode::new_inherited(context, options);
|
||||
reflect_dom_object(Box::new(node), global, CanGc::note())
|
||||
reflect_dom_object(Box::new(node), global, can_gc)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ impl AudioListener {
|
|||
0., // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
let position_y = AudioParam::new(
|
||||
window,
|
||||
|
@ -60,6 +61,7 @@ impl AudioListener {
|
|||
0., // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
let position_z = AudioParam::new(
|
||||
window,
|
||||
|
@ -71,6 +73,7 @@ impl AudioListener {
|
|||
0., // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
let forward_x = AudioParam::new(
|
||||
window,
|
||||
|
@ -82,6 +85,7 @@ impl AudioListener {
|
|||
0., // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
let forward_y = AudioParam::new(
|
||||
window,
|
||||
|
@ -93,6 +97,7 @@ impl AudioListener {
|
|||
0., // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
let forward_z = AudioParam::new(
|
||||
window,
|
||||
|
@ -104,6 +109,7 @@ impl AudioListener {
|
|||
-1., // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
let up_x = AudioParam::new(
|
||||
window,
|
||||
|
@ -115,6 +121,7 @@ impl AudioListener {
|
|||
0., // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
let up_y = AudioParam::new(
|
||||
window,
|
||||
|
@ -126,6 +133,7 @@ impl AudioListener {
|
|||
1., // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
let up_z = AudioParam::new(
|
||||
window,
|
||||
|
@ -137,6 +145,7 @@ impl AudioListener {
|
|||
0., // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
|
||||
AudioListener {
|
||||
|
|
|
@ -78,6 +78,7 @@ impl AudioParam {
|
|||
default_value: f32,
|
||||
min_value: f32,
|
||||
max_value: f32,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<AudioParam> {
|
||||
let audio_param = AudioParam::new_inherited(
|
||||
context,
|
||||
|
@ -89,7 +90,7 @@ impl AudioParam {
|
|||
min_value,
|
||||
max_value,
|
||||
);
|
||||
reflect_dom_object(Box::new(audio_param), window, CanGc::note())
|
||||
reflect_dom_object(Box::new(audio_param), window, can_gc)
|
||||
}
|
||||
|
||||
fn message_node(&self, message: AudioNodeMessage) {
|
||||
|
|
|
@ -52,13 +52,14 @@ impl AudioTrack {
|
|||
label: DOMString,
|
||||
language: DOMString,
|
||||
track_list: Option<&AudioTrackList>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<AudioTrack> {
|
||||
reflect_dom_object(
|
||||
Box::new(AudioTrack::new_inherited(
|
||||
id, kind, label, language, track_list,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -40,11 +40,12 @@ impl AudioTrackList {
|
|||
window: &Window,
|
||||
tracks: &[&AudioTrack],
|
||||
media_element: Option<&HTMLMediaElement>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<AudioTrackList> {
|
||||
reflect_dom_object(
|
||||
Box::new(AudioTrackList::new_inherited(tracks, media_element)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ impl BaseAudioContextMethods<crate::DomTypeHolder> for BaseAudioContext {
|
|||
options.channelCount = Some(self.channel_count);
|
||||
options.channelCountMode = Some(ChannelCountMode::Explicit);
|
||||
options.channelInterpretation = Some(ChannelInterpretation::Speakers);
|
||||
AudioDestinationNode::new(&global, self, &options)
|
||||
AudioDestinationNode::new(&global, self, &options, CanGc::note())
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -560,7 +560,7 @@ impl BaseAudioContextMethods<crate::DomTypeHolder> for BaseAudioContext {
|
|||
let resolver = resolvers.remove(&uuid).unwrap();
|
||||
if let Some(callback) = resolver.error_callback {
|
||||
let _ = callback.Call__(
|
||||
&DOMException::new(&this.global(), DOMErrorName::DataCloneError),
|
||||
&DOMException::new(&this.global(), DOMErrorName::DataCloneError, CanGc::note()),
|
||||
ExceptionHandling::Report);
|
||||
}
|
||||
let error = format!("Audio decode error {:?}", error);
|
||||
|
|
|
@ -33,12 +33,8 @@ impl BeforeUnloadEvent {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new_uninitialized(window: &Window) -> DomRoot<BeforeUnloadEvent> {
|
||||
reflect_dom_object(
|
||||
Box::new(BeforeUnloadEvent::new_inherited()),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
pub(crate) fn new_uninitialized(window: &Window, can_gc: CanGc) -> DomRoot<BeforeUnloadEvent> {
|
||||
reflect_dom_object(Box::new(BeforeUnloadEvent::new_inherited()), window, can_gc)
|
||||
}
|
||||
|
||||
pub(crate) fn new(
|
||||
|
@ -47,7 +43,7 @@ impl BeforeUnloadEvent {
|
|||
bubbles: EventBubbles,
|
||||
cancelable: EventCancelable,
|
||||
) -> DomRoot<BeforeUnloadEvent> {
|
||||
let ev = BeforeUnloadEvent::new_uninitialized(window);
|
||||
let ev = BeforeUnloadEvent::new_uninitialized(window, CanGc::note());
|
||||
{
|
||||
let event = ev.upcast::<Event>();
|
||||
event.init_event(type_, bool::from(bubbles), bool::from(cancelable));
|
||||
|
|
|
@ -159,7 +159,7 @@ pub(crate) fn throw_dom_exception(cx: SafeJSContext, global: &GlobalScope, resul
|
|||
|
||||
unsafe {
|
||||
assert!(!JS_IsExceptionPending(*cx));
|
||||
let exception = DOMException::new(global, code);
|
||||
let exception = DOMException::new(global, code, CanGc::note());
|
||||
rooted!(in(*cx) let mut thrown = UndefinedValue());
|
||||
exception.to_jsval(*cx, thrown.handle_mut());
|
||||
JS_SetPendingException(*cx, thrown.handle(), ExceptionStackBehavior::Capture);
|
||||
|
|
|
@ -70,6 +70,7 @@ impl BiquadFilterNode {
|
|||
options.gain, // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
let q = AudioParam::new(
|
||||
window,
|
||||
|
@ -81,6 +82,7 @@ impl BiquadFilterNode {
|
|||
options.q, // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
let frequency = AudioParam::new(
|
||||
window,
|
||||
|
@ -92,6 +94,7 @@ impl BiquadFilterNode {
|
|||
options.frequency, // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
let detune = AudioParam::new(
|
||||
window,
|
||||
|
@ -103,6 +106,7 @@ impl BiquadFilterNode {
|
|||
options.detune, // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
Ok(BiquadFilterNode {
|
||||
node,
|
||||
|
|
|
@ -151,8 +151,8 @@ impl Bluetooth {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope) -> DomRoot<Bluetooth> {
|
||||
reflect_dom_object(Box::new(Bluetooth::new_inherited()), global, CanGc::note())
|
||||
pub(crate) fn new(global: &GlobalScope, can_gc: CanGc) -> DomRoot<Bluetooth> {
|
||||
reflect_dom_object(Box::new(Bluetooth::new_inherited()), global, can_gc)
|
||||
}
|
||||
|
||||
fn get_bluetooth_thread(&self) -> IpcSender<BluetoothRequest> {
|
||||
|
@ -582,7 +582,7 @@ impl BluetoothMethods<crate::DomTypeHolder> for Bluetooth {
|
|||
}
|
||||
|
||||
impl AsyncBluetoothListener for Bluetooth {
|
||||
fn handle_response(&self, response: BluetoothResponse, promise: &Rc<Promise>, _can_gc: CanGc) {
|
||||
fn handle_response(&self, response: BluetoothResponse, promise: &Rc<Promise>, can_gc: CanGc) {
|
||||
match response {
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#request-bluetooth-devices
|
||||
// Step 11, 13 - 14.
|
||||
|
@ -596,6 +596,7 @@ impl AsyncBluetoothListener for Bluetooth {
|
|||
DOMString::from(device.id.clone()),
|
||||
device.name.map(DOMString::from),
|
||||
self,
|
||||
can_gc,
|
||||
);
|
||||
device_instance_map.insert(device.id.clone(), Dom::from_ref(&bt_device));
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ impl BluetoothCharacteristicProperties {
|
|||
authenticatedSignedWrites: bool,
|
||||
reliableWrite: bool,
|
||||
writableAuxiliaries: bool,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<BluetoothCharacteristicProperties> {
|
||||
reflect_dom_object(
|
||||
Box::new(BluetoothCharacteristicProperties::new_inherited(
|
||||
|
@ -79,7 +80,7 @@ impl BluetoothCharacteristicProperties {
|
|||
writableAuxiliaries,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,17 +81,18 @@ impl BluetoothDevice {
|
|||
id: DOMString,
|
||||
name: Option<DOMString>,
|
||||
context: &Bluetooth,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<BluetoothDevice> {
|
||||
reflect_dom_object(
|
||||
Box::new(BluetoothDevice::new_inherited(id, name, context)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn get_gatt(&self) -> DomRoot<BluetoothRemoteGATTServer> {
|
||||
self.gatt
|
||||
.or_init(|| BluetoothRemoteGATTServer::new(&self.global(), self))
|
||||
.or_init(|| BluetoothRemoteGATTServer::new(&self.global(), self, CanGc::note()))
|
||||
}
|
||||
|
||||
fn get_context(&self) -> DomRoot<Bluetooth> {
|
||||
|
@ -114,6 +115,7 @@ impl BluetoothDevice {
|
|||
DOMString::from(service.uuid.clone()),
|
||||
service.is_primary,
|
||||
service.instance_id.clone(),
|
||||
CanGc::note(),
|
||||
);
|
||||
service_map.insert(service.instance_id.clone(), Dom::from_ref(&bt_service));
|
||||
bt_service
|
||||
|
@ -140,6 +142,7 @@ impl BluetoothDevice {
|
|||
characteristic.authenticated_signed_writes,
|
||||
characteristic.reliable_write,
|
||||
characteristic.writable_auxiliaries,
|
||||
CanGc::note(),
|
||||
);
|
||||
let bt_characteristic = BluetoothRemoteGATTCharacteristic::new(
|
||||
&service.global(),
|
||||
|
@ -147,6 +150,7 @@ impl BluetoothDevice {
|
|||
DOMString::from(characteristic.uuid.clone()),
|
||||
&properties,
|
||||
characteristic.instance_id.clone(),
|
||||
CanGc::note(),
|
||||
);
|
||||
characteristic_map.insert(
|
||||
characteristic.instance_id.clone(),
|
||||
|
@ -181,6 +185,7 @@ impl BluetoothDevice {
|
|||
characteristic,
|
||||
DOMString::from(descriptor.uuid.clone()),
|
||||
descriptor.instance_id.clone(),
|
||||
CanGc::note(),
|
||||
);
|
||||
descriptor_map.insert(
|
||||
descriptor.instance_id.clone(),
|
||||
|
|
|
@ -48,11 +48,12 @@ impl BluetoothPermissionResult {
|
|||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
status: &PermissionStatus,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<BluetoothPermissionResult> {
|
||||
reflect_dom_object(
|
||||
Box::new(BluetoothPermissionResult::new_inherited(status)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -96,7 +97,7 @@ impl BluetoothPermissionResultMethods<crate::DomTypeHolder> for BluetoothPermiss
|
|||
}
|
||||
|
||||
impl AsyncBluetoothListener for BluetoothPermissionResult {
|
||||
fn handle_response(&self, response: BluetoothResponse, promise: &Rc<Promise>, _can_gc: CanGc) {
|
||||
fn handle_response(&self, response: BluetoothResponse, promise: &Rc<Promise>, can_gc: CanGc) {
|
||||
match response {
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#request-bluetooth-devices
|
||||
// Step 3, 11, 13 - 14.
|
||||
|
@ -118,6 +119,7 @@ impl AsyncBluetoothListener for BluetoothPermissionResult {
|
|||
DOMString::from(device.id.clone()),
|
||||
device.name.map(DOMString::from),
|
||||
&bluetooth,
|
||||
can_gc,
|
||||
);
|
||||
device_instance_map.insert(device.id.clone(), Dom::from_ref(&bt_device));
|
||||
self.global()
|
||||
|
|
|
@ -70,6 +70,7 @@ impl BluetoothRemoteGATTCharacteristic {
|
|||
uuid: DOMString,
|
||||
properties: &BluetoothCharacteristicProperties,
|
||||
instance_id: String,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<BluetoothRemoteGATTCharacteristic> {
|
||||
reflect_dom_object(
|
||||
Box::new(BluetoothRemoteGATTCharacteristic::new_inherited(
|
||||
|
@ -79,7 +80,7 @@ impl BluetoothRemoteGATTCharacteristic {
|
|||
instance_id,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ impl BluetoothRemoteGATTDescriptor {
|
|||
characteristic: &BluetoothRemoteGATTCharacteristic,
|
||||
uuid: DOMString,
|
||||
instance_id: String,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<BluetoothRemoteGATTDescriptor> {
|
||||
reflect_dom_object(
|
||||
Box::new(BluetoothRemoteGATTDescriptor::new_inherited(
|
||||
|
@ -66,7 +67,7 @@ impl BluetoothRemoteGATTDescriptor {
|
|||
instance_id,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -42,11 +42,12 @@ impl BluetoothRemoteGATTServer {
|
|||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
device: &BluetoothDevice,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<BluetoothRemoteGATTServer> {
|
||||
reflect_dom_object(
|
||||
Box::new(BluetoothRemoteGATTServer::new_inherited(device)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -54,13 +54,14 @@ impl BluetoothRemoteGATTService {
|
|||
uuid: DOMString,
|
||||
isPrimary: bool,
|
||||
instanceID: String,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<BluetoothRemoteGATTService> {
|
||||
reflect_dom_object(
|
||||
Box::new(BluetoothRemoteGATTService::new_inherited(
|
||||
device, uuid, isPrimary, instanceID,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ impl TestRunner {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope) -> DomRoot<TestRunner> {
|
||||
reflect_dom_object(Box::new(TestRunner::new_inherited()), global, CanGc::note())
|
||||
pub(crate) fn new(global: &GlobalScope, can_gc: CanGc) -> DomRoot<TestRunner> {
|
||||
reflect_dom_object(Box::new(TestRunner::new_inherited()), global, can_gc)
|
||||
}
|
||||
|
||||
fn get_bluetooth_thread(&self) -> IpcSender<BluetoothRequest> {
|
||||
|
|
|
@ -42,11 +42,15 @@ impl CanvasGradient {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope, style: CanvasGradientStyle) -> DomRoot<CanvasGradient> {
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
style: CanvasGradientStyle,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CanvasGradient> {
|
||||
reflect_dom_object(
|
||||
Box::new(CanvasGradient::new_inherited(style)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ impl CanvasPattern {
|
|||
surface_size: Size2D<u32>,
|
||||
repeat: RepetitionStyle,
|
||||
origin_clean: bool,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CanvasPattern> {
|
||||
reflect_dom_object(
|
||||
Box::new(CanvasPattern::new_inherited(
|
||||
|
@ -62,7 +63,7 @@ impl CanvasPattern {
|
|||
origin_clean,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
pub(crate) fn origin_is_clean(&self) -> bool {
|
||||
|
|
|
@ -61,13 +61,14 @@ impl CanvasRenderingContext2D {
|
|||
global: &GlobalScope,
|
||||
canvas: &HTMLCanvasElement,
|
||||
size: Size2D<u32>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CanvasRenderingContext2D> {
|
||||
let boxed = Box::new(CanvasRenderingContext2D::new_inherited(
|
||||
global,
|
||||
Some(canvas),
|
||||
size,
|
||||
));
|
||||
reflect_dom_object(boxed, global, CanGc::note())
|
||||
reflect_dom_object(boxed, global, can_gc)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#concept-canvas-set-bitmap-dimensions
|
||||
|
|
|
@ -39,11 +39,11 @@ impl Client {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(window: &Window) -> DomRoot<Client> {
|
||||
pub(crate) fn new(window: &Window, can_gc: CanGc) -> DomRoot<Client> {
|
||||
reflect_dom_object(
|
||||
Box::new(Client::new_inherited(window.get_url())),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -31,12 +31,8 @@ impl CompositionEvent {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new_uninitialized(window: &Window) -> DomRoot<CompositionEvent> {
|
||||
reflect_dom_object(
|
||||
Box::new(CompositionEvent::new_inherited()),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
pub(crate) fn new_uninitialized(window: &Window, can_gc: CanGc) -> DomRoot<CompositionEvent> {
|
||||
reflect_dom_object(Box::new(CompositionEvent::new_inherited()), window, can_gc)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
|
|
@ -55,6 +55,7 @@ impl ConstantSourceNode {
|
|||
*options.offset,
|
||||
f32::MIN,
|
||||
f32::MAX,
|
||||
CanGc::note(),
|
||||
);
|
||||
|
||||
Ok(ConstantSourceNode {
|
||||
|
|
|
@ -37,15 +37,16 @@ impl Crypto {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope) -> DomRoot<Crypto> {
|
||||
reflect_dom_object(Box::new(Crypto::new_inherited()), global, CanGc::note())
|
||||
pub(crate) fn new(global: &GlobalScope, can_gc: CanGc) -> DomRoot<Crypto> {
|
||||
reflect_dom_object(Box::new(Crypto::new_inherited()), global, can_gc)
|
||||
}
|
||||
}
|
||||
|
||||
impl CryptoMethods<crate::DomTypeHolder> for Crypto {
|
||||
/// <https://w3c.github.io/webcrypto/#dfn-Crypto-attribute-subtle>
|
||||
fn Subtle(&self) -> DomRoot<SubtleCrypto> {
|
||||
self.subtle.or_init(|| SubtleCrypto::new(&self.global()))
|
||||
self.subtle
|
||||
.or_init(|| SubtleCrypto::new(&self.global(), CanGc::note()))
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
|
|
@ -78,6 +78,7 @@ impl CryptoKey {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
key_type: KeyType,
|
||||
|
@ -86,6 +87,7 @@ impl CryptoKey {
|
|||
algorithm_object: HandleObject,
|
||||
usages: Vec<KeyUsage>,
|
||||
handle: Handle,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CryptoKey> {
|
||||
let object = reflect_dom_object(
|
||||
Box::new(CryptoKey::new_inherited(
|
||||
|
@ -96,7 +98,7 @@ impl CryptoKey {
|
|||
handle,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
);
|
||||
|
||||
object.algorithm_object.set(algorithm_object.get());
|
||||
|
|
|
@ -39,6 +39,7 @@ impl CSSFontFaceRule {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
fontfacerule: Arc<Locked<FontFaceRule>>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSFontFaceRule> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSFontFaceRule::new_inherited(
|
||||
|
@ -46,7 +47,7 @@ impl CSSFontFaceRule {
|
|||
fontfacerule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ use crate::dom::bindings::str::DOMString;
|
|||
use crate::dom::cssrule::CSSRule;
|
||||
use crate::dom::cssrulelist::{CSSRuleList, RulesSource};
|
||||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub(crate) struct CSSGroupingRule {
|
||||
|
@ -45,6 +46,7 @@ impl CSSGroupingRule {
|
|||
self.global().as_window(),
|
||||
parent_stylesheet,
|
||||
RulesSource::Rules(self.rules.clone()),
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -42,11 +42,12 @@ impl CSSImportRule {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
import_rule: Arc<Locked<ImportRule>>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(Self::new_inherited(parent_stylesheet, import_rule)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ impl CSSKeyframeRule {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
keyframerule: Arc<Locked<Keyframe>>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSKeyframeRule> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSKeyframeRule::new_inherited(
|
||||
|
@ -52,7 +53,7 @@ impl CSSKeyframeRule {
|
|||
keyframerule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -70,6 +71,7 @@ impl CSSKeyframeRuleMethods<crate::DomTypeHolder> for CSSKeyframeRule {
|
|||
),
|
||||
None,
|
||||
CSSModificationAccess::ReadWrite,
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ impl CSSKeyframesRule {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
keyframesrule: Arc<Locked<KeyframesRule>>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSKeyframesRule> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSKeyframesRule::new_inherited(
|
||||
|
@ -56,7 +57,7 @@ impl CSSKeyframesRule {
|
|||
keyframesrule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -67,6 +68,7 @@ impl CSSKeyframesRule {
|
|||
self.global().as_window(),
|
||||
parent_stylesheet,
|
||||
RulesSource::Keyframes(self.keyframesrule.clone()),
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ impl CSSLayerBlockRule {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
layerblockrule: Arc<LayerBlockRule>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSLayerBlockRule> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSLayerBlockRule::new_inherited(
|
||||
|
@ -52,7 +53,7 @@ impl CSSLayerBlockRule {
|
|||
layerblockrule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ impl CSSLayerStatementRule {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
layerstatementrule: Arc<LayerStatementRule>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSLayerStatementRule> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSLayerStatementRule::new_inherited(
|
||||
|
@ -50,7 +51,7 @@ impl CSSLayerStatementRule {
|
|||
layerstatementrule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,11 +43,12 @@ impl CSSMediaRule {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
mediarule: Arc<MediaRule>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSMediaRule> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSMediaRule::new_inherited(parent_stylesheet, mediarule)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -57,6 +58,7 @@ impl CSSMediaRule {
|
|||
self.global().as_window(),
|
||||
self.cssconditionrule.parent_stylesheet(),
|
||||
self.mediarule.media_queries.clone(),
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ impl CSSNamespaceRule {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
namespacerule: Arc<NamespaceRule>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSNamespaceRule> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSNamespaceRule::new_inherited(
|
||||
|
@ -47,7 +48,7 @@ impl CSSNamespaceRule {
|
|||
namespacerule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ use crate::dom::cssstylerule::CSSStyleRule;
|
|||
use crate::dom::cssstylesheet::CSSStyleSheet;
|
||||
use crate::dom::csssupportsrule::CSSSupportsRule;
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub(crate) struct CSSRule {
|
||||
|
@ -82,38 +83,65 @@ impl CSSRule {
|
|||
) -> DomRoot<CSSRule> {
|
||||
// be sure to update the match in as_specific when this is updated
|
||||
match rule {
|
||||
StyleCssRule::Import(s) => {
|
||||
DomRoot::upcast(CSSImportRule::new(window, parent_stylesheet, s))
|
||||
},
|
||||
StyleCssRule::Style(s) => {
|
||||
DomRoot::upcast(CSSStyleRule::new(window, parent_stylesheet, s))
|
||||
},
|
||||
StyleCssRule::FontFace(s) => {
|
||||
DomRoot::upcast(CSSFontFaceRule::new(window, parent_stylesheet, s))
|
||||
},
|
||||
StyleCssRule::Import(s) => DomRoot::upcast(CSSImportRule::new(
|
||||
window,
|
||||
parent_stylesheet,
|
||||
s,
|
||||
CanGc::note(),
|
||||
)),
|
||||
StyleCssRule::Style(s) => DomRoot::upcast(CSSStyleRule::new(
|
||||
window,
|
||||
parent_stylesheet,
|
||||
s,
|
||||
CanGc::note(),
|
||||
)),
|
||||
StyleCssRule::FontFace(s) => DomRoot::upcast(CSSFontFaceRule::new(
|
||||
window,
|
||||
parent_stylesheet,
|
||||
s,
|
||||
CanGc::note(),
|
||||
)),
|
||||
StyleCssRule::FontFeatureValues(_) => unimplemented!(),
|
||||
StyleCssRule::CounterStyle(_) => unimplemented!(),
|
||||
StyleCssRule::Keyframes(s) => {
|
||||
DomRoot::upcast(CSSKeyframesRule::new(window, parent_stylesheet, s))
|
||||
},
|
||||
StyleCssRule::Media(s) => {
|
||||
DomRoot::upcast(CSSMediaRule::new(window, parent_stylesheet, s))
|
||||
},
|
||||
StyleCssRule::Namespace(s) => {
|
||||
DomRoot::upcast(CSSNamespaceRule::new(window, parent_stylesheet, s))
|
||||
},
|
||||
StyleCssRule::Supports(s) => {
|
||||
DomRoot::upcast(CSSSupportsRule::new(window, parent_stylesheet, s))
|
||||
},
|
||||
StyleCssRule::Keyframes(s) => DomRoot::upcast(CSSKeyframesRule::new(
|
||||
window,
|
||||
parent_stylesheet,
|
||||
s,
|
||||
CanGc::note(),
|
||||
)),
|
||||
StyleCssRule::Media(s) => DomRoot::upcast(CSSMediaRule::new(
|
||||
window,
|
||||
parent_stylesheet,
|
||||
s,
|
||||
CanGc::note(),
|
||||
)),
|
||||
StyleCssRule::Namespace(s) => DomRoot::upcast(CSSNamespaceRule::new(
|
||||
window,
|
||||
parent_stylesheet,
|
||||
s,
|
||||
CanGc::note(),
|
||||
)),
|
||||
StyleCssRule::Supports(s) => DomRoot::upcast(CSSSupportsRule::new(
|
||||
window,
|
||||
parent_stylesheet,
|
||||
s,
|
||||
CanGc::note(),
|
||||
)),
|
||||
StyleCssRule::Page(_) => unreachable!(),
|
||||
StyleCssRule::Container(_) => unimplemented!(), // TODO
|
||||
StyleCssRule::Document(_) => unimplemented!(), // TODO
|
||||
StyleCssRule::LayerBlock(s) => {
|
||||
DomRoot::upcast(CSSLayerBlockRule::new(window, parent_stylesheet, s))
|
||||
},
|
||||
StyleCssRule::LayerStatement(s) => {
|
||||
DomRoot::upcast(CSSLayerStatementRule::new(window, parent_stylesheet, s))
|
||||
},
|
||||
StyleCssRule::LayerBlock(s) => DomRoot::upcast(CSSLayerBlockRule::new(
|
||||
window,
|
||||
parent_stylesheet,
|
||||
s,
|
||||
CanGc::note(),
|
||||
)),
|
||||
StyleCssRule::LayerStatement(s) => DomRoot::upcast(CSSLayerStatementRule::new(
|
||||
window,
|
||||
parent_stylesheet,
|
||||
s,
|
||||
CanGc::note(),
|
||||
)),
|
||||
StyleCssRule::FontPaletteValues(_) => unimplemented!(), // TODO
|
||||
StyleCssRule::Property(_) => unimplemented!(), // TODO
|
||||
StyleCssRule::Margin(_) => unimplemented!(), // TODO
|
||||
|
|
|
@ -87,11 +87,12 @@ impl CSSRuleList {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
rules: RulesSource,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSRuleList> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSRuleList::new_inherited(parent_stylesheet, rules)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -193,6 +194,7 @@ impl CSSRuleList {
|
|||
self.global().as_window(),
|
||||
parent_stylesheet,
|
||||
rules.read_with(&guard).keyframes[idx as usize].clone(),
|
||||
CanGc::note(),
|
||||
)),
|
||||
}
|
||||
})
|
||||
|
|
|
@ -235,6 +235,7 @@ impl CSSStyleDeclaration {
|
|||
owner: CSSStyleOwner,
|
||||
pseudo: Option<PseudoElement>,
|
||||
modification_access: CSSModificationAccess,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSStyleDeclaration> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSStyleDeclaration::new_inherited(
|
||||
|
@ -243,7 +244,7 @@ impl CSSStyleDeclaration {
|
|||
modification_access,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -50,11 +50,12 @@ impl CSSStyleRule {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
stylerule: Arc<Locked<StyleRule>>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSStyleRule> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSStyleRule::new_inherited(parent_stylesheet, stylerule)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -86,6 +87,7 @@ impl CSSStyleRuleMethods<crate::DomTypeHolder> for CSSStyleRule {
|
|||
),
|
||||
None,
|
||||
CSSModificationAccess::ReadWrite,
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -58,20 +58,26 @@ impl CSSStyleSheet {
|
|||
href: Option<DOMString>,
|
||||
title: Option<DOMString>,
|
||||
stylesheet: Arc<StyleStyleSheet>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSStyleSheet> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSStyleSheet::new_inherited(
|
||||
owner, type_, href, title, stylesheet,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
fn rulelist(&self) -> DomRoot<CSSRuleList> {
|
||||
self.rulelist.or_init(|| {
|
||||
let rules = self.style_stylesheet.contents.rules.clone();
|
||||
CSSRuleList::new(self.global().as_window(), self, RulesSource::Rules(rules))
|
||||
CSSRuleList::new(
|
||||
self.global().as_window(),
|
||||
self,
|
||||
RulesSource::Rules(rules),
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -113,6 +119,7 @@ impl CSSStyleSheet {
|
|||
self.global().as_window(),
|
||||
self,
|
||||
self.style_stylesheet().media.clone(),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,11 +27,15 @@ impl CSSStyleValue {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope, value: String) -> DomRoot<CSSStyleValue> {
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
value: String,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSStyleValue> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSStyleValue::new_inherited(value)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ impl CSSSupportsRule {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
supportsrule: Arc<SupportsRule>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<CSSSupportsRule> {
|
||||
reflect_dom_object(
|
||||
Box::new(CSSSupportsRule::new_inherited(
|
||||
|
@ -49,7 +50,7 @@ impl CSSSupportsRule {
|
|||
supportsrule,
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -89,11 +89,11 @@ impl CustomElementRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(window: &Window) -> DomRoot<CustomElementRegistry> {
|
||||
pub(crate) fn new(window: &Window, can_gc: CanGc) -> DomRoot<CustomElementRegistry> {
|
||||
reflect_dom_object(
|
||||
Box::new(CustomElementRegistry::new_inherited(window)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -581,6 +581,7 @@ impl CustomElementRegistryMethods<crate::DomTypeHolder> for CustomElementRegistr
|
|||
promise.reject_native(&DOMException::new(
|
||||
self.window.as_global_scope(),
|
||||
DOMErrorName::SyntaxError,
|
||||
CanGc::note(),
|
||||
));
|
||||
return promise;
|
||||
}
|
||||
|
|
|
@ -261,6 +261,6 @@ impl DataTransferMethods<crate::DomTypeHolder> for DataTransfer {
|
|||
}
|
||||
|
||||
// Step 5
|
||||
FileList::new(self.global().as_window(), files)
|
||||
FileList::new(self.global().as_window(), files, can_gc)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,11 +37,14 @@ impl DissimilarOriginLocation {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(window: &DissimilarOriginWindow) -> DomRoot<DissimilarOriginLocation> {
|
||||
pub(crate) fn new(
|
||||
window: &DissimilarOriginWindow,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<DissimilarOriginLocation> {
|
||||
reflect_dom_object(
|
||||
Box::new(DissimilarOriginLocation::new_inherited(window)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ use crate::dom::bindings::trace::RootedTraceableBox;
|
|||
use crate::dom::dissimilaroriginlocation::DissimilarOriginLocation;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::dom::windowproxy::WindowProxy;
|
||||
use crate::script_runtime::JSContext;
|
||||
use crate::script_runtime::{CanGc, JSContext};
|
||||
|
||||
/// Represents a dissimilar-origin `Window` that exists in another script thread.
|
||||
///
|
||||
|
@ -193,7 +193,7 @@ impl DissimilarOriginWindowMethods<crate::DomTypeHolder> for DissimilarOriginWin
|
|||
// https://html.spec.whatwg.org/multipage/#dom-location
|
||||
fn Location(&self) -> DomRoot<DissimilarOriginLocation> {
|
||||
self.location
|
||||
.or_init(|| DissimilarOriginLocation::new(self))
|
||||
.or_init(|| DissimilarOriginLocation::new(self, CanGc::note()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2039,7 +2039,7 @@ impl Document {
|
|||
let touch = Touch::new(
|
||||
window, identifier, &target, client_x,
|
||||
client_y, // TODO: Get real screen coordinates?
|
||||
client_x, client_y, page_x, page_y,
|
||||
client_x, client_y, page_x, page_y, can_gc,
|
||||
);
|
||||
|
||||
match event.event_type {
|
||||
|
@ -2079,7 +2079,7 @@ impl Document {
|
|||
let touches = {
|
||||
let touches = self.active_touch_points.borrow();
|
||||
target_touches.extend(touches.iter().filter(|t| t.Target() == target).cloned());
|
||||
TouchList::new(window, touches.r())
|
||||
TouchList::new(window, touches.r(), can_gc)
|
||||
};
|
||||
|
||||
let event = DomTouchEvent::new(
|
||||
|
@ -2090,8 +2090,8 @@ impl Document {
|
|||
Some(window),
|
||||
0i32,
|
||||
&touches,
|
||||
&TouchList::new(window, from_ref(&&*touch)),
|
||||
&TouchList::new(window, target_touches.r()),
|
||||
&TouchList::new(window, from_ref(&&*touch), can_gc),
|
||||
&TouchList::new(window, target_touches.r(), can_gc),
|
||||
// FIXME: modifier keys
|
||||
false,
|
||||
false,
|
||||
|
@ -4558,8 +4558,12 @@ impl Document {
|
|||
self.visibility_state.set(visibility_state);
|
||||
// Step 3 Queue a new VisibilityStateEntry whose visibility state is visibilityState and whose timestamp is
|
||||
// the current high resolution time given document's relevant global object.
|
||||
let entry =
|
||||
VisibilityStateEntry::new(&self.global(), visibility_state, CrossProcessInstant::now());
|
||||
let entry = VisibilityStateEntry::new(
|
||||
&self.global(),
|
||||
visibility_state,
|
||||
CrossProcessInstant::now(),
|
||||
can_gc,
|
||||
);
|
||||
self.window
|
||||
.Performance()
|
||||
.queue_entry(entry.upcast::<PerformanceEntry>(), can_gc);
|
||||
|
@ -4649,13 +4653,15 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
|
|||
StyleSheetList::new(
|
||||
&self.window,
|
||||
StyleSheetListOwner::Document(Dom::from_ref(self)),
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-implementation
|
||||
fn Implementation(&self) -> DomRoot<DOMImplementation> {
|
||||
self.implementation.or_init(|| DOMImplementation::new(self))
|
||||
self.implementation
|
||||
.or_init(|| DOMImplementation::new(self, CanGc::note()))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-document-url
|
||||
|
@ -5055,9 +5061,10 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
|
|||
match &*interface {
|
||||
"beforeunloadevent" => Ok(DomRoot::upcast(BeforeUnloadEvent::new_uninitialized(
|
||||
&self.window,
|
||||
can_gc,
|
||||
))),
|
||||
"compositionevent" | "textevent" => Ok(DomRoot::upcast(
|
||||
CompositionEvent::new_uninitialized(&self.window),
|
||||
CompositionEvent::new_uninitialized(&self.window, can_gc),
|
||||
)),
|
||||
"customevent" => Ok(DomRoot::upcast(CustomEvent::new_uninitialized(
|
||||
self.window.upcast(),
|
||||
|
@ -5095,9 +5102,10 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
|
|||
))),
|
||||
"touchevent" => Ok(DomRoot::upcast(DomTouchEvent::new_uninitialized(
|
||||
&self.window,
|
||||
&TouchList::new(&self.window, &[]),
|
||||
&TouchList::new(&self.window, &[]),
|
||||
&TouchList::new(&self.window, &[]),
|
||||
&TouchList::new(&self.window, &[], can_gc),
|
||||
&TouchList::new(&self.window, &[], can_gc),
|
||||
&TouchList::new(&self.window, &[], can_gc),
|
||||
can_gc,
|
||||
))),
|
||||
"uievent" | "uievents" => Ok(DomRoot::upcast(UIEvent::new_uninitialized(
|
||||
&self.window,
|
||||
|
@ -5942,7 +5950,10 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
|
|||
// https://w3c.github.io/selection-api/#dom-document-getselection
|
||||
fn GetSelection(&self) -> Option<DomRoot<Selection>> {
|
||||
if self.has_browsing_context {
|
||||
Some(self.selection.or_init(|| Selection::new(self)))
|
||||
Some(
|
||||
self.selection
|
||||
.or_init(|| Selection::new(self, CanGc::note())),
|
||||
)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -145,13 +145,17 @@ impl DOMException {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope, code: DOMErrorName) -> DomRoot<DOMException> {
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
code: DOMErrorName,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<DOMException> {
|
||||
let (message, name) = DOMException::get_error_data_by_code(code);
|
||||
|
||||
reflect_dom_object(
|
||||
Box::new(DOMException::new_inherited(message, name)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -47,12 +47,12 @@ impl DOMImplementation {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(document: &Document) -> DomRoot<DOMImplementation> {
|
||||
pub(crate) fn new(document: &Document, can_gc: CanGc) -> DomRoot<DOMImplementation> {
|
||||
let window = document.window();
|
||||
reflect_dom_object(
|
||||
Box::new(DOMImplementation::new_inherited(document)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,7 @@ impl DOMImplementationMethods<crate::DomTypeHolder> for DOMImplementation {
|
|||
DocumentSource::NotFromParser,
|
||||
loader,
|
||||
Some(self.document.insecure_requests_policy()),
|
||||
can_gc,
|
||||
);
|
||||
|
||||
// Step 2. Let element be null.
|
||||
|
|
|
@ -27,11 +27,15 @@ impl DOMStringList {
|
|||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub(crate) fn new(window: &Window, strings: Vec<DOMString>) -> DomRoot<DOMStringList> {
|
||||
pub(crate) fn new(
|
||||
window: &Window,
|
||||
strings: Vec<DOMString>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<DOMStringList> {
|
||||
reflect_dom_object(
|
||||
Box::new(DOMStringList::new_inherited(strings)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@ impl DOMStringMap {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(element: &HTMLElement) -> DomRoot<DOMStringMap> {
|
||||
pub(crate) fn new(element: &HTMLElement, can_gc: CanGc) -> DomRoot<DOMStringMap> {
|
||||
reflect_dom_object(
|
||||
Box::new(DOMStringMap::new_inherited(element)),
|
||||
&*element.owner_window(),
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ impl DOMTokenList {
|
|||
element: &Element,
|
||||
local_name: &LocalName,
|
||||
supported_tokens: Option<Vec<Atom>>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<DOMTokenList> {
|
||||
reflect_dom_object(
|
||||
Box::new(DOMTokenList::new_inherited(
|
||||
|
@ -53,7 +54,7 @@ impl DOMTokenList {
|
|||
supported_tokens,
|
||||
)),
|
||||
&*element.owner_window(),
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -45,11 +45,12 @@ impl DynamicModuleOwner {
|
|||
global: &GlobalScope,
|
||||
promise: Rc<Promise>,
|
||||
id: DynamicModuleId,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(DynamicModuleOwner::new_inherited(promise, id)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -546,6 +546,7 @@ impl Element {
|
|||
mode,
|
||||
slot_assignment_mode,
|
||||
clonable,
|
||||
CanGc::note(),
|
||||
);
|
||||
self.ensure_rare_data().shadow_root = Some(Dom::from_ref(&*shadow_root));
|
||||
shadow_root
|
||||
|
@ -2182,7 +2183,7 @@ impl Element {
|
|||
let elem = self
|
||||
.downcast::<HTMLElement>()
|
||||
.expect("ensure_element_internals should only be called for an HTMLElement");
|
||||
Dom::from_ref(&*ElementInternals::new(elem))
|
||||
Dom::from_ref(&*ElementInternals::new(elem, CanGc::note()))
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
@ -2245,7 +2246,7 @@ impl ElementMethods<crate::DomTypeHolder> for Element {
|
|||
// https://dom.spec.whatwg.org/#dom-element-classlist
|
||||
fn ClassList(&self) -> DomRoot<DOMTokenList> {
|
||||
self.class_list
|
||||
.or_init(|| DOMTokenList::new(self, &local_name!("class"), None))
|
||||
.or_init(|| DOMTokenList::new(self, &local_name!("class"), None, CanGc::note()))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-slot
|
||||
|
@ -2257,7 +2258,7 @@ impl ElementMethods<crate::DomTypeHolder> for Element {
|
|||
// https://dom.spec.whatwg.org/#dom-element-attributes
|
||||
fn Attributes(&self) -> DomRoot<NamedNodeMap> {
|
||||
self.attr_list
|
||||
.or_init(|| NamedNodeMap::new(&self.owner_window(), self))
|
||||
.or_init(|| NamedNodeMap::new(&self.owner_window(), self, CanGc::note()))
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-element-hasattributes
|
||||
|
|
|
@ -87,12 +87,12 @@ impl ElementInternals {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(element: &HTMLElement) -> DomRoot<ElementInternals> {
|
||||
pub(crate) fn new(element: &HTMLElement, can_gc: CanGc) -> DomRoot<ElementInternals> {
|
||||
let global = element.owner_window();
|
||||
reflect_dom_object(
|
||||
Box::new(ElementInternals::new_inherited(element)),
|
||||
&*global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -350,6 +350,7 @@ impl Validatable for ElementInternals {
|
|||
ValidityState::new(
|
||||
&self.target_element.owner_window(),
|
||||
self.target_element.upcast(),
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -30,13 +30,17 @@ impl FileList {
|
|||
}
|
||||
|
||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
|
||||
pub(crate) fn new(window: &Window, files: Vec<DomRoot<File>>) -> DomRoot<FileList> {
|
||||
pub(crate) fn new(
|
||||
window: &Window,
|
||||
files: Vec<DomRoot<File>>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<FileList> {
|
||||
reflect_dom_object(
|
||||
Box::new(FileList::new_inherited(
|
||||
files.iter().map(|r| Dom::from_ref(&**r)).collect(),
|
||||
)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ impl FileReader {
|
|||
fr.change_ready_state(FileReaderReadyState::Done);
|
||||
*fr.result.borrow_mut() = None;
|
||||
|
||||
let exception = DOMException::new(&fr.global(), error);
|
||||
let exception = DOMException::new(&fr.global(), error, can_gc);
|
||||
fr.error.set(Some(&exception));
|
||||
|
||||
fr.dispatch_progress_event(atom!("error"), 0, None, can_gc);
|
||||
|
@ -413,7 +413,7 @@ impl FileReaderMethods<crate::DomTypeHolder> for FileReader {
|
|||
// Steps 1 & 3
|
||||
*self.result.borrow_mut() = None;
|
||||
|
||||
let exception = DOMException::new(&self.global(), DOMErrorName::AbortError);
|
||||
let exception = DOMException::new(&self.global(), DOMErrorName::AbortError, can_gc);
|
||||
self.error.set(Some(&exception));
|
||||
|
||||
self.terminate_ongoing_reading();
|
||||
|
|
|
@ -58,6 +58,7 @@ impl GainNode {
|
|||
*options.gain, // default value
|
||||
f32::MIN, // min value
|
||||
f32::MAX, // max value
|
||||
CanGc::note(),
|
||||
);
|
||||
Ok(GainNode {
|
||||
node,
|
||||
|
|
|
@ -35,11 +35,12 @@ impl GamepadButton {
|
|||
global: &GlobalScope,
|
||||
pressed: bool,
|
||||
touched: bool,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<GamepadButton> {
|
||||
reflect_dom_object(
|
||||
Box::new(GamepadButton::new_inherited(pressed, touched)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,11 +27,15 @@ impl GamepadButtonList {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope, list: &[&GamepadButton]) -> DomRoot<GamepadButtonList> {
|
||||
pub(crate) fn new(
|
||||
global: &GlobalScope,
|
||||
list: &[&GamepadButton],
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<GamepadButtonList> {
|
||||
reflect_dom_object(
|
||||
Box::new(GamepadButtonList::new_inherited(list)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -60,25 +64,25 @@ impl GamepadButtonList {
|
|||
/// <https://www.w3.org/TR/gamepad/#dfn-initializing-buttons>
|
||||
pub(crate) fn init_buttons(global: &GlobalScope) -> DomRoot<GamepadButtonList> {
|
||||
let standard_buttons = &[
|
||||
GamepadButton::new(global, false, false), // Bottom button in right cluster
|
||||
GamepadButton::new(global, false, false), // Right button in right cluster
|
||||
GamepadButton::new(global, false, false), // Left button in right cluster
|
||||
GamepadButton::new(global, false, false), // Top button in right cluster
|
||||
GamepadButton::new(global, false, false), // Top left front button
|
||||
GamepadButton::new(global, false, false), // Top right front button
|
||||
GamepadButton::new(global, false, false), // Bottom left front button
|
||||
GamepadButton::new(global, false, false), // Bottom right front button
|
||||
GamepadButton::new(global, false, false), // Left button in center cluster
|
||||
GamepadButton::new(global, false, false), // Right button in center cluster
|
||||
GamepadButton::new(global, false, false), // Left stick pressed button
|
||||
GamepadButton::new(global, false, false), // Right stick pressed button
|
||||
GamepadButton::new(global, false, false), // Top button in left cluster
|
||||
GamepadButton::new(global, false, false), // Bottom button in left cluster
|
||||
GamepadButton::new(global, false, false), // Left button in left cluster
|
||||
GamepadButton::new(global, false, false), // Right button in left cluster
|
||||
GamepadButton::new(global, false, false), // Center button in center cluster
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Bottom button in right cluster
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Right button in right cluster
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Left button in right cluster
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Top button in right cluster
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Top left front button
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Top right front button
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Bottom left front button
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Bottom right front button
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Left button in center cluster
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Right button in center cluster
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Left stick pressed button
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Right stick pressed button
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Top button in left cluster
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Bottom button in left cluster
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Left button in left cluster
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Right button in left cluster
|
||||
GamepadButton::new(global, false, false, CanGc::note()), // Center button in center cluster
|
||||
];
|
||||
rooted_vec!(let buttons <- standard_buttons.iter().map(DomRoot::as_traced));
|
||||
Self::new(global, buttons.r())
|
||||
Self::new(global, buttons.r(), CanGc::note())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,12 +44,8 @@ impl GamepadPose {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope) -> DomRoot<GamepadPose> {
|
||||
reflect_dom_object(
|
||||
Box::new(GamepadPose::new_inherited()),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
pub(crate) fn new(global: &GlobalScope, can_gc: CanGc) -> DomRoot<GamepadPose> {
|
||||
reflect_dom_object(Box::new(GamepadPose::new_inherited()), global, can_gc)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -814,7 +814,8 @@ impl GlobalScope {
|
|||
}
|
||||
|
||||
// Step 2.1 -> 2.5
|
||||
let new_registration = ServiceWorkerRegistration::new(self, scope.clone(), registration_id);
|
||||
let new_registration =
|
||||
ServiceWorkerRegistration::new(self, scope.clone(), registration_id, CanGc::note());
|
||||
|
||||
// Step 2.6
|
||||
if let Some(worker_id) = installing_worker {
|
||||
|
@ -849,7 +850,13 @@ impl GlobalScope {
|
|||
} else {
|
||||
// Step 2.1
|
||||
// TODO: step 2.2, worker state.
|
||||
let new_worker = ServiceWorker::new(self, script_url.clone(), scope.clone(), worker_id);
|
||||
let new_worker = ServiceWorker::new(
|
||||
self,
|
||||
script_url.clone(),
|
||||
scope.clone(),
|
||||
worker_id,
|
||||
CanGc::note(),
|
||||
);
|
||||
|
||||
// Step 2.3
|
||||
workers.insert(worker_id, Dom::from_ref(&*new_worker));
|
||||
|
@ -2136,7 +2143,7 @@ impl GlobalScope {
|
|||
}
|
||||
|
||||
pub(crate) fn crypto(&self) -> DomRoot<Crypto> {
|
||||
self.crypto.or_init(|| Crypto::new(self))
|
||||
self.crypto.or_init(|| Crypto::new(self, CanGc::note()))
|
||||
}
|
||||
|
||||
pub(crate) fn live_devtools_updates(&self) -> bool {
|
||||
|
@ -2719,7 +2726,8 @@ impl GlobalScope {
|
|||
.map(|data| data.to_vec())
|
||||
.unwrap_or_else(|| vec![0; size.area() as usize * 4]);
|
||||
|
||||
let image_bitmap = ImageBitmap::new(self, size.width, size.height).unwrap();
|
||||
let image_bitmap =
|
||||
ImageBitmap::new(self, size.width, size.height, can_gc).unwrap();
|
||||
|
||||
image_bitmap.set_bitmap_data(data);
|
||||
image_bitmap.set_origin_clean(canvas.origin_is_clean());
|
||||
|
@ -2739,7 +2747,8 @@ impl GlobalScope {
|
|||
.map(|data| data.to_vec())
|
||||
.unwrap_or_else(|| vec![0; size.area() as usize * 4]);
|
||||
|
||||
let image_bitmap = ImageBitmap::new(self, size.width, size.height).unwrap();
|
||||
let image_bitmap =
|
||||
ImageBitmap::new(self, size.width, size.height, can_gc).unwrap();
|
||||
image_bitmap.set_bitmap_data(data);
|
||||
image_bitmap.set_origin_clean(canvas.origin_is_clean());
|
||||
p.resolve_native(&(image_bitmap));
|
||||
|
|
|
@ -62,12 +62,8 @@ impl History {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(window: &Window) -> DomRoot<History> {
|
||||
reflect_dom_object(
|
||||
Box::new(History::new_inherited(window)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
pub(crate) fn new(window: &Window, can_gc: CanGc) -> DomRoot<History> {
|
||||
reflect_dom_object(Box::new(History::new_inherited(window)), window, can_gc)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -153,6 +153,7 @@ impl HTMLAnchorElementMethods<crate::DomTypeHolder> for HTMLAnchorElement {
|
|||
Atom::from("noreferrer"),
|
||||
Atom::from("opener"),
|
||||
]),
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -370,6 +370,7 @@ impl HTMLAreaElementMethods<crate::DomTypeHolder> for HTMLAreaElement {
|
|||
Atom::from("noreferrer"),
|
||||
Atom::from("opener"),
|
||||
]),
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ impl Validatable for HTMLButtonElement {
|
|||
|
||||
fn validity_state(&self) -> DomRoot<ValidityState> {
|
||||
self.validity_state
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast()))
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast(), CanGc::note()))
|
||||
}
|
||||
|
||||
fn is_instance_validatable(&self) -> bool {
|
||||
|
|
|
@ -276,7 +276,8 @@ impl HTMLCanvasElement {
|
|||
|
||||
let window = self.owner_window();
|
||||
let size = self.get_size();
|
||||
let context = CanvasRenderingContext2D::new(window.as_global_scope(), self, size);
|
||||
let context =
|
||||
CanvasRenderingContext2D::new(window.as_global_scope(), self, size, CanGc::note());
|
||||
*self.context.borrow_mut() = Some(CanvasContext::Context2d(Dom::from_ref(&*context)));
|
||||
Some(context)
|
||||
}
|
||||
|
@ -356,7 +357,7 @@ impl HTMLCanvasElement {
|
|||
.recv()
|
||||
.expect("Failed to get WebGPU channel")
|
||||
.map(|channel| {
|
||||
let context = GPUCanvasContext::new(&global_scope, self, channel);
|
||||
let context = GPUCanvasContext::new(&global_scope, self, channel, CanGc::note());
|
||||
*self.context.borrow_mut() = Some(CanvasContext::WebGPU(Dom::from_ref(&*context)));
|
||||
context
|
||||
})
|
||||
|
@ -717,7 +718,12 @@ impl HTMLCanvasElementMethods<crate::DomTypeHolder> for HTMLCanvasElement {
|
|||
) -> DomRoot<MediaStream> {
|
||||
let global = self.global();
|
||||
let stream = MediaStream::new(&global, can_gc);
|
||||
let track = MediaStreamTrack::new(&global, MediaStreamId::new(), MediaStreamType::Video);
|
||||
let track = MediaStreamTrack::new(
|
||||
&global,
|
||||
MediaStreamId::new(),
|
||||
MediaStreamType::Video,
|
||||
can_gc,
|
||||
);
|
||||
stream.AddTrack(&track);
|
||||
stream
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ impl HTMLCollection {
|
|||
}
|
||||
}
|
||||
|
||||
Self::new(window, root, Box::new(NoFilter))
|
||||
Self::new(window, root, Box::new(NoFilter), CanGc::note())
|
||||
}
|
||||
|
||||
#[cfg_attr(crown, allow(crown::unrooted_must_root))]
|
||||
|
@ -104,12 +104,9 @@ impl HTMLCollection {
|
|||
window: &Window,
|
||||
root: &Node,
|
||||
filter: Box<dyn CollectionFilter + 'static>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<Self> {
|
||||
reflect_dom_object(
|
||||
Box::new(Self::new_inherited(root, filter)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
reflect_dom_object(Box::new(Self::new_inherited(root, filter)), window, can_gc)
|
||||
}
|
||||
|
||||
/// Create a new [`HTMLCollection`] that just filters element using a static function.
|
||||
|
@ -135,6 +132,7 @@ impl HTMLCollection {
|
|||
window,
|
||||
root,
|
||||
Box::new(StaticFunctionFilter(filter_function)),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -143,7 +141,7 @@ impl HTMLCollection {
|
|||
root: &Node,
|
||||
filter: Box<dyn CollectionFilter + 'static>,
|
||||
) -> DomRoot<Self> {
|
||||
Self::new(window, root, filter)
|
||||
Self::new(window, root, filter, CanGc::note())
|
||||
}
|
||||
|
||||
fn validate_cache(&self) {
|
||||
|
|
|
@ -144,6 +144,7 @@ impl HTMLElementMethods<crate::DomTypeHolder> for HTMLElement {
|
|||
CSSStyleOwner::Element(Dom::from_ref(self.upcast())),
|
||||
None,
|
||||
CSSModificationAccess::ReadWrite,
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
@ -183,7 +184,8 @@ impl HTMLElementMethods<crate::DomTypeHolder> for HTMLElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-dataset
|
||||
fn Dataset(&self) -> DomRoot<DOMStringMap> {
|
||||
self.dataset.or_init(|| DOMStringMap::new(self))
|
||||
self.dataset
|
||||
.or_init(|| DOMStringMap::new(self, CanGc::note()))
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#handler-onerror
|
||||
|
|
|
@ -271,7 +271,7 @@ impl Validatable for HTMLFieldSetElement {
|
|||
|
||||
fn validity_state(&self) -> DomRoot<ValidityState> {
|
||||
self.validity_state
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast()))
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast(), CanGc::note()))
|
||||
}
|
||||
|
||||
fn is_instance_validatable(&self) -> bool {
|
||||
|
|
|
@ -45,11 +45,12 @@ impl HTMLFormControlsCollection {
|
|||
window: &Window,
|
||||
form: &HTMLFormElement,
|
||||
filter: Box<dyn CollectionFilter + 'static>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<HTMLFormControlsCollection> {
|
||||
reflect_dom_object(
|
||||
Box::new(HTMLFormControlsCollection::new_inherited(form, filter)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ impl HTMLFormElementMethods<crate::DomTypeHolder> for HTMLFormElement {
|
|||
form: DomRoot::from_ref(self),
|
||||
});
|
||||
let window = self.owner_window();
|
||||
HTMLFormControlsCollection::new(&window, self, filter)
|
||||
HTMLFormControlsCollection::new(&window, self, filter, CanGc::note())
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -502,6 +502,7 @@ impl HTMLFormElementMethods<crate::DomTypeHolder> for HTMLFormElement {
|
|||
Atom::from("noreferrer"),
|
||||
Atom::from("opener"),
|
||||
]),
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -597,6 +597,7 @@ impl HTMLIFrameElementMethods<crate::DomTypeHolder> for HTMLIFrameElement {
|
|||
Atom::from("allow-scripts"),
|
||||
Atom::from("allow-top-navigation"),
|
||||
]),
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1179,6 +1179,7 @@ impl HTMLImageElement {
|
|||
promise.reject_native(&DOMException::new(
|
||||
&document.global(),
|
||||
DOMErrorName::EncodingError,
|
||||
CanGc::note(),
|
||||
));
|
||||
} else if matches!(
|
||||
self.current_request.borrow().state,
|
||||
|
@ -1206,6 +1207,7 @@ impl HTMLImageElement {
|
|||
promise.reject_native(&DOMException::new(
|
||||
&document.global(),
|
||||
DOMErrorName::EncodingError,
|
||||
CanGc::note(),
|
||||
));
|
||||
}
|
||||
self.image_decode_promises.borrow_mut().clear();
|
||||
|
|
|
@ -1326,7 +1326,7 @@ impl HTMLInputElementMethods<crate::DomTypeHolder> for HTMLInputElement {
|
|||
ValueMode::Filename => {
|
||||
if value.is_empty() {
|
||||
let window = self.owner_window();
|
||||
let fl = FileList::new(&window, vec![]);
|
||||
let fl = FileList::new(&window, vec![], can_gc);
|
||||
self.filelist.set(Some(&fl));
|
||||
} else {
|
||||
return Err(Error::InvalidState);
|
||||
|
@ -1961,7 +1961,7 @@ impl HTMLInputElement {
|
|||
if let Some(err) = error {
|
||||
debug!("Input file select error: {:?}", err);
|
||||
} else {
|
||||
let filelist = FileList::new(&window, files);
|
||||
let filelist = FileList::new(&window, files, can_gc);
|
||||
self.filelist.set(Some(&filelist));
|
||||
|
||||
target.fire_bubbling_event(atom!("input"), can_gc);
|
||||
|
@ -2380,7 +2380,7 @@ impl VirtualMethods for HTMLInputElement {
|
|||
|
||||
if new_type == InputType::File {
|
||||
let window = self.owner_window();
|
||||
let filelist = FileList::new(&window, vec![]);
|
||||
let filelist = FileList::new(&window, vec![], CanGc::note());
|
||||
self.filelist.set(Some(&filelist));
|
||||
}
|
||||
|
||||
|
@ -2722,7 +2722,7 @@ impl Validatable for HTMLInputElement {
|
|||
|
||||
fn validity_state(&self) -> DomRoot<ValidityState> {
|
||||
self.validity_state
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast()))
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast(), CanGc::note()))
|
||||
}
|
||||
|
||||
fn is_instance_validatable(&self) -> bool {
|
||||
|
|
|
@ -183,6 +183,7 @@ impl HTMLLinkElement {
|
|||
None, // todo handle location
|
||||
None, // todo handle title
|
||||
sheet,
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
@ -582,6 +583,7 @@ impl HTMLLinkElementMethods<crate::DomTypeHolder> for HTMLLinkElement {
|
|||
Atom::from("prerender"),
|
||||
Atom::from("stylesheet"),
|
||||
]),
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1014,8 +1014,7 @@ impl HTMLMediaElement {
|
|||
// Step 1.
|
||||
this.error.set(Some(&*MediaError::new(
|
||||
&this.owner_window(),
|
||||
MEDIA_ERR_SRC_NOT_SUPPORTED,
|
||||
)));
|
||||
MEDIA_ERR_SRC_NOT_SUPPORTED, CanGc::note())));
|
||||
|
||||
// Step 2.
|
||||
this.AudioTracks().clear();
|
||||
|
@ -1562,6 +1561,7 @@ impl HTMLMediaElement {
|
|||
self.error.set(Some(&*MediaError::new(
|
||||
&self.owner_window(),
|
||||
MEDIA_ERR_DECODE,
|
||||
can_gc,
|
||||
)));
|
||||
|
||||
// 3. Set the element's networkState attribute to the NETWORK_IDLE value.
|
||||
|
@ -1601,6 +1601,7 @@ impl HTMLMediaElement {
|
|||
DOMString::new(),
|
||||
DOMString::new(),
|
||||
Some(&*self.AudioTracks()),
|
||||
can_gc,
|
||||
);
|
||||
|
||||
// Steps 2. & 3.
|
||||
|
@ -1660,6 +1661,7 @@ impl HTMLMediaElement {
|
|||
DOMString::new(),
|
||||
DOMString::new(),
|
||||
Some(&*self.VideoTracks()),
|
||||
can_gc,
|
||||
);
|
||||
|
||||
// Steps 2. & 3.
|
||||
|
@ -2380,7 +2382,11 @@ impl HTMLMediaElementMethods<crate::DomTypeHolder> for HTMLMediaElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-played
|
||||
fn Played(&self) -> DomRoot<TimeRanges> {
|
||||
TimeRanges::new(self.global().as_window(), self.played.borrow().clone())
|
||||
TimeRanges::new(
|
||||
self.global().as_window(),
|
||||
self.played.borrow().clone(),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-buffered
|
||||
|
@ -2393,28 +2399,28 @@ impl HTMLMediaElementMethods<crate::DomTypeHolder> for HTMLMediaElement {
|
|||
}
|
||||
}
|
||||
}
|
||||
TimeRanges::new(self.global().as_window(), buffered)
|
||||
TimeRanges::new(self.global().as_window(), buffered, CanGc::note())
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-audiotracks
|
||||
fn AudioTracks(&self) -> DomRoot<AudioTrackList> {
|
||||
let window = self.owner_window();
|
||||
self.audio_tracks_list
|
||||
.or_init(|| AudioTrackList::new(&window, &[], Some(self)))
|
||||
.or_init(|| AudioTrackList::new(&window, &[], Some(self), CanGc::note()))
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-videotracks
|
||||
fn VideoTracks(&self) -> DomRoot<VideoTrackList> {
|
||||
let window = self.owner_window();
|
||||
self.video_tracks_list
|
||||
.or_init(|| VideoTrackList::new(&window, &[], Some(self)))
|
||||
.or_init(|| VideoTrackList::new(&window, &[], Some(self), CanGc::note()))
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-texttracks
|
||||
fn TextTracks(&self) -> DomRoot<TextTrackList> {
|
||||
let window = self.owner_window();
|
||||
self.text_tracks_list
|
||||
.or_init(|| TextTrackList::new(&window, &[]))
|
||||
.or_init(|| TextTrackList::new(&window, &[], CanGc::note()))
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-media-addtexttrack
|
||||
|
@ -2435,6 +2441,7 @@ impl HTMLMediaElementMethods<crate::DomTypeHolder> for HTMLMediaElement {
|
|||
language,
|
||||
TextTrackMode::Hidden,
|
||||
None,
|
||||
CanGc::note(),
|
||||
);
|
||||
// Step 3 & 4
|
||||
self.TextTracks().add(&track);
|
||||
|
@ -2855,6 +2862,7 @@ impl FetchResponseListener for HTMLMediaElementFetchListener {
|
|||
elem.error.set(Some(&*MediaError::new(
|
||||
&elem.owner_window(),
|
||||
MEDIA_ERR_NETWORK,
|
||||
CanGc::note(),
|
||||
)));
|
||||
|
||||
// Step 3
|
||||
|
|
|
@ -139,7 +139,7 @@ impl Validatable for HTMLObjectElement {
|
|||
|
||||
fn validity_state(&self) -> DomRoot<ValidityState> {
|
||||
self.validity_state
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast()))
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast(), CanGc::note()))
|
||||
}
|
||||
|
||||
fn is_instance_validatable(&self) -> bool {
|
||||
|
|
|
@ -47,11 +47,12 @@ impl HTMLOptionsCollection {
|
|||
window: &Window,
|
||||
select: &HTMLSelectElement,
|
||||
filter: Box<dyn CollectionFilter + 'static>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<HTMLOptionsCollection> {
|
||||
reflect_dom_object(
|
||||
Box::new(HTMLOptionsCollection::new_inherited(select, filter)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ impl Validatable for HTMLOutputElement {
|
|||
|
||||
fn validity_state(&self) -> DomRoot<ValidityState> {
|
||||
self.validity_state
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast()))
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast(), CanGc::note()))
|
||||
}
|
||||
|
||||
fn is_instance_validatable(&self) -> bool {
|
||||
|
|
|
@ -280,7 +280,7 @@ impl HTMLSelectElementMethods<crate::DomTypeHolder> for HTMLSelectElement {
|
|||
fn Options(&self) -> DomRoot<HTMLOptionsCollection> {
|
||||
self.options.or_init(|| {
|
||||
let window = self.owner_window();
|
||||
HTMLOptionsCollection::new(&window, self, Box::new(OptionsFilter))
|
||||
HTMLOptionsCollection::new(&window, self, Box::new(OptionsFilter), CanGc::note())
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -510,7 +510,7 @@ impl Validatable for HTMLSelectElement {
|
|||
|
||||
fn validity_state(&self) -> DomRoot<ValidityState> {
|
||||
self.validity_state
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast()))
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast(), CanGc::note()))
|
||||
}
|
||||
|
||||
fn is_instance_validatable(&self) -> bool {
|
||||
|
|
|
@ -177,6 +177,7 @@ impl HTMLStyleElement {
|
|||
None, // todo handle location
|
||||
None, // todo handle title
|
||||
sheet,
|
||||
CanGc::note(),
|
||||
)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -187,7 +187,12 @@ impl HTMLTableElementMethods<crate::DomTypeHolder> for HTMLTableElement {
|
|||
// https://html.spec.whatwg.org/multipage/#dom-table-rows
|
||||
fn Rows(&self) -> DomRoot<HTMLCollection> {
|
||||
let filter = self.get_rows();
|
||||
HTMLCollection::new(&self.owner_window(), self.upcast(), Box::new(filter))
|
||||
HTMLCollection::new(
|
||||
&self.owner_window(),
|
||||
self.upcast(),
|
||||
Box::new(filter),
|
||||
CanGc::note(),
|
||||
)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-table-caption
|
||||
|
|
|
@ -723,7 +723,7 @@ impl Validatable for HTMLTextAreaElement {
|
|||
|
||||
fn validity_state(&self) -> DomRoot<ValidityState> {
|
||||
self.validity_state
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast()))
|
||||
.or_init(|| ValidityState::new(&self.owner_window(), self.upcast(), CanGc::note()))
|
||||
}
|
||||
|
||||
fn is_instance_validatable(&self) -> bool {
|
||||
|
|
|
@ -65,6 +65,7 @@ impl HTMLTrackElement {
|
|||
Default::default(),
|
||||
Default::default(),
|
||||
None,
|
||||
can_gc,
|
||||
);
|
||||
Node::reflect_node_with_proto(
|
||||
Box::new(HTMLTrackElement::new_inherited(
|
||||
|
|
|
@ -44,11 +44,12 @@ impl ImageBitmap {
|
|||
global: &GlobalScope,
|
||||
width: u32,
|
||||
height: u32,
|
||||
can_gc: CanGc,
|
||||
) -> Fallible<DomRoot<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, CanGc::note()))
|
||||
Ok(reflect_dom_object(imagebitmap, global, can_gc))
|
||||
}
|
||||
|
||||
pub(crate) fn set_bitmap_data(&self, data: Vec<u8>) {
|
||||
|
|
|
@ -57,12 +57,8 @@ impl Location {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(window: &Window) -> DomRoot<Location> {
|
||||
reflect_dom_object(
|
||||
Box::new(Location::new_inherited(window)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
pub(crate) fn new(window: &Window, can_gc: CanGc) -> DomRoot<Location> {
|
||||
reflect_dom_object(Box::new(Location::new_inherited(window)), window, can_gc)
|
||||
}
|
||||
|
||||
/// Navigate the relevant `Document`'s browsing context.
|
||||
|
|
|
@ -46,13 +46,14 @@ impl MediaDeviceInfo {
|
|||
kind: MediaDeviceKind,
|
||||
label: &str,
|
||||
group_id: &str,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<MediaDeviceInfo> {
|
||||
reflect_dom_object(
|
||||
Box::new(MediaDeviceInfo::new_inherited(
|
||||
device_id, kind, label, group_id,
|
||||
)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,12 +40,8 @@ impl MediaDevices {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(global: &GlobalScope) -> DomRoot<MediaDevices> {
|
||||
reflect_dom_object(
|
||||
Box::new(MediaDevices::new_inherited()),
|
||||
global,
|
||||
CanGc::note(),
|
||||
)
|
||||
pub(crate) fn new(global: &GlobalScope, can_gc: CanGc) -> DomRoot<MediaDevices> {
|
||||
reflect_dom_object(Box::new(MediaDevices::new_inherited()), global, can_gc)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,13 +59,15 @@ impl MediaDevicesMethods<crate::DomTypeHolder> for MediaDevices {
|
|||
let stream = MediaStream::new(&self.global(), can_gc);
|
||||
if let Some(constraints) = convert_constraints(&constraints.audio) {
|
||||
if let Some(audio) = media.create_audioinput_stream(constraints) {
|
||||
let track = MediaStreamTrack::new(&self.global(), audio, MediaStreamType::Audio);
|
||||
let track =
|
||||
MediaStreamTrack::new(&self.global(), audio, MediaStreamType::Audio, can_gc);
|
||||
stream.add_track(&track);
|
||||
}
|
||||
}
|
||||
if let Some(constraints) = convert_constraints(&constraints.video) {
|
||||
if let Some(video) = media.create_videoinput_stream(constraints) {
|
||||
let track = MediaStreamTrack::new(&self.global(), video, MediaStreamType::Video);
|
||||
let track =
|
||||
MediaStreamTrack::new(&self.global(), video, MediaStreamType::Video, can_gc);
|
||||
stream.add_track(&track);
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +100,7 @@ impl MediaDevicesMethods<crate::DomTypeHolder> for MediaDevices {
|
|||
device.kind.convert(),
|
||||
&device.label,
|
||||
"",
|
||||
can_gc,
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
|
|
|
@ -25,12 +25,8 @@ impl MediaError {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(window: &Window, code: u16) -> DomRoot<MediaError> {
|
||||
reflect_dom_object(
|
||||
Box::new(MediaError::new_inherited(code)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
pub(crate) fn new(window: &Window, code: u16, can_gc: CanGc) -> DomRoot<MediaError> {
|
||||
reflect_dom_object(Box::new(MediaError::new_inherited(code)), window, can_gc)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,11 +47,12 @@ impl MediaList {
|
|||
window: &Window,
|
||||
parent_stylesheet: &CSSStyleSheet,
|
||||
media_queries: Arc<Locked<StyleMediaList>>,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<MediaList> {
|
||||
reflect_dom_object(
|
||||
Box::new(MediaList::new_inherited(parent_stylesheet, media_queries)),
|
||||
window,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -46,11 +46,15 @@ impl MediaQueryList {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(document: &Document, media_query_list: MediaList) -> DomRoot<MediaQueryList> {
|
||||
pub(crate) fn new(
|
||||
document: &Document,
|
||||
media_query_list: MediaList,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<MediaQueryList> {
|
||||
reflect_dom_object(
|
||||
Box::new(MediaQueryList::new_inherited(document, media_query_list)),
|
||||
document.window(),
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,12 +63,8 @@ impl MediaSession {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(window: &Window) -> DomRoot<MediaSession> {
|
||||
reflect_dom_object(
|
||||
Box::new(MediaSession::new_inherited()),
|
||||
window,
|
||||
CanGc::note(),
|
||||
)
|
||||
pub(crate) fn new(window: &Window, can_gc: CanGc) -> DomRoot<MediaSession> {
|
||||
reflect_dom_object(Box::new(MediaSession::new_inherited()), window, can_gc)
|
||||
}
|
||||
|
||||
pub(crate) fn register_media_instance(&self, media_instance: &HTMLMediaElement) {
|
||||
|
|
|
@ -57,7 +57,7 @@ impl MediaStream {
|
|||
can_gc: CanGc,
|
||||
) -> DomRoot<MediaStream> {
|
||||
let this = Self::new(global, can_gc);
|
||||
let track = MediaStreamTrack::new(global, id, ty);
|
||||
let track = MediaStreamTrack::new(global, id, ty, can_gc);
|
||||
this.AddTrack(&track);
|
||||
this
|
||||
}
|
||||
|
|
|
@ -38,11 +38,12 @@ impl MediaStreamTrack {
|
|||
global: &GlobalScope,
|
||||
id: MediaStreamId,
|
||||
ty: MediaStreamType,
|
||||
can_gc: CanGc,
|
||||
) -> DomRoot<MediaStreamTrack> {
|
||||
reflect_dom_object(
|
||||
Box::new(MediaStreamTrack::new_inherited(id, ty)),
|
||||
global,
|
||||
CanGc::note(),
|
||||
can_gc,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -71,6 +72,6 @@ impl MediaStreamTrackMethods<crate::DomTypeHolder> for MediaStreamTrack {
|
|||
|
||||
/// <https://w3c.github.io/mediacapture-main/#dom-mediastreamtrack-clone>
|
||||
fn Clone(&self) -> DomRoot<MediaStreamTrack> {
|
||||
MediaStreamTrack::new(&self.global(), self.id, self.ty)
|
||||
MediaStreamTrack::new(&self.global(), self.id, self.ty, CanGc::note())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,10 +27,10 @@ impl MessageChannel {
|
|||
can_gc: CanGc,
|
||||
) -> DomRoot<MessageChannel> {
|
||||
// Step 1
|
||||
let port1 = MessagePort::new(incumbent);
|
||||
let port1 = MessagePort::new(incumbent, can_gc);
|
||||
|
||||
// Step 2
|
||||
let port2 = MessagePort::new(incumbent);
|
||||
let port2 = MessagePort::new(incumbent, can_gc);
|
||||
|
||||
incumbent.track_message_port(&port1, None);
|
||||
incumbent.track_message_port(&port2, None);
|
||||
|
|
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