Index: LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied.html |
diff --git a/LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied.html b/LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied.html |
index 9ffa2e05ee9ab19a2b0ea76f866a4dc9d184573f..282b6057b481c1c2a17c3976f8264d2d2706d1f5 100644 |
--- a/LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied.html |
+++ b/LayoutTests/fast/frames/sandboxed-iframe-autofocus-denied.html |
@@ -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> |