diff options
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index e453b453f..327662e7c 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -1,7 +1,5 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -use rusty_v8 as v8; - use crate::bindings; use crate::error::attach_handle_to_error; use crate::error::generic_error; @@ -529,7 +527,7 @@ impl JsRuntime { let scope = &mut self.handle_scope(); let state_rc = JsRuntime::state(scope); let js_sync_cb_handle = state_rc.borrow().js_sync_cb.clone().unwrap(); - let js_sync_cb = js_sync_cb_handle.get(scope); + let js_sync_cb = js_sync_cb_handle.open(scope); let this = v8::undefined(scope).into(); js_sync_cb.call(scope, this, &[]); } @@ -995,7 +993,7 @@ impl JsRuntime { let status = { let scope = &mut self.handle_scope(); - let module = module_handle.get(scope); + let module = module_handle.open(scope); module.get_status() }; @@ -1142,7 +1140,7 @@ impl JsRuntime { .dynamic_import_map .remove(&id) .expect("Invalid dynamic import id"); - let resolver = resolver_handle.get(scope); + let resolver = resolver_handle.open(scope); let exception = err .downcast_ref::<ErrWithV8Handle>() @@ -1171,7 +1169,7 @@ impl JsRuntime { .dynamic_import_map .remove(&id) .expect("Invalid dynamic import id"); - let resolver = resolver_handle.get(scope); + let resolver = resolver_handle.open(scope); let module = { module_map_rc @@ -1328,7 +1326,7 @@ impl JsRuntime { let module_evaluation = maybe_module_evaluation.unwrap(); let scope = &mut self.handle_scope(); - let promise = module_evaluation.promise.get(scope); + let promise = module_evaluation.promise.open(scope); let promise_state = promise.state(); match promise_state { @@ -1364,8 +1362,8 @@ impl JsRuntime { let scope = &mut self.handle_scope(); let module_id = pending_dyn_evaluate.module_id; - let promise = pending_dyn_evaluate.promise.get(scope); - let _module = pending_dyn_evaluate.module.get(scope); + let promise = pending_dyn_evaluate.promise.open(scope); + let _module = pending_dyn_evaluate.module.open(scope); let promise_state = promise.state(); match promise_state { @@ -1545,7 +1543,7 @@ impl JsRuntime { } let tc_scope = &mut v8::TryCatch::new(scope); - let js_recv_cb = js_recv_cb_handle.get(tc_scope); + let js_recv_cb = js_recv_cb_handle.open(tc_scope); let this = v8::undefined(tc_scope).into(); js_recv_cb.call(tc_scope, this, args.as_slice()); @@ -1563,7 +1561,7 @@ impl JsRuntime { }; let scope = &mut self.handle_scope(); - let js_macrotask_cb = js_macrotask_cb_handle.get(scope); + let js_macrotask_cb = js_macrotask_cb_handle.open(scope); // Repeatedly invoke macrotask callback until it returns true (done), // such that ready microtasks would be automatically run before @@ -1729,13 +1727,13 @@ pub mod tests { let value_global = runtime.execute_script("a.js", "a = 1 + 2").unwrap(); { let scope = &mut runtime.handle_scope(); - let value = value_global.get(scope); + let value = value_global.open(scope); assert_eq!(value.integer_value(scope).unwrap(), 3); } let value_global = runtime.execute_script("b.js", "b = 'foobar'").unwrap(); { let scope = &mut runtime.handle_scope(); - let value = value_global.get(scope); + let value = value_global.open(scope); assert!(value.is_string()); assert_eq!( value.to_string(scope).unwrap().to_rust_string_lossy(scope), @@ -1753,7 +1751,7 @@ pub mod tests { let result_global = runtime.resolve_value(value_global).await.unwrap(); { let scope = &mut runtime.handle_scope(); - let value = result_global.get(scope); + let value = result_global.open(scope); assert_eq!(value.integer_value(scope).unwrap(), 3); } @@ -1766,7 +1764,7 @@ pub mod tests { let result_global = runtime.resolve_value(value_global).await.unwrap(); { let scope = &mut runtime.handle_scope(); - let value = result_global.get(scope); + let value = result_global.open(scope); assert_eq!(value.integer_value(scope).unwrap(), 4); } |