Closed Bug 734666 Opened 12 years ago Closed 10 years ago

Style Editor default filename for saving

Categories

(DevTools :: Style Editor, defect, P2)

11 Branch
defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 29

People

(Reporter: sys.sgx, Assigned: beberveiga)

Details

Attachments

(1 file, 3 obsolete files)

User Agent: Mozilla/5.0 (Windows NT 6.0; rv:11.0) Gecko/20100101 Firefox/11.0
Build ID: 20120309131123

Steps to reproduce:

Open Style Editor.
Click the save button.


Actual results:

There is no default filename.


Expected results:

A default filename could have been suggested, the one of the original css file.
Component: Untriaged → Developer Tools: Style Editor
OS: Windows Vista → All
Priority: -- → P3
Hardware: x86 → All
Priority: P3 → P2
QA Contact: untriaged → developer.tools.style.editor
My first attempt.

There's a code smell and I'm not comfortable with it. "suggestedFilename" is used only when "toSave" is true.

I'll wait your review.

Thank you very much.
Attachment #8344419 - Flags: review?
Comment on attachment 8344419 [details] [diff] [review]
734666-on-save-suggests-the-filename.patch

Rob, would you mind reviewing or finding a reviewer?
Attachment #8344419 - Flags: review? → review?(rcampbell)
Assignee: nobody → contact
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment on attachment 8344419 [details] [diff] [review]
734666-on-save-suggests-the-filename.patch

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

code smell. :)

This looks good William. It should probably have a unit test though I'll leave that for the ultimate reviewer here.

Thanks for the patch!
Attachment #8344419 - Flags: review?(rcampbell) → review?(fayearthur)
Comment on attachment 8344419 [details] [diff] [review]
734666-on-save-suggests-the-filename.patch

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

This is a great change. Looks good except for this one line here:

::: browser/devtools/styleeditor/StyleSheetEditor.jsm
@@ +377,5 @@
>        }.bind(this));
>      };
>  
> +    let osFile = Cu.import("resource://gre/modules/osfile.jsm");
> +    showFilePicker(file || this._styleSheetFilePath, true, this._window, onFile, osFile.OS.Path.basename(this._friendlyName));

This is a long line here, break off like `let defaultName = osFile.OS.Path.basename(this._friendlyName)` to alleviate it.
Attachment #8344419 - Flags: review?(fayearthur) → review+
Comment on attachment 8344419 [details] [diff] [review]
734666-on-save-suggests-the-filename.patch

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

One more thing...

::: browser/devtools/styleeditor/StyleSheetEditor.jsm
@@ +376,5 @@
>          this.sourceEditor.setClean();
>        }.bind(this));
>      };
>  
> +    let osFile = Cu.import("resource://gre/modules/osfile.jsm");

Put this import at the top of the file.
Comment on attachment 8344419 [details] [diff] [review]
734666-on-save-suggests-the-filename.patch

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

Just tried this out. An error occurs when there you try to save an inline style sheet, (try http://google.com, which has a lot of inline sheets). The error is:

System JS : ERROR resource://gre/modules/osfile/ospath_unix.jsm:44 - TypeError: path is undefined

We'll need to fix this, as the error stops the file picker dialog from even showing up.
This patch seems to fix the issues.
Thank you guys!
Attachment #8348394 - Flags: review?(fayearthur)
(In reply to Willian Gustavo Veiga from comment #7)
> Created attachment 8348394 [details] [diff] [review]
> 734666-on-save-suggests-the-filename.patch
> 
> This patch seems to fix the issues.
> Thank you guys!

This patch seems to be based on your previous patch. Can you combine it into one patch?
Attached patch Combined patch (obsolete) — Splinter Review
I went ahead and combined them, and it works great. Try build ongoing: https://tbpl.mozilla.org/?tree=Try&rev=9e6f230e6411
Passed try. Thanks a bunch for the patches, Willian.
Attachment #8355746 - Attachment is obsolete: true
Attachment #8344419 - Attachment is obsolete: true
Attachment #8348394 - Attachment is obsolete: true
Attachment #8348394 - Flags: review?(fayearthur)
https://hg.mozilla.org/mozilla-central/rev/974401cb4866
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 29
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: