blob: 14afbbfcc889fc8a47967d1ef9b495eb4e769bd9 (
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
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/*
* Check that private field initialization is marked as effectful.
*/
add_task(
threadFrontTest(async ({ threadFront, targetFront, debuggee }) => {
const consoleFront = await targetFront.getFront("console");
const initial_response = await consoleFront.evaluateJSAsync(`
// This is a silly trick that allows stamping a field into
// arbitrary objects.
class Base { constructor(o) { return o; }};
class A extends Base {
#x = 10;
};
var obj = {};
`);
// If an exception occurred, private fields are not yet enabled. Abort
// the rest of this test.
if (initial_response.hasException) {
return;
}
const eagerResult = await consoleFront.evaluateJSAsync("new A(obj)", {
eager: true,
});
Assert.equal(
eagerResult.result.type,
"undefined",
"shouldn't have actually produced a result"
);
const timeoutResult = await consoleFront.evaluateJSAsync("new A(obj); 1;");
Assert.equal(timeoutResult.result, 1, "normal eval, no throw.");
})
);
|