Closed Bug 1066101 Opened 10 years ago Closed 10 years ago

Responsive Design View uses incorrect dates in screenshot filename

Categories

(DevTools :: Responsive Design Mode, defect)

32 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 35

People

(Reporter: chris, Assigned: chris)

Details

Attachments

(1 file, 2 obsolete files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:32.0) Gecko/20100101 Firefox/32.0
Build ID: 20140825202822

Steps to reproduce:

Open the responsive design view
Click on the screenshot button


Actual results:

The filename used a date 6 days in the past: 

"Screen Shot 2014-09-05 at 10.50.46"


Expected results:

It should have used the current date, as the new full-page screenshot does:

"Screen Shot 2014-09-11 at 10.50.46"
JavaScript Date() API horribleness strikes again:

http://dxr.mozilla.org/mozilla-central/source/browser/devtools/responsivedesign/responsivedesign.jsm#775

      let day = ("0" + (date.getDay() + 1)).substr(-2, 2);

getDay() actually returns the day of the week. That should be:

      let day = ("0" + (date.getDate())).substr(-2, 2);
Component: Untriaged → Developer Tools: Responsive Mode
Awesome, thanks for the patch! Let me find someone who can review this for you... :-)
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Mac OS X → All
Hardware: x86 → All
Comment on attachment 8487975 [details] [diff] [review]
Use getDate() instead of getDay() in generated filename

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

Mike, you reviewed the original code here, so... :-)
Attachment #8487975 - Flags: review?(mratcliffe)
Comment on attachment 8487975 [details] [diff] [review]
Use getDate() instead of getDay() in generated filename

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

Thanks for the patch!

The change looks good to me.  However, could you attach an updated one with the right commit message format[1]?

Flag me for review? again on the new patch, and then I'll push it to Try to run tests.

[1]: https://developer.mozilla.org/en-US/docs/Mercurial_FAQ#How_can_I_generate_a_patch_for_somebody_else_to_check-in_for_me.3F
Attachment #8487975 - Flags: review?(mratcliffe) → review+
Assignee: nobody → chris
Status: NEW → ASSIGNED
Attached patch fix-screenshot-filename.patch (obsolete) — Splinter Review
Reformatted to follow https://developer.mozilla.org/en-US/docs/Mercurial_FAQ#Commit_Message_Conventions more closely
Attachment #8487975 - Attachment is obsolete: true
Flags: needinfo?(chris)
I just uploaded a version with what appears to be the right format. Please let me know if there's something I missed.
Comment on attachment 8490084 [details] [diff] [review]
fix-screenshot-filename.patch

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

One thing to fix.  Be sure to set "review?" to my email address next time to be sure I am notified of your new patch version.

::: browser/devtools/responsivedesign/responsivedesign.jsm
@@ +769,5 @@
>      let filename = aFileName;
>      if (!filename) {
>        let date = new Date();
>        let month = ("0" + (date.getMonth() + 1)).substr(-2, 2);
> +      let day = ("0" + (date.getDate()).substr(-2, 2);

I didn't notice late time around... but you now have unbalanced parentheses.  Changing "(date" to "date" seems like the right fix.
Attachment #8490084 - Attachment is obsolete: true
Attachment #8490247 - Flags: review?(jryans)
(In reply to J. Ryan Stinnett [:jryans] from comment #8)
> I didn't notice late time around... but you now have unbalanced parentheses.
> Changing "(date" to "date" seems like the right fix.

Sorry about that, I'd corrected that locally but made the mistake of using a local commit rather than updating the patch queue. I just uploaded a corrected version.
Comment on attachment 8490247 [details] [diff] [review]
fix-screenshot-filename.patch

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

No worries, looks good now!

Even though this seems like a pretty safe change, I'll push this to our test suite now to make sure.

If everything looks green there, you can then set this bug's keyword field to "checkin-needed" and someone will land your patch for you.

Try: https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=013fe95e2de6
Attachment #8490247 - Flags: review?(jryans) → review+
Tests look green, marking for checkin.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/2170a92dad71
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 35
Thanks again for the fix!  Take a look at our other mentored bugs[1] if you'd like to work on some more.

[1]: https://wiki.mozilla.org/DevTools/GetInvolved#Mentored_and_Good_First_Bugs
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: