summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Object-isClassConstructor.js
blob: 342e9d1a5263556c78c2f3c5fde7d4fc05f8944b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Debugger.Object.prototype.isClassConstructor recognizes ES6 classes.

var g = newGlobal({ newCompartment: true });
var dbg = new Debugger();
var gDO = dbg.addDebuggee(g);
var hits = 0;

function checkIsClassConstructor(shouldBe, expr) {
  print(expr);
  assertEq(gDO.executeInGlobal(expr).return.isClassConstructor, shouldBe);
}

checkIsClassConstructor(true, "class MyClass{}; MyClass;");
checkIsClassConstructor(false, "class MyClass2{}; MyClass2.constructor;");
checkIsClassConstructor(
  false,
  "class MyClass3{}; Object.getPrototypeOf(MyClass3)"
);
checkIsClassConstructor(false, "(a) => { bleh; }");
checkIsClassConstructor(false, "(async function f () {})");
checkIsClassConstructor(void 0, "({})");