summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/document-policy/experimental-features/resources/document-write-disallowed.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/document-policy/experimental-features/resources/document-write-disallowed.html')
-rw-r--r--testing/web-platform/tests/document-policy/experimental-features/resources/document-write-disallowed.html37
1 files changed, 37 insertions, 0 deletions
diff --git a/testing/web-platform/tests/document-policy/experimental-features/resources/document-write-disallowed.html b/testing/web-platform/tests/document-policy/experimental-features/resources/document-write-disallowed.html
new file mode 100644
index 0000000000..633fa85e6a
--- /dev/null
+++ b/testing/web-platform/tests/document-policy/experimental-features/resources/document-write-disallowed.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<style>
+#spacer {
+ width: 200%;
+ height: 200%;
+}
+</style>
+<body>
+<script>
+ window.addEventListener("message", onMessageReceived);
+
+ function test(api, args) {
+ let did_throw = false;
+ try {
+ document[api](args);
+ } catch(e) {
+ did_throw = true;
+ }
+ return did_throw;
+ }
+
+ function onMessageReceived(e) {
+ let msg = e.data;
+
+ msg.did_throw_exception = test(msg.api, msg.args);
+ if (msg.query) {
+ let el = document.querySelector(msg.query);
+ msg.value = el ? el.innerHTML : false;
+ }
+ ackMessage(msg, e.source);
+ }
+
+ function ackMessage(msg, source) {
+ source.postMessage(msg, "*");
+ }
+</script>
+</body>