1941002-1.html (1457B)
1 <html class="reftest-wait"> 2 <body> 3 <script> 4 function checkEvents(test, callback) { 5 const detailsElement = document.getElementById("detailsElement"); 6 detailsElement.addEventListener("toggle", callback, { once: true }); 7 detailsElement.setAttribute("open", ""); 8 9 test(); 10 11 detailsElement.removeAttribute("open"); 12 } 13 14 function destroyElement(doc) { 15 doc.removeChild(doc.documentElement); 16 SpecialPowers.forceGC(); 17 SpecialPowers.forceCC(); 18 } 19 20 const xmlString = `<foo><bar/></foo>`; 21 const xsltString = ` 22 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 23 <xsl:include href="1941002.sjs"/> 24 <xsl:template match="/"> 25 <xsl:copy-of select="foo|(document('1941002.sjs')/xsl:stylesheet)"/> 26 </xsl:template> 27 </xsl:stylesheet> 28 `; 29 30 const parser = new DOMParser(); 31 const xmlDoc = parser.parseFromString(xmlString, "application/xml"); 32 const xsltDoc = parser.parseFromString(xsltString, "application/xml"); 33 const xsltProcessor = new XSLTProcessor(); 34 35 addEventListener("load", () => { 36 checkEvents(() => { 37 xsltProcessor.importStylesheet(xsltDoc); 38 }, () => { destroyElement(xsltDoc); }); 39 40 checkEvents(() => { 41 xsltProcessor.transformToFragment(xmlDoc, document); 42 }, () => { destroyElement(xmlDoc); }); 43 44 document.documentElement.classList.remove("reftest-wait"); 45 }); 46 </script> 47 <details id="detailsElement"></details> 48 </body> 49 </html>