Bug 1515801 - Remove JS::CompileLatin1{ForNonSyntacticScope} now that both are unused. r=jandem

--HG--
extra : rebase_source : d092af0c2f7337fae899e1bc55e6551ff44830cb
This commit is contained in:
Jeff Walden 2018-12-14 14:34:16 -08:00
Родитель 605ce5d8cc
Коммит 4f1eec4171
4 изменённых файлов: 6 добавлений и 62 удалений

Просмотреть файл

@ -211,20 +211,6 @@ extern JS_PUBLIC_API bool CompileUtf8DontInflate(
JSContext* cx, const ReadOnlyCompileOptions& options, const char* bytes,
size_t length, MutableHandle<JSScript*> script);
/**
* Compile the provided Latin-1 data (i.e. each byte directly corresponds to
* the same Unicode code point) into a script.
*
* This function may eventually be removed, such that *only* bytes containing
* UTF-8 source text may be directly compiled. Avoid using it if you can.
*
* |script| is always set to the compiled script or to null in case of error.
*/
extern JS_PUBLIC_API bool CompileLatin1(JSContext* cx,
const ReadOnlyCompileOptions& options,
const char* bytes, size_t length,
MutableHandle<JSScript*> script);
/**
* Compile the UTF-8 contents of the given file into a script. If the contents
* contain any malformed UTF-8, an error is reported.
@ -266,17 +252,6 @@ extern JS_PUBLIC_API bool CompileForNonSyntacticScope(
JSContext* cx, const ReadOnlyCompileOptions& options,
SourceText<char16_t>& srcBuf, MutableHandle<JSScript*> script);
/**
* Compile the given Latin-1 data for non-syntactic scope.
*
* There is no way to compile UTF-8 data for non-syntactic scope because no
* user currently needs it. Such way could be added in the future if it's ever
* needed.
*/
extern JS_PUBLIC_API bool CompileLatin1ForNonSyntacticScope(
JSContext* cx, const ReadOnlyCompileOptions& options, const char* bytes,
size_t length, MutableHandle<JSScript*> script);
/**
* Compile the given UTF-8 data for non-syntactic scope.
*

Просмотреть файл

@ -72,7 +72,7 @@ bool testCompile(bool nonSyntactic) {
CHECK(CompileForNonSyntacticScope(cx, options, buf, &script));
CHECK_EQUAL(script->hasNonSyntacticScope(), true);
CHECK(CompileLatin1ForNonSyntacticScope(cx, options, src, length, &script));
CHECK(CompileUtf8ForNonSyntacticScope(cx, options, src, length, &script));
CHECK_EQUAL(script->hasNonSyntacticScope(), true);
{
@ -86,7 +86,7 @@ bool testCompile(bool nonSyntactic) {
CHECK(Compile(cx, options, buf, &script));
CHECK_EQUAL(script->hasNonSyntacticScope(), nonSyntactic);
CHECK(CompileLatin1(cx, options, src, length, &script));
CHECK(CompileUtf8(cx, options, src, length, &script));
CHECK_EQUAL(script->hasNonSyntacticScope(), nonSyntactic);
{

Просмотреть файл

@ -25,8 +25,8 @@ BEGIN_TEST(testExecuteInJSMEnvironment_Basic) {
options.setNoScriptRval(true);
JS::RootedScript script(cx);
CHECK(JS::CompileLatin1ForNonSyntacticScope(cx, options, src, sizeof(src) - 1,
&script));
CHECK(JS::CompileUtf8ForNonSyntacticScope(cx, options, src, sizeof(src) - 1,
&script));
JS::RootedObject varEnv(cx, js::NewJSMEnvironment(cx));
JS::RootedObject lexEnv(cx, JS_ExtensibleLexicalEnvironment(varEnv));
@ -79,8 +79,8 @@ BEGIN_TEST(testExecuteInJSMEnvironment_Callback) {
options.setNoScriptRval(true);
JS::RootedScript script(cx);
CHECK(JS::CompileLatin1ForNonSyntacticScope(cx, options, src, sizeof(src) - 1,
&script));
CHECK(JS::CompileUtf8ForNonSyntacticScope(cx, options, src, sizeof(src) - 1,
&script));
JS::RootedObject nsvo(cx, js::NewJSMEnvironment(cx));
CHECK(nsvo);

Просмотреть файл

@ -71,22 +71,6 @@ static bool CompileSourceBuffer(JSContext* cx,
return !!script;
}
static bool CompileLatin1(JSContext* cx, const ReadOnlyCompileOptions& options,
const char* bytes, size_t length,
JS::MutableHandleScript script) {
auto chars = UniqueTwoByteChars(InflateString(cx, bytes, length));
if (!chars) {
return false;
}
SourceText<char16_t> source;
if (!source.init(cx, std::move(chars), length)) {
return false;
}
return CompileSourceBuffer(cx, options, source, script);
}
static bool CompileUtf8(JSContext* cx, const ReadOnlyCompileOptions& options,
const char* bytes, size_t length,
JS::MutableHandleScript script) {
@ -128,12 +112,6 @@ bool JS::CompileDontInflate(JSContext* cx,
return CompileSourceBuffer(cx, options, srcBuf, script);
}
bool JS::CompileLatin1(JSContext* cx, const ReadOnlyCompileOptions& options,
const char* bytes, size_t length,
JS::MutableHandleScript script) {
return ::CompileLatin1(cx, options, bytes, length, script);
}
bool JS::CompileUtf8(JSContext* cx, const ReadOnlyCompileOptions& options,
const char* bytes, size_t length,
JS::MutableHandleScript script) {
@ -204,15 +182,6 @@ bool JS::CompileUtf8ForNonSyntacticScope(
return ::CompileUtf8(cx, options, bytes, length, script);
}
bool JS::CompileLatin1ForNonSyntacticScope(
JSContext* cx, const ReadOnlyCompileOptions& optionsArg, const char* bytes,
size_t length, JS::MutableHandleScript script) {
CompileOptions options(cx, optionsArg);
options.setNonSyntacticScope(true);
return ::CompileLatin1(cx, options, bytes, length, script);
}
JS_PUBLIC_API bool JS_Utf8BufferIsCompilableUnit(JSContext* cx,
HandleObject obj,
const char* utf8,