Bug 1351635 - Return isClassConstructor in class grip. r=loganfsmyth.

A test is added to ensure isClassConstructor has the expected
value for ES6 class grips.

Differential Revision: https://phabricator.services.mozilla.com/D50962

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2019-10-30 10:03:01 +00:00
parent f56a3c5a49
commit 90b00ddcf7
3 changed files with 48 additions and 0 deletions

View File

@ -255,6 +255,10 @@ const proto = {
g.promiseState = this._createPromiseState();
}
if (g.class == "Function") {
g.isClassConstructor = this.obj.isClassConstructor;
}
const raw = this.getRawObject();
this._populateGripPreview(g, raw);
this.hooks.decrementGripDepth();

View File

@ -0,0 +1,43 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Test that ES6 classes grip have the expected properties.
"use strict";
Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});
add_task(
threadFrontTest(async ({ threadFront, debuggee }) => {
await new Promise(function(resolve) {
threadFront.once("paused", async function(packet) {
const [grip] = packet.frame.arguments;
strictEqual(
grip.class,
"Function",
`Grip has expected value for "class" property`
);
strictEqual(
grip.isClassConstructor,
true,
`Grip has expected value for "isClassConstructor" property`
);
await threadFront.resume();
resolve();
});
debuggee.eval(`
class MyClass {};
stopMe(MyClass);
function stopMe(arg1) {
debugger;
}
`);
});
})
);

View File

@ -161,6 +161,7 @@ skip-if = true # breakpoint sliding is not supported bug 1525685
[test_objectgrips-20.js]
[test_objectgrips-21.js]
[test_objectgrips-22.js]
[test_objectgrips-23.js]
[test_objectgrips-array-like-object.js]
[test_objectgrips-property-value-01.js]
[test_objectgrips-property-value-02.js]