Title: [121792] trunk
Revision
121792
Author
[email protected]
Date
2012-07-03 10:51:27 -0700 (Tue, 03 Jul 2012)

Log Message

Web Inspector: [Extensions API] Resource manipulations should be based on UISourceCode thus extending Sources Panel.
https://bugs.webkit.org/show_bug.cgi?id=89868

Reviewed by Pavel Feldman.

Source/WebCore:

Extensions API is now based on both ScriptsPanel acting as a UISourceCodeProvider and ResourceTreeModel.
Extensions API resource could be for any content provider now.
Extensions API resource.setContent implementation is now based on UISourceCode editing methods.
Drive-by StyleSource insremental editing timeout fix.

* inspector/front-end/ExtensionServer.js:
(WebInspector.ExtensionServer.prototype._handleOpenURL):
(WebInspector.ExtensionServer.prototype._makeResource):
(WebInspector.ExtensionServer.prototype._onGetPageResources):
(WebInspector.ExtensionServer.prototype._getResourceContent):
(WebInspector.ExtensionServer.prototype._onGetResourceContent):
(WebInspector.ExtensionServer.prototype._onSetResourceContent):
(WebInspector.ExtensionServer.prototype._notifyResourceAdded):
(WebInspector.ExtensionServer.prototype._notifyResourceContentCommitted):
* inspector/front-end/_javascript_Source.js:
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype.uiSourceCodes):
(WebInspector.ScriptsPanel.prototype.uiSourceCodeForURL):
(WebInspector.ScriptsPanel.prototype._addUISourceCode):
(WebInspector.ScriptsPanel.prototype._reset):
(WebInspector.ScriptsPanel.prototype.canShowAnchorLocation):
* inspector/front-end/StylesPanel.js:
(WebInspector.StyleSource.prototype.workingCopyCommitted):
(WebInspector.StyleSource.prototype.workingCopyChanged):
(WebInspector.StyleSource.prototype._callOrSetTimeout):
(WebInspector.StyleSource.prototype._commitIncrementalEdit):
(WebInspector.StyleSource.prototype._clearIncrementalUpdateTimer):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCode.prototype.requestContent):
(WebInspector.UISourceCode.prototype.workingCopy):
(WebInspector.UISourceCode.prototype.setWorkingCopy):
(WebInspector.UISourceCode.prototype.isDirty):

LayoutTests:

* http/tests/inspector/extensions-test.js:
(initialize_ExtensionsTest):
(initialize_ExtensionsTest.completeTest):
(initialize_ExtensionsTest.InspectorTest.runExtensionTests):
* http/tests/inspector/resources/extension-main.js:
* inspector/extensions/extensions-resources.html:
* inspector/styles/styles-history.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (121791 => 121792)


--- trunk/LayoutTests/ChangeLog	2012-07-03 17:49:41 UTC (rev 121791)
+++ trunk/LayoutTests/ChangeLog	2012-07-03 17:51:27 UTC (rev 121792)
@@ -1,3 +1,18 @@
+2012-06-27  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: [Extensions API] Resource manipulations should be based on UISourceCode thus extending Sources Panel.
+        https://bugs.webkit.org/show_bug.cgi?id=89868
+
+        Reviewed by Pavel Feldman.
+
+        * http/tests/inspector/extensions-test.js:
+        (initialize_ExtensionsTest):
+        (initialize_ExtensionsTest.completeTest):
+        (initialize_ExtensionsTest.InspectorTest.runExtensionTests):
+        * http/tests/inspector/resources/extension-main.js:
+        * inspector/extensions/extensions-resources.html:
+        * inspector/styles/styles-history.html:
+
 2012-07-03  Robert Hogan  <[email protected]>
 
         CSS 2.1 failure: floats-wrap-top-below-inline-* fail

Modified: trunk/LayoutTests/inspector/extensions/extensions-resources-expected.txt (121791 => 121792)


--- trunk/LayoutTests/inspector/extensions/extensions-resources-expected.txt	2012-07-03 17:49:41 UTC (rev 121791)
+++ trunk/LayoutTests/inspector/extensions/extensions-resources-expected.txt	2012-07-03 17:51:27 UTC (rev 121792)
@@ -56,7 +56,7 @@
     1 : ""
 }
 RUNNING TEST: extension_testOnContentCommitted
