WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": true, "wss": true};
WebInspector.NetworkLogView._responseHeaderColumns = ["Cache-Control", "Connection", "Content-Encoding", "Content-Length", "ETag", "Keep-Alive", "Last-Modified", "Server", "Vary"];
WebInspector.NetworkLogView._defaultColumnsVisibility = {
- method: true, status: true, scheme: false, domain: false, type: true, initiator: true, cookies: false, setCookies: false, size: true, time: true,
+ method: true, status: true, scheme: false, domain: false, remoteAddress: false, type: true, initiator: true, cookies: false, setCookies: false, size: true, time: true,
"Cache-Control": false, "Connection": false, "Content-Encoding": false, "Content-Length": false, "ETag": false, "Keep-Alive": false, "Last-Modified": false, "Server": false, "Vary": false
};
WebInspector.NetworkLogView._defaultRefreshDelay = 500;
});
columns.push({
+ id: "remoteAddress",
+ title: WebInspector.UIString("Remote Address"),
+ sortable: true,
+ weight: 10,
+ align: WebInspector.DataGrid.Align.Right
+ });
+
+ columns.push({
id: "type",
title: WebInspector.UIString("Type"),
sortable: true,
this._sortingFunctions.status = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "statusCode", false);
this._sortingFunctions.scheme = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "scheme", false);
this._sortingFunctions.domain = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "domain", false);
+ this._sortingFunctions.remoteAddress = WebInspector.NetworkDataGridNode.RemoteAddressComparator;
this._sortingFunctions.type = WebInspector.NetworkDataGridNode.RequestPropertyComparator.bind(null, "mimeType", false);
this._sortingFunctions.initiator = WebInspector.NetworkDataGridNode.InitiatorComparator;
this._sortingFunctions.cookies = WebInspector.NetworkDataGridNode.RequestCookiesCountComparator;
this._dataGrid.scrollToLastRow();
},
- _onRecordButtonClicked: function(e)
+ _onRecordButtonClicked: function()
{
if (!this._recordButton.toggled)
this._reset();
return this._requests;
},
- /**
- * @return {!WebInspector.NetworkRequest}
- */
- requestById: function(id)
- {
- return this._requestsById[id];
- },
-
_onRequestStarted: function(event)
{
if (this._recordButton.toggled)
contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy request headers" : "Copy Request Headers"), this._copyRequestHeaders.bind(this, request));
if (request.responseHeadersText)
contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy response headers" : "Copy Response Headers"), this._copyResponseHeaders.bind(this, request));
+ if (request.finished)
+ contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy response" : "Copy Response"), this._copyResponse.bind(this, request));
contextMenu.appendItem(WebInspector.UIString("Copy as cURL"), this._copyCurlCommand.bind(this, request));
}
contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy all as HAR" : "Copy All as HAR"), this._copyAll.bind(this));
NetworkAgent.replayXHR(requestId);
},
+ _harRequests: function()
+ {
+ var httpRequests = this._requests.filter(WebInspector.NetworkLogView.HTTPRequestsFilter);
+ return httpRequests.filter(WebInspector.NetworkLogView.NonSourceMapRequestsFilter);
+ },
+
_copyAll: function()
{
var harArchive = {
- log: (new WebInspector.HARLog(this._requests.filter(WebInspector.NetworkLogView.HTTPRequestsFilter))).build()
+ log: (new WebInspector.HARLog(this._harRequests())).build()
};
InspectorFrontendHost.copyText(JSON.stringify(harArchive, null, 2));
},
InspectorFrontendHost.copyText(request.requestHeadersText());
},
+ _copyResponse: function(request)
+ {
+ function callback(content)
+ {
+ if (request.contentEncoded)
+ content = request.asDataURL();
+ InspectorFrontendHost.copyText(content || "");
+ }
+ request.requestContent(callback);
+ },
+
_copyResponseHeaders: function(request)
{
InspectorFrontendHost.copyText(request.responseHeadersText);
var progressIndicator = new WebInspector.ProgressIndicator();
this._progressBarContainer.appendChild(progressIndicator.element);
var harWriter = new WebInspector.HARWriter();
- harWriter.write(stream, this._requests.filter(WebInspector.NetworkLogView.HTTPRequestsFilter), progressIndicator);
+ harWriter.write(stream, this._harRequests(), progressIndicator);
}
},
*/
_highlightNthMatchedRequestForSearch: function(matchedRequestIndex, reveal)
{
- var request = this.requestById(this._matchedRequests[matchedRequestIndex]);
+ var request = this._requestsById[this._matchedRequests[matchedRequestIndex]];
if (!request)
return;
this._removeAllHighlights();
_highlightNode: function(node)
{
- node.element.classList.add("highlighted-row");
+ WebInspector.runCSSAnimationOnce(node.element, "highlighted-row");
this._highlightedNode = node;
},
return request.parsedURL.isValid && (request.scheme in WebInspector.NetworkLogView.HTTPSchemas);
}
+/**
+ * @param {!WebInspector.NetworkRequest} request
+ * @return {boolean}
+ */
+WebInspector.NetworkLogView.NonSourceMapRequestsFilter = function(request)
+{
+ return !WebInspector.SourceMap.hasSourceMapRequestHeader(request);
+}
WebInspector.NetworkLogView.EventTypes = {
ViewCleared: "ViewCleared",
this._searchableView.show(this.element);
this._contentsElement = this._searchableView.element;
- this.createSidebarView(this._contentsElement);
- this.splitView.hideMainElement();
+ this._splitView = new WebInspector.SplitView(true, false, "networkSidebarWidth");
+ this._splitView.show(this._contentsElement);
+ this._splitView.hideMain();
var defaultColumnsVisibility = WebInspector.NetworkLogView._defaultColumnsVisibility;
var networkLogColumnsVisibilitySetting = WebInspector.settings.createSetting("networkLogColumnsVisibility", defaultColumnsVisibility);
networkLogColumnsVisibilitySetting.set(columnsVisibility);
this._networkLogView = new WebInspector.NetworkLogView(this._filterBar, networkLogColumnsVisibilitySetting);
- this.splitView.setSidebarView(this._networkLogView);
+ this._networkLogView.show(this._splitView.sidebarElement());
- this._viewsContainerElement = this.splitView.mainElement();
+ var viewsContainerView = new WebInspector.View();
+ this._viewsContainerElement = viewsContainerView.element;
this._viewsContainerElement.id = "network-views";
- this._viewsContainerElement.classList.add("hidden");
if (!this._networkLogView.useLargeRows)
this._viewsContainerElement.classList.add("small");
+ viewsContainerView.show(this._splitView.mainElement());
this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.ViewCleared, this._onViewCleared, this);
this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.RowSizeChanged, this._onRowSizeChanged, this);
},
/**
- * @return {!WebInspector.NetworkRequest}
- */
- requestById: function(id)
- {
- return this._networkLogView.requestById(id);
- },
-
- _requestByAnchor: function(anchor)
- {
- return anchor.requestId ? this.requestById(anchor.requestId) : this._networkLogView._requestsByURL[anchor.href];
- },
-
- /**
- * @param {!Element} anchor
- * @return {boolean}
+ * @param {!WebInspector.NetworkRequest} request
*/
- showAnchorLocation: function(anchor)
- {
- var request = this._requestByAnchor(anchor);
- if (!request)
- return false;
- this.revealAndHighlightRequest(request)
- WebInspector.inspectorView.setCurrentPanel(this);
- return true;
- },
-
revealAndHighlightRequest: function(request)
{
this._toggleGridMode();
if (this._viewingRequestMode) {
this._viewingRequestMode = false;
this.element.classList.remove("viewing-resource");
- this.splitView.hideMainElement();
+ this._splitView.hideMain();
}
this._networkLogView.switchToDetailedView();
this._viewingRequestMode = true;
this.element.classList.add("viewing-resource");
- this.splitView.showMainElement();
+ this._splitView.showBoth();
this._networkLogView.allowPopover = false;
this._networkLogView._allowRequestSelection = true;
this._networkLogView.switchToBriefView();
/**
* @constructor
+ * @implements {WebInspector.Revealer}
+ */
+WebInspector.NetworkPanel.RequestRevealer = function()
+{
+}
+
+WebInspector.NetworkPanel.RequestRevealer.prototype = {
+ /**
+ * @param {!Object} request
+ */
+ reveal: function(request)
+ {
+ if (request instanceof WebInspector.NetworkRequest)
+ /** @type {!WebInspector.NetworkPanel} */ (WebInspector.showPanel("network")).revealAndHighlightRequest(request);
+ }
+}
+
+/**
+ * @constructor
* @implements {WebInspector.TimelineGrid.Calculator}
*/
WebInspector.NetworkBaseCalculator = function()
this._statusCell = this._createDivInTD("status");
this._schemeCell = this._createDivInTD("scheme");
this._domainCell = this._createDivInTD("domain");
+ this._remoteAddressCell = this._createDivInTD("remoteAddress");
this._typeCell = this._createDivInTD("type");
this._initiatorCell = this._createDivInTD("initiator");
this._cookiesCell = this._createDivInTD("cookies");
this._refreshStatusCell();
this._refreshSchemeCell();
this._refreshDomainCell();
+ this._refreshRemoteAddressCell();
this._refreshTypeCell();
this._refreshInitiatorCell();
this._refreshCookiesCell();
this._timelineCell.classList.add("resource-cached");
this._element.classList.add("network-item");
- this._element.enableStyleClass("network-error-row", this._request.failed || (this._request.statusCode >= 400));
+ this._element.enableStyleClass("network-error-row", this._isFailed());
this._updateElementStyleClasses(this._element);
},
/**
+ * @return {boolean}
+ */
+ _isFailed: function()
+ {
+ return !!this._request.failed || (this._request.statusCode >= 400);
+ },
+
+ /**
* @param {!Element} element
*/
_updateElementStyleClasses: function(element)
_refreshStatusCell: function()
{
this._statusCell.removeChildren();
+ this._statusCell.enableStyleClass("network-dim-cell", !this._isFailed() && (this._request.cached || !this._request.statusCode));
- if (this._request.failed) {
- var failText = this._request.canceled ? WebInspector.UIString("(canceled)") : WebInspector.UIString("(failed)");
+ if (this._request.failed && !this._request.canceled) {
+ var failText = WebInspector.UIString("(failed)");
if (this._request.localizedFailDescription) {
this._statusCell.appendChild(document.createTextNode(failText));
this._appendSubtitle(this._statusCell, this._request.localizedFailDescription);
this._statusCell.title = failText + " " + this._request.localizedFailDescription;
} else
this._statusCell.setTextAndTitle(failText);
- this._statusCell.classList.add("network-dim-cell");
- return;
- }
-
- this._statusCell.classList.remove("network-dim-cell");
-
- if (this._request.statusCode) {
+ } else if (this._request.statusCode) {
this._statusCell.appendChild(document.createTextNode("" + this._request.statusCode));
this._appendSubtitle(this._statusCell, this._request.statusText);
this._statusCell.title = this._request.statusCode + " " + this._request.statusText;
- if (this._request.cached)
- this._statusCell.classList.add("network-dim-cell");
+ } else if (this._request.parsedURL.isDataURL()) {
+ this._statusCell.setTextAndTitle(WebInspector.UIString("(data)"));
+ } else if (this._request.isPingRequest()) {
+ this._statusCell.setTextAndTitle(WebInspector.UIString("(ping)"));
+ } else if (this._request.canceled) {
+ this._statusCell.setTextAndTitle(WebInspector.UIString("(canceled)"));
+ } else if (this._request.finished) {
+ this._statusCell.setTextAndTitle(WebInspector.UIString("Finished"));
} else {
- if (this._request.parsedURL.isDataURL())
- this._statusCell.setTextAndTitle(WebInspector.UIString("(data)"));
- else if (this._request.isPingRequest())
- this._statusCell.setTextAndTitle(WebInspector.UIString("(ping)"));
- else if (this._request.finished)
- this._statusCell.setTextAndTitle(WebInspector.UIString("Finished"));
- else
- this._statusCell.setTextAndTitle(WebInspector.UIString("(pending)"));
- this._statusCell.classList.add("network-dim-cell");
+ this._statusCell.setTextAndTitle(WebInspector.UIString("(pending)"));
}
},
this._domainCell.setTextAndTitle(this._request.domain);
},
+ _refreshRemoteAddressCell: function()
+ {
+ this._remoteAddressCell.setTextAndTitle(this._request.remoteAddress());
+ },
+
_refreshTypeCell: function()
{
if (this._request.mimeType) {
return 0;
}
+WebInspector.NetworkDataGridNode.RemoteAddressComparator = function(a, b)
+{
+ var aRemoteAddress = a._request.remoteAddress();
+ var bRemoteAddress = b._request.remoteAddress();
+ if (aRemoteAddress > bRemoteAddress)
+ return 1;
+ if (bRemoteAddress > aRemoteAddress)
+ return -1;
+ return 0;
+}
+
WebInspector.NetworkDataGridNode.SizeComparator = function(a, b)
{
if (b._request.cached && !a._request.cached)