https://bugs.webkit.org/show_bug.cgi?id=90549
Reviewed by Pavel Feldman.
Revision is now added in UISourceCode.commitWorkingCopy synchronously even if saving to JS VM or CSS model failed.
* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSStyleModelResourceBinding.prototype.setStyleContent):
* inspector/front-end/ExtensionServer.js:
(WebInspector.ExtensionServer.prototype._handleOpenURL):
(WebInspector.ExtensionServer.prototype._onGetResourceContent):
(WebInspector.ExtensionServer.prototype._onSetResourceContent):
* inspector/front-end/JavaScriptSource.js:
(WebInspector.JavaScriptSource.prototype.workingCopyCommitted):
* inspector/front-end/StylesPanel.js:
(WebInspector.StyleSource.prototype._callOrSetTimeout):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCode.prototype.commitWorkingCopy):
* inspector/front-end/Workspace.js:
(WebInspector.CompositeUISourceCodeProvider.prototype.uiSourceCodeForURL):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121855
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-07-04 Vsevolod Vlasov <vsevik@chromium.org>
+
+ Web Inspector: UISourceCode should take care of adding revision after committing working copy.
+ https://bugs.webkit.org/show_bug.cgi?id=90549
+
+ Reviewed by Pavel Feldman.
+
+ Revision is now added in UISourceCode.commitWorkingCopy synchronously even if saving to JS VM or CSS model failed.
+
+ * inspector/front-end/CSSStyleModel.js:
+ (WebInspector.CSSStyleModelResourceBinding.prototype.setStyleContent):
+ * inspector/front-end/ExtensionServer.js:
+ (WebInspector.ExtensionServer.prototype._handleOpenURL):
+ (WebInspector.ExtensionServer.prototype._onGetResourceContent):
+ (WebInspector.ExtensionServer.prototype._onSetResourceContent):
+ * inspector/front-end/JavaScriptSource.js:
+ (WebInspector.JavaScriptSource.prototype.workingCopyCommitted):
+ * inspector/front-end/StylesPanel.js:
+ (WebInspector.StyleSource.prototype._callOrSetTimeout):
+ * inspector/front-end/UISourceCode.js:
+ (WebInspector.UISourceCode.prototype.commitWorkingCopy):
+ * inspector/front-end/Workspace.js:
+ (WebInspector.CompositeUISourceCodeProvider.prototype.uiSourceCodeForURL):
+
2012-07-04 Pavel Feldman <pfeldman@chromium.org>
Web Inspector: move settings button back to the right.
{
var resource = styleSource.resource();
if (this._styleSheetIdForResource(resource)) {
- this._innerSetContent(resource, content, majorChange, innerCallback, null);
+ this._innerSetContent(resource, content, majorChange, userCallback, null);
return;
}
- this._loadStyleSheetHeaders(this._innerSetContent.bind(this, resource, content, majorChange, innerCallback));
-
- function innerCallback(error)
- {
- if (error) {
- userCallback(error);
- return;
- }
-
- if (majorChange)
- resource.addRevision(content);
-
- userCallback(null);
- }
+ this._loadStyleSheetHeaders(this._innerSetContent.bind(this, resource, content, majorChange, userCallback));
},
/**
_handleOpenURL: function(port, details)
{
- var url = /** @type {String} */ details.url;
+ var url = /** @type {string} */ details.url;
var contentProvider = WebInspector.workspace.uiSourceCodeForURL(url) || WebInspector.resourceForURL(url);
if (!contentProvider)
return false;
_onGetResourceContent: function(message, port)
{
- var url = /** @type {String} */ message.url;
+ var url = /** @type {string} */ message.url;
var contentProvider = WebInspector.workspace.uiSourceCodeForURL(url) || WebInspector.resourceForURL(url);
if (!contentProvider)
return this._status.E_NOTFOUND(url);
this._dispatchCallback(message.requestId, port, response);
}
- var url = /** @type {String} */ message.url;
+ var url = /** @type {string} */ message.url;
var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url);
if (!uiSourceCode) {
var resource = WebInspector.resourceTreeModel.resourceForURL(url);
if (message.commit)
uiSourceCode.commitWorkingCopy(callbackWrapper.bind(this));
else
- callbackWrapper.call(this);
+ callbackWrapper.call(this, null);
},
_requestId: function(request)
callback(error);
}
- this._setScriptSource(this.workingCopy(), innerCallback.bind(this));
- },
-
- /**
- * @param {string} newSource
- * @param {function(?Protocol.Error)} callback
- */
- _setScriptSource: function(newSource, callback)
- {
var rawLocation = this.uiLocationToRawLocation(0, 0);
var script = WebInspector.debuggerModel.scriptForId(rawLocation.scriptId);
-
- /**
- * @this {WebInspector.JavaScriptSource}
- * @param {?Protocol.Error} error
- */
- function didEditScriptSource(error)
- {
- if (error) {
- callback(error);
- return;
- }
-
- var resource = this.resource();
- if (resource)
- resource.addRevision(newSource);
-
- callback(null);
- }
- WebInspector.debuggerModel.setScriptSource(script.scriptId, newSource, didEditScriptSource.bind(this));
+ WebInspector.debuggerModel.setScriptSource(script.scriptId, this.workingCopy(), innerCallback.bind(this));
},
/**
if (WebInspector.StyleSource.updateTimeout >= 0)
this._incrementalUpdateTimer = setTimeout(callback, WebInspector.StyleSource.updateTimeout);
else
- callback();
+ callback(null);
},
/**
commitWorkingCopy: function(callback)
{
if (!this.isDirty()) {
- callback()
+ callback(null);
return;
}
- /**
- * @param {?string} error
- */
- function innerCallback(error)
- {
- delete this._committingWorkingCopy;
- this.contentChanged(newContent, this._mimeType);
- callback(error);
- }
-
var newContent = this._workingCopy;
this._committingWorkingCopy = true;
- this.workingCopyCommitted(innerCallback.bind(this));
+ this.workingCopyCommitted(callback);
+ if (this.resource())
+ this.resource().addRevision(newContent);
+ delete this._committingWorkingCopy;
+ this.contentChanged(newContent, this._mimeType);
+
},
/**
},
/**
- * @param {String} url
- * @return {WebInspector.UISourceCode}
+ * @param {string} url
+ * @return {?WebInspector.UISourceCode}
*/
uiSourceCodeForURL: function(url)
{
return uiSourceCodes[j];
}
}
+ return null;
},
/**