Closed Bug 1346662 Opened 3 years ago Closed 2 years ago

Changes made to source-mapped CSS are reverted on save

Categories

(DevTools :: Style Editor, defect, P3)

53 Branch
defect

Tracking

(firefox57 fixed)

RESOLVED FIXED
Firefox 57
Tracking Status
firefox57 --- fixed

People

(Reporter: zzyxpaw, Assigned: tromey)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20170307144106

Steps to reproduce:

1. Set up a directory with an html file + sass stylesheet, with main.css linked into index.html:

.
├── index.html
├── main.css
├── main.css.map
└── scss
    └── main.scss

2. Start sass (or similar) watching for changes to scss/main.scss and regenerating main.css and main.css.map accordingly.

3. View index.html in Firefox through the filesystem (file://)

4. Open up source-mapped sass file in the style editor

5. Make a change and save it


Actual results:

Firefox correctly live-reloaded the rendered page to reflect the changes, then after about a second, reverted the changes in the style editor without updating the page.

Leaving me with my changes reflected in the rendered page, but the unchanged scss in the style editor.

Undoing brought back my changes, putting the style editor back in sync with the page.


Expected results:

Firefox should not revert changes after saving.
Component: Untriaged → Developer Tools: Style Editor
Inspector bug triage (filter on CLIMBING SHOES).
Priority: -- → P3
Status: UNCONFIRMED → NEW
Ever confirmed: true
The style editor calls the sheet actor's update method:

https://dxr.mozilla.org/mozilla-central/rev/f9a5e9ed62103c84e4cde915f4d08f1ce71be83e/devtools/server/actors/stylesheets.js#715

However, this doesn't clear out the existing source map info,
so eventually the style editor gets stale text for the original source.

It's possible to clear the source maps in |update| but I wonder what effect
that will have when, say, as-authored editing a rule.
Though probably that is already kind of broken when source maps are present.
Not only did that not work, it's also too complicated - it seems to suffice to set _isUpdating
in updateLinkedStyleSheet
Assignee: nobody → ttromey
Comment on attachment 8907750 [details]
Bug 1346662 - do not revert original text after saving;

https://reviewboard.mozilla.org/r/179420/#review184636
Attachment #8907750 - Flags: review?(gl) → review+
Pushed by ttromey@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/270740992bc6
do not revert original text after saving; r=gl
https://hg.mozilla.org/mozilla-central/rev/270740992bc6
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 57
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.