зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1017302 - Expose add-on IDs to JS engine (r=bholley)
This commit is contained in:
Родитель
393c349aa3
Коммит
a144caadb7
|
@ -27,6 +27,7 @@ class JSFunction;
|
|||
class JSObject;
|
||||
class JSScript;
|
||||
class JSString;
|
||||
class JSAddonId;
|
||||
|
||||
struct jsid;
|
||||
|
||||
|
|
|
@ -1007,6 +1007,24 @@ JS_GetCompartmentPrivate(JSCompartment *compartment)
|
|||
return compartment->data;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSAddonId *)
|
||||
JS::NewAddonId(JSContext *cx, HandleString str)
|
||||
{
|
||||
return static_cast<JSAddonId *>(JS_InternJSString(cx, str));
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(const jschar *)
|
||||
JS::CharsZOfAddonId(JSAddonId *id)
|
||||
{
|
||||
return id->charsZ();
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString *)
|
||||
JS::StringOfAddonId(JSAddonId *id)
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_SetZoneUserData(JS::Zone *zone, void *data)
|
||||
{
|
||||
|
|
|
@ -4324,6 +4324,19 @@ class JSAutoByteString
|
|||
JSAutoByteString &operator=(const JSAutoByteString &another);
|
||||
};
|
||||
|
||||
namespace JS {
|
||||
|
||||
extern JS_PUBLIC_API(JSAddonId *)
|
||||
NewAddonId(JSContext *cx, JS::HandleString str);
|
||||
|
||||
extern JS_PUBLIC_API(const jschar *)
|
||||
CharsZOfAddonId(JSAddonId *id);
|
||||
|
||||
extern JS_PUBLIC_API(JSString *)
|
||||
StringOfAddonId(JSAddonId *id);
|
||||
|
||||
} // namespace JS
|
||||
|
||||
/************************************************************************/
|
||||
/*
|
||||
* JSON functions
|
||||
|
|
|
@ -1278,6 +1278,11 @@ CopyChars(CharT *dest, const JSLinearString &str);
|
|||
|
||||
} /* namespace js */
|
||||
|
||||
// Addon IDs are interned atoms which are never destroyed. This detail is
|
||||
// not exposed outside the API.
|
||||
class JSAddonId : public JSAtom
|
||||
{};
|
||||
|
||||
/* Avoid requiring vm/String-inl.h just to call getChars. */
|
||||
|
||||
MOZ_ALWAYS_INLINE const jschar *
|
||||
|
|
Загрузка…
Ссылка в новой задаче