summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-onNativeCall-03.js
blob: 7e9c0b280a7a3c6a7219fcc680a756db7b09b533 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Test onNativeCall's behavior when used with self-hosted functions.

load(libdir + 'eqArrayHelper.js');

var g = newGlobal({newCompartment: true});
var dbg = Debugger(g);
var gdbg = dbg.addDebuggee(g);

const rv = [];

dbg.onEnterFrame = f => {
  rv.push("EnterFrame");
};

dbg.onNativeCall = f => {
  rv.push(f.displayName);
};

gdbg.executeInGlobal(`
  var x = [1,3,2];
  x.sort((a, b) => {print(a)});
`);

assertEqArray(rv, [
  "EnterFrame", "sort",
  "ArraySortCompare/<",
  "EnterFrame", "print",
  "ArraySortCompare/<",
  "EnterFrame", "print",
]);