test_bug462787.html (2101B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=462787 5 --> 6 <head> 7 <title>Test for Bug 462787</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=462787">Mozilla Bug 462787</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script type="application/javascript"> 19 20 /** Test for Bug 462787 */ 21 22 const InspectorUtils = SpecialPowers.InspectorUtils; 23 24 function do_test() { 25 try { 26 InspectorUtils.getMatchingCSSRules(null); 27 ok(false, "expected an exception"); 28 } 29 catch(e) { 30 is(e.name, "TypeError", "got the expected exception"); 31 } 32 33 try { 34 InspectorUtils.getRuleLine(null); 35 ok(false, "expected an exception"); 36 } 37 catch(e) { 38 is(e.name, "TypeError", "got the expected exception"); 39 } 40 41 try { 42 InspectorUtils.isIgnorableWhitespace(null); 43 ok(false, "expected an exception"); 44 } 45 catch(e) { 46 is(e.name, "TypeError", "got the expected exception"); 47 } 48 49 try { 50 InspectorUtils.getParentForNode(null, true); 51 ok(false, "expected an exception"); 52 } 53 catch(e) { 54 is(e.name, "TypeError", "got the expected exception"); 55 } 56 57 try { 58 InspectorUtils.getContentState(null); 59 ok(false, "expected an exception"); 60 } 61 catch(e) { 62 is(e.name, "TypeError", "got the expected exception"); 63 } 64 65 try { 66 InspectorUtils.setContentState(null, false); 67 ok(false, "expected an exception"); 68 } 69 catch(e) { 70 is(e.name, "TypeError", "got the expected exception"); 71 } 72 73 try { 74 InspectorUtils.setContentState(document.documentElement, 3); 75 ok(false, "expected an exception"); 76 } 77 catch(e) { 78 ok(true, "Threw"); 79 } 80 81 try { 82 InspectorUtils.removeContentState(document.documentElement, 3); 83 ok(false, "expected an exception"); 84 } 85 catch(e) { 86 ok(true, "Threw"); 87 } 88 89 SimpleTest.finish(); 90 } 91 92 SimpleTest.waitForExplicitFinish(); 93 addLoadEvent(do_test); 94 95 96 </script> 97 </pre> 98 </body> 99 </html>