Commit e45f44cb authored by eseidel@chromium.org's avatar eseidel@chromium.org

Revert of Do not trigger new history entry if iframe URL doesn't change...

Revert of Do not trigger new history entry if iframe URL doesn't change (https://codereview.chromium.org/201773002/)

Reason for revert:
This may have broken browser_tests: http://build.chromium.org/p/chromium.webkit/builders/Linux%20Tests%20%28dbg%29/builds/2034/steps/browser_tests/logs/TabDestroyed

Original issue's description:
> Do not trigger new history entry if iframe URL doesn't change
> 
> When URL of an iframe changes from "unset" to "set", we don't want to
> create new history entry. This worked for URLs without fragment
> identifier but failed with it present.
> 
> This change takes the idea from the old code, before it was rewritten
> in https://codereview.chromium.org/126453005
> 
> BUG=353096
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=169665

TBR=abarth@chromium.org,japhet@chromium.org,rchlodnicki@opera.com
NOTREECHECKS=true
NOTRY=true
BUG=353096

Review URL: https://codereview.chromium.org/207683003

git-svn-id: svn://svn.chromium.org/blink/trunk@169723 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 99ffc5cd
Tests that appending iframe with with no URL and setting its URL later (without the hash part) does not overwrite current history entry.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
============== Back Forward List ==============
curr-> (file test):fast/history/history-length-append-subframe-no-hash.html#wentBack
about:blank (in frame "<!--framePath //<!--frame0-->-->")
data:text/html,<body onload="history.back()">Must not see this text!!!</body>
===============================================
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<pre id="console"></pre>
<script>
var jsTestIsAsync = true;
description('Tests that appending iframe with with no URL and setting its URL later (without the hash part) does not overwrite current history entry.');
if (window.testRunner)
testRunner.clearBackForwardList();
onload = beginTest;
function beginTest() {
// The frame must be appened both on initial load and after navigating
// back. On first load we must set the same SRC as after navigating away.
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
if (location.hash.indexOf('wentBack') == -1) {
// Run else code path after going back.
location.hash = 'wentBack';
setFrameSrc();
// Navigate forward and back to create forward navigation entry.
// Must be done outside the load handler to generate history entry.
window.setTimeout(function() {
location.href = 'data:text/html,<body onload="history.back()">Must not see this text!!!</body>';
}, 0);
} else {
window.setTimeout(setFrameSrcAndfinishTest, 100);
}
}
function setFrameSrc() {
document.querySelector('iframe').src = 'about:blank';
}
function setFrameSrcAndfinishTest() {
document.querySelector('iframe').src = 'about:blank';
testRunner.dumpBackForwardList();
finishJSTest();
}
</script>
</body>
</html>
Tests that appending iframe with with no URL and setting its URL later (including hash part) does not overwrite current history entry.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
============== Back Forward List ==============
curr-> (file test):fast/history/history-length-append-subframe-with-hash.html#wentBack
about:blank/#identifier (in frame "<!--framePath //<!--frame0-->-->")
data:text/html,<body onload="history.back()">Must not see this text!!!</body>
===============================================
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<pre id="console"></pre>
<script>
var jsTestIsAsync = true;
description('Tests that appending iframe with with no URL and setting its URL later (including hash part) does not overwrite current history entry.');
if (window.testRunner)
testRunner.clearBackForwardList();
onload = beginTest;
function beginTest() {
// The frame must be appened both on initial load and after navigating
// back. On first load we must set the same SRC as after navigating away.
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
if (location.hash.indexOf('wentBack') == -1) {
// Run else code path after going back.
location.hash = 'wentBack';
setFrameSrc();
// Navigate forward and back to create forward navigation entry.
// Must be done outside the load handler to generate history entry.
window.setTimeout(function() {
location.href = 'data:text/html,<body onload="history.back()">Must not see this text!!!</body>';
}, 0);
} else {
window.setTimeout(setFrameSrcAndfinishTest, 100);
}
}
function setFrameSrc() {
document.querySelector('iframe').src = 'about:blank/#identifier';
}
function setFrameSrcAndfinishTest() {
document.querySelector('iframe').src = 'about:blank/#identifier';
testRunner.dumpBackForwardList();
finishJSTest();
}
</script>
</body>
</html>
...@@ -763,7 +763,7 @@ void FrameLoader::load(const FrameLoadRequest& passedRequest) ...@@ -763,7 +763,7 @@ void FrameLoader::load(const FrameLoadRequest& passedRequest)
const KURL& url = request.resourceRequest().url(); const KURL& url = request.resourceRequest().url();
if (!action.shouldOpenInNewWindow() && shouldPerformFragmentNavigation(request.formState(), request.resourceRequest().httpMethod(), newLoadType, url)) { if (!action.shouldOpenInNewWindow() && shouldPerformFragmentNavigation(request.formState(), request.resourceRequest().httpMethod(), newLoadType, url)) {
m_documentLoader->setTriggeringAction(action); m_documentLoader->setTriggeringAction(action);
loadInSameDocument(url, nullptr, newLoadType == FrameLoadTypeStandard && !shouldTreatURLAsSameAsCurrent(url) ? UpdateBackForwardList : DoNotUpdateBackForwardList, request.clientRedirect()); loadInSameDocument(url, nullptr, newLoadType == FrameLoadTypeStandard ? UpdateBackForwardList : DoNotUpdateBackForwardList, request.clientRedirect());
return; return;
} }
bool sameURL = url == m_documentLoader->urlForHistory(); bool sameURL = url == m_documentLoader->urlForHistory();
...@@ -1401,11 +1401,6 @@ bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con ...@@ -1401,11 +1401,6 @@ bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con
} }
} }
bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const
{
return m_currentItem && url == m_currentItem->url();
}
bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const
{ {
if (!equalIgnoringCase(url.string(), "about:srcdoc")) if (!equalIgnoringCase(url.string(), "about:srcdoc"))
......
...@@ -123,7 +123,6 @@ public: ...@@ -123,7 +123,6 @@ public:
bool isLoadingMainFrame() const; bool isLoadingMainFrame() const;
bool shouldTreatURLAsSameAsCurrent(const KURL&) const;
bool shouldTreatURLAsSrcdocDocument(const KURL&) const; bool shouldTreatURLAsSrcdocDocument(const KURL&) const;
FrameLoadType loadType() const; FrameLoadType loadType() const;
......
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