Commit 129cdd7b authored by darin@apple.com's avatar darin@apple.com

WebCore:

        Reviewed by Anders.
        Based on a patch by Tim Steele <timsteele41@gmail.com>.

        - fix http://bugs.webkit.org/show_bug.cgi?id=17186
          Fragment navigation within a page permanently cancels meta refresh

        Test: fast/loader/meta-refresh-anchor-click.html

        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::load): When load type is FrameLoadTypeRedirectWithLockedHistory,
        always do a real load. This makes sure that meta refresh loads are treated as real loads
        rather than anchor scrolls. Also tweaked formatting a bit.
        (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy): This function is
        an alternate way to complete a load, so it needs to start the redirection timer if
        redirection has already been scheduled.

LayoutTests:

        Reviewed by Anders.

        - test for http://bugs.webkit.org/show_bug.cgi?id=17186
          Fragment navigation within a page permanently cancels meta refresh

        * fast/loader/meta-refresh-anchor-click-expected.txt: Added.
        * fast/loader/meta-refresh-anchor-click.html: Added.
        * fast/loader/resources/meta-refresh-subframe.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30571 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 815ef2f2
2008-02-25 Darin Adler <darin@apple.com>
Reviewed by Anders.
- test for http://bugs.webkit.org/show_bug.cgi?id=17186
Fragment navigation within a page permanently cancels meta refresh
* fast/loader/meta-refresh-anchor-click-expected.txt: Added.
* fast/loader/meta-refresh-anchor-click.html: Added.
* fast/loader/resources/meta-refresh-subframe.html: Added.
2008-02-25 Johnny Ding <johnnyding.webkit@gmail.com>
Reviewed by Darin Adler.
This tests whether clicking on a link to an anchor stops meta refresh reloads; it should not!
We'll let the subframe load 10 times, then click the link, then let it refresh 10 more.
Times subframe has loaded: 20.
Test passed.
<html>
<head>
<script>
var count = 0;
function init()
{
if (layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
}
function bumpCount()
{
++count;
document.getElementById("count").innerHTML = count;
if (count == 10) {
var subframeDocument = frames[0].document;
var event = subframeDocument.createEvent("MouseEvents");
event.initEvent("click", true, true);
subframeDocument.getElementById("link").dispatchEvent(event);
}
if (count == 20) {
var subframe = document.getElementById("subframe");
subframe.parentNode.removeChild(subframe);
document.getElementById("result").innerHTML = "Test passed.";
if (layoutTestController)
layoutTestController.notifyDone();
}
}
</script>
</head>
<body onload="init()">
<p>This tests whether clicking on a link to an anchor stops meta refresh reloads; it should not!</p>
<p>We'll let the subframe load 10 times, then click the link, then let it refresh 10 more.</p>
<p>Times subframe has loaded: <span id="count">0</span>.</p>
<p id="result">TEST DID NOT YET COMPLETE.</p>
<iframe id="subframe" src="resources/meta-refresh-subframe.html"></iframe>
</body>
</html>
<html>
<head>
<meta http-equiv="refresh" content="0">
</head>
<body onload="top.bumpCount()">
<p><a id="link" href="#anchor">Clicking on this link should not stop this frame from refreshing.</a><p>
<p><a name="anchor">This is the anchor that the link points to.</a></p>
</body>
</html>
2008-02-25 Darin Adler <darin@apple.com>
Reviewed by Anders.
Based on a patch by Tim Steele <timsteele41@gmail.com>.
- fix http://bugs.webkit.org/show_bug.cgi?id=17186
Fragment navigation within a page permanently cancels meta refresh
Test: fast/loader/meta-refresh-anchor-click.html
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::load): When load type is FrameLoadTypeRedirectWithLockedHistory,
always do a real load. This makes sure that meta refresh loads are treated as real loads
rather than anchor scrolls. Also tweaked formatting a bit.
(WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy): This function is
an alternate way to complete a load, so it needs to start the redirection timer if
redirection has already been scheduled.
2008-02-25 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
......@@ -2011,18 +2011,18 @@ void FrameLoader::load(const KURL& newURL, const String& referrer, FrameLoadType
// exactly the same so pages with '#' links and DHTML side effects
// work properly.
if (!isFormSubmission
&& newLoadType != FrameLoadTypeReload
&& newLoadType != FrameLoadTypeSame
&& !shouldReload(newURL, url())
// We don't want to just scroll if a link from within a
// frameset is trying to reload the frameset into _top.
&& !m_frame->isFrameSet()) {
&& newLoadType != FrameLoadTypeRedirectWithLockedHistory
&& newLoadType != FrameLoadTypeReload
&& newLoadType != FrameLoadTypeSame
&& !shouldReload(newURL, url())
&& !m_frame->isFrameSet()) {
// Just do anchor navigation within the existing content.
// We don't do this if we are submitting a form, explicitly reloading,
// currently displaying a frameset, or if the new URL does not have a fragment.
// These rules are based on what KHTML was doing in KHTMLPart::openURL.
// These rules were originally based on what KHTML was doing in KHTMLPart::openURL.
// FIXME: What about load types other than Standard and Reload?
......@@ -2031,18 +2031,19 @@ void FrameLoader::load(const KURL& newURL, const String& referrer, FrameLoadType
checkNavigationPolicy(request, oldDocumentLoader.get(), formState,
callContinueFragmentScrollAfterNavigationPolicy, this);
} else {
// must grab this now, since this load may stop the previous load and clear this flag
// must grab m_quickRedirectComing now, since this load may stop the previous load and clear this flag.
bool isRedirect = m_quickRedirectComing;
load(request, action, newLoadType, formState);
if (isRedirect) {
m_quickRedirectComing = false;
if (m_provisionalDocumentLoader)
m_provisionalDocumentLoader->setIsClientRedirect(true);
} else if (sameURL)
} else if (sameURL) {
// Example of this case are sites that reload the same URL with a different cookie
// driving the generated content, or a master frame with links that drive a target
// frame, where the user has clicked on the same link repeatedly.
m_loadType = FrameLoadTypeSame;
}
}
}
......@@ -3147,9 +3148,6 @@ String FrameLoader::userAgent(const KURL& url) const
void FrameLoader::tokenizerProcessedData()
{
// ASSERT(m_frame->page());
// ASSERT(m_frame->document());
checkCompleted();
}
......@@ -3394,9 +3392,8 @@ void FrameLoader::callContinueFragmentScrollAfterNavigationPolicy(void* argument
void FrameLoader::continueFragmentScrollAfterNavigationPolicy(const ResourceRequest& request, bool shouldContinue)
{
// FIXME:
// some functions check m_quickRedirectComing, and others check for
// FrameLoadTypeRedirectWithLockedHistory.
// FIXME: Some functions check m_quickRedirectComing, and others check for
// FrameLoadTypeRedirectWithLockedHistory; need to unify these.
bool isRedirect = m_quickRedirectComing || m_policyLoadType == FrameLoadTypeRedirectWithLockedHistory;
m_quickRedirectComing = false;
......@@ -3423,14 +3420,18 @@ void FrameLoader::continueFragmentScrollAfterNavigationPolicy(const ResourceRequ
scrollToAnchor(url);
if (!isRedirect)
if (!isRedirect) {
// This will clear previousItem from the rest of the frame tree that didn't
// doing any loading. We need to make a pass on this now, since for anchor nav
// we'll not go through a real load and reach Completed state.
checkLoadComplete();
}
m_client->dispatchDidChangeLocationWithinPage();
m_client->didFinishLoad();
if (m_scheduledRedirection && !m_redirectionTimer.isActive())
startRedirectionTimer();
}
void FrameLoader::opened()
......
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