Closed Bug 1256364 Opened 8 years ago Closed 8 years ago

Make SimpleTest's window.onerror actually report the stack for the exception

Categories

(Testing :: Mochitest, defect)

defect
Not set
normal

Tracking

(firefox48 fixed)

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file)

What bug 511888 should have been, but I'm not sure we had the core bits in place then.
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8730272 [details] [diff] [review]
If we have an exception stack in the onerror handler in SimpleTest, include it in the error message

Review of attachment 8730272 [details] [diff] [review]:
-----------------------------------------------------------------

these changes are just fine, but I am not sure how the onerror handler will get column and exception parameters.  Please explain that and I will be fine with a r+.

::: testing/mochitest/tests/SimpleTest/SimpleTest.js
@@ +1527,5 @@
>  var info = SimpleTest.info;
>  
>  var gOldOnError = window.onerror;
> +window.onerror = function simpletestOnerror(errorMsg, url, lineNumber,
> +                                            columnNumber, originalException) {

will we have columnNumber and originalException?
Attachment #8730272 - Flags: review?(jmaher) → review-
> but I am not sure how the onerror handler will get column and exception parameters.  

They're always passed to the onerror handler.  See https://html.spec.whatwg.org/multipage/webappapis.html#the-event-handler-processing-algorithm step 3, which will be reached from https://html.spec.whatwg.org/multipage/webappapis.html#report-the-error step 13.  Steps 11 and 12 of this last algorithm are what set up the state on the ErrorEvent for the first algorithm to grab from there.

Alternately, see https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror or I can link you to the relevant part of our source.  ;)

Or did you want the explanation in a comment SimpleTest.js?
Flags: needinfo?(jmaher)
Comment on attachment 8730272 [details] [diff] [review]
If we have an exception stack in the onerror handler in SimpleTest, include it in the error message

thanks for explaining that :bz.  I think having this discoverable from a commit message -> bug comments is enough if we have questions in the future.
Flags: needinfo?(jmaher)
Attachment #8730272 - Flags: review- → review+
https://hg.mozilla.org/mozilla-central/rev/dca912a377ea
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: