diff options
Diffstat (limited to 'testing/web-platform/tests/html/cross-origin-embedder-policy/resources/blob-url-factory.html')
-rw-r--r-- | testing/web-platform/tests/html/cross-origin-embedder-policy/resources/blob-url-factory.html | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/cross-origin-embedder-policy/resources/blob-url-factory.html b/testing/web-platform/tests/html/cross-origin-embedder-policy/resources/blob-url-factory.html new file mode 100644 index 0000000000..928d404672 --- /dev/null +++ b/testing/web-platform/tests/html/cross-origin-embedder-policy/resources/blob-url-factory.html @@ -0,0 +1,24 @@ +<body> +<script src="script-factory.js"></script> +<script> +const query = new URLSearchParams(window.location.search); +const id = query.get("id"); +const variant = query.get("variant"); +let parent = "parent"; +if (variant === "subframe") { + parent = "parent.parent"; +} else if (variant === "popup") { + parent = "opener.parent"; +} +const blob = new Blob([`<script>${createScript(window.origin, query.get("crossOrigin"), parent, id)}<\/script>`], { type: "text/html" }); +const blobURL = URL.createObjectURL(blob); +if (variant === "subframe") { + const frame = document.createElement("iframe"); + frame.src = blobURL; + document.body.append(frame); +} else if (variant === "popup") { + window.open(blobURL); +} else { + window.location = blobURL; +} +</script> |