summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/trusted-types/support/resolve-spv.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/trusted-types/support/resolve-spv.js')
-rw-r--r--testing/web-platform/tests/trusted-types/support/resolve-spv.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/testing/web-platform/tests/trusted-types/support/resolve-spv.js b/testing/web-platform/tests/trusted-types/support/resolve-spv.js
new file mode 100644
index 0000000000..89e58b2a8b
--- /dev/null
+++ b/testing/web-platform/tests/trusted-types/support/resolve-spv.js
@@ -0,0 +1,9 @@
+// Returns a promise that resolves with a Security Policy Violation (spv)
+ // even when it is received.
+function promise_spv() {
+ return new Promise((resolve, reject) => {
+ window.addEventListener("securitypolicyviolation", e => {
+ resolve(e);
+ }, { once: true });
+ });
+}