Closed Bug 1070719 Opened 10 years ago Closed 9 years ago

Auto save all files on press "Play"

Categories

(DevTools Graveyard :: WebIDE, defect)

x86
macOS
defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
Firefox 44
Tracking Status
firefox44 --- fixed

People

(Reporter: andre.fiedler, Assigned: rrocik)

Details

Attachments

(1 file, 5 obsolete files)

If I press the "Play" button, all unsaved files should be saved before they get pushed to the device.
I think that makes sense. I keep forgetting about saving my files.
Jen, this bug may be a good way to learn about the editor portion of WebIDE.
Assignee: nobody → jfong
Whiteboard: [good first bug]
Whiteboard: [good first bug]
I don't believe Jen is currently working on this.
Assignee: jfong → nobody
I have made such a tweak for myself already. Can someone assign me to this bug while I prepare the patch? Thanks.
(In reply to rrocik from comment #4) > I have made such a tweak for myself already. Can someone assign me to this > bug while I prepare the patch? Thanks. Typically for new contributors, we'll wait for the first patch to be attached before assigning. Feel free to begin working on it!
Attached patch bug1070719_autosavefiles.patch (obsolete) — Splinter Review
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #5) > Typically for new contributors, we'll wait for the first patch to be > attached before assigning. Feel free to begin working on it! Oh I didn't know it works that way. I must have overlooked something. There is a checkbox in properies. The other thing is "validateAndUpdateProject" will be called as many times as there are files to save, it sounds like a small performance flaw.
Attachment #8651125 - Flags: review?(jryans)
(In reply to Rocik from comment #6) > Created attachment 8651125 [details] [diff] [review] > bug1070719_autosavefiles.patch > > (In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #5) > > Typically for new contributors, we'll wait for the first patch to be > > attached before assigning. Feel free to begin working on it! > > Oh I didn't know it works that way. I must have overlooked something. I think this is just a recent quirk that may not be written down, so no worries! Also, it may be different per team, so that makes it extra confusing. Anyway, I've just updated the "How to Submit a Patch" page[1] to note that some teams do this. I'll review your patch soon! [1]: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/How_to_Submit_a_Patch#Preparation
I noticed my editor used tabs instead of spaces, also there is no longer needed if statement. Should I submit a new patch?
(In reply to Rocik from comment #8) > I noticed my editor used tabs instead of spaces, also there is no longer > needed if statement. Should I submit a new patch? Yes, please do! You can mark the current one as "obsolete" when uploading, and request a new review on the new patch.
Attached patch bug1070719_autosavefiles.patch (obsolete) — Splinter Review
Attachment #8651125 - Attachment is obsolete: true
Attachment #8651125 - Flags: review?(jryans)
Attachment #8651914 - Flags: review?(jryans)
Comment on attachment 8651914 [details] [diff] [review] bug1070719_autosavefiles.patch Review of attachment 8651914 [details] [diff] [review]: ----------------------------------------------------------------- Looks like your patch commit message has a typo "Autsave". Also, please add "r=jryans" to the end of the message. About "validateAndUpdateProject", you're right it would be best to skip doing that for each file. For the moment, I would guess it's not a big issue, as you're unlikely to have a large set of edited files. In my testing, there was a larger issue though. Here's what I saw: 1. Edit file A 2. Edit file B 3. Press play 4. Contents of file A is saved to both A and B Are you able to reproduce this? ::: browser/devtools/projecteditor/lib/projecteditor.js @@ +760,5 @@ > } > > return true; > + }, > + Nit: Trailing whitespace, you may need to change some editor settings to remove it ::: browser/devtools/webide/content/webide.js @@ +1174,5 @@ > let busy; > switch(AppManager.selectedProject.type) { > case "packaged": > + > + let autosave = Services.prefs.getBoolPref("devtools.webide.autosavefiles"); Nit: There might be tabs here @@ +1175,5 @@ > switch(AppManager.selectedProject.type) { > case "packaged": > + > + let autosave = Services.prefs.getBoolPref("devtools.webide.autosavefiles"); > + if (autosave && UI.projecteditor) { Nit: There might be tabs here ::: browser/devtools/webide/webide-prefs.js @@ +32,5 @@ > #endif > pref("devtools.webide.zoom", "1"); > pref("devtools.webide.busyTimeout", 10000); > pref("devtools.webide.sidebars", false); > +pref("devtools.webide.autosavefiles", false); Do you think most users would want this feature on by default? Nit: We seem to be using variable-style casing in pref names so, let's change "autosavefiles" -> "autosaveFiles" ::: browser/locales/en-US/chrome/browser/devtools/webide.dtd @@ +136,5 @@ > <!ENTITY prefs_options_autoclosebrackets_tooltip "Automatically insert closing brackets"> > <!ENTITY prefs_options_keybindings "Keybindings"> > <!ENTITY prefs_options_keybindings_default "Default"> > +<!ENTITY prefs_options_autosavefiles "Autosave files"> > +<!ENTITY prefs_options_autosavefiles_tooltip "Automatically save progress before running project"> Nit: Let's change "progress" to "edited files"
Attachment #8651914 - Flags: review?(jryans)
Assignee: nobody → rrocik
Status: NEW → ASSIGNED
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #11) > In my testing, there was a larger issue though. Here's what I saw: > > 1. Edit file A > 2. Edit file B > 3. Press play > 4. Contents of file A is saved to both A and B > > Are you able to reproduce this? I had such issues without: let editor = this.editorFor(resource); It worked fine, and still is (checked with latest changes). I'm using the fx-team repo so I think our builds should be the same, am I wrong? Maybe you took some other steps I am not checking.
(In reply to Rocik from comment #12) > (In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #11) > > In my testing, there was a larger issue though. Here's what I saw: > > > > 1. Edit file A > > 2. Edit file B > > 3. Press play > > 4. Contents of file A is saved to both A and B > > > > Are you able to reproduce this? > > I had such issues without: let editor = this.editorFor(resource); > It worked fine, and still is (checked with latest changes). > I'm using the fx-team repo so I think our builds should be the same, am I > wrong? > Maybe you took some other steps I am not checking. Hmm, I should be seeing the same thing as you after applying the patch... I'll leave a ni? for myself to investigate later. If you can figure out details in the mean time, leave a comment!
Flags: needinfo?(jryans)
It may be a little while before I am able to investigate this more deeply. Keeping ni? until then.
I checked this in many various ways, whatever I could think of and it's still working. So take you time. If you'll get some clues why it does happen, let me know.
I spent some more time on this today, but still wasn't able to fix the problem. I'll attach an updated patch and ask for some help.
Flags: needinfo?(jryans)
Attached patch auto-save-files (obsolete) — Splinter Review
:bgrins, I am hoping you can help me figure out what's wrong here. Maybe it's something obvious. This patch **almost** works for saving all unsaved files, but has a major flaw: 1. Edit file A 2. Edit file B 3. Press play 4. Contents of file A is saved to both A and B (verify file content from terminal, not WebIDE) I thought that using a task to wait for file A to finish (even it doesn't seem like it should be required) would be enough to fix it, but the problem still occurs. Before I added the tasks, sometimes I would see the concatenated context of A + B written to both files. I started tracing down into OS.File, and it seems like things are happening as expected. It's passing around the correct data for each file separately.
Attachment #8651914 - Attachment is obsolete: true
Attachment #8669950 - Flags: feedback?(bgrinstead)
Attached patch auto-save-files (obsolete) — Splinter Review
Updated to enable the saving feature by default.
Attachment #8669955 - Flags: feedback?(bgrinstead)
Attachment #8669950 - Attachment is obsolete: true
Attachment #8669950 - Flags: feedback?(bgrinstead)
Attached patch projecteditor-saveall.patch (obsolete) — Splinter Review
I couldn't reproduce the issue in Comment 17 either when running in WebIDE or in a test case (which I've written and included in this patch)
Comment on attachment 8669955 [details] [diff] [review] auto-save-files Review of attachment 8669955 [details] [diff] [review]: ----------------------------------------------------------------- Does the test in Attachment 8670494 [details] [diff] fail for you?
Attachment #8669955 - Flags: feedback?(bgrinstead)
(In reply to Brian Grinstead [:bgrins] from comment #20) > Does the test in Attachment 8670494 [details] [diff] fail for you? The test passes... I finally figured out what was wrong. It was specific to the app I happened to test. It's a random test app full of junk that's accumulated. And... out of the two files I would make changes to when testing, one was a symlink to the other! x_x So, we should basically be good to go here. I think I may revert my changes to serialize the file saving, since that will just make it slower for no reason.
That's good to hear. If you'd like I can send the revised patch, but not until tomorrow. I have it on my second computer.
(In reply to Rocik from comment #22) > That's good to hear. If you'd like I can send the revised patch, but not > until tomorrow. I have it on my second computer. It might be simpler at this stage to adapt from :bgrins patch, since he's added a test and such. I'll make sure to set the author to you since you started the whole effort!
Hmm, I think we do actually want the tasks in there, to ensure the files are saved before pushing the app. So, I guess I'll update the author on the one with a test and mark it r+.
Rocik, thanks again for working on this! I'm sorry it took me so long to find out why it was behaving strangely for me. If you're interested in working on some more bugs, check out http://firefox-dev.tools/ for some more that would be good to take a look at. A sheriff will resolve this bug once it moves to mozilla-central.
This site is great. Way better than the other ones, thanks for letting me know.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 44
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: