mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 785524 - Remove JS_MakeStringImmutable; it is no longer necessary; r=luke
--HG-- extra : rebase_source : bf9e007733e5f4c6ab3fcc618c3fcff3b2fb69fc
This commit is contained in:
parent
5e413f34f8
commit
340bde0157
@ -6225,14 +6225,6 @@ JS_UndependString(JSContext *cx, JSString *str)
|
||||
return str->getCharsZ(cx);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_MakeStringImmutable(JSContext *cx, JSString *str)
|
||||
{
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
return !!str->ensureFixed(cx);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_EncodeCharacters(JSContext *cx, const jschar *src, size_t srclen, char *dst, size_t *dstlenp)
|
||||
{
|
||||
|
@ -5557,27 +5557,6 @@ JS_PutEscapedFlatString(char *buffer, size_t size, JSFlatString *str, char quote
|
||||
extern JS_PUBLIC_API(JSString *)
|
||||
JS_NewGrowableString(JSContext *cx, jschar *chars, size_t length);
|
||||
|
||||
/*
|
||||
* Mutable string support. A string's characters are never mutable in this JS
|
||||
* implementation, but a dependent string is a substring of another dependent
|
||||
* or immutable string, and a rope is a lazily concatenated string that creates
|
||||
* its underlying buffer the first time it is accessed. Even after a rope
|
||||
* creates its underlying buffer, it still considered mutable. The direct data
|
||||
* members of the (opaque to API clients) JSString struct may be changed in a
|
||||
* single-threaded way for dependent strings and ropes.
|
||||
*
|
||||
* Therefore mutable strings (ropes and dependent strings) cannot be used by
|
||||
* more than one thread at a time. You may call JS_MakeStringImmutable to
|
||||
* convert the string from a mutable string to an immutable (and therefore
|
||||
* thread-safe) string. The engine takes care of converting ropes and dependent
|
||||
* strings to immutable for you if you store strings in multi-threaded objects
|
||||
* using JS_SetProperty or kindred API entry points.
|
||||
*
|
||||
* If you store a JSString pointer in a native data structure that is (safely)
|
||||
* accessible to multiple threads, you must call JS_MakeStringImmutable before
|
||||
* retiring the store.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create a dependent string, i.e., a string that owns no character storage,
|
||||
* but that refers to a slice of another string's chars. Dependent strings
|
||||
@ -5601,13 +5580,6 @@ JS_ConcatStrings(JSContext *cx, JSString *left, JSString *right);
|
||||
extern JS_PUBLIC_API(const jschar *)
|
||||
JS_UndependString(JSContext *cx, JSString *str);
|
||||
|
||||
/*
|
||||
* Convert a mutable string (either rope or dependent) into an immutable,
|
||||
* thread-safe one.
|
||||
*/
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_MakeStringImmutable(JSContext *cx, JSString *str);
|
||||
|
||||
/*
|
||||
* Return JS_TRUE if C (char []) strings passed via the API and internally
|
||||
* are UTF-8.
|
||||
|
@ -283,10 +283,8 @@ JSBool XPCVariant::InitializeData(XPCCallContext& ccx)
|
||||
if (val.isNull())
|
||||
return NS_SUCCEEDED(nsVariant::SetToEmpty(&mData));
|
||||
if (val.isString()) {
|
||||
// Make our string immutable. This will also ensure null-termination,
|
||||
// which nsVariant assumes for its PRUnichar* stuff.
|
||||
JSString* str = val.toString();
|
||||
if (!JS_MakeStringImmutable(ccx, str))
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
// Don't use nsVariant::SetFromWStringWithSize, because that will copy
|
||||
|
Loading…
Reference in New Issue
Block a user