Title: [121855] trunk/Source/WebCore
Revision
121855
Author
[email protected]
Date
2012-07-04 08:14:01 -0700 (Wed, 04 Jul 2012)

Log Message

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/_javascript_Source.js:
(WebInspector._javascript_Source.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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121854 => 121855)


--- trunk/Source/WebCore/ChangeLog	2012-07-04 15:13:24 UTC (rev 121854)
+++ trunk/Source/WebCore/ChangeLog	2012-07-04 15:14:01 UTC (rev 121855)
@@ -1,3 +1,27 @@
+2012-07-04  Vsevolod Vlasov  <[email protected]>
+
+        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/_javascript_Source.js:
+        (WebInspector._javascript_Source.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  <[email protected]>
 
         Web Inspector: move settings button back to the right.

Modified: trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js (121854 => 121855)


--- trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js	2012-07-04 15:13:24 UTC (rev 121854)
+++ trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js	2012-07-04 15:14:01 UTC (rev 121855)
@@ -955,23 +955,10 @@
     {
         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));
     },
 
     /**

Modified: trunk/Source/WebCore/inspector/front-end/ExtensionServer.js (121854 => 121855)


--- trunk/Source/WebCore/inspector/front-end/ExtensionServer.js	2012-07-04 15:13:24 UTC (rev 121854)
+++ trunk/Source/WebCore/inspector/front-end/ExtensionServer.js	2012-07-04 15:14:01 UTC (rev 121855)
@@ -290,7 +290,7 @@
 
     _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;
@@ -482,7 +482,7 @@
 
     _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);
@@ -500,7 +500,7 @@
             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);
@@ -512,7 +512,7 @@
         if (message.commit)
             uiSourceCode.commitWorkingCopy(callbackWrapper.bind(this));
         else
-            callbackWrapper.call(this);
+            callbackWrapper.call(this, null);
     },
 
     _requestId: function(request)

Modified: trunk/Source/WebCore/inspector/front-end/_javascript_Source.js (121854 => 121855)


--- trunk/Source/WebCore/inspector/front-end/_javascript_Source.js	2012-07-04 15:13:24 UTC (rev 121854)
+++ trunk/Source/WebCore/inspector/front-end/_javascript_Source.js	2012-07-04 15:14:01 UTC (rev 121855)
@@ -207,36 +207,9 @@
             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._javascript_Source}
-         * @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));
     },
 
     /**

Modified: trunk/Source/WebCore/inspector/front-end/StylesPanel.js (121854 => 121855)


--- trunk/Source/WebCore/inspector/front-end/StylesPanel.js	2012-07-04 15:13:24 UTC (rev 121854)
+++ trunk/Source/WebCore/inspector/front-end/StylesPanel.js	2012-07-04 15:14:01 UTC (rev 121855)
@@ -130,7 +130,7 @@
         if (WebInspector.StyleSource.updateTimeout >= 0)
             this._incrementalUpdateTimer = setTimeout(callback, WebInspector.StyleSource.updateTimeout);
         else
-            callback();
+            callback(null);
     },
 
     /**

Modified: trunk/Source/WebCore/inspector/front-end/UISourceCode.js (121854 => 121855)


--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-07-04 15:13:24 UTC (rev 121854)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-07-04 15:14:01 UTC (rev 121855)
@@ -201,23 +201,18 @@
     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);
+
     },
 
     /**

Modified: trunk/Source/WebCore/inspector/front-end/Workspace.js (121854 => 121855)


--- trunk/Source/WebCore/inspector/front-end/Workspace.js	2012-07-04 15:13:24 UTC (rev 121854)
+++ trunk/Source/WebCore/inspector/front-end/Workspace.js	2012-07-04 15:14:01 UTC (rev 121855)
@@ -76,8 +76,8 @@
     },
 
     /**
-     * @param {String} url
-     * @return {WebInspector.UISourceCode}
+     * @param {string} url
+     * @return {?WebInspector.UISourceCode}
      */
     uiSourceCodeForURL: function(url)
     {
@@ -88,6 +88,7 @@
                     return uiSourceCodes[j];
             }
         }
+        return null;
     },
 
     /**
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to