tearoff_with_cc_helper.html (1218B)
1 <!DOCTYPE html> 2 <html> 3 <body onload="go()"> 4 <svg id="outerSvg" width="50%" height="50%" 5 style="border: 1px solid black"> 6 </svg> 7 <script type="application/javascript"> 8 /* I'm not sure what exactly was required to trigger bug 1288228's crash, 9 * but it involved tweaking a length's specified units and cycle-collecting 10 * and reloading (in some combination). So, we'll tweak the units and 11 * cycle-collect a few times, and message the outer page to reload us 12 * after we've made the first tweak. 13 */ 14 const maxTweaks = 5; 15 let remainingTweaks = maxTweaks; 16 17 var savedBaseVal = document.getElementById("outerSvg").width.baseVal; 18 function go() { 19 window.parent.SpecialPowers.DOMWindowUtils.cycleCollect(); 20 tweak(); 21 } 22 23 function tweak() { 24 console.log("tweaked"); 25 savedBaseVal.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PX); 26 savedBaseVal.convertToSpecifiedUnits(SVGLength.SVG_LENGTHTYPE_PERCENTAGE); 27 if (remainingTweaks == maxTweaks) { 28 window.parent.postMessage("ping", "*"); // only do this on first tweak 29 } 30 if (--remainingTweaks) { 31 setTimeout(tweak, 0); 32 } 33 } 34 </script> 35 </body> 36 </html>