Issue #618 - Match JSAPI names with the changes in 9ca74147225eed305e28c7887f9b2251aeeb0f36

Ref: BZ 1388728
This commit is contained in:
Moonchild 2020-07-03 14:21:27 +00:00 • committed by Roy Tam
commit 91a79c0ddc
5 changed files with 20 additions and 21 deletions

View file

@ -308,9 +308,9 @@ nsJSUtils::CompileModule(JSContext* aCx,
} }
nsresult nsresult
nsJSUtils::ModuleDeclarationInstantiation(JSContext* aCx, JS::Handle<JSObject*> aModule) nsJSUtils::ModuleInstantiate(JSContext* aCx, JS::Handle<JSObject*> aModule)
{ {
PROFILER_LABEL("nsJSUtils", "ModuleDeclarationInstantiation", PROFILER_LABEL("nsJSUtils", "ModuleInstantiate",
js::ProfileEntry::Category::JS); js::ProfileEntry::Category::JS);
MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext()); MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
@ -318,7 +318,7 @@ nsJSUtils::ModuleDeclarationInstantiation(JSContext* aCx, JS::Handle<JSObject*>
NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK); NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK);
if (!JS::ModuleDeclarationInstantiation(aCx, aModule)) { if (!JS::ModuleInstantiate(aCx, aModule)) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -326,9 +326,9 @@ nsJSUtils::ModuleDeclarationInstantiation(JSContext* aCx, JS::Handle<JSObject*>
} }
nsresult nsresult
nsJSUtils::ModuleEvaluation(JSContext* aCx, JS::Handle<JSObject*> aModule) nsJSUtils::ModuleEvaluate(JSContext* aCx, JS::Handle<JSObject*> aModule)
{ {
PROFILER_LABEL("nsJSUtils", "ModuleEvaluation", PROFILER_LABEL("nsJSUtils", "ModuleEvaluate",
js::ProfileEntry::Category::JS); js::ProfileEntry::Category::JS);
MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext()); MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
@ -338,7 +338,7 @@ nsJSUtils::ModuleEvaluation(JSContext* aCx, JS::Handle<JSObject*> aModule)
NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK); NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK);
if (!JS::ModuleEvaluation(aCx, aModule)) { if (!JS::ModuleEvaluate(aCx, aModule)) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }

View file

@ -116,11 +116,11 @@ public:
JS::CompileOptions &aCompileOptions, JS::CompileOptions &aCompileOptions,
JS::MutableHandle<JSObject*> aModule); JS::MutableHandle<JSObject*> aModule);
static nsresult ModuleDeclarationInstantiation(JSContext* aCx, static nsresult ModuleInstantiate(JSContext* aCx,
JS::Handle<JSObject*> aModule); JS::Handle<JSObject*> aModule);
static nsresult ModuleEvaluation(JSContext* aCx, static nsresult ModuleEvaluate(JSContext* aCx,
JS::Handle<JSObject*> aModule); JS::Handle<JSObject*> aModule);
// Returns false if an exception got thrown on aCx. Passing a null // Returns false if an exception got thrown on aCx. Passing a null
// aElement is allowed; that wil produce an empty aScopeChain. // aElement is allowed; that wil produce an empty aScopeChain.

View file

@ -888,7 +888,7 @@ ScriptLoader::InstantiateModuleTree(ModuleLoadRequest* aRequest)
NS_ENSURE_SUCCESS(rv, false); NS_ENSURE_SUCCESS(rv, false);
JS::Rooted<JSObject*> module(jsapi.cx(), ms->ModuleRecord()); JS::Rooted<JSObject*> module(jsapi.cx(), ms->ModuleRecord());
bool ok = NS_SUCCEEDED(nsJSUtils::ModuleDeclarationInstantiation(jsapi.cx(), module)); bool ok = NS_SUCCEEDED(nsJSUtils::ModuleInstantiate(jsapi.cx(), module));
JS::RootedValue exception(jsapi.cx()); JS::RootedValue exception(jsapi.cx());
if (!ok) { if (!ok) {
@ -1953,7 +1953,7 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
} else { } else {
JS::Rooted<JSObject*> module(aes.cx(), ms->ModuleRecord()); JS::Rooted<JSObject*> module(aes.cx(), ms->ModuleRecord());
MOZ_ASSERT(module); MOZ_ASSERT(module);
rv = nsJSUtils::ModuleEvaluation(aes.cx(), module); rv = nsJSUtils::ModuleEvaluate(aes.cx(), module);
} }
} else { } else {
JS::CompileOptions options(aes.cx()); JS::CompileOptions options(aes.cx());

View file

@ -4704,7 +4704,7 @@ JS::GetModuleHostDefinedField(JSObject* module)
} }
JS_PUBLIC_API(bool) JS_PUBLIC_API(bool)
JS::ModuleDeclarationInstantiation(JSContext* cx, JS::HandleObject moduleArg) JS::ModuleInstantiate(JSContext* cx, JS::HandleObject moduleArg)
{ {
AssertHeapIsIdle(cx); AssertHeapIsIdle(cx);
CHECK_REQUEST(cx); CHECK_REQUEST(cx);
@ -4713,7 +4713,7 @@ JS::ModuleDeclarationInstantiation(JSContext* cx, JS::HandleObject moduleArg)
} }
JS_PUBLIC_API(bool) JS_PUBLIC_API(bool)
JS::ModuleEvaluation(JSContext* cx, JS::HandleObject moduleArg) JS::ModuleEvaluate(JSContext* cx, JS::HandleObject moduleArg)
{ {
AssertHeapIsIdle(cx); AssertHeapIsIdle(cx);
CHECK_REQUEST(cx); CHECK_REQUEST(cx);

View file

@ -4356,28 +4356,27 @@ extern JS_PUBLIC_API(JS::Value)
GetModuleHostDefinedField(JSObject* module); GetModuleHostDefinedField(JSObject* module);
/* /*
* Perform the ModuleDeclarationInstantiation operation on on the give source * Perform the ModuleInstantiate operation on the given source text module
* text module record. * record.
* *
* This transitively resolves all module dependencies (calling the * This transitively resolves all module dependencies (calling the
* HostResolveImportedModule hook) and initializes the environment record for * HostResolveImportedModule hook) and initializes the environment record for
* the module. * the module.
*/ */
extern JS_PUBLIC_API(bool) extern JS_PUBLIC_API(bool)
ModuleDeclarationInstantiation(JSContext* cx, JS::HandleObject moduleRecord); ModuleInstantiate(JSContext* cx, JS::HandleObject moduleRecord);
/* /*
* Perform the ModuleEvaluation operation on on the give source text module * Perform the ModuleEvaluate operation on the given source text module record.
* record.
* *
* This does nothing if this module has already been evaluated. Otherwise, it * This does nothing if this module has already been evaluated. Otherwise, it
* transitively evaluates all dependences of this module and then evaluates this * transitively evaluates all dependences of this module and then evaluates this
* module. * module.
* *
* ModuleDeclarationInstantiation must have completed prior to calling this. * ModuleInstantiate must have completed prior to calling this.
*/ */
extern JS_PUBLIC_API(bool) extern JS_PUBLIC_API(bool)
ModuleEvaluation(JSContext* cx, JS::HandleObject moduleRecord); ModuleEvaluate(JSContext* cx, JS::HandleObject moduleRecord);
/* /*
* Get a list of the module specifiers used by a source text module * Get a list of the module specifiers used by a source text module