aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorchickenleaf <lashwinib@gmail.com>2024-10-25 18:14:15 +0530
committerGitHub <noreply@github.com>2024-10-25 12:44:15 +0000
commit7ad8822d94f22969af4ebe1130a0050e78fbc21b (patch)
treef7f49b0ab4815ec46ddbb54cdff679657db0ff45 /components/script
parent3b5dc069ae338ebf373471e32874ea8f4ba3ade3 (diff)
downloadservo-7ad8822d94f22969af4ebe1130a0050e78fbc21b.tar.gz
servo-7ad8822d94f22969af4ebe1130a0050e78fbc21b.zip
cangc fixes in several files + event.rs + rtcpeerconnection.rs (#34002)
Signed-off-by: L Ashwin B <lashwinib@gmail.com>
Diffstat (limited to 'components/script')
-rw-r--r--components/script/animations.rs4
-rw-r--r--components/script/devtools.rs13
-rw-r--r--components/script/dom/bindings/codegen/Bindings.conf6
-rw-r--r--components/script/dom/cssstyledeclaration.rs32
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs2
-rw-r--r--components/script/dom/document.rs23
-rw-r--r--components/script/dom/event.rs4
-rw-r--r--components/script/dom/eventsource.rs2
-rw-r--r--components/script/dom/eventtarget.rs2
-rw-r--r--components/script/dom/extendablemessageevent.rs6
-rw-r--r--components/script/dom/filereader.rs2
-rw-r--r--components/script/dom/fontfaceset.rs6
-rw-r--r--components/script/dom/gamepad.rs2
-rw-r--r--components/script/dom/globalscope.rs4
-rw-r--r--components/script/dom/history.rs2
-rw-r--r--components/script/dom/htmlelement.rs24
-rw-r--r--components/script/dom/htmlformelement.rs6
-rw-r--r--components/script/dom/htmlmediaelement.rs8
-rw-r--r--components/script/dom/htmlscriptelement.rs2
-rw-r--r--components/script/dom/messageevent.rs4
-rw-r--r--components/script/dom/offlineaudiocontext.rs2
-rw-r--r--components/script/dom/popstateevent.rs2
-rw-r--r--components/script/dom/rtcdatachannel.rs8
-rw-r--r--components/script/dom/rtcpeerconnection.rs50
-rw-r--r--components/script/dom/storage.rs2
-rw-r--r--components/script/dom/texttracklist.rs2
-rw-r--r--components/script/dom/webglrenderingcontext.rs4
-rw-r--r--components/script/dom/websocket.rs4
-rw-r--r--components/script/dom/window.rs6
-rw-r--r--components/script/dom/xmlhttprequest.rs6
-rw-r--r--components/script/dom/xrinputsourcearray.rs6
-rw-r--r--components/script/dom/xrsession.rs14
-rw-r--r--components/script/script_runtime.rs4
-rw-r--r--components/script/script_thread.rs23
-rw-r--r--components/script/security_manager.rs2
-rw-r--r--components/script/timers.rs6
-rw-r--r--components/script/webdriver_handlers.rs3
37 files changed, 166 insertions, 132 deletions
diff --git a/components/script/animations.rs b/components/script/animations.rs
index 5abdb664e7e..aaef7dcdc3f 100644
--- a/components/script/animations.rs
+++ b/components/script/animations.rs
@@ -510,7 +510,7 @@ impl Animations {
};
TransitionEvent::new(&window, event_atom, &event_init, can_gc)
.upcast::<Event>()
- .fire(node.upcast());
+ .fire(node.upcast(), can_gc);
} else {
let event_init = AnimationEventInit {
parent,
@@ -520,7 +520,7 @@ impl Animations {
};
AnimationEvent::new(&window, event_atom, &event_init, can_gc)
.upcast::<Event>()
- .fire(node.upcast());
+ .fire(node.upcast(), can_gc);
}
}
diff --git a/components/script/devtools.rs b/components/script/devtools.rs
index 69840242f9b..2871754fcd3 100644
--- a/components/script/devtools.rs
+++ b/components/script/devtools.rs
@@ -190,6 +190,7 @@ pub fn handle_get_attribute_style(
pipeline: PipelineId,
node_id: String,
reply: IpcSender<Option<Vec<NodeStyle>>>,
+ can_gc: CanGc,
) {
let node = match find_node_by_unique_id(documents, pipeline, &node_id) {
None => return reply.send(None).unwrap(),
@@ -206,7 +207,7 @@ pub fn handle_get_attribute_style(
let name = style.Item(i);
NodeStyle {
name: name.to_string(),
- value: style.GetPropertyValue(name.clone()).to_string(),
+ value: style.GetPropertyValue(name.clone(), can_gc).to_string(),
priority: style.GetPropertyPriority(name).to_string(),
}
})
@@ -223,6 +224,7 @@ pub fn handle_get_stylesheet_style(
selector: String,
stylesheet: usize,
reply: IpcSender<Option<Vec<NodeStyle>>>,
+ can_gc: CanGc,
) {
let msg = (|| {
let node = find_node_by_unique_id(documents, pipeline, &node_id)?;
@@ -248,7 +250,7 @@ pub fn handle_get_stylesheet_style(
let name = style.Item(i);
NodeStyle {
name: name.to_string(),
- value: style.GetPropertyValue(name.clone()).to_string(),
+ value: style.GetPropertyValue(name.clone(), can_gc).to_string(),
priority: style.GetPropertyPriority(name).to_string(),
}
})
@@ -303,6 +305,7 @@ pub fn handle_get_computed_style(
pipeline: PipelineId,
node_id: String,
reply: IpcSender<Option<Vec<NodeStyle>>>,
+ can_gc: CanGc,
) {
let node = match find_node_by_unique_id(documents, pipeline, &node_id) {
None => return reply.send(None).unwrap(),
@@ -320,7 +323,9 @@ pub fn handle_get_computed_style(
let name = computed_style.Item(i);
NodeStyle {
name: name.to_string(),
- value: computed_style.GetPropertyValue(name.clone()).to_string(),
+ value: computed_style
+ .GetPropertyValue(name.clone(), can_gc)
+ .to_string(),
priority: computed_style.GetPropertyPriority(name).to_string(),
}
})
@@ -435,6 +440,7 @@ pub fn handle_modify_rule(
pipeline: PipelineId,
node_id: String,
modifications: Vec<RuleModification>,
+ can_gc: CanGc,
) {
let Some(document) = documents.find_document(pipeline) else {
return warn!("Document for pipeline id {} is not found", &pipeline);
@@ -458,6 +464,7 @@ pub fn handle_modify_rule(
modification.name.into(),
modification.value.into(),
modification.priority.into(),
+ can_gc,
);
}
}
diff --git a/components/script/dom/bindings/codegen/Bindings.conf b/components/script/dom/bindings/codegen/Bindings.conf
index 751aee93cfd..6b3d2eee8fb 100644
--- a/components/script/dom/bindings/codegen/Bindings.conf
+++ b/components/script/dom/bindings/codegen/Bindings.conf
@@ -71,7 +71,7 @@ DOMInterfaces = {
},
'CSSStyleDeclaration': {
- 'canGc': ['RemoveProperty', 'SetCssText']
+ 'canGc': ['RemoveProperty', 'SetCssText', 'GetPropertyValue', 'SetProperty', 'CssFloat', 'SetCssFloat']
},
'CanvasGradient': {
@@ -136,7 +136,7 @@ DOMInterfaces = {
},
'Element': {
- 'canGc': ['SetInnerHTML', 'SetOuterHTML', 'InsertAdjacentHTML', 'GetClientRects', 'GetBoundingClientRect', 'InsertAdjacentText', 'ToggleAttribute', 'SetAttribute', 'SetAttributeNS', "SetId","SetClassName","Prepend","Append","ReplaceChildren","Before","After","ReplaceWith", 'SetRole', 'SetAriaAtomic', 'SetAriaAutoComplete', 'SetAriaBrailleLabel', 'SetAriaBrailleRoleDescription', 'SetAriaBusy', 'SetAriaChecked', 'SetAriaColCount', 'SetAriaColIndex', 'SetAriaColIndexText', 'SetAriaColSpan', 'SetAriaCurrent', 'SetAriaDescription', 'SetAriaDisabled', 'SetAriaExpanded', 'SetAriaHasPopup', 'SetAriaHidden', 'SetAriaInvalid', 'SetAriaKeyShortcuts', 'SetAriaLabel', 'SetAriaLevel', 'SetAriaLive', 'SetAriaModal', 'SetAriaMultiLine', 'SetAriaMultiSelectable', 'SetAriaOrientation', 'SetAriaPlaceholder', 'SetAriaPosInSet', 'SetAriaPressed','SetAriaReadOnly', 'SetAriaRelevant', 'SetAriaRequired', 'SetAriaRoleDescription', 'SetAriaRowCount', 'SetAriaRowIndex', 'SetAriaRowIndexText', 'SetAriaRowSpan', 'SetAriaSelected', 'SetAriaSetSize','SetAriaSort', 'SetAriaValueMax', 'SetAriaValueMin', 'SetAriaValueNow', 'SetAriaValueText', 'SetScrollTop', 'SetScrollLeft', 'Scroll', 'Scroll_', 'ScrollBy', 'ScrollBy_', 'ScrollWidth', 'ScrollHeight', 'ScrollTop', 'ScrollLeft', 'ClientTop', 'ClientLeft', 'ClientWidth', 'ClientHeight', 'RequestFullscreen'],
+ 'canGc': ['SetInnerHTML', 'SetOuterHTML', 'InsertAdjacentHTML', 'GetClientRects', 'GetBoundingClientRect', 'InsertAdjacentText', 'ToggleAttribute', 'SetAttribute', 'SetAttributeNS', 'SetId','SetClassName','Prepend','Append','ReplaceChildren','Before','After','ReplaceWith', 'SetRole', 'SetAriaAtomic', 'SetAriaAutoComplete', 'SetAriaBrailleLabel', 'SetAriaBrailleRoleDescription', 'SetAriaBusy', 'SetAriaChecked', 'SetAriaColCount', 'SetAriaColIndex', 'SetAriaColIndexText', 'SetAriaColSpan', 'SetAriaCurrent', 'SetAriaDescription', 'SetAriaDisabled', 'SetAriaExpanded', 'SetAriaHasPopup', 'SetAriaHidden', 'SetAriaInvalid', 'SetAriaKeyShortcuts', 'SetAriaLabel', 'SetAriaLevel', 'SetAriaLive', 'SetAriaModal', 'SetAriaMultiLine', 'SetAriaMultiSelectable', 'SetAriaOrientation', 'SetAriaPlaceholder', 'SetAriaPosInSet', 'SetAriaPressed','SetAriaReadOnly', 'SetAriaRelevant', 'SetAriaRequired', 'SetAriaRoleDescription', 'SetAriaRowCount', 'SetAriaRowIndex', 'SetAriaRowIndexText', 'SetAriaRowSpan', 'SetAriaSelected', 'SetAriaSetSize','SetAriaSort', 'SetAriaValueMax', 'SetAriaValueMin', 'SetAriaValueNow', 'SetAriaValueText', 'SetScrollTop', 'SetScrollLeft', 'Scroll', 'Scroll_', 'ScrollBy', 'ScrollBy_', 'ScrollWidth', 'ScrollHeight', 'ScrollTop', 'ScrollLeft', 'ClientTop', 'ClientLeft', 'ClientWidth', 'ClientHeight', 'RequestFullscreen'],
},
'ElementInternals': {
@@ -212,7 +212,7 @@ DOMInterfaces = {
},
'HTMLElement': {
- 'canGc': ['Focus', 'Blur', 'Click', 'SetInnerText', 'SetOuterText', "SetTranslate", 'SetAutofocus', 'GetOffsetParent', 'OffsetTop', 'OffsetLeft', 'OffsetWidth', 'OffsetHeight', 'InnerText', 'GetOuterText'],
+ 'canGc': ['Focus', 'Blur', 'Click', 'SetInnerText', 'SetOuterText', "SetTranslate", 'SetAutofocus', 'GetOffsetParent', 'OffsetTop', 'OffsetLeft', 'OffsetWidth', 'OffsetHeight', 'InnerText', 'GetOuterText', 'GetOnerror', 'GetOnload', 'GetOnblur', 'GetOnfocus', 'GetOnresize', 'GetOnscroll'],
},
'HTMLFieldSetElement': {
diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs
index 0e861b83c5d..f981c131c3e 100644
--- a/components/script/dom/cssstyledeclaration.rs
+++ b/components/script/dom/cssstyledeclaration.rs
@@ -192,14 +192,14 @@ macro_rules! css_properties(
$id.enabled_for_all_content(),
"Someone forgot a #[Pref] annotation"
);
- self.get_property_value($id)
+ self.get_property_value($id, CanGc::note())
}
fn $setter(&self, value: DOMString) -> ErrorResult {
debug_assert!(
$id.enabled_for_all_content(),
"Someone forgot a #[Pref] annotation"
);
- self.set_property($id, value, DOMString::new())
+ self.set_property($id, value, DOMString::new(), CanGc::note())
}
)*
);
@@ -263,10 +263,10 @@ impl CSSStyleDeclaration {
}
}
- fn get_property_value(&self, id: PropertyId) -> DOMString {
+ fn get_property_value(&self, id: PropertyId, can_gc: CanGc) -> DOMString {
if self.readonly {
// Readonly style declarations are used for getComputedStyle.
- return self.get_computed_style(id, CanGc::note());
+ return self.get_computed_style(id, can_gc);
}
let mut string = String::new();
@@ -278,7 +278,13 @@ impl CSSStyleDeclaration {
DOMString::from(string)
}
- fn set_property(&self, id: PropertyId, value: DOMString, priority: DOMString) -> ErrorResult {
+ fn set_property(
+ &self,
+ id: PropertyId,
+ value: DOMString,
+ priority: DOMString,
+ can_gc: CanGc,
+ ) -> ErrorResult {
// Step 1
if self.readonly {
return Err(Error::NoModificationAllowed);
@@ -344,7 +350,7 @@ impl CSSStyleDeclaration {
Ok(())
},
- CanGc::note(),
+ can_gc,
)
}
}
@@ -394,12 +400,12 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
}
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertyvalue
- fn GetPropertyValue(&self, property: DOMString) -> DOMString {
+ fn GetPropertyValue(&self, property: DOMString, can_gc: CanGc) -> DOMString {
let id = match PropertyId::parse_enabled_for_all_content(&property) {
Ok(id) => id,
Err(..) => return DOMString::new(),
};
- self.get_property_value(id)
+ self.get_property_value(id, can_gc)
}
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-getpropertypriority
@@ -429,13 +435,14 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
property: DOMString,
value: DOMString,
priority: DOMString,
+ can_gc: CanGc,
) -> ErrorResult {
// Step 3
let id = match PropertyId::parse_enabled_for_all_content(&property) {
Ok(id) => id,
Err(..) => return Ok(()),
};
- self.set_property(id, value, priority)
+ self.set_property(id, value, priority, can_gc)
}
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty
@@ -464,16 +471,17 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
}
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat
- fn CssFloat(&self) -> DOMString {
- self.get_property_value(PropertyId::NonCustom(LonghandId::Float.into()))
+ fn CssFloat(&self, can_gc: CanGc) -> DOMString {
+ self.get_property_value(PropertyId::NonCustom(LonghandId::Float.into()), can_gc)
}
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-cssfloat
- fn SetCssFloat(&self, value: DOMString) -> ErrorResult {
+ fn SetCssFloat(&self, value: DOMString, can_gc: CanGc) -> ErrorResult {
self.set_property(
PropertyId::NonCustom(LonghandId::Float.into()),
value,
DOMString::new(),
+ can_gc,
)
}
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs
index 88fcd9bc879..47b508ab09f 100644
--- a/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/components/script/dom/dedicatedworkerglobalscope.rs
@@ -587,7 +587,7 @@ impl DedicatedWorkerGlobalScope {
CanGc::note(),
);
let event_status =
- event.upcast::<Event>().fire(worker.upcast::<EventTarget>());
+ event.upcast::<Event>().fire(worker.upcast::<EventTarget>(), CanGc::note());
// Step 2.
if event_status == EventStatus::NotCanceled {
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index f97d1b355ea..578f18c9750 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -1382,7 +1382,7 @@ impl Document {
match mouse_event_type {
MouseEventType::Click => {
el.set_click_in_progress(true);
- event.fire(node.upcast());
+ event.fire(node.upcast(), can_gc);
el.set_click_in_progress(false);
},
MouseEventType::MouseDown => {
@@ -1391,7 +1391,7 @@ impl Document {
}
let target = node.upcast();
- event.fire(target);
+ event.fire(target, can_gc);
},
MouseEventType::MouseUp => {
if let Some(a) = activatable {
@@ -1399,7 +1399,7 @@ impl Document {
}
let target = node.upcast();
- event.fire(target);
+ event.fire(target, can_gc);
},
}
@@ -1459,7 +1459,7 @@ impl Document {
None,
can_gc,
);
- event.upcast::<Event>().fire(target.upcast());
+ event.upcast::<Event>().fire(target.upcast(), can_gc);
// When a double click occurs, self.last_click_info is left as None so that a
// third sequential click will not cause another double click.
@@ -1507,7 +1507,7 @@ impl Document {
can_gc,
);
let event = mouse_event.upcast::<Event>();
- event.fire(target);
+ event.fire(target, can_gc);
}
#[allow(unsafe_code)]
@@ -1733,7 +1733,7 @@ impl Document {
event.set_trusted(true);
let target = node.upcast();
- event.fire(target);
+ event.fire(target, can_gc);
}
#[allow(unsafe_code)]
@@ -1743,6 +1743,7 @@ impl Document {
touch_id: TouchId,
point: Point2D<f32>,
node_address: Option<UntrustedNodeAddress>,
+ can_gc: CanGc,
) -> TouchEventResult {
let TouchId(identifier) = touch_id;
@@ -1835,7 +1836,7 @@ impl Document {
false,
);
let event = event.upcast::<Event>();
- let result = event.fire(&target);
+ let result = event.fire(&target, can_gc);
match result {
EventStatus::Canceled => TouchEventResult::Processed(false),
@@ -1876,7 +1877,7 @@ impl Document {
can_gc,
);
let event = keyevent.upcast::<Event>();
- event.fire(target);
+ event.fire(target, can_gc);
let mut cancel_state = event.get_cancel_state();
// https://w3c.github.io/uievents/#keys-cancelable-keys
@@ -1904,7 +1905,7 @@ impl Document {
can_gc,
);
let ev = event.upcast::<Event>();
- ev.fire(target);
+ ev.fire(target, can_gc);
cancel_state = ev.get_cancel_state();
}
@@ -1966,7 +1967,7 @@ impl Document {
can_gc,
);
let event = compositionevent.upcast::<Event>();
- event.fire(target);
+ event.fire(target, can_gc);
}
// https://dom.spec.whatwg.org/#converting-nodes-into-a-node
@@ -2907,7 +2908,7 @@ impl Document {
let event = event.upcast::<Event>();
event.set_trusted(true);
let target = node.upcast();
- event.fire(target);
+ event.fire(target, can_gc);
}
/// <https://html.spec.whatwg.org/multipage/#cookie-averse-document-object>
diff --git a/components/script/dom/event.rs b/components/script/dom/event.rs
index b86c50bdc3b..d02a2b79e93 100644
--- a/components/script/dom/event.rs
+++ b/components/script/dom/event.rs
@@ -381,9 +381,9 @@ impl Event {
}
/// <https://html.spec.whatwg.org/multipage/#fire-a-simple-event>
- pub fn fire(&self, target: &EventTarget) -> EventStatus {
+ pub fn fire(&self, target: &EventTarget, can_gc: CanGc) -> EventStatus {
self.set_trusted(true);
- target.dispatch_event(self, CanGc::note())
+ target.dispatch_event(self, can_gc)
}
}
diff --git a/components/script/dom/eventsource.rs b/components/script/dom/eventsource.rs
index a5f98cd393e..8e9249fbd33 100644
--- a/components/script/dom/eventsource.rs
+++ b/components/script/dom/eventsource.rs
@@ -263,7 +263,7 @@ impl EventSourceContext {
task!(dispatch_the_event_source_event: move || {
let event_source = event_source.root();
if event_source.ready_state.get() != ReadyState::Closed {
- event.root().upcast::<Event>().fire(event_source.upcast());
+ event.root().upcast::<Event>().fire(event_source.upcast(), CanGc::note());
}
}),
&global,
diff --git a/components/script/dom/eventtarget.rs b/components/script/dom/eventtarget.rs
index 67f2b492252..b32472d12e1 100644
--- a/components/script/dom/eventtarget.rs
+++ b/components/script/dom/eventtarget.rs
@@ -708,7 +708,7 @@ impl EventTarget {
can_gc: CanGc,
) -> DomRoot<Event> {
let event = Event::new(&self.global(), name, bubbles, cancelable, can_gc);
- event.fire(self);
+ event.fire(self, can_gc);
event
}
// https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener
diff --git a/components/script/dom/extendablemessageevent.rs b/components/script/dom/extendablemessageevent.rs
index 2d8321fbe46..6b08077e77d 100644
--- a/components/script/dom/extendablemessageevent.rs
+++ b/components/script/dom/extendablemessageevent.rs
@@ -140,7 +140,9 @@ impl ExtendableMessageEvent {
ports,
can_gc,
);
- Extendablemessageevent.upcast::<Event>().fire(target);
+ Extendablemessageevent
+ .upcast::<Event>()
+ .fire(target, can_gc);
}
pub fn dispatch_error(target: &EventTarget, scope: &GlobalScope, can_gc: CanGc) {
@@ -156,7 +158,7 @@ impl ExtendableMessageEvent {
init.ports.clone(),
can_gc,
);
- ExtendableMsgEvent.upcast::<Event>().fire(target);
+ ExtendableMsgEvent.upcast::<Event>().fire(target, can_gc);
}
}
diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs
index ec3d33a6ed0..20831493de7 100644
--- a/components/script/dom/filereader.rs
+++ b/components/script/dom/filereader.rs
@@ -425,7 +425,7 @@ impl FileReader {
total.unwrap_or(0),
can_gc,
);
- progressevent.upcast::<Event>().fire(self.upcast());
+ progressevent.upcast::<Event>().fire(self.upcast(), can_gc);
}
fn terminate_ongoing_reading(&self) {
diff --git a/components/script/dom/fontfaceset.rs b/components/script/dom/fontfaceset.rs
index 0774f2b1617..fa83e8708a1 100644
--- a/components/script/dom/fontfaceset.rs
+++ b/components/script/dom/fontfaceset.rs
@@ -24,16 +24,16 @@ pub struct FontFaceSet {
}
impl FontFaceSet {
- pub fn new_inherited(global: &GlobalScope) -> Self {
+ pub fn new_inherited(global: &GlobalScope, can_gc: CanGc) -> Self {
FontFaceSet {
target: EventTarget::new_inherited(),
- promise: Promise::new(global, CanGc::note()),
+ promise: Promise::new(global, can_gc),
}
}
pub fn new(global: &GlobalScope, proto: Option<HandleObject>, can_gc: CanGc) -> DomRoot<Self> {
reflect_dom_object_with_proto(
- Box::new(FontFaceSet::new_inherited(global)),
+ Box::new(FontFaceSet::new_inherited(global, can_gc)),
global,
proto,
can_gc,
diff --git a/components/script/dom/gamepad.rs b/components/script/dom/gamepad.rs
index a4df6ebb1c3..c7f78a666be 100644
--- a/components/script/dom/gamepad.rs
+++ b/components/script/dom/gamepad.rs
@@ -249,7 +249,7 @@ impl Gamepad {
let event = GamepadEvent::new_with_type(&self.global(), event_type, self, can_gc);
event
.upcast::<Event>()
- .fire(self.global().as_window().upcast::<EventTarget>());
+ .fire(self.global().as_window().upcast::<EventTarget>(), can_gc);
}
/// Initialize the number of axes in the "standard" gamepad mapping.
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs
index f7641d0bd15..d18813a74f8 100644
--- a/components/script/dom/globalscope.rs
+++ b/components/script/dom/globalscope.rs
@@ -2478,7 +2478,9 @@ impl GlobalScope {
);
// Step 7.
- let event_status = event.upcast::<Event>().fire(self.upcast::<EventTarget>());
+ let event_status = event
+ .upcast::<Event>()
+ .fire(self.upcast::<EventTarget>(), can_gc);
// Step 8.
self.in_error_reporting_mode.set(false);
diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs
index d53dbbffb60..67354cb0dc9 100644
--- a/components/script/dom/history.rs
+++ b/components/script/dom/history.rs
@@ -156,7 +156,7 @@ impl History {
);
event
.upcast::<Event>()
- .fire(self.window.upcast::<EventTarget>());
+ .fire(self.window.upcast::<EventTarget>(), can_gc);
}
}
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs
index b3811edb5ec..697e5833a42 100644
--- a/components/script/dom/htmlelement.rs
+++ b/components/script/dom/htmlelement.rs
@@ -181,7 +181,7 @@ impl HTMLElementMethods for HTMLElement {
}
// https://html.spec.whatwg.org/multipage/#handler-onerror
- fn GetOnerror(&self) -> Option<Rc<OnErrorEventHandlerNonNull>> {
+ fn GetOnerror(&self, can_gc: CanGc) -> Option<Rc<OnErrorEventHandlerNonNull>> {
if self.is_body_or_frameset() {
let document = document_from_node(self);
if document.has_browsing_context() {
@@ -191,7 +191,7 @@ impl HTMLElementMethods for HTMLElement {
}
} else {
self.upcast::<EventTarget>()
- .get_event_handler_common("error", CanGc::note())
+ .get_event_handler_common("error", can_gc)
}
}
@@ -210,7 +210,7 @@ impl HTMLElementMethods for HTMLElement {
}
// https://html.spec.whatwg.org/multipage/#handler-onload
- fn GetOnload(&self) -> Option<Rc<EventHandlerNonNull>> {
+ fn GetOnload(&self, can_gc: CanGc) -> Option<Rc<EventHandlerNonNull>> {
if self.is_body_or_frameset() {
let document = document_from_node(self);
if document.has_browsing_context() {
@@ -220,7 +220,7 @@ impl HTMLElementMethods for HTMLElement {
}
} else {
self.upcast::<EventTarget>()
- .get_event_handler_common("load", CanGc::note())
+ .get_event_handler_common("load", can_gc)
}
}
@@ -238,7 +238,7 @@ impl HTMLElementMethods for HTMLElement {
}
// https://html.spec.whatwg.org/multipage/#handler-onblur
- fn GetOnblur(&self) -> Option<Rc<EventHandlerNonNull>> {
+ fn GetOnblur(&self, can_gc: CanGc) -> Option<Rc<EventHandlerNonNull>> {
if self.is_body_or_frameset() {
let document = document_from_node(self);
if document.has_browsing_context() {
@@ -248,7 +248,7 @@ impl HTMLElementMethods for HTMLElement {
}
} else {
self.upcast::<EventTarget>()
- .get_event_handler_common("blur", CanGc::note())
+ .get_event_handler_common("blur", can_gc)
}
}
@@ -266,7 +266,7 @@ impl HTMLElementMethods for HTMLElement {
}
// https://html.spec.whatwg.org/multipage/#handler-onfocus
- fn GetOnfocus(&self) -> Option<Rc<EventHandlerNonNull>> {
+ fn GetOnfocus(&self, can_gc: CanGc) -> Option<Rc<EventHandlerNonNull>> {
if self.is_body_or_frameset() {
let document = document_from_node(self);
if document.has_browsing_context() {
@@ -276,7 +276,7 @@ impl HTMLElementMethods for HTMLElement {
}
} else {
self.upcast::<EventTarget>()
- .get_event_handler_common("focus", CanGc::note())
+ .get_event_handler_common("focus", can_gc)
}
}
@@ -294,7 +294,7 @@ impl HTMLElementMethods for HTMLElement {
}
// https://html.spec.whatwg.org/multipage/#handler-onresize
- fn GetOnresize(&self) -> Option<Rc<EventHandlerNonNull>> {
+ fn GetOnresize(&self, can_gc: CanGc) -> Option<Rc<EventHandlerNonNull>> {
if self.is_body_or_frameset() {
let document = document_from_node(self);
if document.has_browsing_context() {
@@ -304,7 +304,7 @@ impl HTMLElementMethods for HTMLElement {
}
} else {
self.upcast::<EventTarget>()
- .get_event_handler_common("resize", CanGc::note())
+ .get_event_handler_common("resize", can_gc)
}
}
@@ -322,7 +322,7 @@ impl HTMLElementMethods for HTMLElement {
}
// https://html.spec.whatwg.org/multipage/#handler-onscroll
- fn GetOnscroll(&self) -> Option<Rc<EventHandlerNonNull>> {
+ fn GetOnscroll(&self, can_gc: CanGc) -> Option<Rc<EventHandlerNonNull>> {
if self.is_body_or_frameset() {
let document = document_from_node(self);
if document.has_browsing_context() {
@@ -332,7 +332,7 @@ impl HTMLElementMethods for HTMLElement {
}
} else {
self.upcast::<EventTarget>()
- .get_event_handler_common("scroll", CanGc::note())
+ .get_event_handler_common("scroll", can_gc)
}
}
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index e4f35fec912..3be435edcff 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -764,7 +764,7 @@ impl HTMLFormElement {
can_gc,
);
let event = event.upcast::<Event>();
- event.fire(self.upcast::<EventTarget>());
+ event.fire(self.upcast::<EventTarget>(), can_gc);
// Step 6.6
self.firing_submission_events.set(false);
@@ -1223,7 +1223,9 @@ impl HTMLFormElement {
can_gc,
);
- event.upcast::<Event>().fire(self.upcast::<EventTarget>());
+ event
+ .upcast::<Event>()
+ .fire(self.upcast::<EventTarget>(), can_gc);
// Step 8
self.constructing_entry_list.set(false);
diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs
index d51a7e3a86a..dfaa895429c 100644
--- a/components/script/dom/htmlmediaelement.rs
+++ b/components/script/dom/htmlmediaelement.rs
@@ -1640,7 +1640,9 @@ impl HTMLMediaElement {
can_gc,
);
- event.upcast::<Event>().fire(self.upcast::<EventTarget>());
+ event
+ .upcast::<Event>()
+ .fire(self.upcast::<EventTarget>(), can_gc);
}
}
@@ -1695,7 +1697,9 @@ impl HTMLMediaElement {
can_gc,
);
- event.upcast::<Event>().fire(self.upcast::<EventTarget>());
+ event
+ .upcast::<Event>()
+ .fire(self.upcast::<EventTarget>(), can_gc);
}
}
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs
index f504c50ab3b..1f2ddafb2e0 100644
--- a/components/script/dom/htmlscriptelement.rs
+++ b/components/script/dom/htmlscriptelement.rs
@@ -1227,7 +1227,7 @@ impl HTMLScriptElement {
) -> EventStatus {
let window = window_from_node(self);
let event = Event::new(window.upcast(), type_, bubbles, cancelable, can_gc);
- event.fire(self.upcast())
+ event.fire(self.upcast(), can_gc)
}
}
diff --git a/components/script/dom/messageevent.rs b/components/script/dom/messageevent.rs
index b34c15dd557..99f8603973e 100644
--- a/components/script/dom/messageevent.rs
+++ b/components/script/dom/messageevent.rs
@@ -219,7 +219,7 @@ impl MessageEvent {
ports,
can_gc,
);
- messageevent.upcast::<Event>().fire(target);
+ messageevent.upcast::<Event>().fire(target, can_gc);
}
pub fn dispatch_error(target: &EventTarget, scope: &GlobalScope, can_gc: CanGc) {
@@ -236,7 +236,7 @@ impl MessageEvent {
init.ports.clone(),
can_gc,
);
- messageevent.upcast::<Event>().fire(target);
+ messageevent.upcast::<Event>().fire(target, can_gc);
}
}
diff --git a/components/script/dom/offlineaudiocontext.rs b/components/script/dom/offlineaudiocontext.rs
index a994e107dfc..bd3f13f6dd8 100644
--- a/components/script/dom/offlineaudiocontext.rs
+++ b/components/script/dom/offlineaudiocontext.rs
@@ -207,7 +207,7 @@ impl OfflineAudioContextMethods for OfflineAudioContext {
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,
&buffer, CanGc::note());
- event.upcast::<Event>().fire(this.upcast());
+ event.upcast::<Event>().fire(this.upcast(), CanGc::note());
}),
&canceller,
);
diff --git a/components/script/dom/popstateevent.rs b/components/script/dom/popstateevent.rs
index ff24a1f1028..d241c273116 100644
--- a/components/script/dom/popstateevent.rs
+++ b/components/script/dom/popstateevent.rs
@@ -77,7 +77,7 @@ impl PopStateEvent {
) {
let event =
PopStateEvent::new(window, None, atom!("popstate"), false, false, state, can_gc);
- event.upcast::<Event>().fire(target);
+ event.upcast::<Event>().fire(target, can_gc);
}
}
diff --git a/components/script/dom/rtcdatachannel.rs b/components/script/dom/rtcdatachannel.rs
index 29b7e4aeec5..ab38b461546 100644
--- a/components/script/dom/rtcdatachannel.rs
+++ b/components/script/dom/rtcdatachannel.rs
@@ -119,7 +119,7 @@ impl RTCDataChannel {
EventCancelable::NotCancelable,
can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
}
pub fn on_close(&self, can_gc: CanGc) {
@@ -130,7 +130,7 @@ impl RTCDataChannel {
EventCancelable::NotCancelable,
can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
self.peer_connection
.unregister_data_channel(&self.servo_media_id);
@@ -153,7 +153,7 @@ impl RTCDataChannel {
};
let error = RTCError::new(&global, &init, message, can_gc);
let event = RTCErrorEvent::new(&global, atom!("error"), false, false, &error, can_gc);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
}
#[allow(unsafe_code)]
@@ -213,7 +213,7 @@ impl RTCDataChannel {
EventCancelable::NotCancelable,
can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
};
self.ready_state.set(state.into());
}
diff --git a/components/script/dom/rtcpeerconnection.rs b/components/script/dom/rtcpeerconnection.rs
index cc9ce9c27f8..28e39837f3b 100644
--- a/components/script/dom/rtcpeerconnection.rs
+++ b/components/script/dom/rtcpeerconnection.rs
@@ -101,7 +101,7 @@ impl WebRtcSignaller for RTCSignaller {
let _ = self.task_source.queue_with_canceller(
task!(on_negotiation_needed: move || {
let this = this.root();
- this.on_negotiation_needed();
+ this.on_negotiation_needed(CanGc::note());
}),
&self.canceller,
);
@@ -123,7 +123,7 @@ impl WebRtcSignaller for RTCSignaller {
let _ = self.task_source.queue_with_canceller(
task!(update_ice_connection_state: move || {
let this = this.root();
- this.update_ice_connection_state(state);
+ this.update_ice_connection_state(state, CanGc::note());
}),
&self.canceller,
);
@@ -134,7 +134,7 @@ impl WebRtcSignaller for RTCSignaller {
let _ = self.task_source.queue_with_canceller(
task!(update_signaling_state: move || {
let this = this.root();
- this.update_signaling_state(state);
+ this.update_signaling_state(state, CanGc::note());
}),
&self.canceller,
);
@@ -146,7 +146,7 @@ impl WebRtcSignaller for RTCSignaller {
let _ = self.task_source.queue_with_canceller(
task!(on_add_stream: move || {
let this = this.root();
- this.on_add_stream(id, ty);
+ this.on_add_stream(id, ty, CanGc::note());
}),
&self.canceller,
);
@@ -269,10 +269,10 @@ impl RTCPeerConnection {
true,
can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
}
- fn on_negotiation_needed(&self) {
+ fn on_negotiation_needed(&self, can_gc: CanGc) {
if self.closed.get() {
return;
}
@@ -281,25 +281,19 @@ impl RTCPeerConnection {
atom!("negotiationneeded"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,
- CanGc::note(),
+ can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
}
- fn on_add_stream(&self, id: MediaStreamId, ty: MediaStreamType) {
+ fn on_add_stream(&self, id: MediaStreamId, ty: MediaStreamType, can_gc: CanGc) {
if self.closed.get() {
return;
}
let track = MediaStreamTrack::new(&self.global(), id, ty);
- let event = RTCTrackEvent::new(
- &self.global(),
- atom!("track"),
- false,
- false,
- &track,
- CanGc::note(),
- );
- event.upcast::<Event>().fire(self.upcast());
+ let event =
+ RTCTrackEvent::new(&self.global(), atom!("track"), false, false, &track, can_gc);
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
}
fn on_data_channel_event(
@@ -330,7 +324,7 @@ impl RTCPeerConnection {
&channel,
can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
},
_ => {
let channel = if let Some(channel) = self.data_channels.borrow().get(&channel_id) {
@@ -394,9 +388,9 @@ impl RTCPeerConnection {
atom!("icegatheringstatechange"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,
- CanGc::note(),
+ can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
// step 6
if state == RTCIceGatheringState::Complete {
@@ -408,12 +402,12 @@ impl RTCPeerConnection {
true,
can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
}
}
/// <https://www.w3.org/TR/webrtc/#update-ice-connection-state>
- fn update_ice_connection_state(&self, state: IceConnectionState) {
+ fn update_ice_connection_state(&self, state: IceConnectionState, can_gc: CanGc) {
// step 1
if self.closed.get() {
return;
@@ -436,12 +430,12 @@ impl RTCPeerConnection {
atom!("iceconnectionstatechange"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,
- CanGc::note(),
+ can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
}
- fn update_signaling_state(&self, state: SignalingState) {
+ fn update_signaling_state(&self, state: SignalingState, can_gc: CanGc) {
if self.closed.get() {
return;
}
@@ -459,9 +453,9 @@ impl RTCPeerConnection {
atom!("signalingstatechange"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,
- CanGc::note(),
+ can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
}
fn create_offer(&self) {
diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs
index 64577d2564d..030c0957217 100644
--- a/components/script/dom/storage.rs
+++ b/components/script/dom/storage.rs
@@ -225,7 +225,7 @@ impl Storage {
Some(&this),
CanGc::note()
);
- event.upcast::<Event>().fire(global.upcast());
+ event.upcast::<Event>().fire(global.upcast(), CanGc::note());
}),
global.upcast(),
)
diff --git a/components/script/dom/texttracklist.rs b/components/script/dom/texttracklist.rs
index 55ac4fbdfac..51aba9b0f05 100644
--- a/components/script/dom/texttracklist.rs
+++ b/components/script/dom/texttracklist.rs
@@ -87,7 +87,7 @@ impl TextTrackList {
CanGc::note()
);
- event.upcast::<Event>().fire(this.upcast::<EventTarget>());
+ event.upcast::<Event>().fire(this.upcast::<EventTarget>(), CanGc::note());
}
}),
canceller,
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 39b9461f66b..d662b52254d 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -304,10 +304,10 @@ impl WebGLRenderingContext {
);
match canvas {
HTMLCanvasElementOrOffscreenCanvas::HTMLCanvasElement(canvas) => {
- event.upcast::<Event>().fire(canvas.upcast());
+ event.upcast::<Event>().fire(canvas.upcast(), can_gc);
},
HTMLCanvasElementOrOffscreenCanvas::OffscreenCanvas(canvas) => {
- event.upcast::<Event>().fire(canvas.upcast());
+ event.upcast::<Event>().fire(canvas.upcast(), can_gc);
},
}
None
diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs
index 964927038fa..745782c061d 100644
--- a/components/script/dom/websocket.rs
+++ b/components/script/dom/websocket.rs
@@ -541,7 +541,9 @@ impl TaskOnce for CloseTask {
reason,
CanGc::note(),
);
- close_event.upcast::<Event>().fire(ws.upcast());
+ close_event
+ .upcast::<Event>()
+ .fire(ws.upcast(), CanGc::note());
}
}
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index be00b282d31..efdf33f1dd5 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -2294,7 +2294,7 @@ impl Window {
old_url,
new_url,
CanGc::note());
- event.upcast::<Event>().fire(this.upcast::<EventTarget>());
+ event.upcast::<Event>().fire(this.upcast::<EventTarget>(), CanGc::note());
});
// FIXME(nox): Why are errors silenced here?
let _ = self.script_chan.send(CommonScriptMsg::Task(
@@ -2497,7 +2497,9 @@ impl Window {
mql.Matches(),
can_gc,
);
- event.upcast::<Event>().fire(mql.upcast::<EventTarget>());
+ event
+ .upcast::<Event>()
+ .fire(mql.upcast::<EventTarget>(), can_gc);
}
}
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 64466ef749b..74d99176f26 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -1023,7 +1023,7 @@ impl XMLHttpRequest {
EventCancelable::Cancelable,
can_gc,
);
- event.fire(self.upcast());
+ event.fire(self.upcast(), can_gc);
}
}
@@ -1172,7 +1172,7 @@ impl XMLHttpRequest {
EventCancelable::Cancelable,
can_gc,
);
- event.fire(self.upcast());
+ event.fire(self.upcast(), can_gc);
return_if_fetch_was_terminated!();
self.dispatch_response_progress_event(atom!("progress"), can_gc);
}
@@ -1272,7 +1272,7 @@ impl XMLHttpRequest {
} else {
self.upcast()
};
- progressevent.upcast::<Event>().fire(target);
+ progressevent.upcast::<Event>().fire(target, can_gc);
}
fn dispatch_upload_progress_event(
diff --git a/components/script/dom/xrinputsourcearray.rs b/components/script/dom/xrinputsourcearray.rs
index 44f36828540..be9e5ab78dd 100644
--- a/components/script/dom/xrinputsourcearray.rs
+++ b/components/script/dom/xrinputsourcearray.rs
@@ -65,7 +65,7 @@ impl XRInputSourceArray {
&[],
can_gc,
);
- event.upcast::<Event>().fire(session.upcast());
+ event.upcast::<Event>().fire(session.upcast(), can_gc);
}
pub fn remove_input_source(&self, session: &XRSession, id: InputId, can_gc: CanGc) {
@@ -88,7 +88,7 @@ impl XRInputSourceArray {
can_gc,
);
self.input_sources.borrow_mut().retain(|i| i.id() != id);
- event.upcast::<Event>().fire(session.upcast());
+ event.upcast::<Event>().fire(session.upcast(), can_gc);
}
pub fn add_remove_input_source(
@@ -124,7 +124,7 @@ impl XRInputSourceArray {
removed,
can_gc,
);
- event.upcast::<Event>().fire(session.upcast());
+ event.upcast::<Event>().fire(session.upcast(), can_gc);
}
pub fn find(&self, id: InputId) -> Option<DomRoot<XRInputSource>> {
diff --git a/components/script/dom/xrsession.rs b/components/script/dom/xrsession.rs
index fef36e2171b..85a7ec7ae41 100644
--- a/components/script/dom/xrsession.rs
+++ b/components/script/dom/xrsession.rs
@@ -299,7 +299,7 @@ impl XRSession {
// Step 7
let event =
XRSessionEvent::new(&self.global(), atom!("end"), false, false, self, can_gc);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
},
XREvent::Select(input, kind, ty, frame) => {
use servo_atoms::Atom;
@@ -323,7 +323,7 @@ impl XRSession {
&source,
can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
} else {
if ty == SelectEvent::Select {
let event = XRInputSourceEvent::new(
@@ -335,7 +335,7 @@ impl XRSession {
&source,
can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
}
let event = XRInputSourceEvent::new(
&self.global(),
@@ -346,7 +346,7 @@ impl XRSession {
&source,
can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
}
frame.set_active(false);
}
@@ -366,7 +366,7 @@ impl XRSession {
self,
can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
// The page may be visible again, dirty the layers
// This also wakes up the event loop if necessary
self.dirty_layers();
@@ -411,7 +411,7 @@ impl XRSession {
Some(&*offset),
can_gc,
);
- event.upcast::<Event>().fire(space.upcast());
+ event.upcast::<Event>().fire(space.upcast(), can_gc);
});
},
}
@@ -615,7 +615,7 @@ impl XRSession {
self,
can_gc,
);
- event.upcast::<Event>().fire(self.upcast());
+ event.upcast::<Event>().fire(self.upcast(), can_gc);
}
}
diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs
index 552b78b4a48..1b89c714c14 100644
--- a/components/script/script_runtime.rs
+++ b/components/script/script_runtime.rs
@@ -306,7 +306,7 @@ unsafe extern "C" fn promise_rejection_tracker(
CanGc::note()
);
- event.upcast::<Event>().fire(&target);
+ event.upcast::<Event>().fire(&target, CanGc::note());
}),
global.upcast(),
).unwrap();
@@ -424,7 +424,7 @@ pub fn notify_about_rejected_promises(global: &GlobalScope) {
CanGc::note()
);
- let event_status = event.upcast::<Event>().fire(&target);
+ let event_status = event.upcast::<Event>().fire(&target, CanGc::note());
// Step 4-3.
if event_status == EventStatus::Canceled {
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 0120561def3..a367967bd4d 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -1605,6 +1605,7 @@ impl ScriptThread {
identifier,
point,
node_address,
+ can_gc,
);
match (event_type, touch_result) {
(TouchEventType::Down, TouchEventResult::Processed(handled)) => {
@@ -2592,7 +2593,7 @@ impl ScriptThread {
devtools::handle_get_children(&documents, id, node_id, reply)
},
DevtoolScriptControlMsg::GetAttributeStyle(id, node_id, reply) => {
- devtools::handle_get_attribute_style(&documents, id, node_id, reply)
+ devtools::handle_get_attribute_style(&documents, id, node_id, reply, can_gc)
},
DevtoolScriptControlMsg::GetStylesheetStyle(
id,
@@ -2601,13 +2602,13 @@ impl ScriptThread {
stylesheet,
reply,
) => devtools::handle_get_stylesheet_style(
- &documents, id, node_id, selector, stylesheet, reply,
+ &documents, id, node_id, selector, stylesheet, reply, can_gc,
),
DevtoolScriptControlMsg::GetSelectors(id, node_id, reply) => {
devtools::handle_get_selectors(&documents, id, node_id, reply)
},
DevtoolScriptControlMsg::GetComputedStyle(id, node_id, reply) => {
- devtools::handle_get_computed_style(&documents, id, node_id, reply)
+ devtools::handle_get_computed_style(&documents, id, node_id, reply, can_gc)
},
DevtoolScriptControlMsg::GetLayout(id, node_id, reply) => {
devtools::handle_get_layout(&documents, id, node_id, reply, can_gc)
@@ -2616,7 +2617,7 @@ impl ScriptThread {
devtools::handle_modify_attribute(&documents, id, node_id, modifications, can_gc)
},
DevtoolScriptControlMsg::ModifyRule(id, node_id, modifications) => {
- devtools::handle_modify_rule(&documents, id, node_id, modifications)
+ devtools::handle_modify_rule(&documents, id, node_id, modifications, can_gc)
},
DevtoolScriptControlMsg::WantsLiveNotifications(id, to_send) => match documents
.find_window(id)
@@ -2843,7 +2844,14 @@ impl ScriptThread {
)
},
WebDriverScriptCommand::GetElementCSS(node_id, name, reply) => {
- webdriver_handlers::handle_get_css(&documents, pipeline_id, node_id, name, reply)
+ webdriver_handlers::handle_get_css(
+ &documents,
+ pipeline_id,
+ node_id,
+ name,
+ reply,
+ can_gc,
+ )
},
WebDriverScriptCommand::GetElementRect(node_id, reply) => {
webdriver_handlers::handle_get_rect(&documents, pipeline_id, node_id, reply, can_gc)
@@ -3963,6 +3971,7 @@ impl ScriptThread {
identifier: TouchId,
point: Point2D<f32>,
node_address: Option<UntrustedNodeAddress>,
+ can_gc: CanGc,
) -> TouchEventResult {
let document = match self.documents.borrow().find_document(pipeline_id) {
Some(document) => document,
@@ -3971,7 +3980,7 @@ impl ScriptThread {
return TouchEventResult::Processed(true);
},
};
- unsafe { document.handle_touch_event(event_type, identifier, point, node_address) }
+ unsafe { document.handle_touch_event(event_type, identifier, point, node_address, can_gc) }
}
fn handle_wheel_event(
@@ -4087,7 +4096,7 @@ impl ScriptThread {
0i32,
can_gc,
);
- uievent.upcast::<Event>().fire(window.upcast());
+ uievent.upcast::<Event>().fire(window.upcast(), can_gc);
}
}
diff --git a/components/script/security_manager.rs b/components/script/security_manager.rs
index 30ff4242b39..c0c1497029f 100644
--- a/components/script/security_manager.rs
+++ b/components/script/security_manager.rs
@@ -115,7 +115,7 @@ impl CSPViolationReporter {
can_gc,
);
- event.upcast::<Event>().fire(&target);
+ event.upcast::<Event>().fire(&target, can_gc);
}
/// <https://w3c.github.io/webappsec-csp/#strip-url-for-use-in-reports>
diff --git a/components/script/timers.rs b/components/script/timers.rs
index 4f64e529787..b10a356f7c9 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -93,7 +93,7 @@ impl OneshotTimerCallback {
match self {
OneshotTimerCallback::XhrTimeout(callback) => callback.invoke(can_gc),
OneshotTimerCallback::EventSourceTimeout(callback) => callback.invoke(),
- OneshotTimerCallback::JsTimer(task) => task.invoke(this, js_timers),
+ OneshotTimerCallback::JsTimer(task) => task.invoke(this, js_timers, can_gc),
OneshotTimerCallback::TestBindingCallback(callback) => callback.invoke(),
OneshotTimerCallback::FakeRequestAnimationFrame(callback) => callback.invoke(can_gc),
OneshotTimerCallback::RefreshRedirectDue(callback) => callback.invoke(can_gc),
@@ -537,7 +537,7 @@ fn clamp_duration(nesting_level: u32, unclamped: Duration) -> Duration {
impl JsTimerTask {
// see https://html.spec.whatwg.org/multipage/#timer-initialisation-steps
- pub fn invoke<T: DomObject>(self, this: &T, timers: &JsTimers) {
+ pub fn invoke<T: DomObject>(self, this: &T, timers: &JsTimers, can_gc: CanGc) {
// step 4.1 can be ignored, because we proactively prevent execution
// of this task when its scheduled execution is canceled.
@@ -558,7 +558,7 @@ impl JsTimerTask {
rval.handle_mut(),
ScriptFetchOptions::default_classic_script(&global),
global.api_base_url(),
- CanGc::note(),
+ can_gc,
);
},
InternalTimerCallback::FunctionTimerCallback(ref function, ref arguments) => {
diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs
index f1ea8e4f388..7f9b71c859c 100644
--- a/components/script/webdriver_handlers.rs
+++ b/components/script/webdriver_handlers.rs
@@ -1044,6 +1044,7 @@ pub fn handle_get_css(
node_id: String,
name: String,
reply: IpcSender<Result<String, ErrorStatus>>,
+ can_gc: CanGc,
) {
reply
.send(
@@ -1053,7 +1054,7 @@ pub fn handle_get_css(
String::from(
window
.GetComputedStyle(element, None)
- .GetPropertyValue(DOMString::from(name)),
+ .GetPropertyValue(DOMString::from(name), can_gc),
)
}),
)