@@ -47,34 +47,35 @@ unsafe extern "C" fn bar(_cx: *mut JSContext, argc: u32, vp: *mut Value) -> bool
4747
4848fn run ( rt : Runtime ) {
4949 let options = RealmOptions :: default ( ) ;
50- rooted ! ( in( rt. cx( ) ) let global = unsafe {
51- JS_NewGlobalObject ( rt. cx( ) , & SIMPLE_GLOBAL_CLASS , ptr:: null_mut( ) ,
50+ let cx = rt. cx ( ) ;
51+ rooted ! ( in( * cx) let global = unsafe {
52+ JS_NewGlobalObject ( * cx, & SIMPLE_GLOBAL_CLASS , ptr:: null_mut( ) ,
5253 OnNewGlobalHookOption :: FireOnNewGlobalHook ,
5354 & * options)
5455 } ) ;
55- let _ac = JSAutoRealm :: new ( rt . cx ( ) , global. get ( ) ) ;
56+ let _ac = JSAutoRealm :: new ( * cx , global. get ( ) ) ;
5657
5758 // Get WebAssembly.Module and WebAssembly.Instance constructors.
58- rooted ! ( in( rt . cx ( ) ) let mut wasm = UndefinedValue ( ) ) ;
59- rooted ! ( in( rt . cx ( ) ) let mut wasm_module = UndefinedValue ( ) ) ;
60- rooted ! ( in( rt . cx ( ) ) let mut wasm_instance = UndefinedValue ( ) ) ;
59+ rooted ! ( in( * cx ) let mut wasm = UndefinedValue ( ) ) ;
60+ rooted ! ( in( * cx ) let mut wasm_module = UndefinedValue ( ) ) ;
61+ rooted ! ( in( * cx ) let mut wasm_instance = UndefinedValue ( ) ) ;
6162
6263 unsafe {
6364 assert ! ( JS_GetProperty (
64- rt . cx ( ) ,
65+ * cx ,
6566 global. handle( ) ,
6667 c"WebAssembly" . as_ptr( ) ,
6768 & mut wasm. handle_mut( )
6869 ) ) ;
69- rooted ! ( in( rt . cx ( ) ) let mut wasm_obj = wasm. to_object( ) ) ;
70+ rooted ! ( in( * cx ) let mut wasm_obj = wasm. to_object( ) ) ;
7071 assert ! ( JS_GetProperty (
71- rt . cx ( ) ,
72+ * cx ,
7273 wasm_obj. handle( ) ,
7374 c"Module" . as_ptr( ) ,
7475 & mut wasm_module. handle_mut( )
7576 ) ) ;
7677 assert ! ( JS_GetProperty (
77- rt . cx ( ) ,
78+ * cx ,
7879 wasm_obj. handle( ) ,
7980 c"Instance" . as_ptr( ) ,
8081 & mut wasm_instance. handle_mut( )
@@ -84,85 +85,85 @@ fn run(rt: Runtime) {
8485 assert ! ( HI_WASM . 0 . as_ptr( ) as usize % 8 == 0 ) ;
8586
8687 // Construct Wasm module from bytes.
87- rooted ! ( in( rt . cx ( ) ) let mut module = null_mut:: <JSObject >( ) ) ;
88+ rooted ! ( in( * cx ) let mut module = null_mut:: <JSObject >( ) ) ;
8889 {
8990 let array_buffer = JS :: NewArrayBufferWithUserOwnedContents (
90- rt . cx ( ) ,
91+ * cx ,
9192 HI_WASM . 0 . len ( ) ,
9293 HI_WASM . 0 . as_ptr ( ) as _ ,
9394 ) ;
9495 assert ! ( !array_buffer. is_null( ) ) ;
9596
96- rooted ! ( in( rt . cx ( ) ) let val = ObjectValue ( array_buffer) ) ;
97+ rooted ! ( in( * cx ) let val = ObjectValue ( array_buffer) ) ;
9798 let args = HandleValueArray :: from ( val. handle ( ) . into_handle ( ) ) ;
9899
99100 assert ! ( Construct1 (
100- rt . cx ( ) ,
101+ * cx ,
101102 wasm_module. handle( ) ,
102103 & args,
103104 & mut module. handle_mut( )
104105 ) )
105106 }
106107
107108 // Construct Wasm module instance with required imports.
108- rooted ! ( in( rt . cx ( ) ) let mut instance = null_mut:: <JSObject >( ) ) ;
109+ rooted ! ( in( * cx ) let mut instance = null_mut:: <JSObject >( ) ) ;
109110 {
110111 // Build "env" imports object.
111- rooted ! ( in( rt . cx ( ) ) let mut env_import_obj = JS_NewPlainObject ( rt . cx ( ) ) ) ;
112+ rooted ! ( in( * cx ) let mut env_import_obj = JS_NewPlainObject ( * cx ) ) ;
112113 assert ! ( !env_import_obj. is_null( ) ) ;
113114 let function = JS_DefineFunction (
114- rt . cx ( ) ,
115+ * cx ,
115116 env_import_obj. handle ( ) . into ( ) ,
116117 c"bar" . as_ptr ( ) ,
117118 Some ( bar) ,
118119 1 ,
119120 0 ,
120121 ) ;
121122 assert ! ( !function. is_null( ) ) ;
122- rooted ! ( in( rt . cx ( ) ) let mut env_import = ObjectValue ( env_import_obj. get( ) ) ) ;
123+ rooted ! ( in( * cx ) let mut env_import = ObjectValue ( env_import_obj. get( ) ) ) ;
123124 // Build imports bag.
124- rooted ! ( in( rt . cx ( ) ) let mut imports = JS_NewPlainObject ( rt . cx ( ) ) ) ;
125+ rooted ! ( in( * cx ) let mut imports = JS_NewPlainObject ( * cx ) ) ;
125126 assert ! ( !imports. is_null( ) ) ;
126127 assert ! ( JS_SetProperty (
127- rt . cx ( ) ,
128+ * cx ,
128129 imports. handle( ) ,
129130 c"env" . as_ptr( ) ,
130131 env_import. handle( )
131132 ) ) ;
132133
133- rooted ! ( in( rt . cx ( ) ) let mut args = ValueArray :: new( [ ObjectValue ( module. get( ) ) , ObjectValue ( imports. get( ) ) ] ) ) ;
134+ rooted ! ( in( * cx ) let mut args = ValueArray :: new( [ ObjectValue ( module. get( ) ) , ObjectValue ( imports. get( ) ) ] ) ) ;
134135
135136 assert ! ( Construct1 (
136- rt . cx ( ) ,
137+ * cx ,
137138 wasm_instance. handle( ) ,
138139 & HandleValueArray :: from( & args) ,
139140 & mut instance. handle_mut( )
140141 ) ) ;
141142 }
142143
143144 // Find `foo` method in exports.
144- rooted ! ( in( rt . cx ( ) ) let mut exports = UndefinedValue ( ) ) ;
145+ rooted ! ( in( * cx ) let mut exports = UndefinedValue ( ) ) ;
145146
146147 assert ! ( JS_GetProperty (
147- rt . cx ( ) ,
148+ * cx ,
148149 instance. handle( ) ,
149150 c"exports" . as_ptr( ) ,
150151 & mut exports. handle_mut( )
151152 ) ) ;
152153
153- rooted ! ( in( rt . cx ( ) ) let mut exports_obj = exports. to_object( ) ) ;
154- rooted ! ( in( rt . cx ( ) ) let mut foo = UndefinedValue ( ) ) ;
154+ rooted ! ( in( * cx ) let mut exports_obj = exports. to_object( ) ) ;
155+ rooted ! ( in( * cx ) let mut foo = UndefinedValue ( ) ) ;
155156 assert ! ( JS_GetProperty (
156- rt . cx ( ) ,
157+ * cx ,
157158 exports_obj. handle( ) ,
158159 c"foo" . as_ptr( ) ,
159160 & mut foo. handle_mut( )
160161 ) ) ;
161162
162163 // call foo and get its result
163- rooted ! ( in( rt . cx ( ) ) let mut rval = UndefinedValue ( ) ) ;
164+ rooted ! ( in( * cx ) let mut rval = UndefinedValue ( ) ) ;
164165 assert ! ( Call (
165- rt . cx ( ) ,
166+ * cx ,
166167 JS :: UndefinedHandleValue ,
167168 foo. handle( ) . into( ) ,
168169 & HandleValueArray :: empty( ) ,
0 commit comments