@@ -18,9 +18,32 @@ Promise.all = common.mustNotCall('%Promise%.all');
18
18
Promise . allSettled = common . mustNotCall ( '%Promise%.allSettled' ) ;
19
19
Promise . any = common . mustNotCall ( '%Promise%.any' ) ;
20
20
Promise . race = common . mustNotCall ( '%Promise%.race' ) ;
21
- Promise . prototype . catch = common . mustNotCall ( '%Promise.prototype%.catch' ) ;
22
- Promise . prototype . finally = common . mustNotCall ( '%Promise.prototype%.finally' ) ;
23
- Promise . prototype . then = common . mustNotCall ( '%Promise.prototype%.then' ) ;
21
+
22
+ Object . defineProperties ( Promise . prototype , {
23
+ catch : {
24
+ set : common . mustNotCall ( 'set %Promise.prototype%.catch' ) ,
25
+ get : common . mustNotCall ( 'get %Promise.prototype%.catch' ) ,
26
+ } ,
27
+ finally : {
28
+ set : common . mustNotCall ( 'set %Promise.prototype%.finally' ) ,
29
+ get : common . mustNotCall ( 'get %Promise.prototype%.finally' ) ,
30
+ } ,
31
+ then : {
32
+ set : common . mustNotCall ( 'set %Promise.prototype%.then' ) ,
33
+ get : common . mustNotCall ( 'get %Promise.prototype%.then' ) ,
34
+ } ,
35
+ } ) ;
36
+ Object . defineProperties ( Array . prototype , {
37
+ // %Promise.all% and %Promise.allSettled% are depending on the value of
38
+ // `%Array.prototype%.then`.
39
+ then : { } ,
40
+ } ) ;
41
+ Object . defineProperties ( Object . prototype , {
42
+ then : {
43
+ set : common . mustNotCall ( 'set %Object.prototype%.then' ) ,
44
+ get : common . mustNotCall ( 'get %Object.prototype%.then' ) ,
45
+ } ,
46
+ } ) ;
24
47
25
48
assertIsPromise ( PromisePrototypeThen ( test ( ) , common . mustCall ( ) ) ) ;
26
49
assertIsPromise ( SafePromisePrototypeFinally ( test ( ) , common . mustCall ( ) ) ) ;
0 commit comments