@@ -7,7 +7,7 @@ module.exports = require('../common').runTest(test);
7
7
function test ( binding ) {
8
8
{
9
9
const obj = { x : 'a' , y : 'b' , z : 'c' } ;
10
- binding . object_freeze_seal . freeze ( obj ) ;
10
+ assert . strictEqual ( binding . object_freeze_seal . freeze ( obj ) , true ) ;
11
11
assert . strictEqual ( Object . isFrozen ( obj ) , true ) ;
12
12
assert . throws ( ( ) => {
13
13
obj . x = 10 ;
@@ -20,9 +20,21 @@ function test(binding) {
20
20
} , / C a n n o t d e l e t e p r o p e r t y ' x ' o f # < O b j e c t > / ) ;
21
21
}
22
22
23
+ {
24
+ const obj = new Proxy ( { x : 'a' , y : 'b' , z : 'c' } , {
25
+ preventExtensions ( ) {
26
+ throw new Error ( 'foo' ) ;
27
+ } ,
28
+ } ) ;
29
+
30
+ assert . throws ( ( ) => {
31
+ binding . object_freeze_seal . freeze ( obj ) ;
32
+ } , / f o o / ) ;
33
+ }
34
+
23
35
{
24
36
const obj = { x : 'a' , y : 'b' , z : 'c' } ;
25
- binding . object_freeze_seal . seal ( obj ) ;
37
+ assert . strictEqual ( binding . object_freeze_seal . seal ( obj ) , true ) ;
26
38
assert . strictEqual ( Object . isSealed ( obj ) , true ) ;
27
39
assert . throws ( ( ) => {
28
40
obj . w = 'd' ;
@@ -34,4 +46,16 @@ function test(binding) {
34
46
// so this should not throw.
35
47
obj . x = 'd' ;
36
48
}
49
+
50
+ {
51
+ const obj = new Proxy ( { x : 'a' , y : 'b' , z : 'c' } , {
52
+ preventExtensions ( ) {
53
+ throw new Error ( 'foo' ) ;
54
+ } ,
55
+ } ) ;
56
+
57
+ assert . throws ( ( ) => {
58
+ binding . object_freeze_seal . seal ( obj ) ;
59
+ } , / f o o / ) ;
60
+ }
37
61
}
0 commit comments