resolve issue #36074 new_js_regex and matches_js_regex need a CanGc argument (#36111)

* new_js_regex and matches_js_regex need a CanGc argument

Signed-off-by: dericko681 <abonghoderick@gmail.com>

* new_js_regex and matches_js_regex need a CanGc argument

Signed-off-by: dericko681 <abonghoderick@gmail.com>

* edit Propagate CanGc arguments through new_js_regex and matches_js_regex

Signed-off-by: dericko681 <abonghoderick@gmail.com>

* Propagate CanGc arguments through new_js_regex and matches_js_regex

Signed-off-by: dericko681 <abonghoderick@gmail.com>

* Propagate CanGc arguments through new_js_regex and matches_js_regex

Signed-off-by: dericko681 <abonghoderick@gmail.com>

* Propagate CanGc arguments through new_js_regex and matches_js_regex

Signed-off-by: dericko681 <abonghoderick@gmail.com>

---------

Signed-off-by: dericko681 <abonghoderick@gmail.com>
This commit is contained in:
Kunga Derick Abongho 2025-03-29 14:09:56 +01:00 committed by GitHub
parent b5c8164e99
commit 83da63f638
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 600 additions and 435 deletions

View file

@ -107,7 +107,7 @@ impl ValidityState {
// https://html.spec.whatwg.org/multipage/#custom-validity-error-message
pub(crate) fn set_custom_error_message(&self, error: DOMString) {
*self.custom_error_message.borrow_mut() = error;
self.perform_validation_and_update(ValidationFlags::CUSTOM_ERROR);
self.perform_validation_and_update(ValidationFlags::CUSTOM_ERROR, CanGc::note());
}
/// Given a set of [ValidationFlags], recalculate their value by performing
@ -115,12 +115,16 @@ impl ValidityState {
/// if [ValidationFlags::CUSTOM_ERROR] is in `update_flags` and a custom
/// error has been set on this [ValidityState], the state will be updated
/// to reflect the existance of a custom error.
pub(crate) fn perform_validation_and_update(&self, update_flags: ValidationFlags) {
pub(crate) fn perform_validation_and_update(
&self,
update_flags: ValidationFlags,
can_gc: CanGc,
) {
let mut invalid_flags = self.invalid_flags.get();
invalid_flags.remove(update_flags);
if let Some(validatable) = self.element.as_maybe_validatable() {
let new_flags = validatable.perform_validation(update_flags);
let new_flags = validatable.perform_validation(update_flags, can_gc);
invalid_flags.insert(new_flags);
}
@ -132,7 +136,7 @@ impl ValidityState {
}
self.invalid_flags.set(invalid_flags);
self.update_pseudo_classes();
self.update_pseudo_classes(can_gc);
}
pub(crate) fn update_invalid_flags(&self, update_flags: ValidationFlags) {
@ -143,7 +147,7 @@ impl ValidityState {
self.invalid_flags.get()
}
pub(crate) fn update_pseudo_classes(&self) {
pub(crate) fn update_pseudo_classes(&self, can_gc: CanGc) {
if self.element.is_instance_validatable() {
let is_valid = self.invalid_flags.get().is_empty();
self.element.set_state(ElementState::VALID, is_valid);
@ -155,7 +159,7 @@ impl ValidityState {
if let Some(form_control) = self.element.as_maybe_form_control() {
if let Some(form_owner) = form_control.form_owner() {
form_owner.update_validity();
form_owner.update_validity(can_gc);
}
}
@ -166,7 +170,7 @@ impl ValidityState {
.filter_map(DomRoot::downcast::<HTMLFieldSetElement>)
.next()
{
fieldset.update_validity();
fieldset.update_validity(can_gc);
}
}
}