OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script> | 4 <script> |
5 if (window.testRunner) | 5 function fail() |
6 testRunner.dumpAsText(); | 6 { |
| 7 console.log("FAIL: The input element is focused."); |
| 8 } |
7 | 9 |
8 function test() { | 10 function finishTest() |
9 activeTag = document.querySelector('iframe').contentWindow.document.
activeElement.tagName; | 11 { |
| 12 var activeTag = document.querySelector('iframe').contentDocument.act
iveElement.tagName; |
10 if (activeTag == "INPUT") | 13 if (activeTag == "INPUT") |
11 console.log("FAIL: The input element is focused."); | 14 console.log("FAIL: The input element is focused."); |
12 else | 15 else |
13 console.log("PASS: The input element is not focused."); | 16 console.log("PASS: The input element is not focused."); |
| 17 if (window.testRunner) |
| 18 testRunner.notifyDone(); |
| 19 } |
| 20 |
| 21 function runTest() |
| 22 { |
| 23 if (window.testRunner) { |
| 24 testRunner.dumpAsText(); |
| 25 testRunner.waitUntilDone(); |
| 26 } |
| 27 var frameDocument = document.querySelector('iframe').contentDocument
; |
| 28 var autofocusInput = frameDocument.createElement('input'); |
| 29 autofocusInput.autofocus = true; |
| 30 autofocusInput.onfocus = fail; |
| 31 frameDocument.body.appendChild(autofocusInput); |
| 32 frameDocument.body.offsetTop; |
| 33 window.setTimeout(finishTest, 0); |
14 } | 34 } |
15 </script> | 35 </script> |
16 </head> | 36 </head> |
17 <body> | 37 <body onload="runTest()"> |
18 <p>This test passes if the input element in the sandboxed frame is not | 38 <p>This test passes if the input element in the sandboxed frame is not |
19 automatically focused upon, as it should be blocked by the sandboxed | 39 automatically focused upon, as it should be blocked by the sandboxed |
20 scripts flag. A console warning to that effect should also be present.</p> | 40 scripts flag. A console warning to that effect should also be present.</p> |
21 <iframe sandbox="allow-same-origin" | 41 <iframe sandbox="allow-same-origin"></iframe> |
22 onload="test()" | |
23 srcdoc="<input autofocus onfocus>"></iframe> | |
24 </body> | 42 </body> |
25 </html> | 43 </html> |
OLD | NEW |