Bug 1388728 - Rename JS APIs for loading modules in line with the spec r=bkelly
authorJon Coppeard <jcoppeard@mozilla.com>
Tue, 22 Aug 2017 10:07:49 +0100
changeset 376157 fec5a36cf325478431185b457568f813d15ad87c
parent 376156 932c5acc1f86b26863abf895fed5890afe5c2ac7
child 376158 60a74915871b5ee78ad143b0eef4e26ef51bb55a
push id32376
push userkwierso@gmail.com
push dateWed, 23 Aug 2017 00:07:40 +0000
treeherdermozilla-central@64a45ee1731c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1388728
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1388728 - Rename JS APIs for loading modules in line with the spec r=bkelly
dom/base/nsJSUtils.cpp
dom/base/nsJSUtils.h
dom/script/ScriptLoader.cpp
--- a/dom/base/nsJSUtils.cpp
+++ b/dom/base/nsJSUtils.cpp
@@ -397,44 +397,44 @@ nsJSUtils::CompileModule(JSContext* aCx,
   if (!JS::CompileModule(aCx, aCompileOptions, aSrcBuf, aModule)) {
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
 nsresult
-nsJSUtils::ModuleDeclarationInstantiation(JSContext* aCx, JS::Handle<JSObject*> aModule)
+nsJSUtils::ModuleInstantiate(JSContext* aCx, JS::Handle<JSObject*> aModule)
 {
-  AUTO_PROFILER_LABEL("nsJSUtils::ModuleDeclarationInstantiation", JS);
+  AUTO_PROFILER_LABEL("nsJSUtils::ModuleInstantiate", JS);
 
   MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
   MOZ_ASSERT(NS_IsMainThread());
 
   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_OK;
 }
 
 nsresult
-nsJSUtils::ModuleEvaluation(JSContext* aCx, JS::Handle<JSObject*> aModule)
+nsJSUtils::ModuleEvaluate(JSContext* aCx, JS::Handle<JSObject*> aModule)
 {
-  AUTO_PROFILER_LABEL("nsJSUtils::ModuleEvaluation", JS);
+  AUTO_PROFILER_LABEL("nsJSUtils::ModuleEvaluate", JS);
 
   MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(nsContentUtils::IsInMicroTask());
 
   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_OK;
 }
 
 /* static */
 bool
--- a/dom/base/nsJSUtils.h
+++ b/dom/base/nsJSUtils.h
@@ -178,21 +178,21 @@ public:
   };
 
   static nsresult CompileModule(JSContext* aCx,
                                 JS::SourceBufferHolder& aSrcBuf,
                                 JS::Handle<JSObject*> aEvaluationGlobal,
                                 JS::CompileOptions &aCompileOptions,
                                 JS::MutableHandle<JSObject*> aModule);
 
-  static nsresult ModuleDeclarationInstantiation(JSContext* aCx,
-                                                 JS::Handle<JSObject*> aModule);
+  static nsresult ModuleInstantiate(JSContext* aCx,
+                                    JS::Handle<JSObject*> aModule);
 
-  static nsresult ModuleEvaluation(JSContext* aCx,
-                                   JS::Handle<JSObject*> aModule);
+  static nsresult ModuleEvaluate(JSContext* aCx,
+                                 JS::Handle<JSObject*> aModule);
 
   // Returns false if an exception got thrown on aCx.  Passing a null
   // aElement is allowed; that wil produce an empty aScopeChain.
   static bool GetScopeChainForElement(JSContext* aCx,
                                       mozilla::dom::Element* aElement,
                                       JS::AutoObjectVector& aScopeChain);
 
   static void ResetTimeZone();
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -823,17 +823,17 @@ ScriptLoader::InstantiateModuleTree(Modu
   if (NS_WARN_IF(!jsapi.Init(ms->ModuleRecord()))) {
     return false;
   }
 
   nsresult rv = EnsureModuleResolveHook(jsapi.cx());
   NS_ENSURE_SUCCESS(rv, false);
 
   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());
   if (!ok) {
     LOG(("ScriptLoadRequest (%p): Instantiate failed", aRequest));
     MOZ_ASSERT(jsapi.HasException());
     if (!jsapi.StealException(&exception)) {
       return false;
     }
@@ -2080,17 +2080,17 @@ ScriptLoader::EvaluateScript(ScriptLoadR
       MOZ_ASSERT(!ms->IsUninstantiated());
       if (ms->InstantiationFailed()) {
         JS::Rooted<JS::Value> exception(aes.cx(), ms->Exception());
         JS_SetPendingException(aes.cx(), exception);
         rv = NS_ERROR_FAILURE;
       } else {
         JS::Rooted<JSObject*> module(aes.cx(), ms->ModuleRecord());
         MOZ_ASSERT(module);
-        rv = nsJSUtils::ModuleEvaluation(aes.cx(), module);
+        rv = nsJSUtils::ModuleEvaluate(aes.cx(), module);
       }
       aRequest->mCacheInfo = nullptr;
     } else {
       JS::CompileOptions options(aes.cx());
       rv = FillCompileOptionsForRequest(aes, aRequest, global, &options);
 
       if (NS_SUCCEEDED(rv)) {
         if (aRequest->IsBytecode()) {