test_bug1390159.xhtml (1481B)
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=1390159 7 --> 8 <window title="Mozilla Bug 1390159" 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 code goes here --> 13 <script type="application/javascript"><![CDATA[ 14 function test() { 15 var xulRuntime = Services.appinfo; 16 17 // Make sure it has an inSafeMode property. This is just an arbitrary 18 // readonly property. 19 var oldValue = xulRuntime.inSafeMode; 20 is(typeof oldValue, "boolean", "Expected an inSafeMode property"); 21 22 // Changing a readonly property doesn't throw, but shouldn't change 23 // the value. 24 xulRuntime.inSafeMode = !oldValue; 25 is(xulRuntime.inSafeMode, oldValue, "Should not have modified prop"); 26 27 // Adding a new property should throw. 28 let ex = null; 29 try { 30 xulRuntime.foobar = 1; 31 } catch (e) { 32 ex = e; 33 } 34 is(ex.toString().includes("Cannot modify"), true, "Expected an error"); 35 is(xulRuntime.foobar, undefined, "Property not defined"); 36 } 37 test(); 38 ]]></script> 39 40 <!-- test results are displayed in the html:body --> 41 <body xmlns="http://www.w3.org/1999/xhtml"> 42 </body> 43 44 </window>