Chromium Code Reviews| Index: Source/devtools/front_end/UISourceCode.js |
| diff --git a/Source/devtools/front_end/UISourceCode.js b/Source/devtools/front_end/UISourceCode.js |
| index cf07f0b58f762dd85a315565698ee9922fe0bdbd..b9160e1ac1046b32e246d8e4e8ebe2fb374d285a 100644 |
| --- a/Source/devtools/front_end/UISourceCode.js |
| +++ b/Source/devtools/front_end/UISourceCode.js |
| @@ -266,10 +266,15 @@ WebInspector.UISourceCode.prototype = { |
| */ |
| checkContentUpdated: function(callback) |
| { |
| - if (!this._project.canSetFileContent()) |
| + callback = callback || function() {}; |
| + if (!this._project.canSetFileContent()) { |
| + callback(); |
| return; |
| - if (this._checkingContent) |
| + } |
| + if (this._checkingContent) { |
| + callback(); |
|
vsevik
2014/04/01 09:10:20
This one is actually incorrect, I don't think we s
apavlov
2014/04/01 09:12:25
That's why I initially had a boolean callback argu
|
| return; |
| + } |
| this._checkingContent = true; |
| this._project.requestFileContent(this, contentLoaded.bind(this)); |
| @@ -284,29 +289,25 @@ WebInspector.UISourceCode.prototype = { |
| this._commitContent("", false); |
| this.setWorkingCopy(workingCopy); |
| delete this._checkingContent; |
| - if (callback) |
| - callback(); |
| + callback(); |
| return; |
| } |
| if (typeof this._lastAcceptedContent === "string" && this._lastAcceptedContent === updatedContent) { |
| delete this._checkingContent; |
| - if (callback) |
| - callback(); |
| + callback(); |
| return; |
| } |
| if (this._content === updatedContent) { |
| delete this._lastAcceptedContent; |
| delete this._checkingContent; |
| - if (callback) |
| - callback(); |
| + callback(); |
| return; |
| } |
| if (!this.isDirty()) { |
| this._commitContent(updatedContent, false); |
| delete this._checkingContent; |
| - if (callback) |
| - callback(); |
| + callback(); |
| return; |
| } |
| @@ -316,8 +317,7 @@ WebInspector.UISourceCode.prototype = { |
| else |
| this._lastAcceptedContent = updatedContent; |
| delete this._checkingContent; |
| - if (callback) |
| - callback(); |
| + callback(); |
| } |
| }, |