| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML> | |
| 2 <script src="../../../resources/testharness.js"></script> | |
| 3 <script src="../../../resources/testharnessreport.js"></script> | |
| 4 <button id="button"></button> | |
| 5 <iframe id="iframe"></iframe> | |
| 6 <script> | |
| 7 // This is a crash reproduction case for crbug.com/626750. | |
| 8 | |
| 9 // Things are expected to happen in this order: | |
| 10 // 1. window.onload event fires | |
| 11 // 2. button.focus() | |
| 12 // 3. button's focus event handler is called | |
| 13 // 4. iframe.contentWindow.focus() | |
| 14 // 5. button's blur event handler is called (due to 4) | |
| 15 // 6. document.open() (detaches <iframe>) | |
| 16 // 7. focus in iframe blurs | |
| 17 // 8. iframe is set to active while detached <- crash due to crbug.com/626750 | |
| 18 // 9. script execution gets back to button's focus event handler | |
| 19 // (4-8 happen while iframe.contentWindow.focus() is handled) | |
| 20 | |
| 21 async_test((test) => { | |
| 22 button.addEventListener('focus', test.step_func_done(() => { | |
| 23 iframe.contentWindow.focus(); | |
| 24 assert_equals(document.activeElement, null, 'blur handler properly finis
hed.'); | |
| 25 })); | |
| 26 | |
| 27 button.addEventListener('blur', test.step_func(() => { | |
| 28 // This detaches <iframe>. | |
| 29 document.open(); | |
| 30 })); | |
| 31 | |
| 32 window.addEventListener('load', () => button.focus()); | |
| 33 }, 'focusing on detached frame should not crash'); | |
| 34 </script> | |
| OLD | NEW |