blob: 0e289f24132b617381aa7578d403f34359285829 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script src="../../resources/js-test.js"></script>
<script>
description("This tests that 'performance.measure' throws exceptions with reasonable messages.");
window.performance.clearMarks();
window.performance.clearMeasures();
shouldThrow('window.performance.measure("DoesNotExist", "AlsoDoesNotExist")', '"SyntaxError: Failed to execute \'measure\' on \'Performance\': The mark \'AlsoDoesNotExist\' does not exist."');
window.performance.mark('mark');
const eventMarks = [
'unloadEventStart',
'unloadEventEnd',
'redirectStart',
'redirectEnd',
'secureConnectionStart',
'domInteractive',
'domContentLoadedEventStart',
'domContentLoadedEventEnd',
'domComplete',
'loadEventStart',
'loadEventEnd',
];
eventMarks.forEach(function(name) {
shouldThrow('window.performance.measure("measuring", \'' + name + '\', "mark")', '"InvalidAccessError: Failed to execute \'measure\' on \'Performance\': \'' + name + '\' is empty: either the event hasn\'t happened yet, or it would provide cross-origin timing information."');
});
const argAndConvertedArgs = {
"51.15": "51.15",
"{}": "[object Object]",
};
Object.entries(argAndConvertedArgs).forEach(function(pair) {
shouldThrow('window.performance.measure("measuring", ' + pair[0] + ', "mark")', '"SyntaxError: Failed to execute \'measure\' on \'Performance\': The mark \'' + pair[1]+ '\' does not exist."');
});
</script>
</body>
</html>