Skip to content

Commit

Permalink
Bug 1346662 - do not revert original text after saving; r=gl
Browse files Browse the repository at this point in the history
When saving an original style sheet, arrange not to reload the text
from the OriginalSourceActor afterward.  The actor will serve stale
text, but the editor knows better already.

MozReview-Commit-ID: BcMaSSB1uhA

--HG--
extra : rebase_source : 5023f67d17d1702dcd4b1c8fb13562e08d115b18
  • Loading branch information
tromey committed Sep 13, 2017
1 parent d9ca0b6 commit 60120b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions devtools/client/styleeditor/StyleSheetEditor.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ StyleSheetEditor.prototype = {
// We just applied an edit in the editor, so we can drop this
// notification.
this._isUpdating = false;
this.emit("style-applied");
} else if (this.sourceEditor) {
this._getSourceTextAndPrettify().then((newText) => {
this._justSetText = true;
Expand Down Expand Up @@ -742,6 +743,9 @@ StyleSheetEditor.prototype = {
let decoder = new TextDecoder();
let text = decoder.decode(array);

// Ensure we don't re-fetch the text from the original source
// actor when we're notified that the style sheet changed.
this._isUpdating = true;
let relatedSheet = this.styleSheet.relatedStyleSheet;
relatedSheet.update(text, this.transitionsEnabled);
}, this.markLinkedFileBroken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ add_task(function* () {

color = yield getComputedStyleProperty({selector: "div", name: "color"});
is(color, "rgb(0, 0, 255)", "div is blue after saving file");

// Ensure that the editor didn't revert. Bug 1346662.
is(editor.sourceEditor.getText(), CSS_TEXT, "edits remain applied");
});

function editSCSS(editor) {
Expand Down

0 comments on commit 60120b7

Please sign in to comment.