Address
:
[go:
up one dir
,
main page
]
Include Form
Remove Scripts
Accept Cookies
Show Images
Show Referer
Rotate13
Base64
Strip Meta
Strip Title
Session Cookies
More Web Proxy on the site http://driver.im/
Mozilla Home
Privacy
Cookies
Legal
Bugzilla
Browse
Advanced Search
New Bug
Reports
Documentation
Log In
Log In with GitHub
or
Remember me
Browse
Advanced Search
New Bug
Reports
Documentation
Attachment 8716397 Details for
Bug 1240072
[patch]
1 - jsapi-changes - WIP
jsapi-changes (text/plain), 23.44 KB, created by
Jon Coppeard (:jonco)
(
hide
)
Description:
1 - jsapi-changes - WIP
Filename:
MIME Type:
Creator:
Jon Coppeard (:jonco)
Size:
23.44 KB
patch
obsolete
># HG changeset patch ># User Jon Coppeard <jcoppeard@mozilla.com> ># Parent 0965c9467efb2f1ff7fdc2796de20d62548c1acc > >diff --git a/js/src/builtin/ModuleObject.cpp b/js/src/builtin/ModuleObject.cpp >--- a/js/src/builtin/ModuleObject.cpp >+++ b/js/src/builtin/ModuleObject.cpp >@@ -778,16 +778,28 @@ ModuleObject::script() const > } > > bool > ModuleObject::evaluated() const > { > return getReservedSlot(EvaluatedSlot).toBoolean(); > } > >+Value >+ModuleObject::hostDefinedField() const >+{ >+ return getReservedSlot(HostDefined); >+} >+ >+void >+ModuleObject::setHostDefinedField(JS::Value value) >+{ >+ setReservedSlot(HostDefined, value); >+} >+ > ModuleEnvironmentObject& > ModuleObject::initialEnvironment() const > { > return getReservedSlot(InitialEnvironmentSlot).toObject().as<ModuleEnvironmentObject>(); > } > > StaticModuleScope* > ModuleObject::staticScope() const >@@ -906,16 +918,30 @@ ModuleObject::createNamespace(JSContext* > } > > self->initReservedSlot(NamespaceSlot, ObjectValue(*ns)); > self->initReservedSlot(NamespaceExportsSlot, ObjectValue(*exports)); > self->initReservedSlot(NamespaceBindingsSlot, PrivateValue(bindings)); > return ns; > } > >+/* static */ bool >+ModuleObject::DeclarationInstantiation(JSContext* cx, HandleModuleObject self) >+{ >+ RootedValue result(cx); >+ return JS_CallFunctionName(cx, self, "declarationInstantiation", JS::HandleValueArray::empty(), >+ &result); >+} >+ >+/* static */ bool >+ModuleObject::Evaluation(JSContext* cx, HandleModuleObject self, MutableHandleValue result) >+{ >+ return JS_CallFunctionName(cx, self, "evaluation", JS::HandleValueArray::empty(), result); >+} >+ > DEFINE_GETTER_FUNCTIONS(ModuleObject, namespace_, NamespaceSlot) > DEFINE_GETTER_FUNCTIONS(ModuleObject, evaluated, EvaluatedSlot) > DEFINE_GETTER_FUNCTIONS(ModuleObject, requestedModules, RequestedModulesSlot) > DEFINE_GETTER_FUNCTIONS(ModuleObject, importEntries, ImportEntriesSlot) > DEFINE_GETTER_FUNCTIONS(ModuleObject, localExportEntries, LocalExportEntriesSlot) > DEFINE_GETTER_FUNCTIONS(ModuleObject, indirectExportEntries, IndirectExportEntriesSlot) > DEFINE_GETTER_FUNCTIONS(ModuleObject, starExportEntries, StarExportEntriesSlot) > >@@ -947,25 +973,16 @@ GlobalObject::initModuleProto(JSContext* > > if (!DefinePropertiesAndFunctions(cx, proto, protoAccessors, protoFunctions)) > return false; > > global->setReservedSlot(MODULE_PROTO, ObjectValue(*proto)); > return true; > } > >-bool >-js::InitModuleClasses(JSContext* cx, HandleObject obj) >-{ >- Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>()); >- return GlobalObject::initModuleProto(cx, global) && >- GlobalObject::initImportEntryProto(cx, global) && >- GlobalObject::initExportEntryProto(cx, global); >-} >- > #undef DEFINE_GETTER_FUNCTIONS > #undef DEFINE_STRING_ACCESSOR_METHOD > #undef DEFINE_ARRAY_SLOT_ACCESSOR > > /////////////////////////////////////////////////////////////////////////// > // ModuleBuilder > > ModuleBuilder::ModuleBuilder(ExclusiveContext* cx, HandleModuleObject module) >diff --git a/js/src/builtin/ModuleObject.h b/js/src/builtin/ModuleObject.h >--- a/js/src/builtin/ModuleObject.h >+++ b/js/src/builtin/ModuleObject.h >@@ -206,16 +206,17 @@ class ModuleObject : public NativeObject > enum > { > ScriptSlot = 0, > StaticScopeSlot, > InitialEnvironmentSlot, > EnvironmentSlot, > NamespaceSlot, > EvaluatedSlot, >+ HostDefined, > RequestedModulesSlot, > ImportEntriesSlot, > LocalExportEntriesSlot, > IndirectExportEntriesSlot, > StarExportEntriesSlot, > ImportBindingsSlot, > NamespaceExportsSlot, > NamespaceBindingsSlot, >@@ -240,33 +241,47 @@ class ModuleObject : public NativeObject > void fixScopesAfterCompartmentMerge(JSContext* cx); > > JSScript* script() const; > StaticModuleScope* staticScope() const; > ModuleEnvironmentObject& initialEnvironment() const; > ModuleEnvironmentObject* environment() const; > ModuleNamespaceObject* namespace_(); > bool evaluated() const; >+ Value hostDefinedField() const; > ArrayObject& requestedModules() const; > ArrayObject& importEntries() const; > ArrayObject& localExportEntries() const; > ArrayObject& indirectExportEntries() const; > ArrayObject& starExportEntries() const; > IndirectBindingMap& importBindings(); > ArrayObject* namespaceExports(); > IndirectBindingMap* namespaceBindings(); > >+ static bool DeclarationInstantiation(JSContext* cx, HandleModuleObject self); >+ static bool Evaluation(JSContext* cx, HandleModuleObject self, MutableHandleValue result); >+ >+ void setHostDefinedField(JS::Value value); >+ >+ // For intrinsic_CreateModuleEnvironment. > void createEnvironment(); > >+ // For BytecodeEmitter. > bool noteFunctionDeclaration(ExclusiveContext* cx, HandleAtom name, HandleFunction fun); >+ >+ // For intrinsic_InstantiateModuleFunctionDeclarations. > static bool instantiateFunctionDeclarations(JSContext* cx, HandleModuleObject self); > >+ // For intrinsic_SetModuleEvaluated. > void setEvaluated(); >+ >+ // For intrinsic_EvaluateModule. > static bool evaluate(JSContext* cx, HandleModuleObject self, MutableHandleValue rval); > >+ // For intrinsic_NewModuleNamespace. > static ModuleNamespaceObject* createNamespace(JSContext* cx, HandleModuleObject self, > HandleArrayObject exports); > > private: > static void trace(JSTracer* trc, JSObject* obj); > static void finalize(js::FreeOp* fop, JSObject* obj); > > bool hasScript() const; >@@ -319,18 +334,16 @@ class MOZ_STACK_CLASS ModuleBuilder > HandleAtom importName); > > bool maybeAppendRequestedModule(HandleAtom module); > > template <typename T> > ArrayObject* createArray(const GCVector<T>& vector); > }; > >-bool InitModuleClasses(JSContext* cx, HandleObject obj); >- > } // namespace js > > template<> > inline bool > JSObject::is<js::ModuleNamespaceObject>() const > { > return js::IsDerivedProxyObject(this, &js::ModuleNamespaceObject::proxyHandler); > } >diff --git a/js/src/builtin/ReflectParse.cpp b/js/src/builtin/ReflectParse.cpp >--- a/js/src/builtin/ReflectParse.cpp >+++ b/js/src/builtin/ReflectParse.cpp >@@ -3742,16 +3742,20 @@ reflect_parse(JSContext* cx, uint32_t ar > serialize.setParser(&parser); > > ParseNode* pn; > if (target == ParseTarget::Script) { > pn = parser.parse(); > if (!pn) > return false; > } else { >+ Rooted<GlobalObject*> global(cx, cx->global()); >+ if (!GlobalObject::ensureModulePrototypesCreated(cx, global)) >+ return false; >+ > Rooted<ModuleObject*> module(cx, ModuleObject::create(cx, nullptr)); > if (!module) > return false; > > ModuleBuilder builder(cx, module); > pn = parser.standaloneModule(module, builder); > if (!pn) > return false; >diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp >--- a/js/src/frontend/BytecodeCompiler.cpp >+++ b/js/src/frontend/BytecodeCompiler.cpp >@@ -758,35 +758,44 @@ frontend::CompileScript(ExclusiveContext > return script; > } > > ModuleObject* > frontend::CompileModule(ExclusiveContext* cx, const ReadOnlyCompileOptions& optionsInput, > SourceBufferHolder& srcBuf, LifoAlloc* alloc) > { > MOZ_ASSERT(srcBuf.get()); >- MOZ_ASSERT(cx->isJSContext() == (alloc == nullptr)); >- >- if (!alloc) >- alloc = &cx->asJSContext()->tempLifoAlloc(); >+ MOZ_ASSERT(alloc); > > CompileOptions options(cx, optionsInput); > options.maybeMakeStrictMode(true); // ES6 10.2.1 Module code is always strict mode code. > options.setIsRunOnce(true); > > Rooted<StaticScope*> staticScope(cx, &cx->global()->lexicalScope().staticBlock()); > BytecodeCompiler compiler(cx, alloc, options, srcBuf, staticScope, > TraceLogger_ParserCompileModule); >- RootedModuleObject module(cx, compiler.compileModule()); >+ return compiler.compileModule(); >+} >+ >+ModuleObject* >+frontend::CompileModule(JSContext* cx, const ReadOnlyCompileOptions& options, >+ SourceBufferHolder& srcBuf) >+{ >+ Rooted<GlobalObject*> global(cx, cx->global()); >+ if (!GlobalObject::ensureModulePrototypesCreated(cx, global)) >+ return nullptr; >+ >+ LifoAlloc* alloc = &cx->asJSContext()->tempLifoAlloc(); >+ RootedModuleObject module(cx, CompileModule(cx, options, srcBuf, alloc)); > if (!module) > return nullptr; > > // This happens in GlobalHelperThreadState::finishModuleParseTask() when a > // module is compiled off main thread. >- if (cx->isJSContext() && !ModuleObject::FreezeArrayProperties(cx->asJSContext(), module)) >+ if (!ModuleObject::FreezeArrayProperties(cx->asJSContext(), module)) > return nullptr; > > return module; > } > > bool > frontend::CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const char16_t* chars, size_t length) > { >diff --git a/js/src/frontend/BytecodeCompiler.h b/js/src/frontend/BytecodeCompiler.h >--- a/js/src/frontend/BytecodeCompiler.h >+++ b/js/src/frontend/BytecodeCompiler.h >@@ -28,18 +28,22 @@ JSScript* > CompileScript(ExclusiveContext* cx, LifoAlloc* alloc, > HandleObject scopeChain, Handle<StaticScope*> enclosingStaticScope, > HandleScript evalCaller, const ReadOnlyCompileOptions& options, > SourceBufferHolder& srcBuf, JSString* source_ = nullptr, > SourceCompressionTask* extraSct = nullptr, > ScriptSourceObject** sourceObjectOut = nullptr); > > ModuleObject* >+CompileModule(JSContext *cx, const ReadOnlyCompileOptions &options, >+ SourceBufferHolder &srcBuf); >+ >+ModuleObject* > CompileModule(ExclusiveContext *cx, const ReadOnlyCompileOptions &options, >- SourceBufferHolder &srcBuf, LifoAlloc* alloc = nullptr); >+ SourceBufferHolder &srcBuf, LifoAlloc* alloc); > > bool > CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const char16_t* chars, size_t length); > > /* > * enclosingStaticScope is a static enclosing scope (e.g. a StaticWithScope). > * Must be null if the enclosing scope is a global. > */ >diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp >--- a/js/src/jsapi.cpp >+++ b/js/src/jsapi.cpp >@@ -4130,16 +4130,42 @@ JS::FinishOffThreadScript(JSContext* may > } > return script; > } else { > return HelperThreadState().finishScriptParseTask(maybecx, rt, token); > } > } > > JS_PUBLIC_API(bool) >+JS::CompileOffThreadModule(JSContext* cx, const ReadOnlyCompileOptions& options, >+ const char16_t* chars, size_t length, >+ OffThreadCompileCallback callback, void* callbackData) >+{ >+ MOZ_ASSERT(CanCompileOffThread(cx, options, length)); >+ return StartOffThreadParseModule(cx, options, chars, length, callback, callbackData); >+} >+ >+JS_PUBLIC_API(JSObject*) >+JS::FinishOffThreadModule(JSContext* maybecx, JSRuntime* rt, void* token) >+{ >+ MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); >+ >+ if (maybecx) { >+ RootedObject module(maybecx); >+ { >+ AutoLastFrameCheck lfc(maybecx); >+ module = HelperThreadState().finishModuleParseTask(maybecx, rt, token); >+ } >+ return module; >+ } else { >+ return HelperThreadState().finishModuleParseTask(maybecx, rt, token); >+ } >+} >+ >+JS_PUBLIC_API(bool) > JS_CompileScript(JSContext* cx, const char* ascii, size_t length, > const JS::CompileOptions& options, MutableHandleScript script) > { > return Compile(cx, options, ascii, length, script); > } > > JS_PUBLIC_API(bool) > JS_CompileUCScript(JSContext* cx, const char16_t* chars, size_t length, >@@ -4558,16 +4584,107 @@ JS::Evaluate(JSContext* cx, AutoObjectVe > > JS_PUBLIC_API(bool) > JS::Evaluate(JSContext* cx, const ReadOnlyCompileOptions& optionsArg, > const char* filename, MutableHandleValue rval) > { > return ::Evaluate(cx, optionsArg, filename, rval); > } > >+JS_PUBLIC_API(JSFunction*) >+JS::GetModuleResolveHook(JSContext* cx) >+{ >+ AssertHeapIsIdle(cx); >+ CHECK_REQUEST(cx); >+ return cx->global()->moduleResolveHook(); >+} >+ >+JS_PUBLIC_API(void) >+JS::SetModuleResolveHook(JSContext* cx, HandleFunction func) >+{ >+ AssertHeapIsIdle(cx); >+ CHECK_REQUEST(cx); >+ assertSameCompartment(cx, func); >+ cx->global()->setModuleResolveHook(func); >+} >+ >+JS_PUBLIC_API(bool) >+JS::ParseModule(JSContext* cx, const ReadOnlyCompileOptions& options, >+ SourceBufferHolder& srcBuf, JS::MutableHandleObject module) >+{ >+ MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); >+ AssertHeapIsIdle(cx); >+ CHECK_REQUEST(cx); >+ >+ AutoLastFrameCheck lfc(cx); >+ >+ SourceCompressionTask sct(cx); >+ RootedObject obj(cx, frontend::CompileModule(cx, options, srcBuf)); >+ if (!obj) >+ return false; >+ >+ module.set(obj); >+ return true; >+} >+ >+JS_PUBLIC_API(void) >+JS::SetModuleHostDefinedField(JSObject* module, JS::Value value) >+{ >+ MOZ_ASSERT(module->is<ModuleObject>()); >+ module->as<ModuleObject>().setHostDefinedField(value); >+} >+ >+JS_PUBLIC_API(JS::Value) >+JS::GetModuleHostDefinedField(JSObject* module) >+{ >+ MOZ_ASSERT(module->is<ModuleObject>()); >+ return module->as<ModuleObject>().hostDefinedField(); >+} >+ >+JS_PUBLIC_API(bool) >+JS::ModuleDeclarationInstantiation(JSContext* cx, JS::HandleObject moduleArg) >+{ >+ AssertHeapIsIdle(cx); >+ CHECK_REQUEST(cx); >+ assertSameCompartment(cx, moduleArg); >+ if (!moduleArg->is<ModuleObject>()) >+ return false; >+ >+ RootedModuleObject module(cx, &moduleArg->as<ModuleObject>()); >+ return ModuleObject::DeclarationInstantiation(cx, module); >+} >+ >+JS_PUBLIC_API(bool) >+JS::ModuleEvaluation(JSContext* cx, JS::HandleObject moduleArg) >+{ >+ AssertHeapIsIdle(cx); >+ CHECK_REQUEST(cx); >+ assertSameCompartment(cx, moduleArg); >+ if (!moduleArg->is<ModuleObject>()) >+ return false; >+ >+ RootedModuleObject module(cx, &moduleArg->as<ModuleObject>()); >+ RootedValue result(cx); >+ return ModuleObject::Evaluation(cx, module, &result); >+} >+ >+JS_PUBLIC_API(bool) >+JS::GetRequestedModules(JSContext* cx, JS::HandleObject moduleArg, JS::MutableHandleObject rval) >+{ >+ AssertHeapIsIdle(cx); >+ CHECK_REQUEST(cx); >+ assertSameCompartment(cx, moduleArg); >+ if (!moduleArg->is<ModuleObject>()) >+ return false; >+ >+ RootedModuleObject module(cx, &moduleArg->as<ModuleObject>()); >+ rval.set(&module->requestedModules()); >+ return true; >+} >+ > static JSObject* > JS_NewHelper(JSContext* cx, HandleObject ctor, const JS::HandleValueArray& inputArgs) > { > AssertHeapIsIdle(cx); > CHECK_REQUEST(cx); > assertSameCompartment(cx, ctor, inputArgs); > > RootedValue ctorVal(cx, ObjectValue(*ctor)); >diff --git a/js/src/jsapi.h b/js/src/jsapi.h >--- a/js/src/jsapi.h >+++ b/js/src/jsapi.h >@@ -752,16 +752,26 @@ class MOZ_STACK_CLASS SourceBufferHolder > static const char16_t NullChar_ = 0; > if (!get()) { > data_ = &NullChar_; > length_ = 0; > ownsChars_ = false; > } > } > >+ SourceBufferHolder(SourceBufferHolder&& other) >+ : data_(other.data_), >+ length_(other.length_), >+ ownsChars_(other.ownsChars_) >+ { >+ other.data_ = nullptr; >+ other.length_ = 0; >+ other.ownsChars_ = false; >+ } >+ > ~SourceBufferHolder() { > if (ownsChars_) > js_free(const_cast<char16_t*>(data_)); > } > > // Access the underlying source buffer without affecting ownership. > const char16_t* get() const { return data_; } > >@@ -4075,16 +4085,24 @@ CanCompileOffThread(JSContext* cx, const > extern JS_PUBLIC_API(bool) > CompileOffThread(JSContext* cx, const ReadOnlyCompileOptions& options, > const char16_t* chars, size_t length, > OffThreadCompileCallback callback, void* callbackData); > > extern JS_PUBLIC_API(JSScript*) > FinishOffThreadScript(JSContext* maybecx, JSRuntime* rt, void* token); > >+extern JS_PUBLIC_API(bool) >+CompileOffThreadModule(JSContext* cx, const ReadOnlyCompileOptions& options, >+ const char16_t* chars, size_t length, >+ OffThreadCompileCallback callback, void* callbackData); >+ >+extern JS_PUBLIC_API(JSObject*) >+FinishOffThreadModule(JSContext* maybecx, JSRuntime* rt, void* token); >+ > /** > * Compile a function with scopeChain plus the global as its scope chain. > * scopeChain must contain objects in the current compartment of cx. The actual > * scope chain used for the function will consist of With wrappers for those > * objects, followed by the current global of the compartment cx is in. This > * global must not be explicitly included in the scope chain. > */ > extern JS_PUBLIC_API(bool) >@@ -4218,16 +4236,84 @@ Evaluate(JSContext* cx, const ReadOnlyCo > > /** > * Evaluate the given file in the scope of the current global of cx. > */ > extern JS_PUBLIC_API(bool) > Evaluate(JSContext* cx, const ReadOnlyCompileOptions& options, > const char* filename, JS::MutableHandleValue rval); > >+/** >+ * Get the HostResolveImportedModule hook for a global. >+ */ >+extern JS_PUBLIC_API(JSFunction*) >+GetModuleResolveHook(JSContext* cx); >+ >+/** >+ * Set the HostResolveImportedModule hook for a global to the given function. >+ */ >+extern JS_PUBLIC_API(void) >+SetModuleResolveHook(JSContext* cx, JS::HandleFunction func); >+ >+/** >+ * 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) >+ParseModule(JSContext* cx, const ReadOnlyCompileOptions& options, >+ SourceBufferHolder& srcBuf, JS::MutableHandleObject moduleRecord); >+ >+/** >+ * Set the [[HostDefined]] field of a source text module record to the given >+ * value. >+ */ >+extern JS_PUBLIC_API(void) >+SetModuleHostDefinedField(JSObject* module, JS::Value value); >+ >+/** >+ * Get the [[HostDefined]] field of a source text module record. >+ */ >+extern JS_PUBLIC_API(JS::Value) >+GetModuleHostDefinedField(JSObject* module); >+ >+/* >+ * Perform the ModuleDeclarationInstantiation operation on on the give source >+ * text module record. >+ * >+ * This transitively resolves all module dependencies (calling the >+ * HostResolveImportedModule hook) and initializes the environment record for >+ * the module. >+ */ >+extern JS_PUBLIC_API(bool) >+ModuleDeclarationInstantiation(JSContext* cx, JS::HandleObject moduleRecord); >+ >+/* >+ * Perform the ModuleEvaluation operation on on the give source text module >+ * record. >+ * >+ * This does nothing if this module has already been evaluated. Otherwise, it >+ * transitively evaluates all dependences of this module and then evaluates this >+ * module. >+ * >+ * ModuleDeclarationInstantiation must have completed prior to calling this. >+ */ >+extern JS_PUBLIC_API(bool) >+ModuleEvaluation(JSContext* cx, JS::HandleObject moduleRecord); >+ >+/* >+ * Get a list of the module specifiers used by a source text module >+ * record to request importation of modules. >+ * >+ * The result is a JavaScript array of string values. ForOfIterator can be used >+ * to extract the individual strings. >+ */ >+extern JS_PUBLIC_API(bool) >+GetRequestedModules(JSContext* cx, JS::HandleObject moduleRecord, >+ JS::MutableHandleObject rval); >+ > } /* namespace JS */ > > extern JS_PUBLIC_API(bool) > JS_CheckForInterrupt(JSContext* cx); > > /* > * These functions allow setting an interrupt callback that will be called > * from the JS thread some time after any thread triggered the callback using >diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp >--- a/js/src/shell/js.cpp >+++ b/js/src/shell/js.cpp >@@ -3779,32 +3779,16 @@ runOffThreadScript(JSContext* cx, unsign > RootedScript script(cx, JS::FinishOffThreadScript(cx, rt, token)); > if (!script) > return false; > > return JS_ExecuteScript(cx, script, args.rval()); > } > > static bool >-CompileOffThreadModule(JSContext* cx, const ReadOnlyCompileOptions& options, >- const char16_t* chars, size_t length, >- JS::OffThreadCompileCallback callback, void* callbackData) >-{ >- MOZ_ASSERT(JS::CanCompileOffThread(cx, options, length)); >- return StartOffThreadParseModule(cx, options, chars, length, callback, callbackData); >-} >- >-static JSObject* >-FinishOffThreadModule(JSContext* maybecx, JSRuntime* rt, void* token) >-{ >- MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); >- return HelperThreadState().finishModuleParseTask(maybecx, rt, token); >-} >- >-static bool > OffThreadCompileModule(JSContext* cx, unsigned argc, Value* vp) > { > CallArgs args = CallArgsFromVp(argc, vp); > > if (args.length() != 1 || !args[0].isString()) { > JS_ReportErrorNumber(cx, my_GetErrorMessage, nullptr, JSSMSG_INVALID_ARGS, > "offThreadCompileModule"); > return false; >@@ -3847,18 +3831,18 @@ OffThreadCompileModule(JSContext* cx, un > } > > if (!offThreadState.startIfIdle(cx, ownedChars)) { > JS_ReportError(cx, "called offThreadCompileModule without receiving prior off-thread " > "compilation"); > return false; > } > >- if (!CompileOffThreadModule(cx, options, chars, length, >- OffThreadCompileScriptCallback, nullptr)) >+ if (!JS::CompileOffThreadModule(cx, options, chars, length, >+ OffThreadCompileScriptCallback, nullptr)) > { > offThreadState.abandon(cx); > return false; > } > > args.rval().setUndefined(); > return true; > } >@@ -3873,17 +3857,17 @@ FinishOffThreadModule(JSContext* cx, uns > gc::AutoFinishGC finishgc(rt); > > void* token = offThreadState.waitUntilDone(cx); > if (!token) { > JS_ReportError(cx, "called finishOffThreadModule when no compilation is pending"); > return false; > } > >- RootedObject module(cx, FinishOffThreadModule(cx, rt, token)); >+ RootedObject module(cx, JS::FinishOffThreadModule(cx, rt, token)); > if (!module) > return false; > > args.rval().setObject(*module); > return true; > } > > struct MOZ_RAII FreeOnReturn >@@ -6348,19 +6332,16 @@ NewGlobalObject(JSContext* cx, JS::Compa > > RootedObject domProto(cx, JS_InitClass(cx, glob, nullptr, &dom_class, dom_constructor, > 0, dom_props, dom_methods, nullptr, nullptr)); > if (!domProto) > return nullptr; > > /* Initialize FakeDOMObject.prototype */ > InitDOMObject(domProto); >- >- if (!js::InitModuleClasses(cx, glob)) >- return nullptr; > } > > JS_FireOnNewGlobalObject(cx, glob); > > return glob; > } > > static bool >diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp >--- a/js/src/vm/GlobalObject.cpp >+++ b/js/src/vm/GlobalObject.cpp >@@ -741,19 +741,12 @@ GlobalObject::addIntrinsicValue(JSContex > > holder->setSlot(shape->slot(), value); > return true; > } > > /* static */ bool > GlobalObject::ensureModulePrototypesCreated(JSContext *cx, Handle<GlobalObject*> global) > { >- if (global->getSlot(MODULE_PROTO).isUndefined()) { >- MOZ_ASSERT(global->getSlot(IMPORT_ENTRY_PROTO).isUndefined() && >- global->getSlot(EXPORT_ENTRY_PROTO).isUndefined()); >- if (!js::InitModuleClasses(cx, global)) >- return false; >- } >- MOZ_ASSERT(global->getSlot(MODULE_PROTO).isObject() && >- global->getSlot(IMPORT_ENTRY_PROTO).isObject() && >- global->getSlot(EXPORT_ENTRY_PROTO).isObject()); >- return true; >+ return global->getOrCreateObject(cx, MODULE_PROTO, initModuleProto) && >+ global->getOrCreateObject(cx, IMPORT_ENTRY_PROTO, initImportEntryProto) && >+ global->getOrCreateObject(cx, EXPORT_ENTRY_PROTO, initExportEntryProto); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
|
Review
Attachments on
bug 1240072
:
8716397
|
8716399
|
8716400
|
8723066
|
8723067
|
8723068
|
8723069
|
8740994
|
8740995
|
8740997
|
8741016
|
8743799
|
8749699
|
8749722