Closed Bug 1216682 Opened 9 years ago Closed 9 years ago

Weird callback to Array.prototype.some reports an "error" in self-hosted code

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
firefox44 --- affected

People

(Reporter: jruderman, Unassigned)

References

Details

Attachments

(1 file)

Attached file testcase
The testcase gets an exception: [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: self-hosted :: some :: line 192" data: no] I'm not sure this is "wrong", but it tripped my fuzzer's heuristic that errors containing the string "self-hosted" are usually bugs. Should I keep that heuristic?
The string is created by some error handling mechanism on the Gecko side. That probably uses the wrong kind of frame iter to find the topmost content code on the stack. I'll look into it.
Flags: needinfo?(till)
This ends up landing in Exception::Exception which does GetCurrentJSStack() which does JS::CaptureCurrentStack. This last very intentionally includes self-hosted frames, I've been told. See bug 1173638 comment 1, bug 1173638 comment 3, bug 1173638 comment 6. Then later we end up in Exception::ToString, which calls StackFrame::ToString to produce that part of the string. This calls GetFileName, which calls JS::GetSavedFrameSource which happily produces the topmost filename on the stack, which is the selfhosted code. You can get there with a conceptually simpler testcase too, that doesn't even involve the weird Exception::Exception but the more prosaic and spec-required DOMException. Try this in your console: try { [1].some(document.querySelector.bind(document, ":::")) } catch (e) { console.log(e.filename) } Anyway, we would have this problem for Error as well, if it were not for the JS_ReportWhatever insanity; again see bug 1173638. If JSAPI gave me a way to do JS::GetSavedFrameSource and company but skip self-hosted frames, I would totally be doing that in Gecko's StackFrame code.
(In reply to Boris Zbarsky [:bz] from comment #2) > If JSAPI gave me a way to do JS::GetSavedFrameSource and company but skip > self-hosted frames, I would totally be doing that in Gecko's StackFrame code. I can whip up a patch.
I believe bug 1216819 fixed this.
(In reply to Boris Zbarsky [:bz] from comment #4) > I believe bug 1216819 fixed this. Yup.
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: needinfo?(till)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: