зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1293551 - Part 2: Add debug-only function to dump Promise allocation site and resolution site. r=till
This commit is contained in:
Родитель
aad6e47f0d
Коммит
fd6bb53cea
|
@ -4760,6 +4760,26 @@ JS::GetPromiseResolutionSite(JS::HandleObject promise)
|
|||
return promise->as<PromiseObject>().resolutionSite();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
JS_PUBLIC_API(void)
|
||||
JS::DumpPromiseAllocationSite(JSContext* cx, JS::HandleObject promise)
|
||||
{
|
||||
RootedObject stack(cx, promise->as<PromiseObject>().allocationSite());
|
||||
UniqueChars stackStr(reinterpret_cast<char*>(BuildUTF8StackString(cx, stack).get()));
|
||||
if (stackStr.get())
|
||||
fputs(stackStr.get(), stderr);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS::DumpPromiseResolutionSite(JSContext* cx, JS::HandleObject promise)
|
||||
{
|
||||
RootedObject stack(cx, promise->as<PromiseObject>().resolutionSite());
|
||||
UniqueChars stackStr(reinterpret_cast<char*>(BuildUTF8StackString(cx, stack).get()));
|
||||
if (stackStr.get())
|
||||
fputs(stackStr.get(), stderr);
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_PUBLIC_API(JSObject*)
|
||||
JS::CallOriginalPromiseResolve(JSContext* cx, JS::HandleValue resolutionValue)
|
||||
{
|
||||
|
|
|
@ -4436,6 +4436,14 @@ GetPromiseAllocationSite(JS::HandleObject promise);
|
|||
extern JS_PUBLIC_API(JSObject*)
|
||||
GetPromiseResolutionSite(JS::HandleObject promise);
|
||||
|
||||
#ifdef DEBUG
|
||||
extern JS_PUBLIC_API(void)
|
||||
DumpPromiseAllocationSite(JSContext* cx, JS::HandleObject promise);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
DumpPromiseResolutionSite(JSContext* cx, JS::HandleObject promise);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Calls the current compartment's original Promise.resolve on the original
|
||||
* Promise constructor, with `resolutionValue` passed as an argument.
|
||||
|
|
Загрузка…
Ссылка в новой задаче