Add module loader "resolve" hook for local file system to test the loader in JSC...
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Aug 2015 23:48:13 +0000 (23:48 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Aug 2015 23:48:13 +0000 (23:48 +0000)
commite09c889da1d91df32a9533329d44b081214382ef
tree2d46013a99e9968dc1bb7ac996aeac0052a6ea1a
parenta6293ed18dc02bd5eaff98912e498a57d4ecfd55
Add module loader "resolve" hook for local file system to test the loader in JSC shell
https://bugs.webkit.org/show_bug.cgi?id=148543

Reviewed by Filip Pizlo.

Add the module loader "resolve" hook to the JSC shell.
It takes the module name and the referrer module key and resolves the name to the unique module key.

resolve(ModuleName moduleName, ModuleKey referrer) -> Promise<ModuleKey>

In the JSC shell, since we load the module from the local file system, we treat an absolute file path
as a module key. So, in this patch, we implement the "resolve" hook that resolves the module name to
the absolute file path.

This local file system "resolve" functionality makes JSC shell easy to test the module loader.

* jsc.cpp:
(GlobalObject::finishCreation):
(GlobalObject::moduleLoaderFetch):
(pathSeparator):
(extractDirectoryName):
(currentWorkingDirectory):
(resolvePath):
(GlobalObject::moduleLoaderResolve):
(functionDrainMicrotasks):
* runtime/JSInternalPromiseDeferred.cpp:
(JSC::JSInternalPromiseDeferred::resolve):
(JSC::JSInternalPromiseDeferred::reject):
* runtime/JSInternalPromiseDeferred.h:
* tests/stress/pathname-resolve.js: Added.
(shouldBe):
(shouldThrow):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189071 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/runtime/JSInternalPromiseDeferred.cpp
Source/JavaScriptCore/runtime/JSInternalPromiseDeferred.h
Source/JavaScriptCore/tests/stress/pathname-resolve.js [new file with mode: 0644]