diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 2134bd4c60e..cc28f2ff731 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -509,7 +509,7 @@ NS_ScriptErrorReporter(JSContext *cx, const PRUnichar* m = static_cast(report->ucmessage); if (m) { const PRUnichar* n = static_cast - (js::GetErrorTypeName(cx, report->exnType)); + (js::GetErrorTypeName(JS_GetRuntime(cx), report->exnType)); if (n) { msg.Assign(n); msg.AppendLiteral(": "); diff --git a/js/src/jsatominlines.h b/js/src/jsatominlines.h index bf5c59de7cd..71d80fdaac4 100644 --- a/js/src/jsatominlines.h +++ b/js/src/jsatominlines.h @@ -193,14 +193,26 @@ TypeName(JSType type, JSContext *cx) } inline Handle -ClassName(JSProtoKey key, ExclusiveContext *cx) +ClassName(JSProtoKey key, JSAtomState &atomState) { JS_ASSERT(key < JSProto_LIMIT); JS_STATIC_ASSERT(offsetof(JSAtomState, Null) + JSProto_LIMIT * sizeof(FixedHeapPtr) <= sizeof(JSAtomState)); JS_STATIC_ASSERT(JSProto_Null == 0); - return (&cx->names().Null)[key]; + return (&atomState.Null)[key]; +} + +inline Handle +ClassName(JSProtoKey key, JSRuntime *rt) +{ + return ClassName(key, rt->atomState); +} + +inline Handle +ClassName(JSProtoKey key, ExclusiveContext *cx) +{ + return ClassName(key, cx->names()); } } // namespace js diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index 56286ae8880..df69ec03c35 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -872,7 +872,7 @@ js_GetLocalizedErrorMessage(JSContext* cx, void *userRef, const char *locale, } JS_FRIEND_API(const jschar*) -js::GetErrorTypeName(JSContext* cx, int16_t exnType) +js::GetErrorTypeName(JSRuntime* rt, int16_t exnType) { /* * JSEXN_INTERNALERR returns null to prevent that "InternalError: " @@ -884,7 +884,7 @@ js::GetErrorTypeName(JSContext* cx, int16_t exnType) return NULL; } JSProtoKey key = GetExceptionProtoKey(exnType); - return ClassName(key, cx)->chars(); + return ClassName(key, rt)->chars(); } #if defined ( DEBUG_mccabe ) && defined ( PRINTNAMES ) diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 6aef6aa0a62..c81e6019a2c 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -713,7 +713,7 @@ CastToJSFreeOp(FreeOp *fop) * Returns NULL for invalid arguments and JSEXN_INTERNALERR */ extern JS_FRIEND_API(const jschar*) -GetErrorTypeName(JSContext* cx, int16_t exnType); +GetErrorTypeName(JSRuntime* rt, int16_t exnType); #ifdef DEBUG extern JS_FRIEND_API(unsigned)