Commit f239bbf9 authored by weinig@apple.com's avatar weinig@apple.com

WebCore:

2009-04-08  Sam Weinig  <sam@webkit.org>

        Reviewed by Geoffrey "Big Boy" Garen.

        Fix for <rdar://problem/5745677> Possible to stop load during an unload event
        Also fixes https://bugs.webkit.org/show_bug.cgi?id=20605

        Tests: fast/events/stop-load-in-unload-handler-using-document-write.html
               fast/events/stop-load-in-unload-handler-using-window-stop.html

        Don't allow calling methods that would stop the new load inside the unload
        event.

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::FrameLoader):
        (WebCore::FrameLoader::stopLoading):
        (WebCore::FrameLoader::stopAllLoaders):
        * loader/FrameLoader.h:

LayoutTests:

2009-04-08  Sam Weinig  <sam@webkit.org>

        Reviewed by Geoffrey "Big Boy" Garen.

        Tests for <rdar://problem/5745677> Possible to stop load during an unload event

        * fast/events/resources/pass.html: Added.
        * fast/events/resources/subframe-stop-load-in-unload-handler-using-document-write.html: Added.
        * fast/events/resources/subframe-stop-load-in-unload-handler-using-window-stop.html: Added.
        * fast/events/stop-load-in-unload-handler-using-document-write-expected.txt: Added.
        * fast/events/stop-load-in-unload-handler-using-document-write.html: Added.
        * fast/events/stop-load-in-unload-handler-using-window-stop-expected.txt: Added.
        * fast/events/stop-load-in-unload-handler-using-window-stop.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@42365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a2dce8c2
2009-04-08 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey "Big Boy" Garen.
Tests for <rdar://problem/5745677> Possible to stop load during an unload event
* fast/events/resources/pass.html: Added.
* fast/events/resources/subframe-stop-load-in-unload-handler-using-document-write.html: Added.
* fast/events/resources/subframe-stop-load-in-unload-handler-using-window-stop.html: Added.
* fast/events/stop-load-in-unload-handler-using-document-write-expected.txt: Added.
* fast/events/stop-load-in-unload-handler-using-document-write.html: Added.
* fast/events/stop-load-in-unload-handler-using-window-stop-expected.txt: Added.
* fast/events/stop-load-in-unload-handler-using-window-stop.html: Added.
2009-04-09 Adam Roben <aroben@apple.com>
Update results for createDocument-namespace-err.html
......
PASS
<script>
parent.pass();
</script>
<script>
window.location = "pass.html";
window.onunload = function()
{
document.write("document.write");
setTimeout("parent.log('You wanted to go to: '+ location.href); parent.fail()", 500);
}
</script>
<script>
window.location = "pass.html";
window.onunload = function()
{
window.stop();
setTimeout("parent.log('You wanted to go to: '+ location.href); parent.fail()", 500);
}
</script>
frame "<!--framePath //<!--frame0-->-->" - has 1 onunload handler(s)
PASS
<pre id="console"></pre>
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
function log(msg)
{
document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
}
function pass()
{
log("PASS");
if (window.layoutTestController)
layoutTestController.notifyDone();
}
function fail()
{
log("FAIL");
if (window.layoutTestController)
layoutTestController.notifyDone();
}
</script>
<iframe src="resources/subframe-stop-load-in-unload-handler-using-document-write.html"></iframe>
frame "<!--framePath //<!--frame0-->-->" - has 1 onunload handler(s)
PASS
<pre id="console"></pre>
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
function log(msg)
{
document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
}
function pass()
{
log("PASS");
if (window.layoutTestController)
layoutTestController.notifyDone();
}
function fail()
{
log("FAIL");
if (window.layoutTestController)
layoutTestController.notifyDone();
}
</script>
<iframe src="resources/subframe-stop-load-in-unload-handler-using-window-stop.html"></iframe>
2009-04-08 Sam Weinig <sam@webkit.org>
Reviewed by Geoffrey "Big Boy" Garen.
Fix for <rdar://problem/5745677> Possible to stop load during an unload event
Also fixes https://bugs.webkit.org/show_bug.cgi?id=20605
Tests: fast/events/stop-load-in-unload-handler-using-document-write.html
fast/events/stop-load-in-unload-handler-using-window-stop.html
Don't allow calling methods that would stop the new load inside the unload
event.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::FrameLoader):
(WebCore::FrameLoader::stopLoading):
(WebCore::FrameLoader::stopAllLoaders):
* loader/FrameLoader.h:
2009-04-09 David Kilzer <ddkilzer@apple.com>
Reinstating <rdar://problem/6718589> Option to turn off SVG DOM Objective-C bindings
......@@ -273,6 +273,7 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client)
, m_isRunningScript(false)
, m_didCallImplicitClose(false)
, m_wasUnloadEventEmitted(false)
, m_unloadEventBeingDispatched(false)
, m_isComplete(false)
, m_isLoadingMainResource(false)
, m_cancellingWithLoadInProgress(false)
......@@ -607,7 +608,9 @@ void FrameLoader::stopLoading(bool sendUnload)
Node* currentFocusedNode = m_frame->document()->focusedNode();
if (currentFocusedNode)
currentFocusedNode->aboutToUnload();
m_unloadEventBeingDispatched = true;
m_frame->document()->dispatchWindowEvent(eventNames().unloadEvent, false, false);
m_unloadEventBeingDispatched = false;
if (m_frame->document())
m_frame->document()->updateRendering();
m_wasUnloadEventEmitted = true;
......@@ -2633,6 +2636,9 @@ void FrameLoader::stopLoadingSubframes()
void FrameLoader::stopAllLoaders()
{
if (m_unloadEventBeingDispatched)
return;
// If this method is called from within this method, infinite recursion can occur (3442218). Avoid this.
if (m_inStopAllLoaders)
return;
......
......@@ -583,6 +583,7 @@ namespace WebCore {
bool m_didCallImplicitClose;
bool m_wasUnloadEventEmitted;
bool m_unloadEventBeingDispatched;
bool m_isComplete;
bool m_isLoadingMainResource;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment