Bug 1537588: Add crashtest to verify that pagehide is fired, even if there's a sync XHR during pageload. r=bzbarsky
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 22 Mar 2019 06:15:49 +0000
changeset 465730 ae7a26049a6c8e46b5a80c0cdbe9b7125219e1c9
parent 465729 8b4f4d15c0f3871b3cfc9b5adf57073b2789fd6b
child 465731 0e9f9d86014a1bf41badb6f9c8f25551a480d72c
push id35746
push usershindli@mozilla.com
push dateSat, 23 Mar 2019 09:46:24 +0000
treeherdermozilla-central@02b7484f316b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1537588
milestone68.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 1537588: Add crashtest to verify that pagehide is fired, even if there's a sync XHR during pageload. r=bzbarsky Differential Revision: https://phabricator.services.mozilla.com/D24450
dom/base/crashtests/crashtests.list
dom/base/crashtests/xhr-with-pagehide-1-helper.html
dom/base/crashtests/xhr-with-pagehide-1.html
--- a/dom/base/crashtests/crashtests.list
+++ b/dom/base/crashtests/crashtests.list
@@ -244,8 +244,9 @@ load 1505811.html
 load 1505875.html
 load 1508845.html
 load 1516289.html
 load 1516560.html
 load 1528675.html
 load structured_clone_container_throws.html
 load xhr_empty_datauri.html
 load xhr_html_nullresponse.html
+load xhr-with-pagehide-1.html
new file mode 100644
--- /dev/null
+++ b/dom/base/crashtests/xhr-with-pagehide-1-helper.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+function redirectAndFireXHR() {
+  const XHR = new XMLHttpRequest();
+  document.location.assign('data:text/html,final iframe content');
+  XHR.open('GET', 'data:text/html,1', false);
+  XHR.send();
+}
+
+function handlePageHide() {
+  window.parent.finishTest();
+}
+</script>
+</head>
+<body onload="redirectAndFireXHR()"
+      onpagehide="handlePageHide()">
+initial iframe content
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/dom/base/crashtests/xhr-with-pagehide-1.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+  <title>
+    Crashtest to make sure that a sync XHR during pageload doesn't prevent
+    pagehide event from firing.
+  </title>
+  <script>
+    function finishTest() {
+      // Visual indication that we got this far, for humans viewing the test:
+      document.documentElement.style.backgroundColor = "lime";
+
+      // Actually finish the test:
+      document.documentElement.className = "";
+    }
+  </script>
+</head>
+<body>
+  <iframe src="xhr-with-pagehide-1-helper.html"></iframe>
+</body>
+</html>