Bug 1481568 [wpt PR 12343] - [html] Verify synchronicity of beforeunload event, a=testonly
authorMike Pennisi <mike@mikepennisi.com>
Wed, 15 Aug 2018 09:57:58 +0000
changeset 431744 9ee4484da82cd63bb88e713a2d97570b6f33eaac
parent 431743 4a89638926789e52db93b8054e6020f6ef565c25
child 431745 c7cbb4da979b65483a9b153faff2c09f27dae006
push id34451
push userebalazs@mozilla.com
push dateThu, 16 Aug 2018 09:25:15 +0000
treeherdermozilla-central@161817e6d127 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1481568, 12343
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1481568 [wpt PR 12343] - [html] Verify synchronicity of beforeunload event, a=testonly Automatic update from web-platform-tests[html] Verify synchronicity of beforeunload event -- wpt-commits: a65808135f02c386c17f3f019bf8a6c236c60459 wpt-pr: 12343
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-synchronous.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -352260,16 +352260,22 @@
     ]
    ],
    "html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent.html": [
     [
      "/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent.html",
      {}
     ]
    ],
+   "html/browsers/browsing-the-web/unloading-documents/beforeunload-synchronous.html": [
+    [
+     "/html/browsers/browsing-the-web/unloading-documents/beforeunload-synchronous.html",
+     {}
+    ]
+   ],
    "html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload.html": [
     [
      "/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload.html",
      {}
     ]
    ],
    "html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward.html": [
     [
@@ -587591,16 +587597,20 @@
   "html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-2.html": [
    "a34b182e70f8e32bc5a5802d46cdf93adc79026b",
    "support"
   ],
   "html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent.html": [
    "96d49567f365b00a741bb64a7f8cb2efa1427349",
    "testharness"
   ],
+  "html/browsers/browsing-the-web/unloading-documents/beforeunload-synchronous.html": [
+   "6806eaf7a390e9a195b2f7f69d2cf16f4362a0f1",
+   "testharness"
+  ],
   "html/browsers/browsing-the-web/unloading-documents/contains.json": [
    "4ebca09bfda22e4760a978cd471908a85a7432ac",
    "support"
   ],
   "html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-1.html": [
    "b96234fba2cb85b10cfa0e086c723f8aa0a82149",
    "support"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-synchronous.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>beforeunload event is emitted synchronously</title>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#the-event-handler-processing-algorithm">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<script>
+'use strict';
+// "navigate a browsing context" synchronously calls "prompt to unload", which
+// synchronously calls "dispatch an event".
+
+async_test(function(t) {
+  var iframe = document.createElement('iframe');
+
+  iframe.onload = t.step_func(function() {
+    var callCount = 0;
+
+    iframe.contentWindow.onbeforeunload = function() {
+      callCount += 1;
+    };
+
+    iframe.contentWindow.location.href = '/common/blank.html';
+
+    assert_equals(callCount, 1, 'invoked synchronously exactly once');
+
+    t.done();
+  });
+
+  document.body.appendChild(iframe);
+});
+</script>
+</body>