js/xpconnect/tests/unit/test_bug845201.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/xpconnect/tests/unit/test_bug845201.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,18 @@
     1.4 +function sbTest() {
     1.5 +  var threw = false;
     1.6 +  try {
     1.7 +    for (var x in Components) { }
     1.8 +    do_check_true(false, "Shouldn't be able to enumerate Components");
     1.9 +  } catch(e) {
    1.10 +    do_check_true(true, "Threw appropriately");
    1.11 +    threw = true;
    1.12 +  }
    1.13 +  do_check_true(threw, "Shouldn't have thrown uncatchable exception");
    1.14 +}
    1.15 +
    1.16 +function run_test() {
    1.17 +  var sb = Components.utils.Sandbox('http://www.example.com', { wantComponents: true });
    1.18 +  sb.do_check_true = do_check_true;
    1.19 +  Components.utils.evalInSandbox(sbTest.toSource(), sb);
    1.20 +  Components.utils.evalInSandbox('sbTest();', sb);
    1.21 +}

mercurial