-log: Extension server error: Operation failed: Resource is not editable
+log: Extension server error: Object does not support requested operation: Resource is not editable
 content committed for resource .../audits-style1.css (type: stylesheet), new content: div.test { width: 220px; height: 42px; }
 Revision content: div.test { width: 220px; height: 42px; }
 RUNNING TEST: extension_testOnResourceAdded

Modified: trunk/LayoutTests/inspector/extensions/extensions-resources.html (121791 => 121792)


--- trunk/LayoutTests/inspector/extensions/extensions-resources.html	2012-07-03 17:49:41 UTC (rev 121791)
+++ trunk/LayoutTests/inspector/extensions/extensions-resources.html	2012-07-03 17:51:27 UTC (rev 121792)
@@ -30,10 +30,22 @@
 {
     function callback(resources)
     {
+        function filter(resource)
+        {
+            // For some reason scripts from tests previously run in the same test shell sometimes appear, so we need to filter them out.
+            const resourceURLsWhiteList = ["abe.png", "audits-style1.css", "extensions-resources.html", "extensions-test.js", "inspector-test.js", "test-script.js"];
+            for (var i = 0; i < resourceURLsWhiteList.length; ++i) {
+                if (resource.url.indexOf(resourceURLsWhiteList[i]) !== -1)
+                  return true;
+            }
+            return false;
+        }
+
         function compareResources(a, b)
         {
             return trimURL(a.url).localeCompare(trimURL(b.url));
         }
+        resources = resources.filter(filter);
         resources.sort(compareResources);
         output("page resources:");
         dumpObject(Array.prototype.slice.call(arguments), { url: "url" });
@@ -67,24 +79,65 @@
     });
 }
 
+// Extensions tests override WebInspector.StyleSource.updateTimeout because otherwise extensions don't have any control over applying changes to domain specific bindings.
+function extension_setFakeStyleSheetUpdateTimeout(callback)
+{
+    evaluateOnFrontend("WebInspector.oldStyleSheetUpdateTimeout = WebInspector.StyleSource.updateTimeout; WebInspector.StyleSource.updateTimeout = -1; reply();", callback);
+}
+
+function extension_resetStyleSheetUpdateTimeout(callback)
+{
+    evaluateOnFrontend("WebInspector.StyleSource.updateTimeout = WebInspector.oldStyleSheetUpdateTimeout; delete WebInspector.oldStyleSheetUpdateTimeout; reply();", callback);
+}
+
 function extension_testSetResourceContent(nextTest)
 {
-    function callback()
+    extension_setFakeStyleSheetUpdateTimeout(step2);
+
+    function step2()
     {
+        extension_runWithResource(/audits-style1\.css$/, function(resource) {
+            resource.setContent("div.test { width: 126px; height: 42px; }", false, step3);
+        });
+    }
+
+    function step3()
+    {
         webInspector.inspectedWindow.eval("document.getElementById('test-div').clientWidth", function(result) {
             output("div.test width after stylesheet edited (should be 126): " + result);
-            nextTest();
+            step4();
         });
     }
-    extension_runWithResource(/audits-style1\.css$/, function(resource) {
-        resource.setContent("div.test { width: 126px; height: 42px; }", false, callback);
-    });
+
+    function step4()
+    {
+        extension_resetStyleSheetUpdateTimeout(nextTest);
+    }
 }
 
 function extension_testOnContentCommitted(nextTest)
 {
     var expected_content = "div.test { width: 220px; height: 42px; }";
+    extension_setFakeStyleSheetUpdateTimeout(step2);
 
+    function step2()
+    {
+
+        webInspector.inspectedWindow.onResourceContentCommitted.addListener(onContentCommitted);
+        extension_runWithResource(/audits-style1\.css$/, function(resource) {
+            resource.setContent("div.test { width: 140px; height: 42px; }", false);
+        });
+        // The next step is going to produce a console message that will be logged, so synchronize the output now.
+        evaluateOnFrontend("InspectorTest.runAfterPendingDispatches(reply)", function() {
+            extension_runWithResource(/abe\.png$/, function(resource) {
+                resource.setContent("", true);
+            });
+            extension_runWithResource(/audits-style1\.css$/, function(resource) {
+                resource.setContent(expected_content, true);
+            });
+        });
+    }
+
     function onContentCommitted(resource, content)
     {
         output("content committed for resource " + trimURL(resource.url) + " (type: " + resource.type + "), new content: " + content);
@@ -93,22 +146,14 @@
         webInspector.inspectedWindow.onResourceContentCommitted.removeListener(onContentCommitted);
         resource.getContent(function(content) {
             output("Revision content: " + content);
-            nextTest();
+            step3();
         });
     }
-    webInspector.inspectedWindow.onResourceContentCommitted.addListener(onContentCommitted);
-    extension_runWithResource(/audits-style1\.css$/, function(resource) {
-        resource.setContent("div.test { width: 140px; height: 42px; }", false);
-    });
-    // The next step is going to produce a console message that will be logged, so synchronize the output now.
-    evaluateOnFrontend("InspectorTest.runAfterPendingDispatches(reply)", function() {
-        extension_runWithResource(/abe\.png$/, function(resource) {
-            resource.setContent("", true);
-        });
-        extension_runWithResource(/audits-style1\.css$/, function(resource) {
-            resource.setContent(expected_content, true);
-        });
-    });
+
+    function step3()
+    {
+        extension_resetStyleSheetUpdateTimeout(nextTest);
+    }
 }
 
 function extension_testOnResourceAdded(nextTest)

