Commit 3599736d authored by japhet@chromium.org's avatar japhet@chromium.org

Don't propagate sandbox flags to an opened window unless triggered entirely by script.

This was regressed in http://src.chromium.org/viewvc/blink?revision=161843&view=revision,
when we started propagating sandbox flags to new windows via FrameLoader::forceSandboxFlags
even if the new window was caused by clicking a link with target="_blank".

BUG=353253
TEST=http/tests/navigation/new-window-sandboxed-iframe.html

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

git-svn-id: svn://svn.chromium.org/blink/trunk@169970 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 821fdc6d
============== Back Forward List ==============
curr-> http://127.0.0.1:8000/navigation/new-window-sandboxed-iframe.html
http://127.0.0.1:8000/navigation/resources/new-window-sandboxed-iframe-iframe.html (in frame "<!--framePath //<!--frame0-->-->")
===============================================
============== Back Forward List ==============
http://127.0.0.1:8000/navigation/resources/new-window-sandboxed-iframe-destination.html
http://127.0.0.1:8000/navigation/resources/new-window-sandboxed-iframe-destination-iframe.html (in frame "<!--framePath //<!--frame0-->-->")
curr-> http://127.0.0.1:8000/navigation/resources/notify-done.html
===============================================
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.dumpBackForwardList();
testRunner.waitUntilDone();
testRunner.setCanOpenWindows();
}
</script>
<iframe sandbox="allow-scripts allow-forms allow-same-origin allow-popups" src="resources/new-window-sandboxed-iframe-iframe.html"></iframe>
<script>
window.onload = function() {
document.getElementById("a").click();
};
</script>
<a id="a" href="notify-done.html" target="_top">Click here</a>
<iframe src="new-window-sandboxed-iframe-destination-iframe.html"></iframe>
<script>
window.onload = function() {
document.getElementById("a").click();
};
</script>
<a id="a" href="new-window-sandboxed-iframe-destination.html" target="_blank"></a>
...@@ -81,8 +81,6 @@ static LocalFrame* createWindow(LocalFrame& openerFrame, LocalFrame& lookupFrame ...@@ -81,8 +81,6 @@ static LocalFrame* createWindow(LocalFrame& openerFrame, LocalFrame& lookupFrame
ASSERT(page->mainFrame()); ASSERT(page->mainFrame());
LocalFrame& frame = *page->mainFrame(); LocalFrame& frame = *page->mainFrame();
frame.loader().forceSandboxFlags(openerFrame.document()->sandboxFlags());
if (request.frameName() != "_blank") if (request.frameName() != "_blank")
frame.tree().setName(request.frameName()); frame.tree().setName(request.frameName());
...@@ -141,6 +139,9 @@ LocalFrame* createWindow(const String& urlString, const AtomicString& frameName, ...@@ -141,6 +139,9 @@ LocalFrame* createWindow(const String& urlString, const AtomicString& frameName,
if (!newFrame) if (!newFrame)
return 0; return 0;
if (newFrame != &openerFrame && newFrame != openerFrame.tree().top())
newFrame->loader().forceSandboxFlags(openerFrame.document()->sandboxFlags());
newFrame->loader().setOpener(&openerFrame); newFrame->loader().setOpener(&openerFrame);
newFrame->page()->setOpenedByDOM(); newFrame->page()->setOpenedByDOM();
......
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