mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 917843 - Handlify JS identifier APIs r=billm
This commit is contained in:
parent
bc6335ade3
commit
d74902d57d
@ -327,7 +327,7 @@ nsXBLProtoImplField::InstallAccessors(JSContext* aCx,
|
|||||||
// Get the field name as an id.
|
// Get the field name as an id.
|
||||||
JS::Rooted<jsid> id(aCx);
|
JS::Rooted<jsid> id(aCx);
|
||||||
JS::TwoByteChars chars(mName, NS_strlen(mName));
|
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;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
// Properties/Methods have historically taken precendence over fields. We
|
// Properties/Methods have historically taken precendence over fields. We
|
||||||
|
@ -46,8 +46,8 @@ IsValidKeyPathString(JSContext* aCx, const nsAString& aKeyPath)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ASSERTION(JSVAL_IS_STRING(stringVal), "This should never happen");
|
NS_ASSERTION(stringVal.toString(), "This should never happen");
|
||||||
JSString* str = JSVAL_TO_STRING(stringVal);
|
JS::RootedString str(aCx, stringVal.toString());
|
||||||
|
|
||||||
bool isIdentifier = false;
|
bool isIdentifier = false;
|
||||||
if (!JS_IsIdentifier(aCx, str, &isIdentifier) || !isIdentifier) {
|
if (!JS_IsIdentifier(aCx, str, &isIdentifier) || !isIdentifier) {
|
||||||
|
@ -6126,17 +6126,13 @@ BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
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);
|
return IndexToId(cx, index, id);
|
||||||
if (!IndexToId(cx, index, &id))
|
|
||||||
return false;
|
|
||||||
*idp = id;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
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<CanGC>(cx, chars.start().get(), chars.length()));
|
RootedAtom atom(cx, AtomizeChars<CanGC>(cx, chars.start().get(), chars.length()));
|
||||||
if (!atom)
|
if (!atom)
|
||||||
@ -6145,12 +6141,12 @@ JS_CharsToId(JSContext* cx, JS::TwoByteChars chars, jsid *idp)
|
|||||||
uint32_t dummy;
|
uint32_t dummy;
|
||||||
MOZ_ASSERT(!atom->isIndex(&dummy), "API misuse: |chars| must not encode an index");
|
MOZ_ASSERT(!atom->isIndex(&dummy), "API misuse: |chars| must not encode an index");
|
||||||
#endif
|
#endif
|
||||||
*idp = AtomToId(atom);
|
idp.set(AtomToId(atom));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(bool)
|
JS_PUBLIC_API(bool)
|
||||||
JS_IsIdentifier(JSContext *cx, JSString *str, bool *isIdentifier)
|
JS_IsIdentifier(JSContext *cx, HandleString str, bool *isIdentifier)
|
||||||
{
|
{
|
||||||
assertSameCompartment(cx, str);
|
assertSameCompartment(cx, str);
|
||||||
|
|
||||||
|
@ -4273,7 +4273,7 @@ JS_SetGlobalJitCompilerOption(JSContext *cx, JSJitCompilerOption opt, uint32_t v
|
|||||||
* Convert a uint32_t index into a jsid.
|
* Convert a uint32_t index into a jsid.
|
||||||
*/
|
*/
|
||||||
extern JS_PUBLIC_API(bool)
|
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.
|
* Convert chars into a jsid.
|
||||||
@ -4281,13 +4281,13 @@ JS_IndexToId(JSContext *cx, uint32_t index, jsid *id);
|
|||||||
* |chars| may not be an index.
|
* |chars| may not be an index.
|
||||||
*/
|
*/
|
||||||
extern JS_PUBLIC_API(bool)
|
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
|
* Test if the given string is a valid ECMAScript identifier
|
||||||
*/
|
*/
|
||||||
extern JS_PUBLIC_API(bool)
|
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
|
* Return the current script and line number of the most currently running
|
||||||
|
Loading…
Reference in New Issue
Block a user