<rdar://problem/
5539306> REGRESSION: redirect fails when subframe's document is opened but
not closed (affects digg.com)
Tests: fast/loader/meta-refresh-vs-open.html
fast/loader/redirect-with-open-subframe-2.html
fast/loader/redirect-with-open-subframe.html
http/tests/loading/onload-vs-immediate-refresh.pl
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::scheduleRedirection): Only check whether the load is complete for
HTTP redirects - JavaScript-initiated ones are effective immediately.
WebKitTools:
* DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Replace the current document with a blank
one after finishing with a test to avoid having its delayed onload handler fired when
starting the next test. This is ugly and still unreliable (see LayoutTests ChangeLog),
but it helps somewhat.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27986
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-11-23 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/5539306> REGRESSION: redirect fails when subframe's document is opened but
+ not closed (affects digg.com)
+
+ * fast/loader/meta-refresh-vs-open-expected.txt: Added.
+ * fast/loader/meta-refresh-vs-open.html: Added.
+ Test that HTTP refresh never fires if the document stays open indefinitely.
+
+ * fast/loader/redirect-with-open-subframe-expected.txt: Added.
+ * fast/loader/redirect-with-open-subframe.html: Added.
+ * fast/loader/redirect-with-open-subframe-2-expected.txt: Added.
+ * fast/loader/redirect-with-open-subframe-2.html: Added.
+ Test that setting window.location has effect even if the document is open.
+
+ * http/tests/loading/onload-vs-immediate-refresh-expected.txt: Added.
+ * http/tests/loading/onload-vs-immediate-refresh.pl: Added.
+ Test for <rdar://3829452> - HTTP redirect should only happen after onload fires.
+
+ * platform/mac/http/tests/loading/simple-subframe-expected.txt:
+ It seems that there was a line spilled from the previous test that is now in
+ onload-vs-immediate-refresh-expected.txt - despite my efforts, I couldn't get rid of it.
+
2007-11-23 Dan Bernstein <mitz@apple.com>
Reviewed by Alexey Proskuryakov.
--- /dev/null
+
+SUCCESS - shouldn't refresh or invoke onload.
--- /dev/null
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+</script>
+<meta http-equiv="refresh" content="0;url=data:text/plain,You should not have been redirected here.">
+</head>
+<body onload="if (window.layoutTestController) document.write('<p>FAIL: onload</p>'); else alert('FAIL: onload');">
+<iframe id="ifrm" src="about:blank"></iframe>
+<script>
+ document.getElementById("ifrm").contentDocument.open();
+ if (window.layoutTestController)
+ setTimeout("layoutTestController.notifyDone()", 500);
+</script>
+<p>SUCCESS - shouldn't refresh or invoke onload.</p>
+</body>
+</html>
--- /dev/null
+<html>
+<script>
+function test() {
+ if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.dumpAsText();
+ }
+ document.open();
+ var newDoc = "SUCCESS<script>if (window.layoutTestController) layoutTestController.notifyDone();</scr" + "ipt>";
+ setTimeout("window.location='data:text/html," + newDoc + "'", 500);
+}
+</script>
+<body onload="test()">
+</body>
+</html>
--- /dev/null
+<html>
+<body>
+<iframe id="ifrm" src="about:blank"></iframe>
+<script>
+ document.getElementById("ifrm").contentDocument.open();
+ if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.dumpAsText();
+ }
+ var newDoc = "SUCCESS<script>if (window.layoutTestController) layoutTestController.notifyDone();</scr" + "ipt>";
+ setTimeout("window.location='data:text/html," + newDoc + "'", 500);
+</script>
+<div>FAILURE: should redirect.</div>
+</body>
+</html>
--- /dev/null
+main frame - didStartProvisionalLoadForFrame
+frame "f1" - willCloseFrame
+main frame - willCloseFrame
+main frame - didCommitLoadForFrame
+main frame - didClearWindowObjectForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didFinishLoadForFrame
+SUCCESS
--- /dev/null
+#!/usr/bin/perl
+# http://trac.webkit.org/projects/webkit/changeset/7800
+# rdar://problem/3829452 REGRESSION (156-157): onload handler doesn't run on page with meta refresh of 0 duration (new Apple start page)
+
+# flush the buffers after each print
+select (STDOUT);
+$| = 1;
+
+print "Refresh: 0;url=data:text/plain,You should have seen an alert.\r\n";
+print "Content-Type: text/html\r\n";
+print "\r\n";
+
+print << "EOF";
+<html>
+<head>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+</script>
+<meta http-equiv="refresh" content="0;url=data:text/plain,You should have seen an alert.">
+</head>
+EOF
+
+for ($count=1; $count<20000; $count++) {
+ print " \n";
+}
+
+print << "EOF";
+<body onload="if (window.layoutTestController) document.write('<p>SUCCESS</p>'); else alert('SUCCESS');">
+</body>
+</html>
+EOF
main frame - didStartProvisionalLoadForFrame
-frame "f1" - willCloseFrame
main frame - willCloseFrame
main frame - didCommitLoadForFrame
main frame - didClearWindowObjectForFrame
+2007-11-23 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/5539306> REGRESSION: redirect fails when subframe's document is opened but
+ not closed (affects digg.com)
+
+ Tests: fast/loader/meta-refresh-vs-open.html
+ fast/loader/redirect-with-open-subframe-2.html
+ fast/loader/redirect-with-open-subframe.html
+ http/tests/loading/onload-vs-immediate-refresh.pl
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::scheduleRedirection): Only check whether the load is complete for
+ HTTP redirects - JavaScript-initiated ones are effective immediately.
+
2007-11-23 Dan Bernstein <mitz@apple.com>
Reviewed by Alexey Proskuryakov.
{
stopRedirectionTimer();
m_scheduledRedirection.set(redirection);
- if (m_isComplete)
+ if (!m_isComplete && redirection->type != ScheduledRedirection::redirection)
+ completed();
+ if (m_isComplete || redirection->type != ScheduledRedirection::redirection)
startRedirectionTimer();
}
+2007-11-23 Alexey Proskuryakov <ap@webkit.org>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/5539306> REGRESSION: redirect fails when subframe's document is opened but
+ not closed (affects digg.com)
+
+ * DumpRenderTree/mac/DumpRenderTree.mm: (runTest): Replace the current document with a blank
+ one after finishing with a test to avoid having its delayed onload handler firing when
+ replaced with the next one. This is ugly and still unreliable (see LayoutTests ChangeLog),
+ but it helps somewhat.
+
2007-11-22 Mark Rowe <mrowe@apple.com>
Reviewed by Alp Toker.
}
}
+ [mainFrame loadHTMLString:@"<html></html>" baseURL:[NSURL URLWithString:@"about:blank"]];
+ [mainFrame stopLoading];
+
[pool release];
// We should only have our main window left when we're done