summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-onNewGlobalObject-14.js
blob: fb61fab526961eae3baf216a9516fc8e03700f70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Globals passed to onNewGlobalObject handers are ready for use immediately.

var dbg = new Debugger;
var log = '';
dbg.onNewGlobalObject = function (global) {
  log += 'n';
  var gw = dbg.addDebuggee(global);
  gw.defineProperty('x', { value: -1 });
  // Check that the global's magic lazy properties are working.
  assertEq(gw.executeInGlobalWithBindings('Math.atan2(y,x)', { y: 0 }).return, Math.PI);
  // Check that the global's prototype is hooked up.
  assertEq(gw.executeInGlobalWithBindings('x.toString()', { x: gw }).return, "[object global]");
};

newGlobal({newCompartment: true});

assertEq(log, 'n');