Script: Use &mut JSContext in CheckValidity and ReportValidity Methods (#42820)

This is part of replacing can_gc with the new &JSContext/&mut JSContext
method.
We modify CheckValidity and ReportValidity in various HTML Elements to
use the context instead of CanGc.

Testing: Compilation is the test as this is mostly mechanical.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
Narfinger
2026-02-25 19:34:21 +09:00
committed by GitHub
parent 0b94f0a7ce
commit a122bde4b1
11 changed files with 78 additions and 56 deletions

View File

@@ -6,6 +6,7 @@ use std::default::Default;
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix, local_name, ns};
use js::context::JSContext;
use js::rust::HandleObject;
use pixels::RasterImage;
use servo_arc::Arc;
@@ -111,13 +112,13 @@ impl HTMLObjectElementMethods<crate::DomTypeHolder> for HTMLObjectElement {
}
/// <https://html.spec.whatwg.org/multipage/#dom-cva-checkvalidity>
fn CheckValidity(&self, can_gc: CanGc) -> bool {
self.check_validity(can_gc)
fn CheckValidity(&self, cx: &mut JSContext) -> bool {
self.check_validity(cx)
}
/// <https://html.spec.whatwg.org/multipage/#dom-cva-reportvalidity>
fn ReportValidity(&self, can_gc: CanGc) -> bool {
self.report_validity(can_gc)
fn ReportValidity(&self, cx: &mut JSContext) -> bool {
self.report_validity(cx)
}
/// <https://html.spec.whatwg.org/multipage/#dom-cva-validationmessage>