Changeset 271766 in webkit for trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
- Timestamp:
- Jan 22, 2021, 4:07:28 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
r271731 r271766 27 27 28 28 #include "CallFrame.h" 29 #include "CatchScope.h"30 29 #include "IndirectEvalExecutable.h" 31 30 #include "Interpreter.h" … … 799 798 auto* promise = JSPromise::create(vm, globalObject->promiseStructure()); 800 799 801 auto catchScope = DECLARE_CATCH_SCOPE(vm); 802 803 auto reject = [&](Exception* exception) { 804 if (UNLIKELY(isTerminatedExecutionException(vm, exception))) 805 return promise; 806 JSValue error = exception->value(); 807 catchScope.clearException(); 808 promise->reject(globalObject, error); 809 return promise; 810 }; 800 auto scope = DECLARE_THROW_SCOPE(vm); 811 801 812 802 auto sourceOrigin = callFrame->callerSourceOrigin(vm); 813 803 RELEASE_ASSERT(callFrame->argumentCount() == 1); 814 804 auto* specifier = callFrame->uncheckedArgument(0).toString(globalObject); 815 if (Exception* exception = catchScope.exception()) 816 return JSValue::encode(reject(exception)); 805 RETURN_IF_EXCEPTION(scope, JSValue::encode(promise->rejectWithCaughtException(globalObject, scope))); 817 806 818 807 // We always specify parameters as undefined. Once dynamic import() starts accepting fetching parameters, … … 820 809 JSValue parameters = jsUndefined(); 821 810 auto* internalPromise = globalObject->moduleLoader()->importModule(globalObject, specifier, parameters, sourceOrigin); 822 if (Exception* exception = catchScope.exception())823 return JSValue::encode(reject(exception)); 824 811 RETURN_IF_EXCEPTION(scope, JSValue::encode(promise->rejectWithCaughtException(globalObject, scope))); 812 813 scope.release(); 825 814 promise->resolve(globalObject, internalPromise); 826 815 return JSValue::encode(promise);
Note:
See TracChangeset
for help on using the changeset viewer.