1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/xpconnect/tests/unit/test_nuke_sandbox.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 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 +/* See https://bugzilla.mozilla.org/show_bug.cgi?id=769273 */ 1.9 + 1.10 +function run_test() 1.11 +{ 1.12 + var sb = Components.utils.Sandbox("http://www.blah.com"); 1.13 + sb.prop = "prop" 1.14 + var refToObjFromSb = Components.utils.evalInSandbox("var a = {prop2:'prop2'}; a", sb); 1.15 + Components.utils.nukeSandbox(sb); 1.16 + do_check_true(Components.utils.isDeadWrapper(sb), "sb should be dead"); 1.17 + try{ 1.18 + sb.prop; 1.19 + do_check_true(false); 1.20 + } catch (e) { 1.21 + do_check_true(e.toString().indexOf("can't access dead object") > -1); 1.22 + } 1.23 + 1.24 + Components.utils.isDeadWrapper(refToObjFromSb, "ref to object from sb should be dead"); 1.25 + try{ 1.26 + refToObjFromSb.prop2; 1.27 + do_check_true(false); 1.28 + } catch (e) { 1.29 + do_check_true(e.toString().indexOf("can't access dead object") > -1); 1.30 + } 1.31 + 1.32 +}