Closed Bug 1368313 Opened 8 years ago Closed 7 years ago

Missing export names directly throw exception breaking off-main-thread parsing for modules

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: anba, Assigned: anba)

References

Details

Attachments

(1 file, 1 obsolete file)

Test case: --- offThreadCompileModule("export { x };"); finishOffThreadModule(); --- Triggers this assertion in js::LookupOwnPropertyInline(...): --- MOZ_ASSERT(!cx->helperThread()); --- Stack trace: --- #0 0x0000000000e1f282 in js::LookupOwnPropertyInline<(js::AllowGC)1>(JSContext*, js::MaybeRooted<js::NativeObject*, (js::AllowGC)1>::HandleType, js::MaybeRooted<jsid, (js::AllowGC)1>::HandleType, js::May beRooted<JS::PropertyResult, (js::AllowGC)1>::MutableHandleType, bool*) (cx=0x7ffff58b1000, obj=(js::NativeObject * const) 0x7ffff45c26a0 [object Function "Error"], id=$jsid("prototype"), propp= {{shape_ = 0x0, bits_ = 0}, static NotFound = 0, static NonNativeProperty = 1, static DenseOrTypedArrayElement = 1}, donep=0x7ffff58aebd7) at /home/andre/git/mozilla-central/js/src/vm/NativeObject-inl.h:736 #1 0x0000000000e2c8f8 in js::NativeLookupOwnProperty<(js::AllowGC)1>(JSContext*, js::MaybeRooted<js::NativeObject*, (js::AllowGC)1>::HandleType, js::MaybeRooted<jsid, (js::AllowGC)1>::HandleType, js::May beRooted<JS::PropertyResult, (js::AllowGC)1>::MutableHandleType) (cx=0x7ffff58b1000, obj=(js::NativeObject * const) 0x7ffff45c26a0 [object Function "Error"], id=$jsid("prototype"), propp= {{shape_ = 0x0, bits_ = 0}, static NotFound = 0, static NonNativeProperty = 1, static DenseOrTypedArrayElement = 1}) at /home/andre/git/mozilla-central/js/src/vm/NativeObject.cpp:1110 #2 0x0000000000e1065f in js::NativeDefineProperty(JSContext*, JS::Handle<js::NativeObject*>, JS::Handle<jsid>, JS::Handle<JS::PropertyDescriptor>, JS::ObjectOpResult&) (cx=0x7ffff58b1000, obj=(js::Native Object * const) 0x7ffff45c26a0 [object Function "Error"], id=$jsid("prototype"), desc_= {obj = 0x0, attrs = 6, getter = 0x0, setter = 0x0, value = $jsval((JSObject *) 0x7ffff45bb180 [object Object] delegate)}, result=...) at /home/andre/git/mozilla-central/js/src/vm/NativeObject.cpp:1545 #3 0x0000000000baf111 in js::DefineProperty(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, JS::Handle<JS::Value>, bool (*)(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, JS::MutableHandle<JS: :Value>), bool (*)(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, JS::MutableHandle<JS::Value>, JS::ObjectOpResult&), unsigned int, JS::ObjectOpResult&) (cx=0x7ffff58b1000, obj=(JSObject * const) 0x 7ffff45c26a0 [object Function "Error"], id=$jsid("prototype"), value=$jsval((JSObject *) 0x7ffff45bb180 [object Object] delegate), getter=0x0, setter=0x0, attrs=6, result=...) at /home/andre/git/mozilla-central/js/src/jsobj.cpp:2854 #4 0x0000000000baf3d8 in js::DefineProperty(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, JS::Handle<JS::Value>, bool (*)(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, JS::MutableHandle<JS: :Value>), bool (*)(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, JS::MutableHandle<JS::Value>, JS::ObjectOpResult&), unsigned int) (cx=0x7ffff58b1000, obj=(JSObject * const) 0x7ffff45c26a0 [object Function "Error"], id=$jsid("prototype"), value=$jsval((JSObject *) 0x7ffff45bb180 [object Object] delegate), getter=0x0, setter=0x0, attrs=6) at /home/andre/git/mozilla-central/js/src/jsobj.cpp:2885 #5 0x0000000000baf515 in js::DefineProperty(JSContext*, JS::Handle<JSObject*>, js::PropertyName*, JS::Handle<JS::Value>, bool (*)(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, JS::MutableHandle<JS ::Value>), bool (*)(JSContext*, JS::Handle<JSObject*>, JS::Handle<jsid>, JS::MutableHandle<JS::Value>, JS::ObjectOpResult&), unsigned int) (cx=0x7ffff58b1000, obj=(JSObject * const) 0x7ffff45c26a0 [object Function "Error"], name="prototype", value=$jsval((JSObject *) 0x7ffff45bb180 [object Object] delegate), getter=0x0, setter=0x0, attrs=6) at /home/andre/git/mozilla-central/js/src/jsobj.cpp:2900 #6 0x0000000000de0250 in js::LinkConstructorAndPrototype(JSContext*, JSObject*, JSObject*, unsigned int, unsigned int) (cx=0x7ffff58b1000, ctor_=(JSObject *) 0x7ffff45c26a0 [object Function "Error"], pro to_=(JSObject *) 0x7ffff45bb180 [object Object] delegate, prototypeAttrs=6, constructorAttrs=0) at /home/andre/git/mozilla-central/js/src/vm/GlobalObject.cpp:615 #7 0x0000000000dde03d in js::GlobalObject::resolveConstructor(JSContext*, JS::Handle<js::GlobalObject*>, JSProtoKey) (cx=0x7ffff58b1000, global=(js::GlobalObject * const) 0x7ffff45b6060 [object internal- parse-task-global] delegate, key=JSProto_Error) at /home/andre/git/mozilla-central/js/src/vm/GlobalObject.cpp:252 #8 0x0000000000ddd7ec in js::GlobalObject::ensureConstructor(JSContext*, JS::Handle<js::GlobalObject*>, JSProtoKey) (cx=0x7ffff58b1000, global=(js::GlobalObject * const) 0x7ffff45b6060 [object internal-p arse-task-global] delegate, key=JSProto_Error) at /home/andre/git/mozilla-central/js/src/vm/GlobalObject.cpp:122 #9 0x0000000000add344 in js::GlobalObject::getOrCreateCustomErrorPrototype(JSContext*, JS::Handle<js::GlobalObject*>, JSExnType) (cx=0x7ffff58b1000, global=(js::GlobalObject * const) 0x7ffff45b6060 [obje ct internal-parse-task-global] delegate, exnType=JSEXN_ERR) at /home/andre/git/mozilla-central/js/src/vm/GlobalObject.h:399 #10 0x0000000000b4c4dd in js::GlobalObject::getOrCreateErrorPrototype(JSContext*, JS::Handle<js::GlobalObject*>) (cx=0x7ffff58b1000, global=(js::GlobalObject * const) 0x7ffff45b6060 [object internal-parse -task-global] delegate) at /home/andre/git/mozilla-central/js/src/vm/GlobalObject.h:413 #11 0x0000000000b3b039 in js::ErrorObject::createProto(JSContext*, JSProtoKey) (cx=0x7ffff58b1000, key=JSProto_SyntaxError) at /home/andre/git/mozilla-central/js/src/jsexn.cpp:597 #12 0x0000000000dddb0c in js::GlobalObject::resolveConstructor(JSContext*, JS::Handle<js::GlobalObject*>, JSProtoKey) (cx=0x7ffff58b1000, global=(js::GlobalObject * const) 0x7ffff45b6060 [object internal- parse-task-global] delegate, key=JSProto_SyntaxError) at /home/andre/git/mozilla-central/js/src/vm/GlobalObject.cpp:198 #13 0x0000000000ddd7ec in js::GlobalObject::ensureConstructor(JSContext*, JS::Handle<js::GlobalObject*>, JSProtoKey) (cx=0x7ffff58b1000, global=(js::GlobalObject * const) 0x7ffff45b6060 [object internal-p arse-task-global] delegate, key=JSProto_SyntaxError) at /home/andre/git/mozilla-central/js/src/vm/GlobalObject.cpp:122 #14 0x0000000000add344 in js::GlobalObject::getOrCreateCustomErrorPrototype(JSContext*, JS::Handle<js::GlobalObject*>, JSExnType) (cx=0x7ffff58b1000, global=(js::GlobalObject * const) 0x7ffff45b6060 [obje ct internal-parse-task-global] delegate, exnType=JSEXN_SYNTAXERR) at /home/andre/git/mozilla-central/js/src/vm/GlobalObject.h:399 #15 0x0000000000d6f2f2 in js::ErrorObject::create(JSContext*, JSExnType, JS::Handle<JSObject*>, JS::Handle<JSString*>, unsigned int, unsigned int, js::ScopedJSFreePtr<JSErrorReport>*, JS::Handle<JSString* >, JS::Handle<JSObject*>) (cx=0x7ffff58b1000, errorType=JSEXN_SYNTAXERR, stack=0x0, fileName="", lineNumber=0, columnNumber=0, report=0x7ffff58af5d0, message="local binding for export 'x' not found", prot oArg=0x0) at /home/andre/git/mozilla-central/js/src/vm/ErrorObject.cpp:98 #16 0x0000000000b3b903 in js::ErrorToException(JSContext*, JSErrorReport*, JSErrorFormatString const* (*)(void*, unsigned int), void*) (cx=0x7ffff58b1000, reportp=0x7ffff58af710, callback=0xb2b4bf <js::Ge tErrorMessage(void*, unsigned int)>, userRef=0x0) at /home/andre/git/mozilla-central/js/src/jsexn.cpp:702 #17 0x0000000000b2924a in ReportError(JSContext*, JSErrorReport*, JSErrorCallback, void*) (cx=0x7ffff58b1000, reportp=0x7ffff58af710, callback=0xb2b4bf <js::GetErrorMessage(void*, unsigned int)>, userRef= 0x0) at /home/andre/git/mozilla-central/js/src/jscntxt.cpp:308 #18 0x0000000000b2a34d in js::ReportErrorNumberVA(JSContext*, unsigned int, JSErrorFormatString const* (*)(void*, unsigned int), void*, unsigned int, js::ErrorArgumentsType, __va_list_tag*) (cx=0x7ffff58b 1000, flags=0, callback=0xb2b4bf <js::GetErrorMessage(void*, unsigned int)>, userRef=0x0, errorNumber=482, argumentsType=js::ArgumentsAreLatin1, ap=0x7ffff58af7f0) at /home/andre/git/mozilla-central/js/src/jscntxt.cpp:905 #19 0x0000000000ad384f in JS_ReportErrorNumberLatin1VA(JSContext*, JSErrorFormatString const* (*)(void*, unsigned int), void*, unsigned int, __va_list_tag*) (cx=0x7ffff58b1000, errorCallback=0xb2b4bf <js: :GetErrorMessage(void*, unsigned int)>, userRef=0x0, errorNumber=482, ap=0x7ffff58af7f0) at /home/andre/git/mozilla-central/js/src/jsapi.cpp:5876 #20 0x0000000000ad37e9 in JS_ReportErrorNumberLatin1(JSContext*, JSErrorFormatString const* (*)(void*, unsigned int), void*, unsigned int, ...) (cx=0x7ffff58b1000, errorCallback=0xb2b4bf <js::GetErrorMess age(void*, unsigned int)>, userRef=0x0, errorNumber=482) at /home/andre/git/mozilla-central/js/src/jsapi.cpp:5865 #21 0x00000000004c99ab in js::frontend::Parser<js::frontend::FullParseHandler, char16_t>::moduleBody(js::frontend::ModuleSharedContext*) (this=0x7ffff58b08d0, modulesc=0x7ffff58afc70) at /home/andre/git/mozilla-central/js/src/frontend/Parser.cpp:2271 ... ---
Attached patch bug1368313.patch (obsolete) — Splinter Review
It's not great that we can't report any offsets for missing exports, but still better than asserting. :-)
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Attachment #8898837 - Flags: review?(jcoppeard)
Comment on attachment 8898837 [details] [diff] [review] bug1368313.patch Review of attachment 8898837 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for fixing this.
Attachment #8898837 - Flags: review?(jcoppeard) → review+
Attached patch bug1368313.patchSplinter Review
The test case was missing a `helperThreadCount()` check, otherwise it failed when no helper threads can be created and `offThreadCompileModule()` is called. Given that this is a test-only check, carrying r+ from :jonco.
Attachment #8898837 - Attachment is obsolete: true
Attachment #8900635 - Flags: review+
Pushed by ryanvm@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/10c21181061e Use error reporter to report missing module exports. r=jonco
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: