Closed Bug 1244265 Opened 8 years ago Closed 8 years ago

JSON Viewer: save button does nothing

Categories

(DevTools :: JSON Viewer, defect)

defect
Not set
normal

Tracking

(firefox49 fixed)

RESOLVED FIXED
Firefox 49
Tracking Status
firefox49 --- fixed

People

(Reporter: clarkbw, Assigned: davidwalsh)

References

Details

Attachments

(1 file, 2 obsolete files)

via bug 1223143 comment 7

> - The Save buttons (in the JSON and Raw Data tabs) don’t seem to work.

Maybe we should drop the save button?  It either has to work or we need to get rid of it.
Blocks: 1243951
https://reviewboard.mozilla.org/r/46795/#review43367

Could you advise on any standards I've missed?  I also didn't include a test -- let me know if you have ideas for a good way to test the save dialog opening and closing.
Comment on attachment 8741858 [details]
MozReview Request: Bug 1244265 - Show file prompt upon save button click. r?Honza

https://reviewboard.mozilla.org/r/46795/#review43751

Thanks for looking at this!

Honza

::: devtools/client/jsonview/main.js:6
(Diff revision 1)
>  /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
>  /* This Source Code Form is subject to the terms of the Mozilla Public
>   * License, v. 2.0. If a copy of the MPL was not distributed with this
>   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
> -/* globals JsonViewUtils*/
>  

We need the comment to avoid eslint warning about not defined global

::: devtools/client/jsonview/main.js:20
(Diff revision 1)
> +                               "devtools/client/jsonview/utils");
> +
>  XPCOMUtils.defineLazyGetter(this, "JsonViewService", function() {
>    return require("devtools/client/jsonview/utils");
>  });
>  

So, the only thing that needs to be fixed here is replacing the:

XPCOMUtils.defineLazyGetter(this, "JsonViewService", function() {

with:

XPCOMUtils.defineLazyGetter(this, "JsonViewUtils", function() {

... and all should be good.
(it was a typo)

Honza
Comment on attachment 8741858 [details]
MozReview Request: Bug 1244265 - Show file prompt upon save button click. r?Honza

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/46795/diff/1-2/
Attachment #8741858 - Flags: review?(odvarko)
Ahh, OK, cool.  Updated!
(In reply to David Walsh :davidwalsh from comment #2)
> https://reviewboard.mozilla.org/r/46795/#review43367
> 
> Could you advise on any standards I've missed?  I also didn't include a test
> -- let me know if you have ideas for a good way to test the save dialog
> opening and closing.
Some of those might be useful:
https://dxr.mozilla.org/mozilla-central/search?q=path%3Asave%20path%3Abrowser%20path%3Atest&case=true

Honza
Comment on attachment 8741858 [details]
MozReview Request: Bug 1244265 - Show file prompt upon save button click. r?Honza

https://reviewboard.mozilla.org/r/46795/#review43759

Thanks!

Honza
Attachment #8741858 - Flags: review?(odvarko) → review+
Keywords: checkin-needed
It'd be nice to have a test for this, so this bug doesn't happen again.
sorry had to back this out in  https://treeherder.mozilla.org/#/jobs?repo=fx-team&revision=f0210b36ff71 since of this patches caused a bustage like :

https://hg.mozilla.org/integration/fx-team/rev/ee2fff382352d57eeb2c7b5ae35c8eaa254e486e

seems the error is ==============================
 05:54:52     INFO -  The error occurred while processing the following file or one of the files it includes:
 05:54:52     INFO -      /builds/slave/fx-team-m64-000000000000000000/build/src/devtools/client/jsonview/css/moz.build
 05:54:52     INFO -  The error occurred when validating the result of the execution. The reported error is:
 05:54:52     INFO -      File listed in FINAL_TARGET_FILES does not exist: /builds/slave/fx-team-m64-000000000000000000/build/src/devtools/client/jsonview/css/twisty-closed.svg
 05:54:52     INFO -  *** Fix above errors and then restart with               "/usr/bin/make -f client.mk build"
05:54:52 INFO - make[3]: *** [conf
Flags: needinfo?(dwalsh)
Attachment #8741858 - Attachment is obsolete: true
Attachment #8745373 - Attachment is obsolete: true
Attachment #8745373 - Flags: review?(odvarko)
Updated to include test!
Flags: needinfo?(dwalsh)
Attachment #8745406 - Flags: review?(odvarko)
Looks good to me!

The only thing needed is fixing eslint errors.

@pbro: is it ok to put new `MockFilePicker` global into devtools/.eslint.mochitest file?

Honza
Flags: needinfo?(pbrosset)
In fact it would be better to use
let MockFilePicker = SpecialPowers.MockFilePicker;

because SpecialPowers is already a defined global in our browser mochitest config.
(note that the devtools mochitest config only adds a few things, but mostly extends from testing/mochitest/browser.eslintrc: https://dxr.mozilla.org/mozilla-central/source/testing/mochitest/browser.eslintrc )
Flags: needinfo?(pbrosset)
@pbro: thanks!

@davidwalsh: Please add `let MockFilePicker = SpecialPowers.MockFilePicker;` into the test file and I'll r+.

Honza
Flags: needinfo?(dwalsh)
(In reply to Jan Honza Odvarko [:Honza] from comment #17)
> @pbro: thanks!
> 
> @davidwalsh: Please add `let MockFilePicker = SpecialPowers.MockFilePicker;`
> into the test file and I'll r+.
> 
> Honza

Better yet, with destructuring:
let {MockFilePicker} = SpecialPowers;
Comment on attachment 8745406 [details]
MozReview Request: Bug 1244265 - Show file picker when save button clicked within the JSONView component

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/49029/diff/1-2/
Attachment #8745406 - Flags: review?(odvarko)
Updated as requested; please confirm everything is as it should be.  Thank you!
Flags: needinfo?(dwalsh)
Attachment #8745406 - Flags: review?(odvarko)
Comment on attachment 8745406 [details]
MozReview Request: Bug 1244265 - Show file picker when save button clicked within the JSONView component

https://reviewboard.mozilla.org/r/49029/#review46287

Great job here, thanks!

Honza
Attachment #8745406 - Flags: review?(odvarko) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/cfbf0743aefd
https://hg.mozilla.org/mozilla-central/rev/f7bb3675bb71
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 49
Assignee: nobody → dwalsh
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: