Changeset 121855 in webkit


Ignore:
Timestamp:
Jul 4, 2012 8:14:01 AM (12 years ago)
Author:
vsevik@chromium.org
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/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):

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r121853 r121855  
     12012-07-04  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: UISourceCode should take care of adding revision after committing working copy.
     4        https://bugs.webkit.org/show_bug.cgi?id=90549
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Revision is now added in UISourceCode.commitWorkingCopy synchronously even if saving to JS VM or CSS model failed.
     9
     10        * inspector/front-end/CSSStyleModel.js:
     11        (WebInspector.CSSStyleModelResourceBinding.prototype.setStyleContent):
     12        * inspector/front-end/ExtensionServer.js:
     13        (WebInspector.ExtensionServer.prototype._handleOpenURL):
     14        (WebInspector.ExtensionServer.prototype._onGetResourceContent):
     15        (WebInspector.ExtensionServer.prototype._onSetResourceContent):
     16        * inspector/front-end/JavaScriptSource.js:
     17        (WebInspector.JavaScriptSource.prototype.workingCopyCommitted):
     18        * inspector/front-end/StylesPanel.js:
     19        (WebInspector.StyleSource.prototype._callOrSetTimeout):
     20        * inspector/front-end/UISourceCode.js:
     21        (WebInspector.UISourceCode.prototype.commitWorkingCopy):
     22        * inspector/front-end/Workspace.js:
     23        (WebInspector.CompositeUISourceCodeProvider.prototype.uiSourceCodeForURL):
     24
    1252012-07-04  Pavel Feldman  <pfeldman@chromium.org>
    226
  • trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js

    r121850 r121855  
    956956        var resource = styleSource.resource();
    957957        if (this._styleSheetIdForResource(resource)) {
    958             this._innerSetContent(resource, content, majorChange, innerCallback, null);
     958            this._innerSetContent(resource, content, majorChange, userCallback, null);
    959959            return;
    960960        }
    961         this._loadStyleSheetHeaders(this._innerSetContent.bind(this, resource, content, majorChange, innerCallback));
    962        
    963         function innerCallback(error)
    964         {
    965             if (error) {
    966                 userCallback(error);
    967                 return;
    968             }
    969 
    970             if (majorChange)
    971                 resource.addRevision(content);
    972 
    973             userCallback(null);
    974         }
     961        this._loadStyleSheetHeaders(this._innerSetContent.bind(this, resource, content, majorChange, userCallback));
    975962    },
    976963
  • trunk/Source/WebCore/inspector/front-end/ExtensionServer.js

    r121792 r121855  
    291291    _handleOpenURL: function(port, details)
    292292    {
    293         var url = /** @type {String} */ details.url;
     293        var url = /** @type {string} */ details.url;
    294294        var contentProvider = WebInspector.workspace.uiSourceCodeForURL(url) || WebInspector.resourceForURL(url);
    295295        if (!contentProvider)
     
    483483    _onGetResourceContent: function(message, port)
    484484    {
    485         var url = /** @type {String} */ message.url;
     485        var url = /** @type {string} */ message.url;
    486486        var contentProvider = WebInspector.workspace.uiSourceCodeForURL(url) || WebInspector.resourceForURL(url);
    487487        if (!contentProvider)
     
    501501        }
    502502
    503         var url = /** @type {String} */ message.url;
     503        var url = /** @type {string} */ message.url;
    504504        var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url);
    505505        if (!uiSourceCode) {
     
    513513            uiSourceCode.commitWorkingCopy(callbackWrapper.bind(this));
    514514        else
    515             callbackWrapper.call(this);
     515            callbackWrapper.call(this, null);
    516516    },
    517517
  • trunk/Source/WebCore/inspector/front-end/JavaScriptSource.js

    r121850 r121855  
    208208        }
    209209
    210         this._setScriptSource(this.workingCopy(), innerCallback.bind(this));
    211     },
    212 
    213     /**
    214      * @param {string} newSource
    215      * @param {function(?Protocol.Error)} callback
    216      */
    217     _setScriptSource: function(newSource, callback)
    218     {
    219210        var rawLocation = this.uiLocationToRawLocation(0, 0);
    220211        var script = WebInspector.debuggerModel.scriptForId(rawLocation.scriptId);
    221 
    222         /**
    223          * @this {WebInspector.JavaScriptSource}
    224          * @param {?Protocol.Error} error
    225          */
    226         function didEditScriptSource(error)
    227         {
    228             if (error) {
    229                 callback(error);
    230                 return;
    231             }
    232 
    233             var resource = this.resource();
    234             if (resource)
    235                 resource.addRevision(newSource);
    236 
    237             callback(null);
    238         }
    239         WebInspector.debuggerModel.setScriptSource(script.scriptId, newSource, didEditScriptSource.bind(this));
     212        WebInspector.debuggerModel.setScriptSource(script.scriptId, this.workingCopy(), innerCallback.bind(this));
    240213    },
    241214
  • trunk/Source/WebCore/inspector/front-end/StylesPanel.js

    r121850 r121855  
    131131            this._incrementalUpdateTimer = setTimeout(callback, WebInspector.StyleSource.updateTimeout);
    132132        else
    133             callback();
     133            callback(null);
    134134    },
    135135
  • trunk/Source/WebCore/inspector/front-end/UISourceCode.js

    r121850 r121855  
    202202    {
    203203        if (!this.isDirty()) {
    204             callback()
     204            callback(null);
    205205            return;
    206206        }
    207207
    208         /**
    209          * @param {?string} error
    210          */
    211         function innerCallback(error)
    212         {
    213             delete this._committingWorkingCopy;
    214             this.contentChanged(newContent, this._mimeType);
    215             callback(error);
    216         }
    217 
    218208        var newContent = this._workingCopy;
    219209        this._committingWorkingCopy = true;
    220         this.workingCopyCommitted(innerCallback.bind(this));
     210        this.workingCopyCommitted(callback);
     211        if (this.resource())
     212            this.resource().addRevision(newContent);
     213        delete this._committingWorkingCopy;
     214        this.contentChanged(newContent, this._mimeType);
     215
    221216    },
    222217
  • trunk/Source/WebCore/inspector/front-end/Workspace.js

    r121850 r121855  
    7777
    7878    /**
    79      * @param {String} url
    80      * @return {WebInspector.UISourceCode}
     79     * @param {string} url
     80     * @return {?WebInspector.UISourceCode}
    8181     */
    8282    uiSourceCodeForURL: function(url)
     
    8989            }
    9090        }
     91        return null;
    9192    },
    9293
Note: See TracChangeset for help on using the changeset viewer.