Diff
Modified: trunk/LayoutTests/ChangeLog (91927 => 91928)
--- trunk/LayoutTests/ChangeLog 2011-07-28 14:39:17 UTC (rev 91927)
+++ trunk/LayoutTests/ChangeLog 2011-07-28 15:13:34 UTC (rev 91928)
@@ -1,3 +1,16 @@
+2011-07-28 Vsevolod Vlasov <vse...@chromium.org>
+
+ Web Inspector: Add resource initiator column to network panel.
+ https://bugs.webkit.org/show_bug.cgi?id=65105
+
+ Reviewed by Pavel Feldman.
+
+ * http/tests/inspector/network/network-initiator-expected.txt: Added.
+ * http/tests/inspector/network/network-initiator.html: Added.
+ * http/tests/inspector/network/resources/initiator.css: Added.
+ (.image-background):
+ (.image-background-2):
+
2011-07-28 Tony Gentilcore <to...@chromium.org>
[chromium] New expectations for r91915
Added: trunk/LayoutTests/http/tests/inspector/network/network-initiator-expected.txt (0 => 91928)
--- trunk/LayoutTests/http/tests/inspector/network/network-initiator-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/network-initiator-expected.txt 2011-07-28 15:13:34 UTC (rev 91928)
@@ -0,0 +1,18 @@
+CONSOLE MESSAGE: line 34: Done.
+Tests resources initiator for images initiated by IMG tag, static CSS, CSS class added from _javascript_ and XHR.
+
+Bug 65105
+This div has background image set from CSS.
+This div will have background image set from _javascript_.
+Page reloaded.
+http://127.0.0.1:8000/inspector/network/resources/initiator.css: parser
+ http://127.0.0.1:8000/inspector/network/network-initiator.html 3
+http://127.0.0.1:8000/inspector/network/resources/resource.php?type=image&random=1&size=100: parser
+ http://127.0.0.1:8000/inspector/network/network-initiator.html 99
+http://127.0.0.1:8000/inspector/network/resources/resource.php?type=image&random=1&size=200: parser
+ http://127.0.0.1:8000/inspector/network/network-initiator.html 100
+http://127.0.0.1:8000/inspector/network/resources/resource.php?type=image&random=1&size=300: script
+ http://127.0.0.1:8000/inspector/network/network-initiator.html 17
+http://127.0.0.1:8000/inspector/network/resources/resource.php?type=image&random=1&size=400: script
+ http://127.0.0.1:8000/inspector/network/network-initiator.html 29
+
Property changes on: trunk/LayoutTests/http/tests/inspector/network/network-initiator-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/http/tests/inspector/network/network-initiator.html (0 => 91928)
--- trunk/LayoutTests/http/tests/inspector/network/network-initiator.html (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/network-initiator.html 2011-07-28 15:13:34 UTC (rev 91928)
@@ -0,0 +1,103 @@
+<html>
+<head>
+<link href="" rel="stylesheet" type="text/css">
+<script src=""
+<script src=""
+<script>
+
+function addClassToDiv()
+{
+ // We need to setTimeout, to make sure that style recalculation scheduling
+ // is really triggered by adding a class to the div.
+ window.setTimeout(addClassToDivStep2.bind(this), 0);
+}
+
+function addClassToDivStep2()
+{
+ document.getElementById("div-without-class").className = "image-background-2";
+}
+
+function loadData()
+{
+ var xhr = new XMLHttpRequest();
+ xhr._onreadystatechange_ = function()
+ {
+ if (xhr.readyState === XMLHttpRequest.DONE)
+ resourceLoaded();
+ };
+ xhr.open("GET", "resources/resource.php?type=image&random=1&size=400", true);
+ xhr.send(null);
+}
+
+function resourceLoaded()
+{
+ console.log("Done.");
+}
+
+var test = function()
+{
+ InspectorTest.reloadPage(step1);
+
+ function findResourceByURL(url)
+ {
+ var resources = WebInspector.networkLog.resources;
+ for (var i = 0; i < resources.length; ++i) {
+ if (url.test(resources[i].url))
+ return resources[i];
+ }
+ }
+
+ function step1()
+ {
+ WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, onResource);
+ InspectorTest.evaluateInPage("addClassToDiv()", step2);
+ }
+
+ function onResource(event)
+ {
+ var resource = event.data;
+ if (/size=300/.test(resource.url))
+ step2();
+ }
+
+ function step2()
+ {
+ if (!findResourceByURL(/size=300/))
+ return;
+
+ InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step3);
+ InspectorTest.evaluateInPage("loadData()");
+ }
+
+ function step3()
+ {
+ function dumpInitiator(resource)
+ {
+ var initiator = resource.initiator;
+ InspectorTest.addResult(resource.url + ": " + initiator.type);
+ if (initiator.url)
+ InspectorTest.addResult(" " + initiator.url + " " + initiator.lineNumber);
+ if (initiator.stackTrace)
+ InspectorTest.addResult(" " + initiator.stackTrace[0].url + " " + initiator.stackTrace[0].lineNumber);
+ }
+
+ dumpInitiator(findResourceByURL(/initiator\.css/));
+ dumpInitiator(findResourceByURL(/size=100/));
+ dumpInitiator(findResourceByURL(/size=200/));
+ dumpInitiator(findResourceByURL(/size=300/));
+ dumpInitiator(findResourceByURL(/size=400/));
+
+ InspectorTest.completeTest();
+ }
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests resources initiator for images initiated by IMG tag, static CSS, CSS class added from _javascript_ and XHR.</p>
+<a href="" 65105</a>
+<img src=""
+<div class="image-background">This div has background image set from CSS.</div>
+<div id="div-without-class">This div will have background image set from _javascript_.</div>
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/inspector/network/network-initiator.html
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/http/tests/inspector/network/resources/initiator.css (0 => 91928)
--- trunk/LayoutTests/http/tests/inspector/network/resources/initiator.css (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/resources/initiator.css 2011-07-28 15:13:34 UTC (rev 91928)
@@ -0,0 +1,8 @@
+.image-background {
+ background-image: url("resource.php?type=image&random=1&size=200");
+}
+
+.image-background-2 {
+ background-image: url("resource.php?type=image&random=1&size=300");
+}
+
Property changes on: trunk/LayoutTests/http/tests/inspector/network/resources/initiator.css
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (91927 => 91928)
--- trunk/Source/WebCore/ChangeLog 2011-07-28 14:39:17 UTC (rev 91927)
+++ trunk/Source/WebCore/ChangeLog 2011-07-28 15:13:34 UTC (rev 91928)
@@ -1,3 +1,50 @@
+2011-07-28 Vsevolod Vlasov <vse...@chromium.org>
+
+ Web Inspector: Add resource initiator column to network panel.
+ https://bugs.webkit.org/show_bug.cgi?id=65105
+
+ Reviewed by Pavel Feldman.
+
+ Test: http/tests/inspector/network/network-initiator.html
+
+ * English.lproj/localizedStrings.js:
+ * dom/Document.cpp:
+ (WebCore::Document::scheduleStyleRecalc):
+ * inspector/Inspector.json:
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::willRecalculateStyleImpl):
+ (WebCore::InspectorInstrumentation::didRecalculateStyleImpl):
+ (WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
+ * inspector/InspectorInstrumentation.h:
+ (WebCore::InspectorInstrumentation::didScheduleStyleRecalculation):
+ * inspector/InspectorResourceAgent.cpp:
+ (WebCore::InspectorResourceAgent::willSendRequest):
+ (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache):
+ (WebCore::InspectorResourceAgent::willRecalculateStyle):
+ (WebCore::InspectorResourceAgent::didRecalculateStyle):
+ (WebCore::InspectorResourceAgent::didScheduleStyleRecalculation):
+ (WebCore::InspectorResourceAgent::buildInitiatorObject):
+ (WebCore::InspectorResourceAgent::InspectorResourceAgent):
+ * inspector/InspectorResourceAgent.h:
+ * inspector/front-end/NetworkManager.js:
+ (WebInspector.NetworkDispatcher.prototype.requestWillBeSent):
+ (WebInspector.NetworkDispatcher.prototype.resourceLoadedFromMemoryCache):
+ (WebInspector.NetworkDispatcher.prototype._appendRedirect):
+ (WebInspector.NetworkDispatcher.prototype._createResource):
+ * inspector/front-end/NetworkPanel.js:
+ (WebInspector.NetworkLogView.prototype._createTable):
+ (WebInspector.NetworkLogView.prototype._createSortingFunctions):
+ (WebInspector.NetworkLogView.prototype.switchToDetailedView):
+ (WebInspector.NetworkLogView.prototype.switchToBriefView):
+ (WebInspector.NetworkLogView.prototype._toggleGridMode):
+ (WebInspector.NetworkLogView.prototype._toggleViewingResourceMode):
+ (WebInspector.NetworkDataGridNode.prototype.createCells):
+ (WebInspector.NetworkDataGridNode.prototype.refreshResource):
+ (WebInspector.NetworkDataGridNode.prototype._refreshInitiatorCell):
+ (WebInspector.NetworkDataGridNode.InitiatorComparator):
+ * inspector/front-end/networkLogView.css:
+ (.initiator-column a):
+
2011-07-28 Rob Buis <rb...@rim.com>
Use styling test from ietestcenter fails
Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js
(Binary files differ)
Modified: trunk/Source/WebCore/dom/Document.cpp (91927 => 91928)
--- trunk/Source/WebCore/dom/Document.cpp 2011-07-28 14:39:17 UTC (rev 91927)
+++ trunk/Source/WebCore/dom/Document.cpp 2011-07-28 15:13:34 UTC (rev 91928)
@@ -1457,6 +1457,8 @@
invalidateAccessKeyMap();
m_styleRecalcTimer.startOneShot(0);
+
+ InspectorInstrumentation::didScheduleStyleRecalculation(this);
}
void Document::unscheduleStyleRecalc()
Modified: trunk/Source/WebCore/inspector/Inspector.json (91927 => 91928)
--- trunk/Source/WebCore/inspector/Inspector.json 2011-07-28 14:39:17 UTC (rev 91927)
+++ trunk/Source/WebCore/inspector/Inspector.json 2011-07-28 15:13:34 UTC (rev 91928)
@@ -329,7 +329,7 @@
{ "name": "text", "type": "string", "description": "Message text." },
{ "name": "networkIdentifier", "type": "integer", "optional": true, "description": "Identifier of the network request associated with the console message." },
{ "name": "parameters", "type": "array", "items": { "$ref": "Runtime.RemoteObject" }, "description": "Message parameters in case of the formatted message." },
- { "name": "stackTrace", "type": "array", "optional": true, "items": { "$ref": "CallFrame" }, "description": "Call frames for assert and error messages." }
+ { "name": "stackTrace", "$ref": "StackTrace", "description": "Stack trace for assert and error messages." },
]
},
{
@@ -342,6 +342,12 @@
{ "name": "lineNumber", "type": "string", "description": "_javascript_ source line number." },
{ "name": "columnNumber", "type": "string", "description": "_javascript_ source column number." }
]
+ },
+ {
+ "id": "StackTrace",
+ "type": "array",
+ "items": { "$ref": "CallFrame" },
+ "description": "Call frames for assert and error messages."
}
],
"commands": [
@@ -459,6 +465,17 @@
{ "name": "response", "$ref": "ResourceResponse", "description": "Cached response data." },
{ "name": "bodySize", "type": "number", "description": "Cached response body size." }
]
+ },
+ {
+ "id": "Initiator",
+ "type": "object",
+ "description": "Information about the resource load initiator.",
+ "properties": [
+ { "name": "type", "type": "string", "enum": ["parser", "script", "other"], "description": "Type of this initiator." },
+ { "name": "stackTrace", "$ref": "Console.StackTrace", "description": "Initiator _javascript_ stack trace, set for Script only." },
+ { "name": "url", "type": "string", "optional": true, "description": "Initiator URL, set for Parser type only." },
+ { "name": "lineNumber", "type": "number", "optional": true, "description": "Initiator line number, set for Parser type only." }
+ ]
}
],
"commands": [
@@ -535,7 +552,8 @@
{ "name": "documentURL", "type": "string", "description": "URL of the document this resource is loaded for." },
{ "name": "request", "$ref": "ResourceRequest", "description": "Request data." },
{ "name": "timestamp", "type": "number", "description": "Timestamp." },
- { "name": "stackTrace", "type": "array", "items": { "$ref": "Console.CallFrame"}, "description": "_javascript_ stack trace upon issuing this request." },
+ { "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." }
]
},
@@ -593,6 +611,7 @@
{ "name": "loaderId", "type": "string", "description": "Loader identifier." },
{ "name": "documentURL", "type": "string", "description": "URL of the document this resource is loaded for." },
{ "name": "timestamp", "type": "number", "description": "Timestamp." },
+ { "name": "initiator", "$ref": "Initiator", "description": "Request initiator." },
{ "name": "resource", "$ref": "CachedResource", "description": "Cached resource data." }
]
},
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (91927 => 91928)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2011-07-28 14:39:17 UTC (rev 91927)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2011-07-28 15:13:34 UTC (rev 91928)
@@ -388,6 +388,8 @@
timelineAgent->willRecalculateStyle();
timelineAgentId = timelineAgent->id();
}
+ if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+ resourceAgent->willRecalculateStyle();
return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
}
@@ -395,8 +397,19 @@
{
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
timelineAgent->didRecalculateStyle();
+ InstrumentingAgents* instrumentingAgents = cookie.first;
+ if (!instrumentingAgents)
+ return;
+ if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+ resourceAgent->didRecalculateStyle();
}
+void InspectorInstrumentation::didScheduleStyleRecalculationImpl(InstrumentingAgents* instrumentingAgents, Document* document)
+{
+ if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+ resourceAgent->didScheduleStyleRecalculation(document);
+}
+
void InspectorInstrumentation::applyUserAgentOverrideImpl(InstrumentingAgents* instrumentingAgents, String* userAgent)
{
if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (91927 => 91928)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2011-07-28 14:39:17 UTC (rev 91927)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2011-07-28 15:13:34 UTC (rev 91928)
@@ -113,6 +113,7 @@
static void didPaint(const InspectorInstrumentationCookie&);
static InspectorInstrumentationCookie willRecalculateStyle(Document*);
static void didRecalculateStyle(const InspectorInstrumentationCookie&);
+ static void didScheduleStyleRecalculation(Document*);
static void applyUserAgentOverride(Frame*, String*);
static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
@@ -241,6 +242,7 @@
static void didPaintImpl(const InspectorInstrumentationCookie&);
static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*);
static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
+ static void didScheduleStyleRecalculationImpl(InstrumentingAgents*, Document*);
static void applyUserAgentOverrideImpl(InstrumentingAgents*, String*);
static void willSendRequestImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
@@ -665,6 +667,15 @@
#endif
}
+inline void InspectorInstrumentation::didScheduleStyleRecalculation(Document* document)
+{
+#if ENABLE(INSPECTOR)
+ FAST_RETURN_IF_NO_FRONTENDS(void());
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
+ didScheduleStyleRecalculationImpl(instrumentingAgents, document);
+#endif
+}
+
inline void InspectorInstrumentation::applyUserAgentOverride(Frame* frame, String* userAgent)
{
#if ENABLE(INSPECTOR)
Modified: trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp (91927 => 91928)
--- trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp 2011-07-28 14:39:17 UTC (rev 91927)
+++ trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp 2011-07-28 15:13:34 UTC (rev 91928)
@@ -60,6 +60,7 @@
#include "ResourceResponse.h"
#include "ScriptCallStack.h"
#include "ScriptCallStackFactory.h"
+#include "ScriptableDocumentParser.h"
#include "WebSocketHandshakeRequest.h"
#include "WebSocketHandshakeResponse.h"
@@ -231,7 +232,8 @@
callStackValue = callStack->buildInspectorArray();
else
callStackValue = InspectorArray::create();
- m_frontend->requestWillBeSent(resourceId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), loader->url().string(), buildObjectForResourceRequest(request), currentTime(), callStackValue, buildObjectForResourceResponse(redirectResponse));
+ RefPtr<InspectorObject> initiatorObject = buildInitiatorObject(loader->frame() ? loader->frame()->document() : 0);
+ m_frontend->requestWillBeSent(resourceId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), loader->url().string(), buildObjectForResourceRequest(request), currentTime(), initiatorObject, callStackValue, buildObjectForResourceResponse(redirectResponse));
}
void InspectorResourceAgent::markResourceAsCached(unsigned long identifier)
@@ -314,8 +316,9 @@
String resourceId = IdentifiersFactory::resourceId(identifier);
m_resourcesData->resourceCreated(resourceId, loaderId);
m_resourcesData->addCachedResource(resourceId, resource);
+ RefPtr<InspectorObject> initiatorObject = buildInitiatorObject(loader->frame() ? loader->frame()->document() : 0);
- m_frontend->resourceLoadedFromMemoryCache(resourceId, frameId, loaderId, loader->url().string(), currentTime(), buildObjectForCachedResource(*resource));
+ m_frontend->resourceLoadedFromMemoryCache(resourceId, frameId, loaderId, loader->url().string(), currentTime(), initiatorObject, buildObjectForCachedResource(*resource));
}
void InspectorResourceAgent::setInitialScriptContent(unsigned long identifier, const String& sourceString)
@@ -349,6 +352,49 @@
*userAgent = m_userAgentOverride;
}
+void InspectorResourceAgent::willRecalculateStyle()
+{
+ m_isRecalculatingStyle = true;
+}
+
+void InspectorResourceAgent::didRecalculateStyle()
+{
+ m_isRecalculatingStyle = false;
+ m_styleRecalculationInitiator = nullptr;
+}
+
+void InspectorResourceAgent::didScheduleStyleRecalculation(Document* document)
+{
+ if (!m_styleRecalculationInitiator)
+ m_styleRecalculationInitiator = buildInitiatorObject(document);
+}
+
+PassRefPtr<InspectorObject> InspectorResourceAgent::buildInitiatorObject(Document* document)
+{
+ RefPtr<ScriptCallStack> stackTrace = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
+ if (stackTrace && stackTrace->size() > 0) {
+ RefPtr<InspectorObject> initiatorObject = InspectorObject::create();
+ initiatorObject->setString("type", "script");
+ initiatorObject->setArray("stackTrace", stackTrace->buildInspectorArray());
+ return initiatorObject;
+ }
+
+ if (document && document->scriptableDocumentParser()) {
+ RefPtr<InspectorObject> initiatorObject = InspectorObject::create();
+ initiatorObject->setString("type", "parser");
+ initiatorObject->setString("url", document->url().string());
+ initiatorObject->setNumber("lineNumber", document->scriptableDocumentParser()->lineNumber() + 1);
+ return initiatorObject;
+ }
+
+ if (m_isRecalculatingStyle && m_styleRecalculationInitiator)
+ return m_styleRecalculationInitiator;
+
+ RefPtr<InspectorObject> initiatorObject = InspectorObject::create();
+ initiatorObject->setString("type", "other");
+ return initiatorObject;
+}
+
#if ENABLE(WEB_SOCKETS)
// FIXME: More this into the front-end?
@@ -527,6 +573,7 @@
, m_state(state)
, m_resourcesData(adoptPtr(new NetworkResourcesData()))
, m_loadingXHRSynchronously(false)
+ , m_isRecalculatingStyle(false)
{
if (isBackgroundEventsCollectionEnabled()) {
initializeBackgroundCollection();
Modified: trunk/Source/WebCore/inspector/InspectorResourceAgent.h (91927 => 91928)
--- trunk/Source/WebCore/inspector/InspectorResourceAgent.h 2011-07-28 14:39:17 UTC (rev 91927)
+++ trunk/Source/WebCore/inspector/InspectorResourceAgent.h 2011-07-28 15:13:34 UTC (rev 91928)
@@ -104,6 +104,13 @@
void applyUserAgentOverride(String* userAgent);
+ // FIXME: InspectorResourceAgent should now be aware of style recalculation.
+ void willRecalculateStyle();
+ void didRecalculateStyle();
+ void didScheduleStyleRecalculation(Document*);
+
+ PassRefPtr<InspectorObject> buildInitiatorObject(Document*);
+
#if ENABLE(WEB_SOCKETS)
void didCreateWebSocket(unsigned long identifier, const KURL& requestURL);
void willSendWebSocketHandshakeRequest(unsigned long identifier, const WebSocketHandshakeRequest&);
@@ -147,6 +154,10 @@
String m_userAgentOverride;
OwnPtr<NetworkResourcesData> m_resourcesData;
bool m_loadingXHRSynchronously;
+
+ // FIXME: InspectorResourceAgent should now be aware of style recalculation.
+ RefPtr<InspectorObject> m_styleRecalculationInitiator;
+ bool m_isRecalculatingStyle;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/inspector/front-end/NetworkManager.js (91927 => 91928)
--- trunk/Source/WebCore/inspector/front-end/NetworkManager.js 2011-07-28 14:39:17 UTC (rev 91927)
+++ trunk/Source/WebCore/inspector/front-end/NetworkManager.js 2011-07-28 15:13:34 UTC (rev 91928)
@@ -131,7 +131,7 @@
return response && !response.status && !response.mimeType && !Object.keys(response.headers).length;
},
- requestWillBeSent: function(identifier, frameId, loaderId, documentURL, request, time, stackTrace, redirectResponse)
+ requestWillBeSent: function(identifier, frameId, loaderId, documentURL, request, time, initiator, stackTrace, redirectResponse)
{
var resource = this._inflightResourcesById[identifier];
if (resource) {
@@ -141,7 +141,7 @@
this.responseReceived(identifier, time, "Other", redirectResponse);
resource = this._appendRedirect(identifier, time, request.url);
} else
- resource = this._createResource(identifier, frameId, loaderId, request.url, documentURL, stackTrace);
+ resource = this._createResource(identifier, frameId, loaderId, request.url, documentURL, initiator, stackTrace);
resource.hasNetworkData = true;
this._updateResourceWithRequest(resource, request);
resource.startTime = time;
@@ -212,9 +212,9 @@
this._finishResource(resource, time);
},
- resourceLoadedFromMemoryCache: function(identifier, frameId, loaderId, documentURL, time, cachedResource)
+ resourceLoadedFromMemoryCache: function(identifier, frameId, loaderId, documentURL, time, initiator, cachedResource)
{
- var resource = this._createResource(identifier, frameId, loaderId, cachedResource.url, documentURL);
+ var resource = this._createResource(identifier, frameId, loaderId, cachedResource.url, documentURL, initiator);
this._updateResourceWithCachedResource(resource, cachedResource);
resource.cached = true;
resource.requestMethod = "GET";
@@ -286,7 +286,7 @@
delete originalResource.redirects;
this._finishResource(originalResource, time);
var newResource = this._createResource(identifier, originalResource.frameId, originalResource.loaderId,
- redirectURL, originalResource.documentURL, originalResource.stackTrace);
+ redirectURL, originalResource.documentURL, originalResource.initiator, originalResource.stackTrace);
newResource.redirects = previousRedirects.concat(originalResource);
return newResource;
},
@@ -317,11 +317,12 @@
this._manager.dispatchEventToListeners(eventType, resource);
},
- _createResource: function(identifier, frameId, loaderId, url, documentURL, stackTrace)
+ _createResource: function(identifier, frameId, loaderId, url, documentURL, initiator, stackTrace)
{
var resource = new WebInspector.Resource(identifier, url, loaderId);
resource.documentURL = documentURL;
resource.frameId = frameId;
+ resource.initiator = initiator;
resource.stackTrace = stackTrace;
return resource;
}
Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (91927 => 91928)
--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-07-28 14:39:17 UTC (rev 91927)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-07-28 15:13:34 UTC (rev 91928)
@@ -143,7 +143,7 @@
_createTable: function()
{
- var columns = {name: {}, method: {}, status: {}, type: {}, size: {}, time: {}, timeline: {}};
+ var columns = {name: {}, method: {}, status: {}, type: {}, initiator: {}, size: {}, time: {}, timeline: {}};
columns.name.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Name"), WebInspector.UIString("Path"));
columns.name.sortable = true;
columns.name.width = "20%";
@@ -161,6 +161,10 @@
columns.type.sortable = true;
columns.type.width = "6%";
+ columns.initiator.title = WebInspector.UIString("Initiator");
+ columns.initiator.sortable = true;
+ columns.initiator.width = "10%";
+
columns.size.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Size"), WebInspector.UIString("Content"));
columns.size.sortable = true;
columns.size.width = "6%";
@@ -173,7 +177,7 @@
columns.timeline.title = "";
columns.timeline.sortable = false;
- columns.timeline.width = "50%";
+ columns.timeline.width = "40%";
columns.timeline.sort = "ascending";
this._dataGrid = new WebInspector.DataGrid(columns);
@@ -251,6 +255,7 @@
this._sortingFunctions.method = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "method", false);
this._sortingFunctions.status = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "statusCode", false);
this._sortingFunctions.type = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "mimeType", false);
+ this._sortingFunctions.initiator = WebInspector.NetworkDataGridNode.InitiatorComparator;
this._sortingFunctions.size = WebInspector.NetworkDataGridNode.SizeComparator;
this._sortingFunctions.time = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "duration", false);
this._sortingFunctions.timeline = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "startTime", false);
@@ -800,6 +805,7 @@
this._dataGrid.showColumn("method");
this._dataGrid.showColumn("status");
this._dataGrid.showColumn("type");
+ this._dataGrid.showColumn("initiator");
this._dataGrid.showColumn("size");
this._dataGrid.showColumn("time");
this._dataGrid.showColumn("timeline");
@@ -809,9 +815,10 @@
widths.method = 6;
widths.status = 6;
widths.type = 6;
+ widths.initiator = 10;
widths.size = 6;
widths.time = 6;
- widths.timeline = 50;
+ widths.timeline = 40;
this._dataGrid.applyColumnWidthsMap(widths);
},
@@ -823,6 +830,7 @@
this._dataGrid.hideColumn("method");
this._dataGrid.hideColumn("status");
this._dataGrid.hideColumn("type");
+ this._dataGrid.hideColumn("initiator");
this._dataGrid.hideColumn("size");
this._dataGrid.hideColumn("time");
this._dataGrid.hideColumn("timeline");
@@ -891,6 +899,7 @@
this._dataGrid.showColumn("method");
this._dataGrid.showColumn("status");
this._dataGrid.showColumn("type");
+ this._dataGrid.showColumn("initiator");
this._dataGrid.showColumn("size");
this._dataGrid.showColumn("time");
@@ -899,9 +908,10 @@
widths.method = 6;
widths.status = 6;
widths.type = 6;
+ widths.initiator = 10;
widths.size = 6;
widths.time = 6;
- widths.timeline = 50;
+ widths.timeline = 40;
this._dataGrid.showColumn("timeline");
this._dataGrid.applyColumnWidthsMap(widths);
@@ -918,6 +928,7 @@
this._dataGrid.hideColumn("method");
this._dataGrid.hideColumn("status");
this._dataGrid.hideColumn("type");
+ this._dataGrid.hideColumn("initiator");
this._dataGrid.hideColumn("size");
this._dataGrid.hideColumn("time");
this._dataGrid.hideColumn("timeline");
@@ -1724,6 +1735,7 @@
this._methodCell = this._createDivInTD("method");
this._statusCell = this._createDivInTD("status");
this._typeCell = this._createDivInTD("type");
+ this._initiatorCell = this._createDivInTD("initiator");
this._sizeCell = this._createDivInTD("size");
this._timeCell = this._createDivInTD("time");
this._createTimelineCell();
@@ -1816,6 +1828,7 @@
this._refreshStatusCell();
this._refreshTypeCell();
+ this._refreshInitiatorCell();
this._refreshSizeCell();
this._refreshTimeCell();
@@ -1917,6 +1930,28 @@
}
},
+ _refreshInitiatorCell: function()
+ {
+ var initiator = this._resource.initiator;
+ if (!initiator || initiator.type === "other") {
+ this._initiatorCell.addStyleClass("network-dim-cell");
+ this._initiatorCell.setTextAndTitle(WebInspector.UIString("Other"));
+ } else {
+ this._initiatorCell.removeStyleClass("network-dim-cell");
+ this._initiatorCell.removeChildren();
+ if (initiator.type === "script") {
+ var topFrame = initiator.stackTrace[0];
+ this._initiatorCell.title = topFrame.url + ":" + topFrame.lineNumber;
+ this._initiatorCell.appendChild(WebInspector.linkifyResourceAsNode(topFrame.url, "scripts", topFrame.lineNumber));
+ this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Script"));
+ } else { // initiator.type === "parser"
+ this._initiatorCell.title = initiator.url + ":" + initiator.lineNumber;
+ this._initiatorCell.appendChild(WebInspector.linkifyResourceAsNode(initiator.url, "resources", initiator.lineNumber));
+ this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Parser"));
+ }
+ }
+ },
+
_refreshSizeCell: function()
{
if (this._resource.cached) {
@@ -2073,6 +2108,21 @@
return a._resource.resourceSize - b._resource.resourceSize;
}
+WebInspector.NetworkDataGridNode.InitiatorComparator = function(a, b)
+{
+ if (!a._resource.initiator || a._resource.initiator.type === "Other")
+ return -1;
+ if (!b._resource.initiator || b._resource.initiator.type === "Other")
+ return 1;
+
+ if (a._resource.initiator.url < b._resource.initiator.url)
+ return -1;
+ if (a._resource.initiator.url > b._resource.initiator.url)
+ return 1;
+
+ return a._resource.initiator.lineNumber - b._resource.initiator.lineNumber;
+}
+
WebInspector.NetworkDataGridNode.ResourcePropertyComparator = function(propertyName, revert, a, b)
{
var aValue = a._resource[propertyName];
Modified: trunk/Source/WebCore/inspector/front-end/networkLogView.css (91927 => 91928)
--- trunk/Source/WebCore/inspector/front-end/networkLogView.css 2011-07-28 14:39:17 UTC (rev 91927)
+++ trunk/Source/WebCore/inspector/front-end/networkLogView.css 2011-07-28 15:13:34 UTC (rev 91928)
@@ -89,6 +89,7 @@
.network-log-grid td.method-column,
.network-log-grid td.status-column,
.network-log-grid td.type-column,
+.network-log-grid td.initiator-column,
.network-log-grid td.size-column,
.network-log-grid td.time-column {
background-color: rgba(0, 0, 0, 0.07);
@@ -112,6 +113,10 @@
color: gray;
}
+.initiator-column a {
+ color: inherit;
+}
+
.network-log-grid tr.selected .network-cell-subtitle {
color: white;
}