summaryrefslogtreecommitdiffstats
path: root/docshell/test/iframesandbox/file_top_navigation_by_user_activation_iframe.html
diff options
context:
space:
mode:
Diffstat (limited to 'docshell/test/iframesandbox/file_top_navigation_by_user_activation_iframe.html')
-rw-r--r--docshell/test/iframesandbox/file_top_navigation_by_user_activation_iframe.html32
1 files changed, 32 insertions, 0 deletions
diff --git a/docshell/test/iframesandbox/file_top_navigation_by_user_activation_iframe.html b/docshell/test/iframesandbox/file_top_navigation_by_user_activation_iframe.html
new file mode 100644
index 0000000000..b775579f28
--- /dev/null
+++ b/docshell/test/iframesandbox/file_top_navigation_by_user_activation_iframe.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="/tests/SimpleTest/EventUtils.js"></script>
+<title>Test window for top navigation with user activation</title>
+<script>
+function navigate(aURL) {
+ try {
+ top.location.href = aURL;
+ } catch (e) {
+ top.postMessage("BLOCKED", "*");
+ }
+}
+
+window.onmessage = (e) => {
+ SpecialPowers.wrap(document).clearUserGestureActivation();
+ let [command, url] = e.data;
+ if (command == "CLICK") {
+ let button = document.querySelector("button");
+ button.addEventListener("click", () => {
+ navigate(url);
+ }, { once: true });
+ synthesizeMouseAtCenter(button, {});
+ } else if (command == "SCRIPT") {
+ navigate(url);
+ }
+};
+</script>
+</head>
+<body><button>Click</button></body>
+</html>