| <!DOCTYPE html> |
| <html> |
| <head> |
| <script> |
| function fail() |
| { |
| console.log("FAIL: The input element is focused."); |
| } |
| |
| 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 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"></iframe> |
| </body> |
| </html> |