michael@0: function sbTest() { michael@0: var threw = false; michael@0: try { michael@0: for (var x in Components) { } michael@0: do_check_true(false, "Shouldn't be able to enumerate Components"); michael@0: } catch(e) { michael@0: do_check_true(true, "Threw appropriately"); michael@0: threw = true; michael@0: } michael@0: do_check_true(threw, "Shouldn't have thrown uncatchable exception"); michael@0: } michael@0: michael@0: function run_test() { michael@0: var sb = Components.utils.Sandbox('http://www.example.com', { wantComponents: true }); michael@0: sb.do_check_true = do_check_true; michael@0: Components.utils.evalInSandbox(sbTest.toSource(), sb); michael@0: Components.utils.evalInSandbox('sbTest();', sb); michael@0: }