Bug 1829630 - [bidi] Use promiseAllocationSite as fallback to fetch rejected promise stacktrace r=webdriver-reviewers,Sasha

Differential Revision: https://phabricator.services.mozilla.com/D176353
This commit is contained in:
Julian Descottes 2023-04-27 16:53:29 +00:00
Родитель 46bc1b971c
Коммит 93f5685ca6
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -126,7 +126,13 @@ class ScriptModule extends WindowGlobalBiDiModule {
exception = realm.globalObjectReference.makeDebuggeeValue(
asyncException
);
stack = rv.return.promiseResolutionSite;
// If the returned promise was rejected by calling its reject callback
// the stack will be available on promiseResolutionSite.
// Otherwise, (eg. rejected Promise chained with a then() call) we
// fallback on the promiseAllocationSite.
stack =
rv.return.promiseResolutionSite || rv.return.promiseAllocationSite;
}
} else {
// rv.return is a Debugger.Object or a primitive.