summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/tests/unit/test_getObjectPrincipal.js
blob: 03c6ffce3da761f9cf0a5bce62def221646a2432 (plain)
1
2
3
4
5
6
function run_test() {
  Assert.ok(Cu.getObjectPrincipal({}).isSystemPrincipal);
  var sb = new Cu.Sandbox('http://www.example.com');
  Cu.evalInSandbox('var obj = { foo: 42 };', sb);
  Assert.equal(Cu.getObjectPrincipal(sb.obj).origin, 'http://www.example.com');
}