1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/xpconnect/tests/unit/test_bug809674.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,30 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +const Cc = Components.classes; 1.9 +const Ci = Components.interfaces; 1.10 + 1.11 +function run_test() { 1.12 + 1.13 + // Load the component manifest. 1.14 + Components.manager.autoRegister(do_get_file('../components/js/xpctest.manifest')); 1.15 + 1.16 + // Test for each component. 1.17 + test_property_throws("@mozilla.org/js/xpc/test/js/Bug809674;1"); 1.18 +} 1.19 + 1.20 +function test_property_throws(contractid) { 1.21 + 1.22 + // Instantiate the object. 1.23 + var o = Cc[contractid].createInstance(Ci["nsIXPCTestBug809674"]); 1.24 + 1.25 + // Test the initial values. 1.26 + try { 1.27 + o.jsvalProperty; 1.28 + do_check_true(false, "Should have thrown"); 1.29 + } catch (e) { 1.30 + do_check_true(/implicit_jscontext/.test(e), "Should throw a helpful error"); 1.31 + } 1.32 + 1.33 +}