Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js |
| index cf37c6908f6b4a280c0fc50018b39e95c141d596..303a7a0301676d79b9a1608297cd67971c59233a 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/workspace/UISourceCode.js |
| @@ -75,6 +75,7 @@ Workspace.UISourceCode = class extends Common.Object { |
| this._workingCopy = null; |
| /** @type {?function() : string} */ |
| this._workingCopyGetter = null; |
| + this._mightHaveChanges = false; |
| } |
| /** |
| @@ -318,6 +319,7 @@ Workspace.UISourceCode = class extends Common.Object { |
| if (!lastRevision || lastRevision._content !== this._content) { |
| var revision = new Workspace.Revision(this, this._content, new Date()); |
| this._history.push(revision); |
| + this.mightHaveChanges = true; |
|
lushnikov
2017/02/14 00:05:11
let's not have this
|
| } |
| this._innerResetWorkingCopy(); |
| @@ -331,6 +333,15 @@ Workspace.UISourceCode = class extends Common.Object { |
| } |
| } |
| + /** |
| + * @return {!Promise<boolean>} |
| + */ |
| + hasChanges() { |
| + if (!this.mightHaveChanges) |
|
lushnikov
2017/02/14 00:05:11
hasChanges => this.isDirty() || !!this._history.le
|
| + return Promise.resolve(false); |
| + return this.requestOriginalContent().then(content => this.mightHaveChanges = content !== this.workingCopy()); |
| + } |
| + |
| saveAs() { |
| Workspace.fileManager.save(this._url, this.workingCopy(), true, callback.bind(this)); |
| Workspace.fileManager.close(this._url); |
| @@ -442,6 +453,7 @@ Workspace.UISourceCode = class extends Common.Object { |
| } |
| _workingCopyChanged() { |
| + this.mightHaveChanges = true; |
| this._removeAllMessages(); |
| this.dispatchEventToListeners(Workspace.UISourceCode.Events.WorkingCopyChanged, this); |
| this._project.workspace().dispatchEventToListeners( |