diff --git a/content/xbl/src/nsXBLProtoImplField.cpp b/content/xbl/src/nsXBLProtoImplField.cpp index 7085d818856..30745378656 100644 --- a/content/xbl/src/nsXBLProtoImplField.cpp +++ b/content/xbl/src/nsXBLProtoImplField.cpp @@ -327,7 +327,7 @@ nsXBLProtoImplField::InstallAccessors(JSContext* aCx, // Get the field name as an id. JS::Rooted id(aCx); JS::TwoByteChars chars(mName, NS_strlen(mName)); - if (!JS_CharsToId(aCx, chars, id.address())) + if (!JS_CharsToId(aCx, chars, &id)) return NS_ERROR_OUT_OF_MEMORY; // Properties/Methods have historically taken precendence over fields. We diff --git a/dom/indexedDB/KeyPath.cpp b/dom/indexedDB/KeyPath.cpp index ff574de913d..67900cbcb63 100644 --- a/dom/indexedDB/KeyPath.cpp +++ b/dom/indexedDB/KeyPath.cpp @@ -46,8 +46,8 @@ IsValidKeyPathString(JSContext* aCx, const nsAString& aKeyPath) return false; } - NS_ASSERTION(JSVAL_IS_STRING(stringVal), "This should never happen"); - JSString* str = JSVAL_TO_STRING(stringVal); + NS_ASSERTION(stringVal.toString(), "This should never happen"); + JS::RootedString str(aCx, stringVal.toString()); bool isIdentifier = false; if (!JS_IsIdentifier(aCx, str, &isIdentifier) || !isIdentifier) { diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 82e2520abbc..66db0991288 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -6126,17 +6126,13 @@ BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved) #endif JS_PUBLIC_API(bool) -JS_IndexToId(JSContext *cx, uint32_t index, jsid *idp) +JS_IndexToId(JSContext *cx, uint32_t index, MutableHandleId id) { - RootedId id(cx); - if (!IndexToId(cx, index, &id)) - return false; - *idp = id; - return true; + return IndexToId(cx, index, id); } JS_PUBLIC_API(bool) -JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, jsid *idp) +JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, MutableHandleId idp) { RootedAtom atom(cx, AtomizeChars(cx, chars.start().get(), chars.length())); if (!atom) @@ -6145,12 +6141,12 @@ JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, jsid *idp) uint32_t dummy; MOZ_ASSERT(!atom->isIndex(&dummy), "API misuse: |chars| must not encode an index"); #endif - *idp = AtomToId(atom); + idp.set(AtomToId(atom)); return true; } JS_PUBLIC_API(bool) -JS_IsIdentifier(JSContext *cx, JSString *str, bool *isIdentifier) +JS_IsIdentifier(JSContext *cx, HandleString str, bool *isIdentifier) { assertSameCompartment(cx, str); diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 7b5a7587f42..680979685c9 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -4273,7 +4273,7 @@ JS_SetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt, uint32_t v * Convert a uint32_t index into a jsid. */ extern JS_PUBLIC_API(bool) -JS_IndexToId(JSContext *cx, uint32_t index, jsid *id); +JS_IndexToId(JSContext *cx, uint32_t index, JS::MutableHandleId); /* * Convert chars into a jsid. @@ -4281,13 +4281,13 @@ JS_IndexToId(JSContext *cx, uint32_t index, jsid *id); * |chars| may not be an index. */ extern JS_PUBLIC_API(bool) -JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, jsid *idp); +JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, JS::MutableHandleId); /* * Test if the given string is a valid ECMAScript identifier */ extern JS_PUBLIC_API(bool) -JS_IsIdentifier(JSContext *cx, JSString *str, bool *isIdentifier); +JS_IsIdentifier(JSContext *cx, JS::HandleString str, bool *isIdentifier); /* * Return the current script and line number of the most currently running