- Revision
- 145543
- Author
- vse...@chromium.org
- Date
- 2013-03-12 07:53:30 -0700 (Tue, 12 Mar 2013)
Log Message
Web Inspector: Fix checkContentUpdated behavior in UISourceCode.
https://bugs.webkit.org/show_bug.cgi?id=112037
Reviewed by Alexander Pavlov.
UISourceCode.checkContentUpdated now saves last updated content that was loaded and rejected
by user on the per-file basis (only the last one was saved currently).
* inspector/front-end/FileSystemProjectDelegate.js:
(WebInspector.FileSystemProjectDelegate.prototype.innerCallback):
(WebInspector.FileSystemProjectDelegate.prototype.requestFileContent):
(WebInspector.FileSystemProjectDelegate.prototype.canSetFileContent):
(WebInspector.FileSystemWorkspaceProvider.prototype._fileSystemAdded):
* inspector/front-end/SimpleWorkspaceProvider.js:
(WebInspector.SimpleProjectDelegate.prototype.canSetFileContent):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCode.prototype.checkContentUpdated.contentLoaded):
(WebInspector.UISourceCode.prototype.checkContentUpdated):
(WebInspector.UISourceCode.prototype._commitContent):
(WebInspector.UISourceCode.prototype.addRevision):
(WebInspector.UISourceCode.prototype.commitWorkingCopy):
* inspector/front-end/Workspace.js:
(WebInspector.ProjectDelegate.prototype.canSetFileContent):
(WebInspector.Project.prototype.canSetFileContent):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (145542 => 145543)
--- trunk/Source/WebCore/ChangeLog 2013-03-12 14:51:19 UTC (rev 145542)
+++ trunk/Source/WebCore/ChangeLog 2013-03-12 14:53:30 UTC (rev 145543)
@@ -1,3 +1,30 @@
+2013-03-12 Vsevolod Vlasov <vse...@chromium.org>
+
+ Web Inspector: Fix checkContentUpdated behavior in UISourceCode.
+ https://bugs.webkit.org/show_bug.cgi?id=112037
+
+ Reviewed by Alexander Pavlov.
+
+ UISourceCode.checkContentUpdated now saves last updated content that was loaded and rejected
+ by user on the per-file basis (only the last one was saved currently).
+
+ * inspector/front-end/FileSystemProjectDelegate.js:
+ (WebInspector.FileSystemProjectDelegate.prototype.innerCallback):
+ (WebInspector.FileSystemProjectDelegate.prototype.requestFileContent):
+ (WebInspector.FileSystemProjectDelegate.prototype.canSetFileContent):
+ (WebInspector.FileSystemWorkspaceProvider.prototype._fileSystemAdded):
+ * inspector/front-end/SimpleWorkspaceProvider.js:
+ (WebInspector.SimpleProjectDelegate.prototype.canSetFileContent):
+ * inspector/front-end/UISourceCode.js:
+ (WebInspector.UISourceCode.prototype.checkContentUpdated.contentLoaded):
+ (WebInspector.UISourceCode.prototype.checkContentUpdated):
+ (WebInspector.UISourceCode.prototype._commitContent):
+ (WebInspector.UISourceCode.prototype.addRevision):
+ (WebInspector.UISourceCode.prototype.commitWorkingCopy):
+ * inspector/front-end/Workspace.js:
+ (WebInspector.ProjectDelegate.prototype.canSetFileContent):
+ (WebInspector.Project.prototype.canSetFileContent):
+
2013-03-12 Tomas Popela <tpop...@redhat.com>
[Gtk] NBSP are not replaced when using X clipboard
Modified: trunk/Source/WebCore/inspector/front-end/FileSystemProjectDelegate.js (145542 => 145543)
--- trunk/Source/WebCore/inspector/front-end/FileSystemProjectDelegate.js 2013-03-12 14:51:19 UTC (rev 145542)
+++ trunk/Source/WebCore/inspector/front-end/FileSystemProjectDelegate.js 2013-03-12 14:53:30 UTC (rev 145543)
@@ -104,47 +104,21 @@
*/
function innerCallback(content)
{
- this._contentRequestFinished(path, content);
var contentType = this._contentTypeForPath(path);
callback(content, false, contentType.canonicalMimeType());
}
},
/**
- * @param {Array.<string>} path
- * @param {string} content
+ * @return {boolean}
*/
- _contentRequestFinished: function(path, content)
+ canSetFileContent: function()
{
- this._lastContentRequestPath = path;
- this._lastContentRequestContent = content;
+ return true;
},
/**
* @param {Array.<string>} path
- * @param {string} currentContent
- * @param {function(?string)} callback
- */
- requestUpdatedFileContent: function(path, currentContent, callback)
- {
- var filePath = this._filePathForPath(path);
- this._fileSystem.requestFileContent(filePath, innerCallback.bind(this));
-
- /**
- * @param {?string} content
- */
- function innerCallback(content)
- {
- var previousContent = this._lastContentRequestPath === path ? this._lastContentRequestContent : null;
- if (typeof previousContent !== "string")
- previousContent = currentContent;
- this._contentRequestFinished(path, content);
- callback(content !== previousContent ? content : null);
- }
- },
-
- /**
- * @param {Array.<string>} path
* @param {string} newContent
* @param {function(?string)} callback
*/
@@ -269,7 +243,7 @@
var projectId = WebInspector.FileSystemProjectDelegate.projectId(fileSystem.path());
var projectDelegate = new WebInspector.FileSystemProjectDelegate(fileSystem, this._workspace)
this._simpleProjectDelegates[projectDelegate.id()] = projectDelegate;
- console.assert(!projectDelegate.id());
+ console.assert(!this._workspace.project(projectDelegate.id()));
this._workspace.addProject(projectDelegate);
projectDelegate.populate();
},
Modified: trunk/Source/WebCore/inspector/front-end/SimpleWorkspaceProvider.js (145542 => 145543)
--- trunk/Source/WebCore/inspector/front-end/SimpleWorkspaceProvider.js 2013-03-12 14:51:19 UTC (rev 145542)
+++ trunk/Source/WebCore/inspector/front-end/SimpleWorkspaceProvider.js 2013-03-12 14:53:30 UTC (rev 145543)
@@ -98,13 +98,11 @@
},
/**
- * @param {Array.<string>} path
- * @param {string} currentContent
- * @param {function(?string)} callback
+ * @return {boolean}
*/
- requestUpdatedFileContent: function(path, currentContent, callback)
+ canSetFileContent: function()
{
- callback(null);
+ return false;
},
/**
Modified: trunk/Source/WebCore/inspector/front-end/UISourceCode.js (145542 => 145543)
--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js 2013-03-12 14:51:19 UTC (rev 145542)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js 2013-03-12 14:53:30 UTC (rev 145543)
@@ -216,21 +216,36 @@
checkContentUpdated: function()
{
- this._project.requestUpdatedFileContent(this, updatedContentLoaded.bind(this));
+ if (!this._project.canSetFileContent())
+ return;
+ if (this._checkingContent)
+ return;
+ this._checkingContent = true;
+ this._project.requestFileContent(this, contentLoaded.bind(this));
- function updatedContentLoaded(updatedContent)
+ function contentLoaded(updatedContent)
{
- if (typeof updatedContent !== "string")
+ if (typeof this._lastAcceptedContent === "string" && this._lastAcceptedContent === updatedContent) {
+ delete this._checkingContent;
return;
+ }
+ if (this._content === updatedContent) {
+ delete this._checkingContent;
+ return;
+ }
if (!this.isDirty()) {
- this.addRevision(updatedContent);
+ this._commitContent(updatedContent, false);
+ delete this._checkingContent;
return;
}
var shouldUpdate = window.confirm(WebInspector.UIString("This file was changed externally. Would you like to reload it?"));
if (shouldUpdate)
- this.addRevision(updatedContent);
+ this._commitContent(updatedContent, false);
+ else
+ this._lastAcceptedContent = updatedContent;
+ delete this._checkingContent;
}
},
@@ -244,8 +259,9 @@
/**
* @param {string} content
+ * @param {boolean} shouldSetContentInProject
*/
- _commitContent: function(content)
+ _commitContent: function(content, shouldSetContentInProject)
{
this._content = content;
this._contentLoaded = true;
@@ -264,7 +280,8 @@
WebInspector.fileManager.save(this._url, this._content, false);
WebInspector.fileManager.close(this._url);
}
- this._project.setFileContent(this, this._content, function() { });
+ if (shouldSetContentInProject)
+ this._project.setFileContent(this, this._content, function() { });
},
/**
@@ -272,7 +289,7 @@
*/
addRevision: function(content)
{
- this._commitContent(content);
+ this._commitContent(content, true);
},
_restoreRevisionHistory: function()
@@ -405,7 +422,7 @@
return;
}
- this._commitContent(this._workingCopy);
+ this._commitContent(this._workingCopy, true);
callback(null);
WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, {
Modified: trunk/Source/WebCore/inspector/front-end/Workspace.js (145542 => 145543)
--- trunk/Source/WebCore/inspector/front-end/Workspace.js 2013-03-12 14:51:19 UTC (rev 145542)
+++ trunk/Source/WebCore/inspector/front-end/Workspace.js 2013-03-12 14:53:30 UTC (rev 145543)
@@ -101,11 +101,9 @@
requestFileContent: function(path, callback) { },
/**
- * @param {Array.<string>} path
- * @param {string} currentContent
- * @param {function(?string)} callback
+ * @return {boolean}
*/
- requestUpdatedFileContent: function(path, currentContent, callback) { },
+ canSetFileContent: function() { },
/**
* @param {Array.<string>} path
@@ -250,12 +248,11 @@
},
/**
- * @param {WebInspector.UISourceCode} uiSourceCode
- * @param {function(?string)} callback
+ * @return {boolean}
*/
- requestUpdatedFileContent: function(uiSourceCode, callback)
+ canSetFileContent: function()
{
- this._projectDelegate.requestUpdatedFileContent(uiSourceCode.path(), uiSourceCode.workingCopy(), callback);
+ return this._projectDelegate.canSetFileContent();
},
/**