mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 05:30:29 +00:00
Bug 1243001 part 3. Turn off the IDL bits of PromiseDebugging when SPIDERMONKEY_PROMISE is defined. r=peterv
These are basically the minimal changes needed to make PromiseDebugging compile in the new world. It will NOT function correctly (see the XXX comments); Till will be fixing it up more in bug 911216 as he transitions the relevant bits in our devtools to work on top of SpiderMonkey promises.
This commit is contained in:
parent
7fd3989391
commit
a1f6df215a
@ -66,6 +66,7 @@ private:
|
||||
/* static */ MOZ_THREAD_LOCAL(bool)
|
||||
FlushRejections::sDispatched;
|
||||
|
||||
#ifndef SPIDERMONKEY_PROMISE
|
||||
static Promise*
|
||||
UnwrapPromise(JS::Handle<JSObject*> aPromise, ErrorResult& aRv)
|
||||
{
|
||||
@ -103,6 +104,8 @@ PromiseDebugging::GetState(GlobalObject&, JS::Handle<JSObject*> aPromise,
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SPIDERMONKEY_PROMISE
|
||||
|
||||
/*static */ nsString
|
||||
PromiseDebugging::sIDPrefix;
|
||||
|
||||
@ -130,10 +133,15 @@ PromiseDebugging::Shutdown()
|
||||
/* static */ void
|
||||
PromiseDebugging::FlushUncaughtRejections()
|
||||
{
|
||||
// XXXbz figure out the plan
|
||||
#ifndef SPIDERMONKEY_PROMISE
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
FlushRejections::FlushSync();
|
||||
#endif // SPIDERMONKEY_PROMISE
|
||||
}
|
||||
|
||||
#ifndef SPIDERMONKEY_PROMISE
|
||||
|
||||
/* static */ void
|
||||
PromiseDebugging::GetAllocationStack(GlobalObject&, JS::Handle<JSObject*> aPromise,
|
||||
JS::MutableHandle<JSObject*> aStack,
|
||||
@ -210,6 +218,8 @@ PromiseDebugging::GetTimeToSettle(GlobalObject&, JS::Handle<JSObject*> aPromise,
|
||||
promise->mCreationTimestamp).ToMilliseconds();
|
||||
}
|
||||
|
||||
#endif // SPIDERMONKEY_PROMISE
|
||||
|
||||
/* static */ void
|
||||
PromiseDebugging::AddUncaughtRejectionObserver(GlobalObject&,
|
||||
UncaughtRejectionObserver& aObserver)
|
||||
@ -235,6 +245,8 @@ PromiseDebugging::RemoveUncaughtRejectionObserver(GlobalObject&,
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef SPIDERMONKEY_PROMISE
|
||||
|
||||
/* static */ void
|
||||
PromiseDebugging::AddUncaughtRejection(Promise& aPromise)
|
||||
{
|
||||
@ -263,10 +275,13 @@ PromiseDebugging::GetPromiseID(GlobalObject&,
|
||||
aID = sIDPrefix;
|
||||
aID.AppendInt(promiseID);
|
||||
}
|
||||
#endif // SPIDERMONKEY_PROMISE
|
||||
|
||||
/* static */ void
|
||||
PromiseDebugging::FlushUncaughtRejectionsInternal()
|
||||
{
|
||||
// XXXbz talk to till about replacement for this stuff.
|
||||
#ifndef SPIDERMONKEY_PROMISE
|
||||
CycleCollectedJSRuntime* storage = CycleCollectedJSRuntime::Get();
|
||||
|
||||
// The Promise that have been left uncaught (rejected and last in
|
||||
@ -327,6 +342,7 @@ PromiseDebugging::FlushUncaughtRejectionsInternal()
|
||||
obs->OnConsumed(*promise, err); // Ignore errors
|
||||
}
|
||||
}
|
||||
#endif // SPIDERMONKEY_PROMISE
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
|
||||
#ifndef SPIDERMONKEY_PROMISE
|
||||
static void GetState(GlobalObject&, JS::Handle<JSObject*> aPromise,
|
||||
PromiseDebuggingStateHolder& aState,
|
||||
ErrorResult& aRv);
|
||||
@ -58,20 +59,25 @@ public:
|
||||
|
||||
static void GetPromiseID(GlobalObject&, JS::Handle<JSObject*>, nsString&,
|
||||
ErrorResult&);
|
||||
#endif // SPIDERMONKEY_PROMISE
|
||||
|
||||
// Mechanism for watching uncaught instances of Promise.
|
||||
// XXXbz figure out the plan
|
||||
static void AddUncaughtRejectionObserver(GlobalObject&,
|
||||
UncaughtRejectionObserver& aObserver);
|
||||
static bool RemoveUncaughtRejectionObserver(GlobalObject&,
|
||||
UncaughtRejectionObserver& aObserver);
|
||||
|
||||
#ifndef SPIDERMONKEY_PROMISE
|
||||
// Mark a Promise as having been left uncaught at script completion.
|
||||
static void AddUncaughtRejection(Promise&);
|
||||
// Mark a Promise previously added with `AddUncaughtRejection` as
|
||||
// eventually consumed.
|
||||
static void AddConsumedRejection(Promise&);
|
||||
#endif // SPIDERMONKEY_PROMISE
|
||||
// Propagate the informations from AddUncaughtRejection
|
||||
// and AddConsumedRejection to observers.
|
||||
// XXXbz figure out the plan.
|
||||
static void FlushUncaughtRejections();
|
||||
|
||||
protected:
|
||||
|
@ -52,6 +52,7 @@ callback interface UncaughtRejectionObserver {
|
||||
|
||||
[ChromeOnly, Exposed=(Window,System)]
|
||||
interface PromiseDebugging {
|
||||
#ifndef SPIDERMONKEY_PROMISE
|
||||
/**
|
||||
* The various functions on this interface all expect to take promises but
|
||||
* don't want the WebIDL behavior of assimilating random passed-in objects
|
||||
@ -130,6 +131,8 @@ interface PromiseDebugging {
|
||||
[Throws]
|
||||
static DOMHighResTimeStamp getTimeToSettle(object p);
|
||||
|
||||
#endif // SPIDERMONKEY_PROMISE
|
||||
|
||||
/**
|
||||
* Watching uncaught rejections on the current thread.
|
||||
*
|
||||
|
@ -12,6 +12,7 @@ PREPROCESSED_WEBIDL_FILES = [
|
||||
'HTMLMediaElement.webidl',
|
||||
'Navigator.webidl',
|
||||
'Promise.webidl',
|
||||
'PromiseDebugging.webidl',
|
||||
'ServiceWorkerRegistration.webidl',
|
||||
'Window.webidl',
|
||||
]
|
||||
@ -391,7 +392,6 @@ WEBIDL_FILES = [
|
||||
'PresentationRequest.webidl',
|
||||
'ProcessingInstruction.webidl',
|
||||
'ProfileTimelineMarker.webidl',
|
||||
'PromiseDebugging.webidl',
|
||||
'PropertyIndexedKeyframes.webidl',
|
||||
'RadioNodeList.webidl',
|
||||
'Range.webidl',
|
||||
|
Loading…
x
Reference in New Issue
Block a user