1 function checkThrows(fn) {
4 ok(false, "Should have thrown");
6 ok(/denied|insecure|prohibited/.test(e));
11 var xosb = new Cu.Sandbox('http://www.example.org');
12 var sb = new Cu.Sandbox('http://www.example.com');
14 sb.fun = function() { ok(false, "Shouldn't ever reach me"); };
15 sb.cow = { foopy: 2 };
16 sb.payload = Cu.evalInSandbox('new Object()', xosb);
17 Cu.evalInSandbox(checkThrows.toSource(), sb);
18 Cu.evalInSandbox('checkThrows(function() { fun(payload); });', sb);
19 Cu.evalInSandbox('checkThrows(function() { Function.prototype.call.call(fun, payload); });', sb);
20 Cu.evalInSandbox('checkThrows(function() { Function.prototype.call.call(fun, null, payload); });', sb);
21 Cu.evalInSandbox('checkThrows(function() { new fun(payload); });', sb);
22 Cu.evalInSandbox('checkThrows(function() { cow.foopy = payload; });', sb);
23 Cu.evalInSandbox('checkThrows(function() { Object.defineProperty(cow, "foopy", { value: payload }); });', sb);
24 // These fail for a different reason, .bind can't access the length/name property on the function.
25 Cu.evalInSandbox('checkThrows(function() { Function.bind.call(fun, null, payload); });', sb);
26 Cu.evalInSandbox('checkThrows(function() { Function.bind.call(fun, payload); });', sb);