diff options
Diffstat (limited to 'dom/base/test/useractivation/file_useractivation_sandbox_transient_popup.html')
-rw-r--r-- | dom/base/test/useractivation/file_useractivation_sandbox_transient_popup.html | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/dom/base/test/useractivation/file_useractivation_sandbox_transient_popup.html b/dom/base/test/useractivation/file_useractivation_sandbox_transient_popup.html new file mode 100644 index 0000000000..25bc2037c3 --- /dev/null +++ b/dom/base/test/useractivation/file_useractivation_sandbox_transient_popup.html @@ -0,0 +1,20 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>User activation popup</title> +</head> +<body> +<iframe sandbox="allow-top-navigation-by-user-activation allow-scripts allow-same-origin"></iframe> +<script> + window.addEventListener("message", (e) => { + if (e.data === "triggerIframeLoad") { + // Load into the the iframe a script which notifies the opener of top level navigation or if it was prevented. + let script = `window.opener.postMessage("topNavigation");`; + frames[0].frameElement.src = `javascript:try{window.top.location='javascript:${encodeURIComponent(script)}';} catch (e) {window.top.opener.postMessage("topNavigationBlocked");}`; + } else { + window.opener.postMessage("unexpected"); + } + }); +</script> +</body> +</html> |