зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1552979 - Make JS::CompileModule return the module directly, rather than by outparam duplicative of a boolean return value. r=arai
--HG-- extra : rebase_source : e5db95557dd8c1c3712395a0141badd6e8edbc8e
This commit is contained in:
Родитель
3a69834cbc
Коммит
964550bb3e
|
@ -465,10 +465,12 @@ nsresult nsJSUtils::CompileModule(JSContext* aCx,
|
|||
|
||||
NS_ENSURE_TRUE(xpc::Scriptability::Get(aEvaluationGlobal).Allowed(), NS_OK);
|
||||
|
||||
if (!JS::CompileModule(aCx, aCompileOptions, aSrcBuf, aModule)) {
|
||||
JSObject* module = JS::CompileModule(aCx, aCompileOptions, aSrcBuf);
|
||||
if (!module) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aModule.set(module);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "jsfriendapi.h"
|
||||
#include "js/CompilationAndEvaluation.h"
|
||||
#include "js/MemoryFunctions.h"
|
||||
#include "js/Modules.h" // JS::CompileModule, JS::FinishDynamicModuleImport, JS::{G,S}etModuleResolveHook, JS::Get{ModulePrivate,ModuleScript,RequestedModule{s,Specifier,SourcePos}}, JS::SetModule{DynamicImport,Metadata}Hook
|
||||
#include "js/Modules.h" // JS::FinishDynamicModuleImport, JS::{G,S}etModuleResolveHook, JS::Get{ModulePrivate,ModuleScript,RequestedModule{s,Specifier,SourcePos}}, JS::SetModule{DynamicImport,Metadata}Hook
|
||||
#include "js/OffThreadScriptCompilation.h"
|
||||
#include "js/Realm.h"
|
||||
#include "js/SourceText.h"
|
||||
|
|
|
@ -87,10 +87,9 @@ extern JS_PUBLIC_API bool FinishDynamicModuleImport(
|
|||
* Parse the given source buffer as a module in the scope of the current global
|
||||
* of cx and return a source text module record.
|
||||
*/
|
||||
extern JS_PUBLIC_API bool CompileModule(JSContext* cx,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
SourceText<char16_t>& srcBuf,
|
||||
MutableHandle<JSObject*> moduleRecord);
|
||||
extern JS_PUBLIC_API JSObject* CompileModule(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
SourceText<char16_t>& srcBuf);
|
||||
|
||||
/**
|
||||
* Set a private value associated with a source text module record.
|
||||
|
|
|
@ -80,16 +80,14 @@ JS_PUBLIC_API bool JS::FinishDynamicModuleImport(
|
|||
promise);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::CompileModule(JSContext* cx,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
SourceText<char16_t>& srcBuf,
|
||||
MutableHandle<JSObject*> module) {
|
||||
JS_PUBLIC_API JSObject* JS::CompileModule(JSContext* cx,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
SourceText<char16_t>& srcBuf) {
|
||||
MOZ_ASSERT(!cx->zone()->isAtomsZone());
|
||||
AssertHeapIsIdle();
|
||||
CHECK_THREAD(cx);
|
||||
|
||||
module.set(js::frontend::CompileModule(cx, options, srcBuf));
|
||||
return !!module;
|
||||
return js::frontend::CompileModule(cx, options, srcBuf);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API void JS::SetModulePrivate(JSObject* module, const Value& value) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче