michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: michael@0: function run_test() { michael@0: michael@0: // Load the component manifest. michael@0: Components.manager.autoRegister(do_get_file('../components/js/xpctest.manifest')); michael@0: michael@0: // Test for each component. michael@0: test_property_throws("@mozilla.org/js/xpc/test/js/Bug809674;1"); michael@0: } michael@0: michael@0: function test_property_throws(contractid) { michael@0: michael@0: // Instantiate the object. michael@0: var o = Cc[contractid].createInstance(Ci["nsIXPCTestBug809674"]); michael@0: michael@0: // Test the initial values. michael@0: try { michael@0: o.jsvalProperty; michael@0: do_check_true(false, "Should have thrown"); michael@0: } catch (e) { michael@0: do_check_true(/implicit_jscontext/.test(e), "Should throw a helpful error"); michael@0: } michael@0: michael@0: }