Commit dfcf2211 authored by dcheng@chromium.org's avatar dcheng@chromium.org

Unflake sandboxed-iframe-autofocus-denied.html.

The previous version of this test generated non-deterministic results
due to the way console messages are generated. Specifically, the test
case was constructed while parsing might not yet be complete, but the
act of constructing the test case generated console messages. If a
console message is generated with no specified line number,
Document::internalAddMessage attempts to attach a line number, but one
of the conditionals for doing so is whether the Document is still
parsing making the output non-deterministic.

To get around that, the test  has been rewritten to only run once the
document is finished loading.

BUG=381451
R=japhet@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@175706 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0a2c8161
......@@ -1036,8 +1036,6 @@ crbug.com/372917 http/tests/security/contentSecurityPolicy/connect-src-beacon-re
crbug.com/381373 [ Win ] virtual/implsidepainting/inspector/timeline/tracing/decode-resize.html [ Pass Failure ]
crbug.com/381451 fast/frames/sandboxed-iframe-autofocus-denied.html [ Pass Failure ]
crbug.com/361729 [ MountainLion ] printing/return-from-printing-mode.html [ ImageOnlyFailure ]
crbug.com/373430 [ Win7 ] fast/dom/Geolocation/error-clear-watch.html [ Pass Timeout ]
......
CONSOLE ERROR: line 1: Blocked script execution in 'about:srcdoc' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
CONSOLE ERROR: Blocked autofocusing on a form control because the form's frame is sandboxed and the 'allow-scripts' permission is not set.
CONSOLE MESSAGE: line 13: PASS: The input element is not focused.
CONSOLE MESSAGE: line 16: PASS: The input element is not focused.
This test passes if the input element in the sandboxed frame is not automatically focused upon, as it should be blocked by the sandboxed scripts flag. A console warning to that effect should also be present.
......@@ -2,24 +2,42 @@
<html>
<head>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function fail()
{
console.log("FAIL: The input element is focused.");
}
function test() {
activeTag = document.querySelector('iframe').contentWindow.document.activeElement.tagName;
function finishTest()
{
var activeTag = document.querySelector('iframe').contentDocument.activeElement.tagName;
if (activeTag == "INPUT")
console.log("FAIL: The input element is focused.");
else
console.log("PASS: The input element is not focused.");
if (window.testRunner)
testRunner.notifyDone();
}
function runTest()
{
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var frameDocument = document.querySelector('iframe').contentDocument;
var autofocusInput = frameDocument.createElement('input');
autofocusInput.autofocus = true;
autofocusInput.onfocus = fail;
frameDocument.body.appendChild(autofocusInput);
frameDocument.body.offsetTop;
window.setTimeout(finishTest, 0);
}
</script>
</head>
<body>
<body onload="runTest()">
<p>This test passes if the input element in the sandboxed frame is not
automatically focused upon, as it should be blocked by the sandboxed
scripts flag. A console warning to that effect should also be present.</p>
<iframe sandbox="allow-same-origin"
onload="test()"
srcdoc="<input autofocus onfocus>"></iframe>
<iframe sandbox="allow-same-origin"></iframe>
</body>
</html>
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