1
0
Fork 0
firefox/testing/web-platform/tests/user-timing/measure-exceptions.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

49 lines
No EOL
1.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
This tests that 'performance.measure' throws exceptions with reasonable messages.
</head>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
window.performance.clearMarks();
window.performance.clearMeasures();
window.performance.mark('mark');
const eventMarks = [
'unloadEventStart',
'unloadEventEnd',
'redirectStart',
'redirectEnd',
'secureConnectionStart',
'domInteractive',
'domContentLoadedEventStart',
'domContentLoadedEventEnd',
'domComplete',
'loadEventStart',
'loadEventEnd',
];
eventMarks.forEach(function(name) {
test(()=>{
assert_throws_dom("InvalidAccessError", ()=>{
window.performance.measure("measuring", name, "mark");
}, "Should throw");
}, `Passing '${name}' as a mark to measure API should cause error when the mark is empty.`);
});
const args = [
51.15, // Verify that number is parsed as string, not number.
"DoesNotExist", // Non-existant mark name should cause error.
];
args.forEach(each => {
test(()=>{
assert_throws_dom("SyntaxError", ()=>{
window.performance.measure("measuring", each, "mark");
}, "Should throw");
}, `Passing ${each} as a mark to measure API should cause error.`);
});
</script>
</body>
</html>