From a1f6df215a921d1d013119725d5e43dfc1635725 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 9 Feb 2016 17:40:31 -0500 Subject: [PATCH] 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. --- dom/promise/PromiseDebugging.cpp | 16 ++++++++++++++++ dom/promise/PromiseDebugging.h | 6 ++++++ dom/webidl/PromiseDebugging.webidl | 3 +++ dom/webidl/moz.build | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/dom/promise/PromiseDebugging.cpp b/dom/promise/PromiseDebugging.cpp index 6706cd1fd735..92d181f649cf 100644 --- a/dom/promise/PromiseDebugging.cpp +++ b/dom/promise/PromiseDebugging.cpp @@ -66,6 +66,7 @@ private: /* static */ MOZ_THREAD_LOCAL(bool) FlushRejections::sDispatched; +#ifndef SPIDERMONKEY_PROMISE static Promise* UnwrapPromise(JS::Handle aPromise, ErrorResult& aRv) { @@ -103,6 +104,8 @@ PromiseDebugging::GetState(GlobalObject&, JS::Handle 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 aPromise, JS::MutableHandle aStack, @@ -210,6 +218,8 @@ PromiseDebugging::GetTimeToSettle(GlobalObject&, JS::Handle 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 diff --git a/dom/promise/PromiseDebugging.h b/dom/promise/PromiseDebugging.h index c76076620f93..5eeb65e6d3c2 100644 --- a/dom/promise/PromiseDebugging.h +++ b/dom/promise/PromiseDebugging.h @@ -32,6 +32,7 @@ public: static void Init(); static void Shutdown(); +#ifndef SPIDERMONKEY_PROMISE static void GetState(GlobalObject&, JS::Handle aPromise, PromiseDebuggingStateHolder& aState, ErrorResult& aRv); @@ -58,20 +59,25 @@ public: static void GetPromiseID(GlobalObject&, JS::Handle, 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: diff --git a/dom/webidl/PromiseDebugging.webidl b/dom/webidl/PromiseDebugging.webidl index 20eed3deb62c..a679b3f198d9 100644 --- a/dom/webidl/PromiseDebugging.webidl +++ b/dom/webidl/PromiseDebugging.webidl @@ -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. * diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index f808758e84d4..ad789ec8e68f 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -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',