test_bug976151.js (797B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 function run_test() { 6 let unprivilegedSb = new Cu.Sandbox('http://www.example.com'); 7 function checkOpaqueWrapper(val) { 8 unprivilegedSb.prop = val; 9 try { 10 Cu.evalInSandbox('prop();', sb); 11 } catch (e) { 12 Assert.ok(/denied|insecure|/.test(e)); 13 } 14 } 15 let xoSb = new Cu.Sandbox('http://www.example.net'); 16 let epSb = new Cu.Sandbox(['http://www.example.com']); 17 checkOpaqueWrapper(eval); 18 checkOpaqueWrapper(xoSb.eval); 19 checkOpaqueWrapper(epSb.eval); 20 checkOpaqueWrapper(Function); 21 checkOpaqueWrapper(xoSb.Function); 22 checkOpaqueWrapper(epSb.Function); 23 }