Bug 1626105 - Rename |JS::CompileModuleDontInflate| to just plain |JS::CompileModule|. (There is no non-inflating version remove at the same time.) r=evilpie

Differential Revision: https://phabricator.services.mozilla.com/D68912

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Walden 2020-03-31 01:33:03 +00:00
parent a655b1ae65
commit 0d71e9c342
3 changed files with 8 additions and 31 deletions

View File

@ -17,7 +17,7 @@
#include "js/BinASTFormat.h" // JS::BinASTFormat
#include "js/CompilationAndEvaluation.h"
#include "js/Date.h"
#include "js/Modules.h" // JS::CompileModule{,DontInflate}, JS::GetModuleScript, JS::Module{Instantiate,Evaluate}
#include "js/Modules.h" // JS::CompileModule, JS::GetModuleScript, JS::Module{Instantiate,Evaluate}
#include "js/OffThreadScriptCompilation.h"
#include "js/SourceText.h"
#include "nsIScriptContext.h"
@ -458,21 +458,6 @@ nsresult nsJSUtils::ExecutionContext::ExecScript(
return NS_OK;
}
static JSObject* CompileModule(JSContext* aCx,
JS::CompileOptions& aCompileOptions,
JS::SourceText<char16_t>& aSrcBuf) {
return JS::CompileModule(aCx, aCompileOptions, aSrcBuf);
}
static JSObject* CompileModule(JSContext* aCx,
JS::CompileOptions& aCompileOptions,
JS::SourceText<Utf8Unit>& aSrcBuf) {
// Once compile-UTF-8-without-inflating is stable, it'll be renamed to remove
// the "DontInflate" suffix, these two overloads can be removed, and
// |JS::CompileModule| can be used in the sole caller below.
return JS::CompileModuleDontInflate(aCx, aCompileOptions, aSrcBuf);
}
template <typename Unit>
static nsresult CompileJSModule(JSContext* aCx, JS::SourceText<Unit>& aSrcBuf,
JS::Handle<JSObject*> aEvaluationGlobal,
@ -489,7 +474,7 @@ static nsresult CompileJSModule(JSContext* aCx, JS::SourceText<Unit>& aSrcBuf,
NS_ENSURE_TRUE(xpc::Scriptability::Get(aEvaluationGlobal).Allowed(), NS_OK);
JSObject* module = CompileModule(aCx, aCompileOptions, aSrcBuf);
JSObject* module = JS::CompileModule(aCx, aCompileOptions, aSrcBuf);
if (!module) {
return NS_ERROR_FAILURE;
}

View File

@ -95,18 +95,10 @@ extern JS_PUBLIC_API JSObject* CompileModule(
/**
* Parse the given source buffer as a module in the scope of the current global
* of cx and return a source text module record.
*
* The "DontInflate" suffix and (semantically unobservable) don't-inflate
* characteristic are temporary while bugs in UTF-8 compilation are ironed out.
* In the long term this function will be renamed |JS::CompileModule| and will
* just never inflate.
*
* NOTE: UTF-8 compilation is currently experimental, and it's possible it has
* as-yet-undiscovered bugs that the UTF-16 compilation functions do not
* have. Use only if you're willing to take a risk!
* of cx and return a source text module record. An error is reported if a
* UTF-8 encoding error is encountered.
*/
extern JS_PUBLIC_API JSObject* CompileModuleDontInflate(
extern JS_PUBLIC_API JSObject* CompileModule(
JSContext* cx, const ReadOnlyCompileOptions& options,
SourceText<mozilla::Utf8Unit>& srcBuf);

View File

@ -100,9 +100,9 @@ JS_PUBLIC_API JSObject* JS::CompileModule(JSContext* cx,
return CompileModuleHelper(cx, options, srcBuf);
}
JS_PUBLIC_API JSObject* JS::CompileModuleDontInflate(
JSContext* cx, const ReadOnlyCompileOptions& options,
SourceText<Utf8Unit>& srcBuf) {
JS_PUBLIC_API JSObject* JS::CompileModule(JSContext* cx,
const ReadOnlyCompileOptions& options,
SourceText<Utf8Unit>& srcBuf) {
return CompileModuleHelper(cx, options, srcBuf);
}