Web Inspector: follow up to r114116 - fixing QT test
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 14:33:22 +0000 (14:33 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 14:33:22 +0000 (14:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83892

Reviewed by Yury Semikhatsky.

Source/WebCore:

Requesting content for the scripts exclusively via the page agent now.

* inspector/front-end/Resource.js:
(WebInspector.Resource.prototype.get content):
(WebInspector.Resource.prototype.get contentEncoded):
(WebInspector.Resource.prototype.requestContent):
(WebInspector.ResourceRevision.prototype.requestContent):

LayoutTests:

* inspector/debugger/raw-source-code.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114133 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/debugger/raw-source-code.html
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/Resource.js

index 9cfb885..ee60b99 100644 (file)
@@ -1,3 +1,12 @@
+2012-04-13  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: follow up to r114116 - fixing QT test
+        https://bugs.webkit.org/show_bug.cgi?id=83892
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/debugger/raw-source-code.html:
+
 2012-04-13  Yi Shen  <yi.4.shen@nokia.com>
 
         InsertHTML fails to insert h6 if the insertion point is before some text.
index 3ce1bb0..6a50f4e 100644 (file)
@@ -15,11 +15,17 @@ function test()
         callback(undefined, mockContentsMap[requestId], false);
     }
 
+    PageAgent.getResourceContent = function(frameId, url, callback)
+    {
+        callback(undefined, mockContentsMap[url], false);
+    }
+
     function createRequestMock(type, finished, content)
     {
         var requestId = ++lastRequestId + "";
+        var url = "http://fake.url/" + requestId;
         WebInspector.resourceTreeModel._addFrame(new WebInspector.ResourceTreeFrame(WebInspector.resourceTreeModel, null, {id: "frame-id"}));
-        var request = new WebInspector.NetworkRequest(requestId, "http://fake.url", "http://fake.url", "frame-id", "loader-id");
+        var request = new WebInspector.NetworkRequest(requestId, url, "http://fake.url", "frame-id", "loader-id");
         request.type = type === "document" ? WebInspector.resourceTypes.Document : WebInspector.resourceTypes.Script;
 
         WebInspector.networkManager._dispatcher._startNetworkRequest(request);
@@ -27,6 +33,7 @@ function test()
             finishRequest(request);
 
         mockContentsMap[requestId] = content;
+        mockContentsMap[url] = content;
         return request;
     }
 
index 80fb4ec..94c63df 100644 (file)
@@ -1,3 +1,18 @@
+2012-04-13  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: follow up to r114116 - fixing QT test
+        https://bugs.webkit.org/show_bug.cgi?id=83892
+
+        Reviewed by Yury Semikhatsky.
+
+        Requesting content for the scripts exclusively via the page agent now.
+
+        * inspector/front-end/Resource.js:
+        (WebInspector.Resource.prototype.get content):
+        (WebInspector.Resource.prototype.get contentEncoded):
+        (WebInspector.Resource.prototype.requestContent):
+        (WebInspector.ResourceRevision.prototype.requestContent):
+
 2012-04-13  Yi Shen  <yi.4.shen@nokia.com>
 
         InsertHTML fails to insert h6 if the insertion point is before some text.
index abca201..7924cb0 100644 (file)
@@ -289,9 +289,7 @@ WebInspector.Resource.prototype = {
      */
     get content()
     {
-        if (typeof this._content !== "undefined")
-            return this._content;
-        return this._request ? this._request.content : this._content;
+        return this._content;
     },
 
     /**
@@ -299,9 +297,7 @@ WebInspector.Resource.prototype = {
      */
     get contentEncoded()
     {
-        if (typeof this._contentEncoded !== "undefined")
-            return this._contentEncoded;
-        return this._request ? this._request.contentEncoded : this._contentEncoded;
+        return this._contentEncoded;
     },
 
     /**
@@ -368,11 +364,6 @@ WebInspector.Resource.prototype = {
      */
     requestContent: function(callback)
     {
-        if (this._request) {
-            this._request.requestContent(callback);
-            return;
-        }
-
         if (typeof this._content !== "undefined") {
             callback(this._content, !!this._contentEncoded);
             return;
@@ -533,12 +524,7 @@ WebInspector.ResourceRevision.prototype = {
             callback(error ? null : content);
         }
 
-        // FIXME: https://bugs.webkit.org/show_bug.cgi?id=61363 We should separate NetworkResource (NetworkPanel resource)
-        // from ResourceRevision (ResourcesPanel/ScriptsPanel resource) and request content accordingly.
-        if (this._resource.request)
-            NetworkAgent.getResponseBody(this._resource.request.requestId, callbackWrapper);
-        else
-            PageAgent.getResourceContent(this._resource.frameId, this._resource.url, callbackWrapper);
+        PageAgent.getResourceContent(this._resource.frameId, this._resource.url, callbackWrapper);
     }
 }