Commit 19826042 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[d8] Fix file name resolution for dynamic imports.

When executing a script that does import("foo"), "foo" should be
relative to the script's directory, not relative to the current working
directory of the d8 process.

R=gsathya@chromium.org

Bug: v8:5785
Change-Id: Id6ceccb242905bd6b54b07038ece60b93d92e4a0
Reviewed-on: https://chromium-review.googlesource.com/546375
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46185}
parent d14426f6
......@@ -812,9 +812,11 @@ void Shell::DoHostImportModuleDynamically(void* import_data) {
std::string source_url = ToSTLString(referrer);
std::string dir_name =
IsAbsolutePath(source_url) ? DirName(source_url) : GetWorkingDirectory();
DirName(IsAbsolutePath(source_url)
? source_url
: NormalizePath(source_url, GetWorkingDirectory()));
std::string file_name = ToSTLString(specifier);
std::string absolute_path = NormalizePath(file_name.c_str(), dir_name);
std::string absolute_path = NormalizePath(file_name, dir_name);
TryCatch try_catch(isolate);
try_catch.SetVerbose(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment