summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Debugger-onNativeCall-03.js
blob: 27ab5b2b2320a3212831f5c8d440783753b0eaea (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
31
32
33
34
35
36
37
38
39
40
// Test onNativeCall's behavior when used with self-hosted functions
// and trampoline natives.

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.forEach((a) => {print(a)});
  x.sort((a, b) => {print(a)});
  x.sort(print);
`);

assertEqArray(rv, [
  "EnterFrame", "forEach",
  "EnterFrame", "print",
  "EnterFrame", "print",
  "EnterFrame", "print",

  "sort",
  "EnterFrame","print",
  "EnterFrame","print",

  "sort",
  "print",
  "print"
]);