Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r228922 - Document.open() cancels existing provisional load but…
… not navigation policy check https://bugs.webkit.org/show_bug.cgi?id=183012 <rdar://problem/37755831> Reviewed by Alex Christensen. Source/WebCore: Test: fast/dom/Document/open-with-pending-load-async-policy.html * dom/Document.cpp: (WebCore::Document::open): The existing code was calling FrameLoader::stopAllLoaders() when the loader's state is FrameStateProvisional. The issue is that the FrameLoader's state only gets set to FrameStateProvisional after the policy decision for the navigation is made. This means that we fail to cancel a pending load if is still in the policy decision stage, which can happen when the policy decision is made asynchronously. We now also cancel such pending navigation policy checks as well. * loader/PolicyChecker.cpp: (WebCore::PolicyChecker::checkNavigationPolicy): Make sure the m_delegateIsDecidingNavigationPolicy flag gets reset inside the lambda. Otherwise, it gets reset too early when the policy decision is made asynchronously. LayoutTests: Add layout test coverage. * fast/dom/Document/open-with-pending-load-async-policy-expected.txt: Added. * fast/dom/Document/open-with-pending-load-async-policy.html: Added.
- Loading branch information
1 parent
40ff8ef
commit 394524b
Showing
6 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
LayoutTests/fast/dom/Document/open-with-pending-load-async-policy-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This tests that calling document.open on a document that has a pending load correctly cancels the load | ||
SUCCESS | ||
|
29 changes: 29 additions & 0 deletions
29
LayoutTests/fast/dom/Document/open-with-pending-load-async-policy.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script> | ||
if (window.testRunner) { | ||
if (testRunner.setShouldDecideNavigationPolicyAfterDelay) | ||
testRunner.setShouldDecideNavigationPolicyAfterDelay(true); | ||
testRunner.dumpAsText(); | ||
} | ||
|
||
function runTest() { | ||
var result = document.getElementById('result'); | ||
|
||
var text = document.getElementById('iframe').contentDocument.documentElement.outerText; | ||
if (text == 'REPLACED') | ||
result.innerHTML = 'SUCCESS'; | ||
else | ||
result.innerHTML = 'FAILURE - Got "' + text + '"'; | ||
} | ||
|
||
</script> | ||
<body> | ||
<div>This tests that calling document.open on a document that has a pending load correctly cancels the load</div> | ||
<div id="result"></div> | ||
<script language="JavaScript" type="text/javascript"> | ||
document.write('<iframe id="iframe" src="data:text/html,Should not be seen" onload="runTest()"></iframe>') | ||
var oRTE = frames[0].document; | ||
oRTE.open("text/html","replace"); | ||
oRTE.write("REPLACED"); | ||
oRTE.close(); | ||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters