Bug 1397512 - Part 2: Add wpt test of form submission inside an onload handler. r?smaug draft
authorSamael Wang <freesamael@gmail.com>
Thu, 26 Oct 2017 17:26:53 +0800
changeset 688563 f2a9724f94f4157a91ebaf6dc42e005a974ee5bc
parent 686779 0a661eb52be759168c1c28ad8c6e520777ae1a07
child 738099 eaa036efcfbde310a56310ed8580b8fc5fd33c07
push id86782
push userbmo:sawang@mozilla.com
push dateMon, 30 Oct 2017 08:15:12 +0000
reviewerssmaug
bugs1397512
milestone58.0a1
Bug 1397512 - Part 2: Add wpt test of form submission inside an onload handler. r?smaug MozReview-Commit-ID: HearVphzHsG
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload.tentative.html
testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-1.tentative.html
testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-2.tentative.html
testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-dynamic-iframe.tentative.html
testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-iframe.tentative.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -290330,16 +290330,36 @@
      {}
     ]
    ],
    "html/browsers/history/the-session-history-of-browsing-contexts/.gitkeep": [
     [
      {}
     ]
    ],
+   "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-1.tentative.html": [
+    [
+     {}
+    ]
+   ],
+   "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-2.tentative.html": [
+    [
+     {}
+    ]
+   ],
+   "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-dynamic-iframe.tentative.html": [
+    [
+     {}
+    ]
+   ],
+   "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-iframe.tentative.html": [
+    [
+     {}
+    ]
+   ],
    "html/browsers/offline/.gitkeep": [
     [
      {}
     ]
    ],
    "html/browsers/offline/appcache/.gitkeep": [
     [
      {}
@@ -344768,16 +344788,22 @@
     ]
    ],
    "html/browsers/history/the-location-interface/security_location_0.htm": [
     [
      "/html/browsers/history/the-location-interface/security_location_0.htm",
      {}
     ]
    ],
+   "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload.tentative.html": [
+    [
+     "/html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload.tentative.html",
+     {}
+    ]
+   ],
    "html/browsers/offline/appcache/workers/appcache-worker.html": [
     [
      "/html/browsers/offline/appcache/workers/appcache-worker.html",
      {}
     ]
    ],
    "html/browsers/offline/application-cache-api/api_status_idle.html": [
     [
@@ -587491,16 +587517,36 @@
   "html/browsers/history/the-location-interface/security_location_0.htm": [
    "ee1592edde42064646fffd17cafcdc54215faf25",
    "testharness"
   ],
   "html/browsers/history/the-session-history-of-browsing-contexts/.gitkeep": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
+  "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload.tentative.html": [
+   "fbb1c40a56f513dd66084f780eb650664188ec4f",
+   "testharness"
+  ],
+  "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-1.tentative.html": [
+   "dac32837cb8f4cbf91987b6e9a47ac1e55e959ac",
+   "support"
+  ],
+  "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-2.tentative.html": [
+   "e45de51132ab221732295759e9f704466fd22557",
+   "support"
+  ],
+  "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-dynamic-iframe.tentative.html": [
+   "4236268fccfeb4735f469cf7c73e4735c0efd11d",
+   "support"
+  ],
+  "html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-iframe.tentative.html": [
+   "e8251bdc0b5e35d274593f0534b1f70b2adbc58c",
+   "support"
+  ],
   "html/browsers/offline/.gitkeep": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
   "html/browsers/offline/appcache/.gitkeep": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload.tentative.html
@@ -0,0 +1,37 @@
+
+<!doctype html>
+<meta charset=utf-8>
+<title>Navigation in onload handler</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+  var testFiles = [
+    "navigation-in-onload_form-submission-1.tentative.html",
+    "navigation-in-onload_form-submission-iframe.tentative.html",
+    "navigation-in-onload_form-submission-dynamic-iframe.tentative.html"
+  ]
+
+  var t = async_test();
+
+  function scheduleNextTest() {
+    setTimeout(runNextTest, 0);
+  }
+
+  function runNextTest() {
+    var file = testFiles.shift();
+    if (!file) {
+      t.done();
+      return;
+    }
+
+    window.open(file);
+  }
+
+  function verify(actual, expected, desc) {
+    setTimeout(t.step_func(function() {
+      assert_equals(actual, expected, desc);
+    }), 0);
+  }
+
+</script>
+<body onload="scheduleNextTest();"></body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-1.tentative.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <title>Navigation in onload handler through form submission</title>
+    <script>
+      function redirect() {
+        document.querySelector("#redirectionForm").submit();
+      }
+    </script>
+  </head>
+  <body onload="redirect();">
+    <form id="redirectionForm" action="navigation-in-onload_form-submission-2.tentative.html" method="get"></form>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-2.tentative.html
@@ -0,0 +1,22 @@
+<!doctype html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <title>Navigation in onload handler through form submission</title>
+    <script>
+
+      // Verify is called after onload event to ensure history has been stable.
+      function verify() {
+        // Navigation in onload handler through form submission should not
+        // increse history length.
+        var testRunner = window.top.opener;
+        testRunner.verify(history.length, 1,
+          "history.length of subtest '" + top.document.title + "'.");
+        testRunner.scheduleNextTest();
+        setTimeout(window.close.bind(top), 0);
+      }
+    </script>
+  </head>
+  <body onload="setTimeout(verify, 0);">
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-dynamic-iframe.tentative.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <title>Navigation in onload handler through form submission in a dynamically created iframe</title>
+    <script>
+      function test() {
+        let testFrame = document.createElement("iframe");
+        testFrame.src = "navigation-in-onload_form-submission-1.tentative.html";
+        document.body.appendChild(testFrame);
+      }
+    </script>
+  </head>
+  <body onload="test();">
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/history/the-session-history-of-browsing-contexts/navigation-in-onload_form-submission-iframe.tentative.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <title>Navigation in onload handler through form submission in an iframe</title>
+  </head>
+  <body>
+    <iframe id="testFrame" src="navigation-in-onload_form-submission-1.tentative.html"></iframe>
+  </body>
+</html>