Modified: trunk/LayoutTests/inspector/styles/styles-history.html (121791 => 121792)


--- trunk/LayoutTests/inspector/styles/styles-history.html	2012-07-03 17:49:41 UTC (rev 121791)
+++ trunk/LayoutTests/inspector/styles/styles-history.html	2012-07-03 17:51:27 UTC (rev 121792)
@@ -10,35 +10,35 @@
 
 function test()
 {
-    var pendingCallbacks = [];
     InspectorTest.runAfterCachedResourcesProcessed(runTestSuite);
 
-    var styleResource;
-    var styleSheetId;
+    var styleSource;
 
     function runTestSuite()
     {
         InspectorTest.runTestSuite([
             function testSetUp(next)
             {
-                function visitResource(resource)
+                function visitUISourceCodes(uiSourceCode)
                 {
-                    if (resource.url.indexOf("styles-history.css") === -1)
+                    if (uiSourceCode.url.indexOf("styles-history.css") === -1)
                         return;
-                    styleResource = resource;
+                    styleSource = uiSourceCode;
                     next();
                 }
-                WebInspector.resourceTreeModel.forAllResources(visitResource);
+                WebInspector.workspace.uiSourceCodes().forEach(visitUISourceCodes);
             },
 
             function testSetResourceContentMinor(next)
             {
-                styleResource.setContent("body {\n  margin: 15px;\n  padding: 10px;\n}", false, dumpHistory(next));
+                styleSource.setWorkingCopy("body {\n  margin: 15px;\n  padding: 10px;\n}");
+                dumpHistory(next)();
             },
 
             function testSetResourceContentMajor(next)
             {
-                styleResource.setContent("body {\n  margin: 20px;\n  padding: 10px;\n}", true, dumpHistory(next));
+                styleSource.setWorkingCopy("body {\n  margin: 20px;\n  padding: 10px;\n}");
+                styleSource.commitWorkingCopy(dumpHistory(next));
             },
 
             function testSetContentViaModelMinor(next)
@@ -71,7 +71,7 @@
     function styleSheetForResource(callback)
     {
         CSSAgent.getAllStyleSheets(didGetAllStyleSheets.bind(this));
-        
+
         function didGetAllStyleSheets(error, infos)
         {
             if (error) {
@@ -95,10 +95,10 @@
     {
         function result()
         {
-            InspectorTest.addResult("History length: " + styleResource.history.length);
-            for (var i = 0; i < styleResource.history.length; ++i) {
+            InspectorTest.addResult("History length: " + styleSource.resource().history.length);
+            for (var i = 0; i < styleSource.resource().history.length; ++i) {
                 InspectorTest.addResult("Item " + i + ":");
-                InspectorTest.addResult(styleResource.history[i].content);
+                InspectorTest.addResult(styleSource.resource().history[i].content);
             }
             next();
         }

Modified: trunk/Source/WebCore/ChangeLog (121791 => 121792)


--- trunk/Source/WebCore/ChangeLog	2012-07-03 17:49:41 UTC (rev 121791)
+++ trunk/Source/WebCore/ChangeLog	2012-07-03 17:51:27 UTC (rev 121792)
@@ -1,3 +1,43 @@
+2012-06-27  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: [Extensions API] Resource manipulations should be based on UISourceCode thus extending Sources Panel.
+        https://bugs.webkit.org/show_bug.cgi?id=89868
+
+        Reviewed by Pavel Feldman.
+
+        Extensions API is now based on both ScriptsPanel acting as a UISourceCodeProvider and ResourceTreeModel.
+        Extensions API resource could be for any content provider now.
+        Extensions API resource.setContent implementation is now based on UISourceCode editing methods.
+        Drive-by StyleSource insremental editing timeout fix.
+
+        * inspector/front-end/ExtensionServer.js:
+        (WebInspector.ExtensionServer.prototype._handleOpenURL):
+        (WebInspector.ExtensionServer.prototype._makeResource):
+        (WebInspector.ExtensionServer.prototype._onGetPageResources):
+        (WebInspector.ExtensionServer.prototype._getResourceContent):
+        (WebInspector.ExtensionServer.prototype._onGetResourceContent):
+        (WebInspector.ExtensionServer.prototype._onSetResourceContent):
+        (WebInspector.ExtensionServer.prototype._notifyResourceAdded):
+        (WebInspector.ExtensionServer.prototype._notifyResourceContentCommitted):
+        * inspector/front-end/_javascript_Source.js:
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype.uiSourceCodes):
+        (WebInspector.ScriptsPanel.prototype.uiSourceCodeForURL):
+        (WebInspector.ScriptsPanel.prototype._addUISourceCode):
+        (WebInspector.ScriptsPanel.prototype._reset):
+        (WebInspector.ScriptsPanel.prototype.canShowAnchorLocation):
+        * inspector/front-end/StylesPanel.js:
+        (WebInspector.StyleSource.prototype.workingCopyCommitted):
+        (WebInspector.StyleSource.prototype.workingCopyChanged):
+        (WebInspector.StyleSource.prototype._callOrSetTimeout):
+        (WebInspector.StyleSource.prototype._commitIncrementalEdit):
+        (WebInspector.StyleSource.prototype._clearIncrementalUpdateTimer):
+        * inspector/front-end/UISourceCode.js:
+        (WebInspector.UISourceCode.prototype.requestContent):
+        (WebInspector.UISourceCode.prototype.workingCopy):
+        (WebInspector.UISourceCode.prototype.setWorkingCopy):
+        (WebInspector.UISourceCode.prototype.isDirty):
+
 2012-07-03  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: Anonymous scripts (evals) should not be added to Workspace.

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


--- trunk/Source/WebCore/inspector/front-end/ExtensionServer.js	2012-07-03 17:49:41 UTC (rev 121791)
+++ trunk/Source/WebCore/inspector/front-end/ExtensionServer.js	2012-07-03 17:51:27 UTC (rev 121792)
@@ -290,15 +290,17 @@
 
     _handleOpenURL: function(port, details)
     {
-        var resource = WebInspector.resourceForURL(details.url);
-        if (!resource)
+        var url = "" @type {String} */ details.url;
+        var contentProvider = WebInspector.workspace.uiSourceCodeForURL(url) || WebInspector.resourceForURL(url);
+        if (!contentProvider)
             return false;
+            
         var lineNumber = details.lineNumber;
         if (typeof lineNumber === "number")
             lineNumber += 1;
         port.postMessage({
             command: "open-resource",
-            resource: this._makeResource(resource),
+            resource: this._makeResource(contentProvider),
             lineNumber: lineNumber
         });
         return true;
@@ -424,26 +426,35 @@
         return harLog;
     },
 
-    _makeResource: function(resource)
+    /**
+     * @param {WebInspector.ContentProvider} contentProvider
+     */
+    _makeResource: function(contentProvider)
     {
         return {
-            url: resource.url,
-            type: resource.type.name()
+            url: contentProvider.contentURL(),
+            type: contentProvider.contentType().name()
         };
     },
 
     _onGetPageResources: function()
     {
-        var resources = [];
-        function pushResourceData(resource)
+        var resources = {};
+
+        function pushResourceData(contentProvider)
         {
-            resources.push(this._makeResource(resource));
+            if (!resources[contentProvider.contentURL()])
+                resources[contentProvider.contentURL()] = this._makeResource(contentProvider);
         }
+        WebInspector.workspace.uiSourceCodes().forEach(pushResourceData.bind(this));
         WebInspector.resourceTreeModel.forAllResources(pushResourceData.bind(this));
-        return resources;
+        return Object.values(resources);
     },
 
-    _getResourceContent: function(resource, message, port)
+    /**
+     * @param {WebInspector.ContentProvider} contentProvider
+     */
+    _getResourceContent: function(contentProvider, message, port)
     {
         /**
          * @param {?string} content
@@ -458,7 +469,7 @@
             };
             this._dispatchCallback(message.requestId, port, response);
         }
-        resource.requestContent(onContentAvailable.bind(this));
+        contentProvider.requestContent(onContentAvailable.bind(this));
     },
 
     _onGetRequestContent: function(message, port)
@@ -471,10 +482,11 @@
 
     _onGetResourceContent: function(message, port)
     {
-        var resource = WebInspector.resourceTreeModel.resourceForURL(message.url);
-        if (!resource)
-            return this._status.E_NOTFOUND(message.url);
-        this._getResourceContent(resource.uiSourceCode() || resource, message, port);
+        var url = "" @type {String} */ message.url;
+        var contentProvider = WebInspector.workspace.uiSourceCodeForURL(url) || WebInspector.resourceForURL(url);
+        if (!contentProvider)
+            return this._status.E_NOTFOUND(url);
+        this._getResourceContent(contentProvider, message, port);
     },
 
     _onSetResourceContent: function(message, port)
@@ -487,10 +499,20 @@
             var response = error ? this._status.E_FAILED(error) : this._status.OK();
             this._dispatchCallback(message.requestId, port, response);
         }
-        var resource = WebInspector.resourceTreeModel.resourceForURL(message.url);
-        if (!resource)
-            return this._status.E_NOTFOUND(message.url);
-        resource.setContent(message.content, message.commit, callbackWrapper.bind(this));
+
+        var url = "" @type {String} */ message.url;
+        var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url);
+        if (!uiSourceCode) {
+            var resource = WebInspector.resourceTreeModel.resourceForURL(url);
+            if (!resource)
+                return this._status.E_NOTFOUND(url);
+            return this._status.E_NOTSUPPORTED("Resource is not editable")
+        }
+        uiSourceCode.setWorkingCopy(message.content);
+        if (message.commit)
+            uiSourceCode.commitWorkingCopy(callbackWrapper.bind(this));
+        else
+            callbackWrapper.call(this);
     },
 
     _requestId: function(request)
@@ -550,8 +572,8 @@
         this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.NetworkRequestFinished,
             WebInspector.networkManager, WebInspector.NetworkManager.EventTypes.RequestFinished, this._notifyRequestFinished);
         this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.ResourceAdded,
-            WebInspector.resourceTreeModel,
-            WebInspector.ResourceTreeModel.EventTypes.ResourceAdded,
+            WebInspector.workspace,
+            WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded,
             this._notifyResourceAdded);
         if (WebInspector.panels.elements) {
             this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.ElementsPanelObjectSelected,
@@ -592,13 +614,15 @@
 
     _notifyResourceAdded: function(event)
     {
-        var resource = event.data;
-        this._postNotification(WebInspector.extensionAPI.Events.ResourceAdded, this._makeResource(resource));
+        var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data;
+        this._postNotification(WebInspector.extensionAPI.Events.ResourceAdded, this._makeResource(uiSourceCode));
     },
 
     _notifyResourceContentCommitted: function(event)
     {
-        this._postNotification(WebInspector.extensionAPI.Events.ResourceContentCommitted, this._makeResource(event.data.resource), event.data.content);
+        var resource = /** @type {WebInspector.Resource} */ event.data.resource;
+        var contentProvider = resource.uiSourceCode() || resource;
+        this._postNotification(WebInspector.extensionAPI.Events.ResourceContentCommitted, this._makeResource(contentProvider), event.data.content);
     },
 
     _notifyRequestFinished: function(event)

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


--- trunk/Source/WebCore/inspector/front-end/_javascript_Source.js	2012-07-03 17:49:41 UTC (rev 121791)
+++ trunk/Source/WebCore/inspector/front-end/_javascript_Source.js	2012-07-03 17:51:27 UTC (rev 121792)
@@ -86,6 +86,7 @@
 
         // Re-request content
         this._contentLoaded = false;
+        this._content = false;
         WebInspector.UISourceCode.prototype.requestContent.call(this, didGetContent.bind(this));
   
         /**

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


--- trunk/Source/WebCore/inspector/front-end/StylesPanel.js	2012-07-03 17:49:41 UTC (rev 121791)
+++ trunk/Source/WebCore/inspector/front-end/StylesPanel.js	2012-07-03 17:51:27 UTC (rev 121792)
@@ -97,23 +97,49 @@
     WebInspector.UISourceCode.call(this, resource.url, resource, resource);
 }
 
+WebInspector.StyleSource.updateTimeout = 200;
+
 WebInspector.StyleSource.prototype = {
     /**
      * @param {function(?string)} callback
      */
     workingCopyCommitted: function(callback)
     {  
-        WebInspector.cssModel.resourceBinding().setStyleContent(this, this.workingCopy(), true, callback);
+        this._commitIncrementalEdit(true, callback);
     },
 
     workingCopyChanged: function()
-    {  
-        function commitIncrementalEdit()
-        {
-            WebInspector.cssModel.resourceBinding().setStyleContent(this, this.workingCopy(), false, function() {});
-        }
-        const updateTimeout = 200;
-        this._incrementalUpdateTimer = setTimeout(commitIncrementalEdit.bind(this), updateTimeout);
+    {
+        this._callOrSetTimeout(this._commitIncrementalEdit.bind(this, false, function() {}));
+    },
+
+    /**
+     * @param {function(?string)} callback
+     */
+    _callOrSetTimeout: function(callback)
+    {
+        // FIXME: Extensions tests override updateTimeout because extensions don't have any control over applying changes to domain specific bindings.   
+        if (WebInspector.StyleSource.updateTimeout >= 0)
+            this._incrementalUpdateTimer = setTimeout(callback, WebInspector.StyleSource.updateTimeout);
+        else
+            callback();
+    },
+
+    /**
+     * @param {boolean} majorChange
+     * @param {function(?string)} callback
+     */
+    _commitIncrementalEdit: function(majorChange, callback)
+    {
+        this._clearIncrementalUpdateTimer();
+        WebInspector.cssModel.resourceBinding().setStyleContent(this, this.workingCopy(), majorChange, callback);
+    },
+
+    _clearIncrementalUpdateTimer: function()
+    {
+        if (this._incrementalUpdateTimer)
+            clearTimeout(this._incrementalUpdateTimer);
+        delete this._incrementalUpdateTimer;
     }
 }
 
@@ -183,13 +209,6 @@
         delete this._isCommittingEditing;
     },
 
-    _clearIncrementalUpdateTimer: function()
-    {
-        if (this._incrementalUpdateTimer)
-            clearTimeout(this._incrementalUpdateTimer);
-        delete this._incrementalUpdateTimer;
-    },
-
     /**
      * @param {WebInspector.Event} event
      */

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


--- trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-07-03 17:49:41 UTC (rev 121791)
+++ trunk/Source/WebCore/inspector/front-end/UISourceCode.js	2012-07-03 17:51:27 UTC (rev 121792)
@@ -127,7 +127,7 @@
      */
     requestContent: function(callback)
     {
-        if (this._contentLoaded) {
+        if (this._content || this._contentLoaded) {
             callback(this._content, false, this._mimeType);
             return;
         }
@@ -171,7 +171,6 @@
      */
     workingCopy: function()
     {
-        console.assert(this._contentLoaded);
         if (this.isDirty())
             return this._workingCopy;
         return this._content;
@@ -182,7 +181,6 @@
      */
     setWorkingCopy: function(newWorkingCopy)
     {
-        console.assert(this._contentLoaded);
         var oldWorkingCopy = this._workingCopy;
         if (this._content === newWorkingCopy)
             delete this._workingCopy;
@@ -230,7 +228,7 @@
      */
     isDirty: function()
     {
-        return this._contentLoaded && typeof this._workingCopy !== "undefined" && this._workingCopy !== this._content;
+        return typeof this._workingCopy !== "undefined" && this._workingCopy !== this._content;
     },
 
     /**

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


--- trunk/Source/WebCore/inspector/front-end/Workspace.js	2012-07-03 17:49:41 UTC (rev 121791)
+++ trunk/Source/WebCore/inspector/front-end/Workspace.js	2012-07-03 17:51:27 UTC (rev 121792)
@@ -76,6 +76,21 @@
     },
 
     /**
+     * @param {String} url
+     * @return {WebInspector.UISourceCode}
+     */
+    uiSourceCodeForURL: function(url)
+    {
+        for (var i = 0; i < this._uiSourceCodeProviders.length; ++i) {
+            var uiSourceCodes = this._uiSourceCodeProviders[i].uiSourceCodes();
+            for (var j = 0; j < uiSourceCodes.length; ++j) {
+                if (uiSourceCodes[j].url ="" url)
+                    return uiSourceCodes[j];
+            }
+        }
+    },
+
+    /**
      * @return {Array.<WebInspector.UISourceCode>}
      */
     uiSourceCodes: function()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to