diff --git a/src/execution/isolate.cc b/src/execution/isolate.cc index 6d9d53bf824ec5c8ce7f1962c5d8fa4f4a1ba999..a4bec19395c4aea391899024a1027954ae4f05f6 100644 --- a/src/execution/isolate.cc +++ b/src/execution/isolate.cc @@ -975,7 +975,13 @@ void CaptureAsyncStackTrace(Isolate* isolate, Handle promise, isolate); builder->AppendPromiseCombinatorFrame(function, combinator); - // Now peak into the Promise.all() resolve element context to + if (context->IsNativeContext()) { + // NativeContext is used as a marker that the closure was already + // called. We can't access the reject element context any more. + return; + } + + // Now peek into the Promise.all() resolve element context to // find the promise capability that's being resolved when all // the concurrent promises resolve. int const index = @@ -993,7 +999,13 @@ void CaptureAsyncStackTrace(Isolate* isolate, Handle promise, isolate); builder->AppendPromiseCombinatorFrame(function, combinator); - // Now peak into the Promise.any() reject element context to + if (context->IsNativeContext()) { + // NativeContext is used as a marker that the closure was already + // called. We can't access the reject element context any more. + return; + } + + // Now peek into the Promise.any() reject element context to // find the promise capability that's being resolved when any of // the concurrent promises resolve. int const index = PromiseBuiltins::kPromiseAnyRejectElementCapabilitySlot;