Closed Bug 1206817 Opened 9 years ago Closed 9 years ago

mozJSComponentLoader::ImportInto has fishy exception handling

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: bzbarsky, Unassigned)

Details

Attachments

(1 file)

No description provided.
Er, this bit: JSCLContextHelper cxhelper(callercx); ... dom::AutoJSAPI jsapi; jsapi.Init(); JSContext* cx = jsapi.cx(); ... if (!JS_GetProperty(cx, modObj, "EXPORTED_SYMBOLS", &symbols)) { return ReportOnCaller(cxhelper, ERROR_NOT_PRESENT, PromiseFlatCString(aLocation).get()); } and similar later for JS_GetArrayLength and JS_GetElement failures and whatnot. If JS_GetProperty there throws, there will be an exception on cx. We don't seem to report it or anything. Then we do the ReportOnCaller thing, which does something with exceptions on callercx, which need not be the same thing as cx at all. Not sure whether we should just suppress the exception on cx, or report it in addition to whatever we do with ReportOnCaller.
Flags: needinfo?(bobbyholley)
Ugh, this stuff is gross. I think we should .TakeOwnershipOfErrorReporting() on these AutoJSAPIs, and let the internal exception in the JSM scope be reported to the browser console, where somebody can look at it if they want more detail on what happened. I'll push a patch to try and see if that breaks anything.
Flags: needinfo?(bobbyholley)
Comment on attachment 8663872 [details] [diff] [review] Take ownership of error reporting in JSM loading. v1 r=me
Attachment #8663872 - Flags: review?(bzbarsky) → review+
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: