Changeset 223331 in webkit for trunk/Source/JavaScriptCore/jsc.cpp
- Timestamp:
- Oct 15, 2017, 6:55:16 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jsc.cpp
r223237 r223331 1659 1659 1660 1660 static JSInternalPromise* moduleLoaderImportModule(JSGlobalObject*, ExecState*, JSModuleLoader*, JSString*, JSValue, const SourceOrigin&); 1661 static JSInternalPromise*moduleLoaderResolve(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue);1661 static Identifier moduleLoaderResolve(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue); 1662 1662 static JSInternalPromise* moduleLoaderFetch(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSValue, JSValue); 1663 1663 static JSObject* moduleLoaderCreateImportMetaProperties(JSGlobalObject*, ExecState*, JSModuleLoader*, JSValue, JSModuleRecord*, JSValue); … … 1841 1841 } 1842 1842 1843 JSInternalPromise*GlobalObject::moduleLoaderResolve(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue keyValue, JSValue referrerValue, JSValue)1843 Identifier GlobalObject::moduleLoaderResolve(JSGlobalObject* globalObject, ExecState* exec, JSModuleLoader*, JSValue keyValue, JSValue referrerValue, JSValue) 1844 1844 { 1845 1845 VM& vm = globalObject->vm(); 1846 auto scope = DECLARE_CATCH_SCOPE(vm); 1847 1848 JSInternalPromiseDeferred* deferred = JSInternalPromiseDeferred::create(exec, globalObject); 1846 auto scope = DECLARE_THROW_SCOPE(vm); 1847 1849 1848 scope.releaseAssertNoException(); 1850 1849 const Identifier key = keyValue.toPropertyKey(exec); 1851 if (UNLIKELY(scope.exception())) { 1852 JSValue exception = scope.exception(); 1853 scope.clearException(); 1854 return deferred->reject(exec, exception); 1855 } 1856 1857 if (key.isSymbol()) { 1858 auto result = deferred->resolve(exec, keyValue); 1859 scope.releaseAssertNoException(); 1860 return result; 1861 } 1850 RETURN_IF_EXCEPTION(scope, { }); 1851 1852 if (key.isSymbol()) 1853 return key; 1854 1862 1855 if (referrerValue.isUndefined()) { 1863 1856 auto directoryName = currentWorkingDirectory(); 1864 if (!directoryName) 1865 return deferred->reject(exec, createError(exec, ASCIILiteral("Could not resolve the current working directory.")));1866 auto result = deferred->resolve(exec, jsString(exec, resolvePath(directoryName.value(), ModuleName(key.impl()))));1867 scope.releaseAssertNoException();1868 return result;1857 if (!directoryName) { 1858 throwException(exec, scope, createError(exec, ASCIILiteral("Could not resolve the current working directory."))); 1859 return { }; 1860 } 1861 return Identifier::fromString(&vm, resolvePath(directoryName.value(), ModuleName(key.impl()))); 1869 1862 } 1870 1863 1871 1864 const Identifier referrer = referrerValue.toPropertyKey(exec); 1872 if (UNLIKELY(scope.exception())) { 1873 JSValue exception = scope.exception(); 1874 scope.clearException(); 1875 return deferred->reject(exec, exception); 1876 } 1865 RETURN_IF_EXCEPTION(scope, { }); 1877 1866 1878 1867 if (referrer.isSymbol()) { 1879 1868 auto directoryName = currentWorkingDirectory(); 1880 if (!directoryName) 1881 return deferred->reject(exec, createError(exec, ASCIILiteral("Could not resolve the current working directory.")));1882 auto result = deferred->resolve(exec, jsString(exec, resolvePath(directoryName.value(), ModuleName(key.impl()))));1883 scope.releaseAssertNoException();1884 return result;1869 if (!directoryName) { 1870 throwException(exec, scope, createError(exec, ASCIILiteral("Could not resolve the current working directory."))); 1871 return { }; 1872 } 1873 return Identifier::fromString(&vm, resolvePath(directoryName.value(), ModuleName(key.impl()))); 1885 1874 } 1886 1875 1887 1876 // If the referrer exists, we assume that the referrer is the correct absolute path. 1888 1877 auto directoryName = extractDirectoryName(referrer.impl()); 1889 if (!directoryName) 1890 return deferred->reject(exec, createError(exec, makeString("Could not resolve the referrer name '", String(referrer.impl()), "'.")));1891 auto result = deferred->resolve(exec, jsString(exec, resolvePath(directoryName.value(), ModuleName(key.impl()))));1892 scope.releaseAssertNoException();1893 return result;1878 if (!directoryName) { 1879 throwException(exec, scope, createError(exec, makeString("Could not resolve the referrer name '", String(referrer.impl()), "'."))); 1880 return { }; 1881 } 1882 return Identifier::fromString(&vm, resolvePath(directoryName.value(), ModuleName(key.impl()))); 1894 1883 } 1895 1884
Note:
See TracChangeset
for help on using the changeset viewer.