@@ -47,7 +47,10 @@ const bufferSource = fixtures.readSync('simple.wasm');
4747
4848    Object . defineProperty ( instance ,  'exports' ,  { 
4949      get ( )  { 
50-         return  {  _initialize : 5 ,  memory : new  Uint8Array ( )  } ; 
50+         return  { 
51+           _initialize : 5 , 
52+           memory : new  WebAssembly . Memory ( {  initial : 1  } ) , 
53+         } ; 
5154      } , 
5255    } ) ; 
5356    assert . throws ( 
@@ -70,7 +73,7 @@ const bufferSource = fixtures.readSync('simple.wasm');
7073        return  { 
7174          _start ( )  { } , 
7275          _initialize ( )  { } , 
73-           memory : new  Uint8Array ( ) , 
76+           memory : new  WebAssembly . Memory ( {   initial :  1   } ) , 
7477        } ; 
7578      } 
7679    } ) ; 
@@ -97,55 +100,11 @@ const bufferSource = fixtures.readSync('simple.wasm');
97100      ( )  =>  {  wasi . initialize ( instance ) ;  } , 
98101      { 
99102        code : 'ERR_INVALID_ARG_TYPE' , 
100-         message : / " i n s t a n c e \. e x p o r t s \. m e m o r y "   p r o p e r t y   m u s t   b e   o f   t y p e   o b j e c t / 
103+         message : / " i n s t a n c e \. e x p o r t s \. m e m o r y "   p r o p e r t y   m u s t   b e   a   W e b A s s e m b l y \. M e m o r y   o b j e c t / 
101104      } 
102105    ) ; 
103106  } 
104107
105-   { 
106-     // Verify that a non-ArrayBuffer memory.buffer is rejected. 
107-     const  wasi  =  new  WASI ( { } ) ; 
108-     const  wasm  =  await  WebAssembly . compile ( bufferSource ) ; 
109-     const  instance  =  await  WebAssembly . instantiate ( wasm ) ; 
110- 
111-     Object . defineProperty ( instance ,  'exports' ,  { 
112-       get ( )  { 
113-         return  { 
114-           _initialize ( )  { } , 
115-           memory : { } , 
116-         } ; 
117-       } 
118-     } ) ; 
119-     // The error message is a little white lie because any object 
120-     // with a .buffer property of type ArrayBuffer is accepted, 
121-     // but 99% of the time a WebAssembly.Memory object is used. 
122-     assert . throws ( 
123-       ( )  =>  {  wasi . initialize ( instance ) ;  } , 
124-       { 
125-         code : 'ERR_INVALID_ARG_TYPE' , 
126-         message : / " i n s t a n c e \. e x p o r t s \. m e m o r y \. b u f f e r "   p r o p e r t y   m u s t   b e   a n   W e b A s s e m b l y \. M e m o r y / 
127-       } 
128-     ) ; 
129-   } 
130- 
131-   { 
132-     // Verify that an argument that duck-types as a WebAssembly.Instance 
133-     // is accepted. 
134-     const  wasi  =  new  WASI ( { } ) ; 
135-     const  wasm  =  await  WebAssembly . compile ( bufferSource ) ; 
136-     const  instance  =  await  WebAssembly . instantiate ( wasm ) ; 
137- 
138-     Object . defineProperty ( instance ,  'exports' ,  { 
139-       get ( )  { 
140-         return  { 
141-           _initialize ( )  { } , 
142-           memory : {  buffer : new  ArrayBuffer ( 0 )  } , 
143-         } ; 
144-       } 
145-     } ) ; 
146-     wasi . initialize ( instance ) ; 
147-   } 
148- 
149108  { 
150109    // Verify that a WebAssembly.Instance from another VM context is accepted. 
151110    const  wasi  =  new  WASI ( { } ) ; 
0 commit comments