[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: Sathya Gunasekaran <gsathya@chromium.org> Cr-Commit-Position: refs/heads/master@{#46185}
This commit is contained in:
parent
d14426f6f9
commit
1982604218
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user