Web Inspector: limit the use of "Resource" term in the protocol.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Sep 2011 11:45:32 +0000 (11:45 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Sep 2011 11:45:32 +0000 (11:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68250

Reviewed by Yury Semikhatsky.

* inspector/Inspector.json:
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::markResourceAsCached):
(WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache):
(WebCore::InspectorResourceAgent::setExtraHTTPHeaders):
(WebCore::InspectorResourceAgent::getResponseBody):
* inspector/InspectorResourceAgent.h:
* inspector/front-end/ExtensionServer.js:
(WebInspector.ExtensionServer.prototype._onAddRequestHeaders):
* inspector/front-end/NetworkManager.js:
(WebInspector.NetworkManager.prototype.requestContent):
(WebInspector.NetworkDispatcher.prototype.requestServedFromCache):
(WebInspector.NetworkDispatcher.prototype.requestServedFromMemoryCache):

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

Source/WebCore/ChangeLog
Source/WebCore/inspector/Inspector.json
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.h
Source/WebCore/inspector/front-end/ExtensionServer.js
Source/WebCore/inspector/front-end/NetworkManager.js

index 772727f..a7c0bff 100644 (file)
@@ -1,3 +1,24 @@
+2011-09-16  Pavel Feldman  <pfeldman@google.com>
+
+        Web Inspector: limit the use of "Resource" term in the protocol.
+        https://bugs.webkit.org/show_bug.cgi?id=68250
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/Inspector.json:
+        * inspector/InspectorResourceAgent.cpp:
+        (WebCore::InspectorResourceAgent::markResourceAsCached):
+        (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache):
+        (WebCore::InspectorResourceAgent::setExtraHTTPHeaders):
+        (WebCore::InspectorResourceAgent::getResponseBody):
+        * inspector/InspectorResourceAgent.h:
+        * inspector/front-end/ExtensionServer.js:
+        (WebInspector.ExtensionServer.prototype._onAddRequestHeaders):
+        * inspector/front-end/NetworkManager.js:
+        (WebInspector.NetworkManager.prototype.requestContent):
+        (WebInspector.NetworkDispatcher.prototype.requestServedFromCache):
+        (WebInspector.NetworkDispatcher.prototype.requestServedFromMemoryCache):
+
 2011-09-21  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r95608.
index 1172392..0a924e0 100644 (file)
@@ -73,7 +73,7 @@
                 "properties": [
                     { "name": "id", "type": "string", "description": "Frame unique identifier." },
                     { "name": "parentId", "type": "string", "optional": true, "description": "Parent frame identifier." },
-                    { "name": "loaderId", "type": "string", "description": "Identifier of the loader associated with this frame." },
+                    { "name": "loaderId", "$ref": "Network.LoaderId", "description": "Identifier of the loader associated with this frame." },
                     { "name": "name", "type": "string", "optional": true, "description": "Frame's name as specified in the tag." },
                     { "name": "url", "type": "string", "description": "Frame document's URL." },
                     { "name": "mimeType", "type": "string", "description": "Frame document's mimeType as determined by the browser." }
                 "description": "Fired once navigation of the frame has completed. Frame is now associated with the new loader.",
                 "parameters": [
                     { "name": "frame", "$ref": "Frame", "description": "Frame object." },
-                    { "name": "loaderId", "type": "string", "description": "Loader identifier." }
+                    { "name": "loaderId", "$ref": "Network.LoaderId", "description": "Loader identifier." }
                 ],
                 "hidden": true
             },
                     { "name": "text", "type": "string", "description": "Message text." },
                     { "name": "networkRequestId", "$ref": "Network.RequestId", "optional": true, "description": "Identifier of the network request associated with this message." },
                     { "name": "parameters", "type": "array", "items": { "$ref": "Runtime.RemoteObject" }, "optional": true, "description": "Message parameters in case of the formatted message." },
-                    { "name": "stackTrace", "$ref": "StackTrace", "description": "JavaScript stack trace for assertions and error messages." }
+                    { "name": "stackTrace", "$ref": "StackTrace", "optional": true, "description": "JavaScript stack trace for assertions and error messages." }
                 ]
             },
             {
     },
     {
         "domain": "Network",
-        "description": "Network domain allows tracking network activities of the page. It exposes information about HTTP and WebSocket requests and responses, their headers, bodies, timing, etc. It also allows getting the tree of the Frames on the page along with information about their resources.",
+        "description": "Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.",
         "types": [
             {
+                "id": "LoaderId",
+                "type": "string",
+                "description": "Unique loader identifier."
+            },
+            {
                 "id": "RequestId",
                 "type": "string",
                 "description": "Unique request identifier."
                 ]
             },
             {
-                "id": "ResourceRequest",
+                "id": "Request",
                 "type": "object",
                 "description": "HTTP request data.",
                 "properties": [
                 ]
             },
             {
-                "id": "ResourceResponse",
+                "id": "Response",
                 "type": "object",
                 "description": "HTTP response data.",
                 "properties": [
                     { "name": "requestHeadersText", "type": "string", "optional": true, "description": "HTTP request headers text." },
                     { "name": "connectionReused", "type": "boolean", "description": "Specifies whether physical connection was actually reused for this request." },
                     { "name": "connectionId", "type": "number", "description": "Physical connection id that was actually used for this request." },
-                    { "name": "fromDiskCache", "type": "boolean", "optional": true, "description": "Specifies that the resource was loaded from the disk cache." },
+                    { "name": "fromDiskCache", "type": "boolean", "optional": true, "description": "Specifies that the request was served from the disk cache." },
                     { "name": "timing", "$ref": "ResourceTiming", "optional": true, "description": "Timing information for the given request." }
                 ]
             },
                 "properties": [
                     { "name": "url", "type": "string", "description": "Resource URL." },
                     { "name": "type", "$ref": "Page.ResourceType", "description": "Type of this resource." },
-                    { "name": "response", "$ref": "ResourceResponse", "description": "Cached response data." },
+                    { "name": "response", "$ref": "Response", "description": "Cached response data." },
                     { "name": "bodySize", "type": "number", "description": "Cached response body size." }
                 ]
             },
             {
                 "id": "Initiator",
                 "type": "object",
-                "description": "Information about the resource load initiator.",
+                "description": "Information about the request initiator.",
                 "properties": [
                     { "name": "type", "type": "string", "enum": ["parser", "script", "other"], "description": "Type of this initiator." },
                     { "name": "stackTrace", "$ref": "Console.StackTrace", "optional": true, "description": "Initiator JavaScript stack trace, set for Script only." },
                 ]
             },
             {
-                "name": "setExtraHeaders",
+                "name": "setExtraHTTPHeaders",
                 "description": "Allows sending extra HTTP headers with the requests from this page.",
                 "parameters": [
                     { "name": "headers", "type": "object", "description": "Map with extra HTTP headers." }
                 ]
             },
             {
-                "name": "getResourceContent",
-                "description": "Returns content of the given resource.",
+                "name": "getResponseBody",
+                "description": "Returns content served for the given request.",
                 "parameters": [
                     { "name": "requestId", "$ref": "RequestId", "description": "Identifier of the network request to get content for." }
                 ],
                 "returns": [
-                    { "name": "content", "type": "string", "description": "Resource content." },
+                    { "name": "body", "type": "string", "description": "Response body." },
                     { "name": "base64Encoded", "type": "boolean", "description": "True, if content was served as base64." }
                 ]
             },
                 "parameters": [
                     { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
                     { "name": "frameId", "type": "string", "description": "Frame identifier.", "hidden": true },
-                    { "name": "loaderId", "type": "string", "description": "Loader identifier." },
-                    { "name": "documentURL", "type": "string", "description": "URL of the document this resource is loaded for." },
-                    { "name": "request", "$ref": "ResourceRequest", "description": "Request data." },
+                    { "name": "loaderId", "$ref": "LoaderId", "description": "Loader identifier." },
+                    { "name": "documentURL", "type": "string", "description": "URL of the document this request is loaded for." },
+                    { "name": "request", "$ref": "Request", "description": "Request data." },
                     { "name": "timestamp", "type": "number", "description": "Timestamp." },
                     { "name": "initiator", "$ref": "Initiator", "description": "Request initiator." },
-                    { "name": "stackTrace", "$ref": "Console.StackTrace", "description": "JavaScript stack trace upon issuing this request." },
-                    { "name": "redirectResponse", "optional": true, "$ref": "ResourceResponse", "description": "Redirect response data." }
+                    { "name": "stackTrace", "$ref": "Console.StackTrace", "optional": true, "description": "JavaScript stack trace upon issuing this request." },
+                    { "name": "redirectResponse", "optional": true, "$ref": "Response", "description": "Redirect response data." }
                 ]
             },
             {
-                "name": "resourceMarkedAsCached",
-                "description": "Fired when request is known to be served from disk cache.",
+                "name": "requestServedFromCache",
+                "description": "Fired if request ended up loading from cache.",
                 "parameters": [
                     { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." }
                 ]
                     { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
                     { "name": "timestamp", "type": "number", "description": "Timestamp." },
                     { "name": "type", "$ref": "Page.ResourceType", "description": "Resource type." },
-                    { "name": "response", "$ref": "ResourceResponse", "description": "Response data." }
+                    { "name": "response", "$ref": "Response", "description": "Response data." }
                 ]
             },
             {
                 ]
             },
             {
-                "name": "resourceLoadedFromMemoryCache",
+                "name": "requestServedFromMemoryCache",
                 "description": "Fired when HTTP request has been served from memory cache.",
                 "parameters": [
                     { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
                     { "name": "frameId", "type": "string", "description": "Frame identifier.", "hidden": true },
-                    { "name": "loaderId", "type": "string", "description": "Loader identifier." },
-                    { "name": "documentURL", "type": "string", "description": "URL of the document this resource is loaded for." },
+                    { "name": "loaderId", "$ref": "LoaderId", "description": "Loader identifier." },
+                    { "name": "documentURL", "type": "string", "description": "URL of the document this request is loaded for." },
                     { "name": "timestamp", "type": "number", "description": "Timestamp." },
                     { "name": "initiator", "$ref": "Initiator", "description": "Request initiator." },
                     { "name": "resource", "$ref": "CachedResource", "description": "Cached resource data." }
                     { "name": "children", "type": "array", "optional": true, "items": { "$ref": "Node" }, "description": "Child nodes of this node when requested with children." },
                     { "name": "attributes", "type": "array", "optional": true, "items": { "type": "string" }, "description": "Attributes of the <code>Element</code> node in the form of flat array <code>[name1, value1, name2, value2]</code>." },
                     { "name": "documentURL", "type": "string", "optional": true, "description": "Document URL that <code>Document</code> or <code>FrameOwner</code> node points to." },
-                    { "name": "publicId", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s publicId. // FIXME" },
-                    { "name": "systemId", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s systemId. // FIXME" },
-                    { "name": "internalSubset", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s internalSubset. // FIXME" },
-                    { "name": "name", "type": "string", "optional": true, "description": "<code>Attr</code>'s name. // FIXME" },
-                    { "name": "value", "type": "string", "optional": true, "description": "<code>Attr</code>'s value. // FIXME" }
+                    { "name": "publicId", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s publicId." },
+                    { "name": "systemId", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s systemId." },
+                    { "name": "internalSubset", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s internalSubset." },
+                    { "name": "name", "type": "string", "optional": true, "description": "<code>Attr</code>'s name." },
+                    { "name": "value", "type": "string", "optional": true, "description": "<code>Attr</code>'s value." }
                 ],
                 "description": "DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. DOMNode is a base node mirror type."
             },
index 7d9ae70..d3823e6 100644 (file)
@@ -226,7 +226,7 @@ void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentL
 
 void InspectorResourceAgent::markResourceAsCached(unsigned long identifier)
 {
-    m_frontend->resourceMarkedAsCached(IdentifiersFactory::requestId(identifier));
+    m_frontend->requestServedFromCache(IdentifiersFactory::requestId(identifier));
 }
 
 void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response)
@@ -312,7 +312,7 @@ void InspectorResourceAgent::didLoadResourceFromMemoryCache(DocumentLoader* load
     m_resourcesData->addCachedResource(requestId, resource);
     RefPtr<InspectorObject> initiatorObject = buildInitiatorObject(loader->frame() ? loader->frame()->document() : 0);
 
-    m_frontend->resourceLoadedFromMemoryCache(requestId, frameId, loaderId, loader->url().string(), currentTime(), initiatorObject, buildObjectForCachedResource(*resource));
+    m_frontend->requestServedFromMemoryCache(requestId, frameId, loaderId, loader->url().string(), currentTime(), initiatorObject, buildObjectForCachedResource(*resource));
 }
 
 void InspectorResourceAgent::setInitialScriptContent(unsigned long identifier, const String& sourceString)
@@ -470,12 +470,12 @@ void InspectorResourceAgent::setUserAgentOverride(ErrorString*, const String& us
     m_userAgentOverride = userAgent;
 }
 
-void InspectorResourceAgent::setExtraHeaders(ErrorString*, PassRefPtr<InspectorObject> headers)
+void InspectorResourceAgent::setExtraHTTPHeaders(ErrorString*, PassRefPtr<InspectorObject> headers)
 {
     m_state->setObject(ResourceAgentState::extraRequestHeaders, headers);
 }
 
-void InspectorResourceAgent::getResourceContent(ErrorString* errorString, const String& requestId, String* content, bool* base64Encoded)
+void InspectorResourceAgent::getResponseBody(ErrorString* errorString, const String& requestId, String* content, bool* base64Encoded)
 {
     NetworkResourcesData::ResourceData const* resourceData = m_resourcesData->data(requestId);
     if (!resourceData) {
index 9378bbb..2357849 100644 (file)
@@ -124,8 +124,8 @@ public:
     void enable(ErrorString*);
     void disable(ErrorString*);
     void setUserAgentOverride(ErrorString*, const String& userAgent);
-    void setExtraHeaders(ErrorString*, PassRefPtr<InspectorObject>);
-    void getResourceContent(ErrorString*, const String& requestId, String* content, bool* base64Encoded);
+    void setExtraHTTPHeaders(ErrorString*, PassRefPtr<InspectorObject>);
+    void getResponseBody(ErrorString*, const String& requestId, String* content, bool* base64Encoded);
     void clearCache(ErrorString*, const String* const optionalPreservedLoaderId);
 
     void clearBrowserCache(ErrorString*);
index 81e7701..e627a24 100644 (file)
@@ -178,7 +178,7 @@ WebInspector.ExtensionServer.prototype = {
                     allHeaders[name] = headers[name];
             }
         }
-        NetworkAgent.setExtraHeaders(allHeaders);
+        NetworkAgent.setExtraHTTPHeaders(allHeaders);
     },
 
     _onCreatePanel: function(message, port)
index abc4fb4..3446a6d 100644 (file)
@@ -62,7 +62,7 @@ WebInspector.NetworkManager.prototype = {
         // 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 (resource.requestId)
-            NetworkAgent.getResourceContent(resource.requestId, callbackWrapper);
+            NetworkAgent.getResponseBody(resource.requestId, callbackWrapper);
         else
             PageAgent.getResourceContent(resource.frameId, resource.url, callbackWrapper);
     },
@@ -193,7 +193,7 @@ WebInspector.NetworkDispatcher.prototype = {
         this._startResource(resource);
     },
 
-    resourceMarkedAsCached: function(requestId)
+    requestServedFromCache: function(requestId)
     {
         var resource = this._inflightResourcesById[requestId];
         if (!resource)
@@ -256,7 +256,7 @@ WebInspector.NetworkDispatcher.prototype = {
         this._finishResource(resource, time);
     },
 
-    resourceLoadedFromMemoryCache: function(requestId, frameId, loaderId, documentURL, time, initiator, cachedResource)
+    requestServedFromMemoryCache: function(requestId, frameId, loaderId, documentURL, time, initiator, cachedResource)
     {
         var resource = this._createResource(requestId, frameId, loaderId, cachedResource.url, documentURL, initiator);
         this._updateResourceWithCachedResource(resource, cachedResource);