Bug 1306756 - Remove the JS_strdup() overload accepting a JSRuntime*; r=sfink

There's no way to get a JSRuntime* in the JS API any more.
This commit is contained in:
Ehsan Akhgari 2016-09-30 17:50:43 -04:00
parent 327d256722
commit 882e2c307e
3 changed files with 2 additions and 17 deletions

View File

@ -1301,17 +1301,6 @@ JS_strdup(JSContext* cx, const char* s)
return DuplicateString(cx, s).release();
}
JS_PUBLIC_API(char*)
JS_strdup(JSRuntime* rt, const char* s)
{
AssertHeapIsIdle(rt);
size_t n = strlen(s) + 1;
char* p = rt->pod_malloc<char>(n);
if (!p)
return nullptr;
return static_cast<char*>(js_memcpy(p, s, n));
}
#undef JS_AddRoot
JS_PUBLIC_API(bool)

View File

@ -1592,10 +1592,6 @@ JS_updateMallocCounter(JSContext* cx, size_t nbytes);
extern JS_PUBLIC_API(char*)
JS_strdup(JSContext* cx, const char* s);
/** Duplicate a string. Does not report an error on failure. */
extern JS_PUBLIC_API(char*)
JS_strdup(JSRuntime* rt, const char* s);
/**
* Register externally maintained GC roots.
*

View File

@ -623,7 +623,7 @@ JSRuntime::setDefaultLocale(const char* locale)
if (!locale)
return false;
resetDefaultLocale();
defaultLocale = JS_strdup(this, locale);
defaultLocale = JS_strdup(contextFromMainThread(), locale);
return defaultLocale != nullptr;
}
@ -650,7 +650,7 @@ JSRuntime::getDefaultLocale()
if (!locale || !strcmp(locale, "C"))
locale = "und";
char* lang = JS_strdup(this, locale);
char* lang = JS_strdup(contextFromMainThread(), locale);
if (!lang)
return nullptr;