summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2021-01-06 02:56:40 +0100
committerGitHub <noreply@github.com>2021-01-06 02:56:40 +0100
commit60c9c857584bf5180dd0f7b937683dd9691aef84 (patch)
tree86ad8ab84bdf962752c0f7a4361a3f8c556691c9
parentbb884182218b5c12c7354c93860d69f65f59752a (diff)
fix: align performance API to spec using WPT (#9012)
-rw-r--r--cli/tests/wpt.jsonc42
-rw-r--r--runtime/js/40_performance.js10
m---------test_util/wpt0
3 files changed, 48 insertions, 4 deletions
diff --git a/cli/tests/wpt.jsonc b/cli/tests/wpt.jsonc
index 479b6a747..3099d3b48 100644
--- a/cli/tests/wpt.jsonc
+++ b/cli/tests/wpt.jsonc
@@ -135,13 +135,49 @@
"Encoding argument supported for decode: UTF-16LE",
"Encoding argument supported for decode: x-user-defined"
]
- },
+ }
// TODO(lucacasonato): enable when we support utf-16
// "textencoder-utf16-surrogates",
// TODO(lucacasonato): uses XMLHttpRequest unnecessarily. should be fixed upstream before enabling
// "unsupported-encodings",
],
- "dom": [
- "abort/event"
+ "dom": ["abort/event"],
+ "hr-time": ["monotonic-clock"],
+ "html": [
+ "webappapis/microtask-queuing/queue-microtask-exceptions.any",
+ "webappapis/microtask-queuing/queue-microtask.any"
+ ],
+ "user-timing": [
+ "clear_all_marks",
+ "clear_all_measures",
+ "clear_non_existent_mark",
+ "clear_non_existent_measure",
+ "clear_one_mark",
+ "clear_one_measure",
+ "entry_type",
+ "mark-entry-constructor",
+ "mark-errors",
+ "mark-measure-return-objects",
+ "mark.any",
+ {
+ "name": "measure_syntax_err",
+ "expectFail": [
+ // TODO(lucacasonato): re-enable when #9009 is fixed.
+ "self.performance.measure(\"measure\", \"mark\"), where \"mark\" is a non-existent mark, throws a SyntaxError exception.",
+ "self.performance.measure(\"measure\", \"mark\", \"existing_mark\"), where \"mark\" is a non-existent mark, throws a SyntaxError exception.",
+ "self.performance.measure(\"measure\", \"existing_mark\", \"mark\"), where \"mark\" is a non-existent mark, throws a SyntaxError exception.",
+ "self.performance.measure(\"measure\", \"mark\", \"mark\"), where \"mark\" is a non-existent mark, throws a SyntaxError exception."
+ ]
+ },
+ "measure-l3",
+ {
+ "name": "structured-serialize-detail",
+ "expectFail": [
+ // TODO(lucacasonato): re-enable when we use real structured clone.
+ "Mark: Throw an exception when the detail property cannot be structured-serialized.",
+ "Measure: Throw an exception when the detail property cannot be structured-serialized."
+ ]
+ },
+ "user_timing_exists"
]
}
diff --git a/runtime/js/40_performance.js b/runtime/js/40_performance.js
index 0a63dc704..b9c873270 100644
--- a/runtime/js/40_performance.js
+++ b/runtime/js/40_performance.js
@@ -99,6 +99,8 @@
}
class PerformanceMark extends PerformanceEntry {
+ [Symbol.toStringTag] = "PerformanceMark";
+
#detail = null;
get detail() {
@@ -111,8 +113,12 @@
constructor(
name,
- { detail = null, startTime = now() } = {},
+ options = {},
) {
+ if (typeof options !== "object") {
+ throw new TypeError("Invalid options");
+ }
+ const { detail = null, startTime = now() } = options;
super(name, "mark", startTime, 0, illegalConstructorKey);
if (startTime < 0) {
throw new TypeError("startTime cannot be negative");
@@ -140,6 +146,8 @@
}
class PerformanceMeasure extends PerformanceEntry {
+ [Symbol.toStringTag] = "PerformanceMeasure";
+
#detail = null;
get detail() {
diff --git a/test_util/wpt b/test_util/wpt
-Subproject b6f4d8ca80c396728754871433e61340da41302
+Subproject 835839463c5270731a6a57885caff34cac7725e