@@ -66,6 +66,10 @@ test(() => {
6666 assert_throws_js ( RangeError , ( ) => new WebAssembly . Memory ( { "initial" : 10 , "maximum" : 9 } ) ) ;
6767} , "Initial value exceeds maximum" ) ;
6868
69+ test ( ( ) => {
70+ assert_throws ( new TypeError ( ) , ( ) => new WebAssembly . Memory ( { "initial" : 10 , "shared" : true } ) ) ;
71+ } , "Shared memory without maximum" ) ;
72+
6973test ( ( ) => {
7074 const proxy = new Proxy ( { } , {
7175 has ( o , x ) {
@@ -120,6 +124,47 @@ test(() => {
120124 ] ) ;
121125} , "Order of evaluation for descriptor" ) ;
122126
127+ test ( t => {
128+ const order = [ ] ;
129+
130+ new WebAssembly . Memory ( {
131+ get maximum ( ) {
132+ order . push ( "maximum" ) ;
133+ return {
134+ valueOf ( ) {
135+ order . push ( "maximum valueOf" ) ;
136+ return 1 ;
137+ } ,
138+ } ;
139+ } ,
140+
141+ get initial ( ) {
142+ order . push ( "initial" ) ;
143+ return {
144+ valueOf ( ) {
145+ order . push ( "initial valueOf" ) ;
146+ return 1 ;
147+ } ,
148+ } ;
149+ } ,
150+
151+ get shared ( ) {
152+ order . push ( "shared" ) ;
153+ return {
154+ valueOf : t . unreached_func ( "should not call shared valueOf" ) ,
155+ } ;
156+ } ,
157+ } ) ;
158+
159+ assert_array_equals ( order , [
160+ "initial" ,
161+ "initial valueOf" ,
162+ "maximum" ,
163+ "maximum valueOf" ,
164+ "shared" ,
165+ ] ) ;
166+ } , "Order of evaluation for descriptor (with shared)" ) ;
167+
123168test ( ( ) => {
124169 const argument = { "initial" : 0 } ;
125170 const memory = new WebAssembly . Memory ( argument ) ;
@@ -137,3 +182,9 @@ test(() => {
137182 const memory = new WebAssembly . Memory ( argument , { } ) ;
138183 assert_Memory ( memory , { "size" : 0 } ) ;
139184} , "Stray argument" ) ;
185+
186+ test ( ( ) => {
187+ const argument = { "initial" : 4 , "maximum" : 10 , shared : true } ;
188+ const memory = new WebAssembly . Memory ( argument ) ;
189+ assert_Memory ( memory , { "size" : 4 , "shared" : true } ) ;
190+ } , "Shared memory" ) ;
0 commit comments