1419902.html (1628B)
1 <html> 2 <head> 3 <script> 4 // Note that despite what it looks like this test does leave windows open 5 // after the test finishes. That's because some of the window.open calls 6 // trigger an exception but still open a window. Because of the 7 // exception, winsToClose.push is not executed and we have no reference 8 // to the window. So far there is no known way to get a reference to it. 9 // It was also tried to give each opened windowed a named target, save 10 // that list of targets, and use window.open("", targetname) to get a 11 // reference to the window. That also doesn't work because either the 12 // window.open calls never end and this page never loads, or if it does 13 // load after a finite time then still some windows are left open for 14 // some reason. 15 var winsToClose = [] 16 onbeforeunload = function() { 17 for (let win of winsToClose) { 18 if (win) { 19 win.close(); 20 } 21 } 22 }; 23 for (let i = 0; i < 38; i++) { 24 customElements.define("custom-element_0", class extends HTMLElement { 25 constructor() { 26 try { o1 = document.createElement("custom-element_0") } catch (e) {} 27 try { 28 if (winsToClose.length < 20) { 29 // The test used to rely on dom.popup_maximum == 20. 30 winsToClose.push(window.open("javascript:'<html><body>dummy</body></html>';")); 31 } 32 } catch (e) {} 33 } 34 }) 35 try { o3 = document.createElement("custom-element_0") } catch (e) {} 36 } 37 </script> 38 </head> 39 </html>