OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 <script> | 5 <script> |
6 description('Tests inert node focusing across frames and iframes.'); | 6 description('Tests inert node focusing across frames and iframes.'); |
7 if (window.testRunner) | 7 if (window.testRunner) |
8 testRunner.waitUntilDone(); | 8 testRunner.waitUntilDone(); |
9 </script> | 9 </script> |
10 </head> | 10 </head> |
(...skipping 21 matching lines...) Expand all Loading... |
32 theElement = element; | 32 theElement = element; |
33 shouldBe('"' + element.id + '"; focusedElement === theElement', expected); | 33 shouldBe('"' + element.id + '"; focusedElement === theElement', expected); |
34 } | 34 } |
35 | 35 |
36 function test() { | 36 function test() { |
37 debug('Opening a modal dialog in frame1. It blocks other nodes in its docume
nt.'); | 37 debug('Opening a modal dialog in frame1. It blocks other nodes in its docume
nt.'); |
38 var frame1 = mainIframe.contentWindow.frames[0].document; | 38 var frame1 = mainIframe.contentWindow.frames[0].document; |
39 frame1.querySelector('dialog').showModal(); | 39 frame1.querySelector('dialog').showModal(); |
40 | 40 |
41 testFocus(frame1.querySelector('.target'), false); | 41 testFocus(frame1.querySelector('.target'), false); |
42 var iframe = frame1.querySelector('iframe').contentDocument; | 42 var iframe = frame1.querySelector('#iframe1').contentDocument; |
43 testFocus(iframe.querySelector('.target'), false); | 43 testFocus(iframe.querySelector('.target'), false); |
44 | 44 |
45 debug('Even a modal dialog in the iframe is blocked by the modal dialog in t
he parent frame1.'); | 45 debug('Even a modal dialog in the iframe is blocked by the modal dialog in t
he parent frame1.'); |
46 iframe.querySelector('dialog').showModal(); | 46 iframe.querySelector('dialog').showModal(); |
47 testFocus(iframe.querySelector('button'), false); | 47 testFocus(iframe.querySelector('button'), false); |
48 | 48 |
| 49 debug('An iframe within a modal dialog can still be focused.'); |
| 50 var dialogIframe = frame1.querySelector('#iframe-in-dialog').contentDocument
; |
| 51 testFocus(dialogIframe.querySelector('.target'), true); |
| 52 |
49 debug('A modal dialog does not block nodes in a sibling frame.'); | 53 debug('A modal dialog does not block nodes in a sibling frame.'); |
50 var frame2 = mainIframe.contentWindow.frames[1].document; | 54 var frame2 = mainIframe.contentWindow.frames[1].document; |
51 testFocus(frame2.querySelector('.target'), true); | 55 testFocus(frame2.querySelector('.target'), true); |
52 | 56 |
53 debug('Closing the dialog in frame1. The modal dialog in the iframe does not
block nodes in its parent.'); | 57 debug('Closing the dialog in frame1. The modal dialog in the iframe does not
block nodes in its parent.'); |
54 frame1.querySelector('dialog').close(); | 58 frame1.querySelector('dialog').close(); |
55 testFocus(iframe.querySelector('.target'), false); | 59 testFocus(iframe.querySelector('.target'), false); |
56 testFocus(frame1.querySelector('.target'), true); | 60 testFocus(frame1.querySelector('.target'), true); |
57 | 61 |
58 if (window.testRunner) | 62 if (window.testRunner) |
59 testRunner.notifyDone(); | 63 testRunner.notifyDone(); |
60 } | 64 } |
61 | 65 |
62 var mainIframe = document.getElementById('main-iframe'); | 66 var mainIframe = document.getElementById('main-iframe'); |
63 mainIframe.contentDocument.write(mainIframe.textContent); | 67 mainIframe.contentDocument.write(mainIframe.textContent); |
64 mainIframe.contentDocument.close(); | 68 mainIframe.contentDocument.close(); |
65 | 69 |
66 mainIframe.contentWindow.frames[1].window.onload = frameLoaded; | 70 mainIframe.contentWindow.frames[1].window.onload = frameLoaded; |
67 | 71 |
68 window.onload = frameLoaded; | 72 window.onload = frameLoaded; |
69 </script> | 73 </script> |
70 </body> | 74 </body> |
71 </html> | 75 </html> |
OLD | NEW |