Null dereference loading Blink layout test fast/frames/navigation-in-pagehide.html
authorjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jan 2016 20:28:54 +0000 (20:28 +0000)
committerjiewen_tan@apple.com <jiewen_tan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jan 2016 20:28:54 +0000 (20:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149303
<rdar://problem/22747634>

Reviewed by Brent Fulgham.

* imported/blink/fast/frames/navigation-in-pagehide-expected.txt: Added.
* imported/blink/fast/frames/navigation-in-pagehide.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194919 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/imported/blink/fast/frames/navigation-in-pagehide-expected.txt [new file with mode: 0644]
LayoutTests/imported/blink/fast/frames/navigation-in-pagehide.html [new file with mode: 0644]

index 7881a87..66b3a76 100644 (file)
@@ -1,3 +1,14 @@
+2016-01-12  Jiewen Tan  <jiewen_tan@apple.com>
+
+        Null dereference loading Blink layout test fast/frames/navigation-in-pagehide.html
+        https://bugs.webkit.org/show_bug.cgi?id=149303
+        <rdar://problem/22747634>
+
+        Reviewed by Brent Fulgham.
+
+        * imported/blink/fast/frames/navigation-in-pagehide-expected.txt: Added.
+        * imported/blink/fast/frames/navigation-in-pagehide.html: Added.
+
 2016-01-12  Adam Bergkvist  <adam.bergkvist@ericsson.com>
 
         WebRTC: Update RTCPeerConnection.add/removeTrack() and add test
diff --git a/LayoutTests/imported/blink/fast/frames/navigation-in-pagehide-expected.txt b/LayoutTests/imported/blink/fast/frames/navigation-in-pagehide-expected.txt
new file mode 100644 (file)
index 0000000..e1d81d9
--- /dev/null
@@ -0,0 +1,4 @@
+This is a simple test that triggering a navigation from a pagehide handler in a frame being navigated doesn't crash.
+
+
+
diff --git a/LayoutTests/imported/blink/fast/frames/navigation-in-pagehide.html b/LayoutTests/imported/blink/fast/frames/navigation-in-pagehide.html
new file mode 100644 (file)
index 0000000..37c2149
--- /dev/null
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+var firstFrame;
+var secondFrame;
+var callbackCount = 0;
+
+function start() {
+  if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+  }
+
+  firstFrame = document.createElement('iframe');
+  document.body.appendChild(firstFrame);
+  var div = document.createElement('div');
+  firstFrame.appendChild(div);
+  secondFrame = document.createElement('iframe');
+  secondFrame.src = 'javascript:window.top.maybeStart();';
+  div.appendChild(secondFrame);
+  var firstFrameRoot = firstFrame.contentDocument.documentElement;
+  document.documentElement.appendChild(div);
+  firstFrameRoot.appendChild(secondFrame);
+}
+
+function maybeStart() {
+  if (callbackCount++ > 1) {
+    reallyStart();
+    return;
+  }
+}
+
+function reallyStart(frame) {
+  secondFrame.contentWindow.onpagehide = function () {
+    firstFrame.src = 'javascript:window.top.navigateThere();';
+  };
+  firstFrame.src = 'javascript:window.top.navigateHere();';
+
+  if (window.location.hash == '#done') {
+    if (window.testRunner)
+      window.testRunner.notifyDone();
+    return;
+  }
+
+  window.setTimeout(function () {
+    window.location.hash = '#done';
+    window.location.reload();
+  }, 0);
+}
+
+function navigateHere() {
+  return 'a';
+}
+
+function navigateThere() {
+  firstFrame.src='javascript:window.top.navigateThereNested();';
+  return 'b';
+}
+
+function navigateThereNested() {
+  return 'c';
+}
+</script>
+</head>
+<body onload="start()">
+<p>This is a simple test that triggering a navigation from a pagehide handler in
+a frame being navigated doesn't crash.</p>
+</body>
+</html>