test_bug430050.xhtml (1726B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 4 type="text/css"?> 5 <!-- 6 https://bugzilla.mozilla.org/show_bug.cgi?id=430050 7 --> 8 <window title="Mozilla Bug 430050" 9 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 10 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 11 12 <!-- test results are displayed in the html:body --> 13 <body xmlns="http://www.w3.org/1999/xhtml"> 14 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=430050" 15 target="_blank">Mozilla Bug 430050</a> 16 </body> 17 18 <!-- test code goes here --> 19 <script type="application/javascript"><![CDATA[ 20 21 /** Test for Bug 430050 */ 22 23 function endTest() { 24 ok(document.getElementById('b').contentDocument.documentElement.textContent == 25 "succeeded", "Wrong URL loaded!"); 26 SimpleTest.finish(); 27 } 28 29 function startTest() { 30 const observer = new MutationObserver(() => { 31 document.getElementById('b').setAttribute("src", 32 "data:text/plain,failed"); 33 const systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal(); 34 document.getElementById('b').loadURI(Services.io.newURI('data:text/plain,succeeded'), { 35 triggeringPrincipal: systemPrincipal 36 }); 37 document.getElementById('b').addEventListener("load", endTest); 38 }); 39 observer.observe(document.documentElement, { attributes: true }); 40 document.documentElement.setAttribute("foo", "bar"); 41 } 42 43 SimpleTest.waitForExplicitFinish(); 44 addLoadEvent(startTest); 45 46 ]]></script> 47 <browser flex="1" id="b"/> 48 </window>