From 27e1b4cb5ac81c5ac2ca5adf78c91fdbef9409e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 8 Jul 2021 18:56:53 +0200 Subject: feat(core): return v8::Value from JsRuntime::execute_script (#11129) This commit changes return type of JsRuntime::execute_script to include v8::Value returned from evaluation. When embedding deno_core it is sometimes useful to be able to inspect script evaluation value without the hoops of adding ops to store the value on the OpState. v8::Global is used so consumers don't have to pass scope themselves. --- runtime/web_worker.rs | 3 ++- runtime/worker.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/web_worker.rs b/runtime/web_worker.rs index f8aadf4c2..1fcd57dc2 100644 --- a/runtime/web_worker.rs +++ b/runtime/web_worker.rs @@ -427,7 +427,8 @@ impl WebWorker { name: &str, source_code: &str, ) -> Result<(), AnyError> { - self.js_runtime.execute_script(name, source_code) + self.js_runtime.execute_script(name, source_code)?; + Ok(()) } /// Loads and instantiates specified JavaScript module. diff --git a/runtime/worker.rs b/runtime/worker.rs index 04c294146..543eae6f6 100644 --- a/runtime/worker.rs +++ b/runtime/worker.rs @@ -191,7 +191,8 @@ impl MainWorker { name: &str, source_code: &str, ) -> Result<(), AnyError> { - self.js_runtime.execute_script(name, source_code) + self.js_runtime.execute_script(name, source_code)?; + Ok(()) } /// Loads and instantiates specified JavaScript module. -- cgit v1.2.3