Closed Bug 1313050 Opened 8 years ago Closed 8 years ago

Web console dies on logging `new Date(NaN)`

Categories

(DevTools :: Shared Components, defect, P1)

defect

Tracking

(firefox52 verified)

VERIFIED FIXED
Firefox 52
Tracking Status
firefox52 --- verified

People

(Reporter: simon.lindholm10, Assigned: linclark)

References

Details

Attachments

(1 file, 1 obsolete file)

Open the Web Console, enter `new Date(NaN)` (or `new Date("something that doesn't parse")`, which comes up more often in practice). This should show "Date NaN" or "Date <invalid>" or whatever, but instead the console just silently dies and stops printing stuff, and I see the follow error in the web console:

RangeError: invalid date  reps/date-time.js:44:13

Apart from the immediate bug I feel like it would be great to have the web console be more resilient here. Seems like there are lots of opportunities for edge cases of this kind to come up, and getting an alert about an internal web console failure would be a lot better than a blank, dysfunctional console.
Attached patch Bug1313050.patch (obsolete) — Splinter Review
Thanks for filing this.

You're right, it would be better to handle these more gracefully in the web console. I'll create a separate issue for that.
Assignee: nobody → lclark
Status: NEW → ASSIGNED
Attachment #8804766 - Flags: review?(chevobbe.nicolas)
Priority: -- → P1
Comment on attachment 8804766 [details] [diff] [review]
Bug1313050.patch

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

One minor comment, but looks good to me !

::: devtools/client/shared/components/reps/date-time.js
@@ +45,5 @@
>              new Date(grip.preview.timestamp).toISOString()
>            )
> +        );
> +      } catch (e) {
> +        console.error(e);

Do we want to keep this ? I think this could be confusing (for the devtoolers) to have this in the jsconsole/browser toolbox, since we output something.
Attachment #8804766 - Flags: review?(chevobbe.nicolas) → review+
Also, I think this kind of error would be a good candidate to have a [Learn More] link, even if it would require some thinking since this doesn't throw an error.
Thanks for the review. Good point about console.error. I'll remove it. 

The Learn More link idea is interesting. It would probably end up being a larger project (figuring out the classes of things besides errors that we want to add that for), so might be a good fit for after the console rewrite is done.
Attached patch Bug1313050.patchSplinter Review
Attachment #8804766 - Attachment is obsolete: true
Attachment #8804805 - Flags: review+
Comment on attachment 8804805 [details] [diff] [review]
Bug1313050.patch

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

All good!
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6ab0347c0213
Handle invalid dates in reps. r=nchevobbe
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/6ab0347c0213
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 52
I have reproduced this bug with Nightly 52.0a1 (2016-10-26) (64-bit) on Windows 7, 64 Bit !

This bug's fix is verified with latest Nightly

Build ID    20161109030210
User Agent  Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0

[bugday-20161109]
Status: RESOLVED → VERIFIED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: