summaryrefslogtreecommitdiff
path: root/core/ops_builtin_v8.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-14 13:18:01 -0400
committerGitHub <noreply@github.com>2023-03-14 17:18:01 +0000
commit1930c09b04bbf2150a601c0fe47c44750d8c2b57 (patch)
tree3cda81496abf8d6b339c9ba51e4900ff05388ca8 /core/ops_builtin_v8.rs
parent485e12062c95326815df0df59007cc31dd93bf8d (diff)
refactor(core): remove "resolve_url_or_path_deprecated" (#18174)
Remove remaining usages of "resolve_url_or_path_deprecated" in favor of "resolve_url_or_path" with explicit calls to "std::env::current_dir()". Towards landing https://github.com/denoland/deno/pull/15454
Diffstat (limited to 'core/ops_builtin_v8.rs')
-rw-r--r--core/ops_builtin_v8.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/ops_builtin_v8.rs b/core/ops_builtin_v8.rs
index e00ed5a29..c66e4d3c2 100644
--- a/core/ops_builtin_v8.rs
+++ b/core/ops_builtin_v8.rs
@@ -6,13 +6,14 @@ use crate::error::range_error;
use crate::error::type_error;
use crate::error::JsError;
use crate::ops_builtin::WasmStreamingResource;
-use crate::resolve_url_or_path_deprecated;
+use crate::resolve_url_or_path;
use crate::serde_v8::from_v8;
use crate::source_map::apply_source_map as apply_source_map_;
use crate::JsRealm;
use crate::JsRuntime;
use crate::OpDecl;
use crate::ZeroCopyBuf;
+use anyhow::Context;
use anyhow::Error;
use deno_ops::op;
use serde::Deserialize;
@@ -165,7 +166,12 @@ fn op_eval_context<'a>(
let source = v8::Local::<v8::String>::try_from(source.v8_value)
.map_err(|_| type_error("Invalid source"))?;
let specifier = match specifier {
- Some(s) => resolve_url_or_path_deprecated(&s)?.to_string(),
+ Some(s) => {
+ // TODO(bartlomieju): ideally we shouldn't need to call `current_dir()` on each
+ // call - maybe it should be caller's responsibility to pass fully resolved URL?
+ let cwd = std::env::current_dir().context("Unable to get CWD")?;
+ resolve_url_or_path(&s, &cwd)?.to_string()
+ }
None => crate::DUMMY_SPECIFIER.to_string(),
};
let specifier = v8::String::new(tc_scope, &specifier).unwrap();