Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions Source/JavaScriptCore/runtime/JSCJSValuePropertyInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ ALWAYS_INLINE JSValue JSValue::get(JSGlobalObject* globalObject, PropertyName pr

ALWAYS_INLINE JSValue JSValue::get(JSGlobalObject* globalObject, PropertyName propertyName, PropertySlot& slot) const
{
auto scope = DECLARE_THROW_SCOPE(getVM(globalObject));
VM& vm = getVM(globalObject);
auto scope = DECLARE_THROW_SCOPE(vm);
bool hasSlot = getPropertySlot(globalObject, propertyName, slot);
EXCEPTION_ASSERT(!scope.exception() || !hasSlot);
// A DeferTermination scope unwinding inside the slot lookup can throw the
// TerminationException after the property was found; tolerate it like
// JSObject::get does and let the caller's exception check unwind.
EXCEPTION_ASSERT(!scope.exception() || vm.hasPendingTerminationException() || !hasSlot);
RETURN_IF_EXCEPTION(scope, jsUndefined());
if (!hasSlot)
return jsUndefined();
RELEASE_AND_RETURN(scope, slot.getValue(globalObject, propertyName));
Expand Down Expand Up @@ -136,7 +141,10 @@ ALWAYS_INLINE JSValue JSValue::get(JSGlobalObject* globalObject, unsigned proper
object = asObject(asCell());

bool hasSlot = object->getPropertySlot(globalObject, propertyName, slot);
EXCEPTION_ASSERT(!scope.exception() || !hasSlot);
// See JSValue::get(JSGlobalObject*, PropertyName, PropertySlot&) above:
// termination can be thrown after a successful lookup.
EXCEPTION_ASSERT(!scope.exception() || getVM(globalObject).hasPendingTerminationException() || !hasSlot);
RETURN_IF_EXCEPTION(scope, jsUndefined());
if (!hasSlot)
return jsUndefined();
RELEASE_AND_RETURN(scope, slot.getValue(globalObject, propertyName));
Expand Down
5 changes: 4 additions & 1 deletion Source/JavaScriptCore/runtime/JSModuleLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,10 @@ void JSModuleLoader::continueDynamicImport(JSGlobalObject* globalObject, ModuleL
// 1.a. Perform ! Call(promiseCapability.[[Reject]], undefined, « moduleCompletion.[[Value]] »).
promise->reject(vm, (*exception)->value());
// 1.b. Return UNUSED.
scope.assertNoException();
// The abrupt completion may be a resolution failure caused by the
// TerminationException, which rejectWithCaughtException cannot clear;
// it stays pending in the VM and the caller's exception check unwinds.
scope.assertNoExceptionExceptTermination();
return;
}
// 2. Let module be moduleCompletion.[[Value]].
Expand Down
6 changes: 5 additions & 1 deletion Source/JavaScriptCore/runtime/JSObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3933,7 +3933,11 @@ bool JSObject::getOwnPropertyDescriptor(JSGlobalObject* globalObject, PropertyNa
PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);

bool result = methodTable()->getOwnPropertySlot(this, globalObject, propertyName, slot);
EXCEPTION_ASSERT_UNUSED(scope, !scope.exception() || !result);
// A DeferTermination scope unwinding inside the slot lookup can throw the
// TerminationException after the property was found; tolerate it like
// JSObject::get does and let the caller's exception check unwind.
EXCEPTION_ASSERT(!scope.exception() || vm.hasPendingTerminationException() || !result);
RETURN_IF_EXCEPTION(scope, false);
if (!result)
return false;

Expand Down
Loading