2 var sb1 = Cu.Sandbox("http://www.blah.com");
3 var sb2 = Cu.Sandbox(this);
6 // non-chrome accessing chrome Components
8 checkThrows("C.interfaces", sb1);
9 checkThrows("C.utils", sb1);
10 checkThrows("C.classes", sb1);
12 // non-chrome accessing own Components: shouldn't exist.
13 Assert.equal(Cu.evalInSandbox("typeof Components", sb1), 'undefined');
15 // chrome accessing chrome
17 rv = Cu.evalInSandbox("C.utils", sb2);
21 function checkThrows(expression, sb) {
22 var result = Cu.evalInSandbox('(function() { try { ' + expression + '; return "allowed"; } catch (e) { return e.toString(); }})();', sb);
23 Assert.ok(!!/denied/.exec(result));