Bug 1428605 - Add JS:: namespace to API where it's missing. r=sfink

This commit is contained in:
Philip Chimento 2018-01-07 19:08:33 -08:00
parent 08bc97046a
commit feae2f5325
8 changed files with 19 additions and 10 deletions

View File

@ -253,7 +253,7 @@ FindExceptionStackForConsoleReport(nsPIDOMWindowInner* win,
JS::RootingContext* rcx = RootingCx();
JS::RootedObject exceptionObject(rcx, &exceptionValue.toObject());
JSObject* stackObject = ExceptionStackOrNull(exceptionObject);
JSObject* stackObject = JS::ExceptionStackOrNull(exceptionObject);
if (stackObject) {
return stackObject;
}

View File

@ -256,7 +256,7 @@ const WHITELIST_VARS: &'static [&'static str] = &[
/// Functions we want to generate bindings to.
const WHITELIST_FUNCTIONS: &'static [&'static str] = &[
"INTERNED_STRING_TO_JSID",
"ExceptionStackOrNull",
"JS::ExceptionStackOrNull",
"JS_AddExtraGCRootsTracer",
"JS_AddInterruptCallback",
"JS::AddPromiseReactions",

View File

@ -560,14 +560,19 @@ typedef bool
JS::HandleObject allocationSite, JS::HandleObject incumbentGlobal,
void* data);
namespace JS {
enum class PromiseRejectionHandlingState {
Unhandled,
Handled
};
} /* namespace JS */
typedef void
(* JSPromiseRejectionTrackerCallback)(JSContext* cx, JS::HandleObject promise,
PromiseRejectionHandlingState state, void* data);
JS::PromiseRejectionHandlingState state,
void* data);
typedef void
(* JSProcessPromiseCallback)(JSContext* cx, JS::HandleObject promise);
@ -5806,6 +5811,7 @@ JS_DropExceptionState(JSContext* cx, JSExceptionState* state);
extern JS_PUBLIC_API(JSErrorReport*)
JS_ErrorFromException(JSContext* cx, JS::HandleObject obj);
namespace JS {
/**
* If the given object is an exception object (or an unwrappable
* cross-compartment wrapper for one), return the stack for that exception, if
@ -5816,6 +5822,8 @@ JS_ErrorFromException(JSContext* cx, JS::HandleObject obj);
extern JS_PUBLIC_API(JSObject*)
ExceptionStackOrNull(JS::HandleObject obj);
} /* namespace JS */
/**
* A JS context always has an "owner thread". The owner thread is set when the
* context is created (to the current thread) and practically all entry points

View File

@ -423,7 +423,7 @@ js::ErrorFromException(JSContext* cx, HandleObject objArg)
}
JS_PUBLIC_API(JSObject*)
ExceptionStackOrNull(HandleObject objArg)
JS::ExceptionStackOrNull(HandleObject objArg)
{
JSObject* obj = CheckedUnwrap(objArg);
if (!obj || !obj->is<ErrorObject>()) {

View File

@ -848,7 +848,8 @@ DrainJobQueue(JSContext* cx, unsigned argc, Value* vp)
static void
ForwardingPromiseRejectionTrackerCallback(JSContext* cx, JS::HandleObject promise,
PromiseRejectionHandlingState state, void* data)
JS::PromiseRejectionHandlingState state,
void* data)
{
RootedValue callback(cx, GetShellContext(cx)->promiseRejectionTrackerCallback);
if (callback.isNull()) {

View File

@ -753,7 +753,7 @@ JSRuntime::addUnhandledRejectedPromise(JSContext* cx, js::HandleObject promise)
void* data = cx->promiseRejectionTrackerCallbackData;
cx->promiseRejectionTrackerCallback(cx, promise,
PromiseRejectionHandlingState::Unhandled, data);
JS::PromiseRejectionHandlingState::Unhandled, data);
}
void
@ -765,7 +765,7 @@ JSRuntime::removeUnhandledRejectedPromise(JSContext* cx, js::HandleObject promis
void* data = cx->promiseRejectionTrackerCallbackData;
cx->promiseRejectionTrackerCallback(cx, promise,
PromiseRejectionHandlingState::Handled, data);
JS::PromiseRejectionHandlingState::Handled, data);
}
mozilla::non_crypto::XorShift128PlusRNG&

View File

@ -250,7 +250,7 @@ CycleCollectedJSContext::EnqueuePromiseJobCallback(JSContext* aCx,
void
CycleCollectedJSContext::PromiseRejectionTrackerCallback(JSContext* aCx,
JS::HandleObject aPromise,
PromiseRejectionHandlingState state,
JS::PromiseRejectionHandlingState state,
void* aData)
{
#ifdef DEBUG
@ -259,7 +259,7 @@ CycleCollectedJSContext::PromiseRejectionTrackerCallback(JSContext* aCx,
MOZ_ASSERT(aCx == self->Context());
MOZ_ASSERT(Get() == self);
if (state == PromiseRejectionHandlingState::Unhandled) {
if (state == JS::PromiseRejectionHandlingState::Unhandled) {
PromiseDebugging::AddUncaughtRejection(aPromise);
} else {
PromiseDebugging::AddConsumedRejection(aPromise);

View File

@ -115,7 +115,7 @@ private:
void* aData);
static void PromiseRejectionTrackerCallback(JSContext* aCx,
JS::HandleObject aPromise,
PromiseRejectionHandlingState state,
JS::PromiseRejectionHandlingState state,
void* aData);
void AfterProcessMicrotask(uint32_t aRecursionDepth);