script : Return PerformanceMark object from the Performance.mark() (#44199)

This returns the `PerformanceMark` object from Performance.mark()

Testing: More WPT tests passed

---------

Signed-off-by: Shubham Gupta <shubham.gupta@chromium.org>
This commit is contained in:
Shubham Gupta
2026-04-14 17:47:05 +08:00
committed by GitHub
parent e0fd559105
commit 4ff29fecc8
5 changed files with 6 additions and 35 deletions

View File

@@ -638,7 +638,7 @@ impl PerformanceMethods<crate::DomTypeHolder> for Performance {
}
/// <https://w3c.github.io/user -timing/#dom-performance-mark>
fn Mark(&self, mark_name: DOMString) -> Fallible<()> {
fn Mark(&self, mark_name: DOMString) -> Fallible<DomRoot<PerformanceMark>> {
let global = self.global();
// NOTE: This should happen within the performancemark constructor
if global.is::<Window>() && INVALID_ENTRY_NAMES.contains(&&*mark_name.str()) {
@@ -659,7 +659,7 @@ impl PerformanceMethods<crate::DomTypeHolder> for Performance {
// TODO Step 3. Add entry to the performance entry buffer.
// Step 4. Return entry.
Ok(())
Ok(entry)
}
/// <https://w3c.github.io/user-timing/#dom-performance-clearmarks>

View File

@@ -36,7 +36,7 @@ dictionary PerformanceMeasureOptions {
[Exposed=(Window,Worker)]
partial interface Performance {
[Throws]
undefined mark(DOMString markName);
PerformanceMark mark(DOMString markName);
undefined clearMarks(optional DOMString markName);
[Throws]
PerformanceMeasure measure(DOMString measureName, optional (DOMString or PerformanceMeasureOptions) startOrMeasureOptions = {}, optional DOMString endMark);

View File

@@ -1,3 +1,6 @@
[mark-measure-feature-detection.html]
[Test PerformanceMeasure existence and feature detection]
expected: FAIL
[Test PerformanceMark existence and feature detection]
expected: FAIL

View File

@@ -1,14 +0,0 @@
[mark-measure-return-objects.any.html]
[L3: performance.mark(name) should return an entry.]
expected: FAIL
[L3: performance.mark(name, param) should return an entry.]
expected: FAIL
[mark-measure-return-objects.any.worker.html]
[L3: performance.mark(name) should return an entry.]
expected: FAIL
[L3: performance.mark(name, param) should return an entry.]
expected: FAIL

View File

@@ -1,26 +1,8 @@
[measure-l3.any.html]
[When the end mark is given and the start is unprovided, the end time of the measure entry should be the end mark's time, the start time should be 0.]
expected: FAIL
[When the start mark is given and the end is unprovided, the start time of the measure entry should be the start mark's time, the end should be now.]
expected: FAIL
[When start and end mark are both given, the start time and end time of the measure entry should be the the marks' time, repectively]
expected: FAIL
[When start and end mark are both given, the start time and end time of the measure entry should be the marks' time, repectively]
expected: FAIL
[measure-l3.any.worker.html]
[When the end mark is given and the start is unprovided, the end time of the measure entry should be the end mark's time, the start time should be 0.]
expected: FAIL
[When the start mark is given and the end is unprovided, the start time of the measure entry should be the start mark's time, the end should be now.]
expected: FAIL
[When start and end mark are both given, the start time and end time of the measure entry should be the the marks' time, repectively]
expected: FAIL
[When start and end mark are both given, the start time and end time of the measure entry should be the marks' time, repectively]
expected: FAIL