Index: chrome_linux/resources/inspector/NetworkPanel.js |
=================================================================== |
--- chrome_linux/resources/inspector/NetworkPanel.js (revision 237140) |
+++ chrome_linux/resources/inspector/NetworkPanel.js (working copy) |
@@ -27,7 +27,7 @@ |
{this._innerView=innerView;},wasShown:function() |
{this._ensureInnerViewShown();},_ensureInnerViewShown:function() |
{if(this._innerViewShowRequested) |
-return;this._innerViewShowRequested=true;function callback(content,contentEncoded,mimeType) |
+return;this._innerViewShowRequested=true;function callback(content) |
{this._innerViewShowRequested=false;this.contentLoaded();} |
this.request.requestContent(callback.bind(this));},contentLoaded:function() |
{},canHighlightPosition:function() |
@@ -60,32 +60,33 @@ |
{var urlFragment=this._request.parsedURL.fragment;this._urlFragmentTreeElement.hidden=!urlFragment;if(!urlFragment) |
return;var sectionTitle=WebInspector.UIString("URL fragment");this._urlFragmentTreeElement.removeChildren();this._urlFragmentTreeElement.listItemElement.removeChildren();this._urlFragmentTreeElement.listItemElement.appendChild(document.createTextNode(sectionTitle));var fragmentTreeElement=new TreeElement(null,null,false);fragmentTreeElement.title=this._formatHeader("#",urlFragment);fragmentTreeElement.selectable=false;this._urlFragmentTreeElement.appendChild(fragmentTreeElement);},_refreshFormData:function() |
{this._formDataTreeElement.hidden=true;this._requestPayloadTreeElement.hidden=true;var formData=this._request.requestFormData;if(!formData) |
-return;var formParameters=this._request.formParameters;if(formParameters){this._formDataTreeElement.hidden=false;this._refreshParams(WebInspector.UIString("Form Data"),formParameters,formData,this._formDataTreeElement);}else{this._requestPayloadTreeElement.hidden=false;try{var json=JSON.parse(formData);this._refreshRequestJSONPayload(json,formData,false);}catch(e){this._populateTreeElementWithSourceText(this._requestPayloadTreeElement,formData);}}},_populateTreeElementWithSourceText:function(treeElement,sourceText) |
+return;var formParameters=this._request.formParameters;if(formParameters){this._formDataTreeElement.hidden=false;this._refreshParams(WebInspector.UIString("Form Data"),formParameters,formData,this._formDataTreeElement);}else{this._requestPayloadTreeElement.hidden=false;try{var json=JSON.parse(formData);this._refreshRequestJSONPayload(json,formData);}catch(e){this._populateTreeElementWithSourceText(this._requestPayloadTreeElement,formData);}}},_populateTreeElementWithSourceText:function(treeElement,sourceText) |
{treeElement.removeChildren();var sourceTreeElement=new TreeElement(null,null,false);sourceTreeElement.selectable=false;treeElement.appendChild(sourceTreeElement);var sourceTextElement=document.createElement("span");sourceTextElement.addStyleClass("header-value");sourceTextElement.addStyleClass("source-code");sourceTextElement.textContent=String(sourceText).trim();sourceTreeElement.listItemElement.appendChild(sourceTextElement);},_refreshParams:function(title,params,sourceText,paramsTreeElement) |
-{paramsTreeElement.removeChildren();paramsTreeElement.listItemElement.removeChildren();paramsTreeElement.listItemElement.appendChild(document.createTextNode(title));var headerCount=document.createElement("span");headerCount.addStyleClass("header-count");headerCount.textContent=WebInspector.UIString(" (%d)",params.length);paramsTreeElement.listItemElement.appendChild(headerCount);function toggleViewSource() |
+{paramsTreeElement.removeChildren();paramsTreeElement.listItemElement.removeChildren();paramsTreeElement.listItemElement.appendChild(document.createTextNode(title));var headerCount=document.createElement("span");headerCount.addStyleClass("header-count");headerCount.textContent=WebInspector.UIString(" (%d)",params.length);paramsTreeElement.listItemElement.appendChild(headerCount);function toggleViewSource(event) |
{paramsTreeElement._viewSource=!paramsTreeElement._viewSource;this._refreshParams(title,params,sourceText,paramsTreeElement);} |
paramsTreeElement.listItemElement.appendChild(this._createViewSourceToggle(paramsTreeElement._viewSource,toggleViewSource.bind(this)));if(paramsTreeElement._viewSource){this._populateTreeElementWithSourceText(paramsTreeElement,sourceText);return;} |
-var toggleTitle=this._decodeRequestParameters?WebInspector.UIString("view URL encoded"):WebInspector.UIString("view decoded");var toggleButton=this._createToggleButton(toggleTitle);toggleButton.addEventListener("click",this._toggleURLDecoding.bind(this));paramsTreeElement.listItemElement.appendChild(toggleButton);for(var i=0;i<params.length;++i){var paramNameValue=document.createDocumentFragment();var name=this._formatParameter(params[i].name+":","header-name",this._decodeRequestParameters);var value=this._formatParameter(params[i].value,"header-value source-code",this._decodeRequestParameters);paramNameValue.appendChild(name);paramNameValue.appendChild(value);var parmTreeElement=new TreeElement(paramNameValue,null,false);parmTreeElement.selectable=false;paramsTreeElement.appendChild(parmTreeElement);}},_refreshRequestJSONPayload:function(parsedObject,sourceText,viewSource) |
-{this._requestPayloadTreeElement.removeChildren();var listItem=this._requestPayloadTreeElement.listItemElement;listItem.removeChildren();listItem.appendChild(document.createTextNode(this._requestPayloadTreeElement.title));var setViewSource=this._refreshRequestJSONPayload.bind(this,parsedObject,sourceText);if(viewSource){listItem.appendChild(this._createViewSourceToggle(true,setViewSource.bind(this,false)));this._populateTreeElementWithSourceText(this._requestPayloadTreeElement,sourceText);}else{listItem.appendChild(this._createViewSourceToggle(false,setViewSource.bind(this,true)));var object=WebInspector.RemoteObject.fromLocalObject(parsedObject);var section=new WebInspector.ObjectPropertiesSection(object,object.description);section.expand();section.editable=false;listItem.appendChild(section.element);}},_createViewSourceToggle:function(viewSource,handler) |
-{var viewSourceToggleTitle=viewSource?WebInspector.UIString("view parsed"):WebInspector.UIString("view source");var viewSourceToggleButton=this._createToggleButton(viewSourceToggleTitle);viewSourceToggleButton.addEventListener("click",handler);return viewSourceToggleButton;},_toggleURLDecoding:function(event) |
-{this._decodeRequestParameters=!this._decodeRequestParameters;this._refreshQueryString();this._refreshFormData();},_getHeaderValue:function(headers,key) |
-{var lowerKey=key.toLowerCase();for(var testKey in headers){if(testKey.toLowerCase()===lowerKey) |
-return headers[testKey];}},_refreshRequestHeaders:function() |
-{if(this._showRequestHeadersText) |
-this._refreshHeadersText(WebInspector.UIString("Request Headers"),this._request.sortedRequestHeaders,this._request.requestHeadersText,this._requestHeadersTreeElement);else |
-this._refreshHeaders(WebInspector.UIString("Request Headers"),this._request.sortedRequestHeaders,this._requestHeadersTreeElement);if(this._request.requestHeadersText){var toggleButton=this._createHeadersToggleButton(this._showRequestHeadersText);toggleButton.addEventListener("click",this._toggleRequestHeadersText.bind(this));this._requestHeadersTreeElement.listItemElement.appendChild(toggleButton);} |
+var toggleTitle=this._decodeRequestParameters?WebInspector.UIString("view URL encoded"):WebInspector.UIString("view decoded");var toggleButton=this._createToggleButton(toggleTitle);toggleButton.addEventListener("click",this._toggleURLDecoding.bind(this),false);paramsTreeElement.listItemElement.appendChild(toggleButton);for(var i=0;i<params.length;++i){var paramNameValue=document.createDocumentFragment();var name=this._formatParameter(params[i].name+":","header-name",this._decodeRequestParameters);var value=this._formatParameter(params[i].value,"header-value source-code",this._decodeRequestParameters);paramNameValue.appendChild(name);paramNameValue.appendChild(value);var parmTreeElement=new TreeElement(paramNameValue,null,false);parmTreeElement.selectable=false;paramsTreeElement.appendChild(parmTreeElement);}},_refreshRequestJSONPayload:function(parsedObject,sourceText) |
+{var treeElement=this._requestPayloadTreeElement;treeElement.removeChildren();var listItem=this._requestPayloadTreeElement.listItemElement;listItem.removeChildren();listItem.appendChild(document.createTextNode(this._requestPayloadTreeElement.title));function toggleViewSource(event) |
+{treeElement._viewSource=!treeElement._viewSource;this._refreshRequestJSONPayload(parsedObject,sourceText);} |
+listItem.appendChild(this._createViewSourceToggle(treeElement._viewSource,toggleViewSource.bind(this)));if(treeElement._viewSource){this._populateTreeElementWithSourceText(this._requestPayloadTreeElement,sourceText);}else{var object=WebInspector.RemoteObject.fromLocalObject(parsedObject);var section=new WebInspector.ObjectPropertiesSection(object,object.description);section.expand();section.editable=false;listItem.appendChild(section.element);}},_createViewSourceToggle:function(viewSource,handler) |
+{var viewSourceToggleTitle=viewSource?WebInspector.UIString("view parsed"):WebInspector.UIString("view source");var viewSourceToggleButton=this._createToggleButton(viewSourceToggleTitle);viewSourceToggleButton.addEventListener("click",handler,false);return viewSourceToggleButton;},_toggleURLDecoding:function(event) |
+{this._decodeRequestParameters=!this._decodeRequestParameters;this._refreshQueryString();this._refreshFormData();},_refreshRequestHeaders:function() |
+{var treeElement=this._requestHeadersTreeElement;var headers=this._request.requestHeaders();headers=headers.slice();headers.sort(function(a,b){return a.name.toLowerCase().compareTo(b.name.toLowerCase())});var headersText=this._request.requestHeadersText();if(this._showRequestHeadersText&&headersText) |
+this._refreshHeadersText(WebInspector.UIString("Request Headers"),headers.length,headersText,treeElement);else |
+this._refreshHeaders(WebInspector.UIString("Request Headers"),headers,treeElement);if(headersText===undefined){var caution=WebInspector.UIString(" CAUTION: Provisional headers are shown.");treeElement.listItemElement.createChild("span","caution").textContent=caution;} |
+if(headersText){var toggleButton=this._createHeadersToggleButton(this._showRequestHeadersText);toggleButton.addEventListener("click",this._toggleRequestHeadersText.bind(this),false);treeElement.listItemElement.appendChild(toggleButton);} |
this._refreshFormData();},_refreshResponseHeaders:function() |
-{if(this._showResponseHeadersText) |
-this._refreshHeadersText(WebInspector.UIString("Response Headers"),this._request.sortedResponseHeaders,this._request.responseHeadersText,this._responseHeadersTreeElement);else |
-this._refreshHeaders(WebInspector.UIString("Response Headers"),this._request.sortedResponseHeaders,this._responseHeadersTreeElement);if(this._request.responseHeadersText){var toggleButton=this._createHeadersToggleButton(this._showResponseHeadersText);toggleButton.addEventListener("click",this._toggleResponseHeadersText.bind(this));this._responseHeadersTreeElement.listItemElement.appendChild(toggleButton);}},_refreshHTTPInformation:function() |
+{var treeElement=this._responseHeadersTreeElement;var headers=this._request.sortedResponseHeaders;var headersText=this._request.responseHeadersText;if(this._showResponseHeadersText) |
+this._refreshHeadersText(WebInspector.UIString("Response Headers"),headers.length,headersText,treeElement);else |
+this._refreshHeaders(WebInspector.UIString("Response Headers"),headers,treeElement);if(headersText){var toggleButton=this._createHeadersToggleButton(this._showResponseHeadersText);toggleButton.addEventListener("click",this._toggleResponseHeadersText.bind(this),false);treeElement.listItemElement.appendChild(toggleButton);}},_refreshHTTPInformation:function() |
{var requestMethodElement=this._requestMethodTreeElement;requestMethodElement.hidden=!this._request.statusCode;var statusCodeElement=this._statusCodeTreeElement;statusCodeElement.hidden=!this._request.statusCode;if(this._request.statusCode){var statusCodeFragment=document.createDocumentFragment();statusCodeFragment.createChild("div","header-name").textContent=WebInspector.UIString("Status Code")+":";var statusCodeImage=statusCodeFragment.createChild("div","resource-status-image");statusCodeImage.title=this._request.statusCode+" "+this._request.statusText;if(this._request.statusCode<300||this._request.statusCode===304) |
statusCodeImage.addStyleClass("green-ball");else if(this._request.statusCode<400) |
statusCodeImage.addStyleClass("orange-ball");else |
statusCodeImage.addStyleClass("red-ball");requestMethodElement.title=this._formatHeader(WebInspector.UIString("Request Method"),this._request.requestMethod);var value=statusCodeFragment.createChild("div","header-value source-code");value.textContent=this._request.statusCode+" "+this._request.statusText;if(this._request.cached) |
value.createChild("span","status-from-cache").textContent=" "+WebInspector.UIString("(from cache)");statusCodeElement.title=statusCodeFragment;}},_refreshHeadersTitle:function(title,headersTreeElement,headersLength) |
-{headersTreeElement.listItemElement.removeChildren();headersTreeElement.listItemElement.appendChild(document.createTextNode(title));var headerCount=document.createElement("span");headerCount.addStyleClass("header-count");headerCount.textContent=WebInspector.UIString(" (%d)",headersLength);headersTreeElement.listItemElement.appendChild(headerCount);},_refreshHeaders:function(title,headers,headersTreeElement) |
-{headersTreeElement.removeChildren();var length=headers.length;this._refreshHeadersTitle(title,headersTreeElement,length);headersTreeElement.hidden=!length;for(var i=0;i<length;++i){var headerTreeElement=new TreeElement(null,null,false);headerTreeElement.title=this._formatHeader(headers[i].name,headers[i].value);headerTreeElement.selectable=false;headersTreeElement.appendChild(headerTreeElement);}},_refreshHeadersText:function(title,headers,headersText,headersTreeElement) |
-{this._populateTreeElementWithSourceText(headersTreeElement,headersText);this._refreshHeadersTitle(title,headersTreeElement,headers.length);},_toggleRequestHeadersText:function(event) |
+{headersTreeElement.listItemElement.removeChildren();headersTreeElement.listItemElement.createTextChild(title);var headerCount=WebInspector.UIString(" (%d)",headersLength);headersTreeElement.listItemElement.createChild("span","header-count").textContent=headerCount;},_refreshHeaders:function(title,headers,headersTreeElement) |
+{headersTreeElement.removeChildren();var length=headers.length;this._refreshHeadersTitle(title,headersTreeElement,length);headersTreeElement.hidden=!length;for(var i=0;i<length;++i){var headerTreeElement=new TreeElement(null,null,false);headerTreeElement.title=this._formatHeader(headers[i].name,headers[i].value);headerTreeElement.selectable=false;headersTreeElement.appendChild(headerTreeElement);}},_refreshHeadersText:function(title,count,headersText,headersTreeElement) |
+{this._populateTreeElementWithSourceText(headersTreeElement,headersText);this._refreshHeadersTitle(title,headersTreeElement,count);},_toggleRequestHeadersText:function(event) |
{this._showRequestHeadersText=!this._showRequestHeadersText;this._refreshRequestHeaders();},_toggleResponseHeadersText:function(event) |
{this._showResponseHeadersText=!this._showResponseHeadersText;this._refreshResponseHeaders();},_createToggleButton:function(title) |
{var button=document.createElement("span");button.addStyleClass("header-toggle");button.textContent=title;return button;},_createHeadersToggleButton:function(isHeadersTextShown) |
@@ -120,21 +121,22 @@ |
return new WebInspector.RequestJSONView(this.request,parsedJSON);},_htmlView:function() |
{var dataURL=this.request.asDataURL();if(dataURL!==null) |
return new WebInspector.RequestHTMLView(this.request,dataURL);},_createPreviewView:function() |
-{if(this.request.content){if(this.request.hasErrorStatusCode()){var htmlView=this._htmlView();if(htmlView) |
+{if(this.request.content){if(this.request.mimeType==="application/json"){var jsonView=this._jsonView();if(jsonView) |
+return jsonView;} |
+if(this.request.hasErrorStatusCode()){var htmlView=this._htmlView();if(htmlView) |
return htmlView;} |
if(this.request.type===WebInspector.resourceTypes.XHR){var jsonView=this._jsonView();if(jsonView) |
return jsonView;} |
if(this.request.type===WebInspector.resourceTypes.XHR&&this.request.mimeType==="text/html"){var htmlView=this._htmlView();if(htmlView) |
-return htmlView;} |
-if(this.request.type===WebInspector.resourceTypes.Script&&this.request.mimeType==="application/json"){var jsonView=this._jsonView();if(jsonView) |
-return jsonView;}} |
+return htmlView;}} |
if(this._responseView.sourceView) |
return this._responseView.sourceView;if(this.request.type===WebInspector.resourceTypes.Other) |
return this._createEmptyView();return WebInspector.RequestView.nonSourceViewForRequest(this.request);},__proto__:WebInspector.RequestContentView.prototype};WebInspector.RequestResponseView=function(request) |
{WebInspector.RequestContentView.call(this,request);} |
WebInspector.RequestResponseView._maxFormattedResourceSize=100000;WebInspector.RequestResponseView.prototype={get sourceView() |
-{if(!this._sourceView&&WebInspector.RequestView.hasTextContent(this.request)) |
-this._sourceView=this.request.resourceSize<WebInspector.RequestResponseView._maxFormattedResourceSize?new WebInspector.ResourceSourceFrame(this.request):new WebInspector.ResourceSourceFrameFallback(this.request);return this._sourceView;},contentLoaded:function() |
+{if(this._sourceView||!WebInspector.RequestView.hasTextContent(this.request)) |
+return this._sourceView;if(this.request.resourceSize>=WebInspector.RequestResponseView._maxFormattedResourceSize){this._sourceView=new WebInspector.ResourceSourceFrameFallback(this.request);return this._sourceView;} |
+var sourceFrame=new WebInspector.ResourceSourceFrame(this.request);sourceFrame.setHighlighterType(this.request.type.canonicalMimeType()||this.request.mimeType);this._sourceView=sourceFrame;return this._sourceView;},contentLoaded:function() |
{if(!this.request.content||!this.sourceView){if(!this._emptyView){this._emptyView=new WebInspector.EmptyView(WebInspector.UIString("This request has no response data available."));this._emptyView.show(this.element);this.innerView=this._emptyView;}}else{if(this._emptyView){this._emptyView.detach();delete this._emptyView;} |
this.sourceView.show(this.element);this.innerView=this.sourceView;}},__proto__:WebInspector.RequestContentView.prototype};WebInspector.RequestTimingView=function(request) |
{WebInspector.View.call(this);this.element.addStyleClass("resource-timing-view");this._request=request;} |
@@ -147,15 +149,16 @@ |
{if(this._tableElement) |
this._tableElement.remove();this._tableElement=WebInspector.RequestTimingView.createTimingTable(this._request);this.element.appendChild(this._tableElement);},__proto__:WebInspector.View.prototype} |
WebInspector.RequestTimingView.createTimingTable=function(request) |
-{var tableElement=document.createElement("table");var rows=[];function addRow(title,className,start,end) |
+{var tableElement=document.createElement("table");tableElement.className="network-timing-table";var rows=[];function addRow(title,className,start,end) |
{var row={};row.title=title;row.className=className;row.start=start;row.end=end;rows.push(row);} |
-if(request.timing.proxyStart!==-1) |
-addRow(WebInspector.UIString("Proxy"),"proxy",request.timing.proxyStart,request.timing.proxyEnd);if(request.timing.dnsStart!==-1) |
-addRow(WebInspector.UIString("DNS Lookup"),"dns",request.timing.dnsStart,request.timing.dnsEnd);if(request.timing.connectStart!==-1){var label=request.connectionReused?WebInspector.UIString("Blocking"):WebInspector.UIString("Connecting");addRow(label,"connecting",request.timing.connectStart,request.timing.connectEnd);} |
-if(request.timing.sslStart!==-1) |
-addRow(WebInspector.UIString("SSL"),"ssl",request.timing.sslStart,request.timing.sslEnd);addRow(WebInspector.UIString("Sending"),"sending",request.timing.sendStart,request.timing.sendEnd);addRow(WebInspector.UIString("Waiting"),"waiting",request.timing.sendEnd,request.timing.receiveHeadersEnd);addRow(WebInspector.UIString("Receiving"),"receiving",(request.responseReceivedTime-request.timing.requestTime)*1000,(request.endTime-request.timing.requestTime)*1000);const chartWidth=200;var total=(request.endTime-request.timing.requestTime)*1000;var scale=chartWidth/total;for(var i=0;i<rows.length;++i){var tr=document.createElement("tr");tableElement.appendChild(tr);var td=document.createElement("td");td.textContent=rows[i].title;tr.appendChild(td);td=document.createElement("td");td.width=chartWidth+"px";var row=document.createElement("div");row.className="network-timing-row";td.appendChild(row);var bar=document.createElement("span");bar.className="network-timing-bar "+rows[i].className;bar.style.left=scale*rows[i].start+"px";bar.style.right=scale*(total-rows[i].end)+"px";bar.style.backgroundColor=rows[i].color;bar.textContent="\u200B";row.appendChild(bar);var title=document.createElement("span");title.className="network-timing-bar-title";if(total-rows[i].end<rows[i].start) |
+var timing=request.timing;var blocking=timing.dnsStart>0?timing.dnsStart:timing.connectStart>0?timing.connectStart:timing.sendStart;if(blocking>0) |
+addRow(WebInspector.UIString("Blocking"),"blocking",0,blocking);if(timing.proxyStart!==-1) |
+addRow(WebInspector.UIString("Proxy"),"proxy",timing.proxyStart,timing.proxyEnd);if(timing.dnsStart!==-1) |
+addRow(WebInspector.UIString("DNS Lookup"),"dns",timing.dnsStart,timing.dnsEnd);if(timing.connectStart!==-1) |
+addRow(WebInspector.UIString("Connecting"),"connecting",timing.connectStart,timing.connectEnd);if(timing.sslStart!==-1) |
+addRow(WebInspector.UIString("SSL"),"ssl",timing.sslStart,timing.sslEnd);addRow(WebInspector.UIString("Sending"),"sending",timing.sendStart,timing.sendEnd);addRow(WebInspector.UIString("Waiting"),"waiting",timing.sendEnd,timing.receiveHeadersEnd);addRow(WebInspector.UIString("Receiving"),"receiving",(request.responseReceivedTime-timing.requestTime)*1000,(request.endTime-timing.requestTime)*1000);const chartWidth=200;var total=(request.endTime-timing.requestTime)*1000;var scale=chartWidth/total;for(var i=0;i<rows.length;++i){var tr=document.createElement("tr");tableElement.appendChild(tr);var td=document.createElement("td");td.textContent=rows[i].title;tr.appendChild(td);td=document.createElement("td");td.width=chartWidth+"px";var row=document.createElement("div");row.className="network-timing-row";td.appendChild(row);var bar=document.createElement("span");bar.className="network-timing-bar "+rows[i].className;bar.style.left=Math.floor(scale*rows[i].start)+"px";bar.style.right=Math.floor(scale*(total-rows[i].end))+"px";bar.style.backgroundColor=rows[i].color;bar.textContent="\u200B";row.appendChild(bar);var title=document.createElement("span");title.className="network-timing-bar-title";if(total-rows[i].end<rows[i].start) |
title.style.right=(scale*(total-rows[i].end)+3)+"px";else |
-title.style.left=(scale*rows[i].start+3)+"px";title.textContent=Number.secondsToString((rows[i].end-rows[i].start)/1000);row.appendChild(title);tr.appendChild(td);} |
+title.style.left=(scale*rows[i].start+3)+"px";title.textContent=Number.secondsToString((rows[i].end-rows[i].start)/1000,true);row.appendChild(title);tr.appendChild(td);} |
return tableElement;};WebInspector.ResourceWebSocketFrameView=function(resource) |
{WebInspector.View.call(this);this.element.addStyleClass("resource-websocket");this.resource=resource;this.element.removeChildren();this._dataGrid=new WebInspector.DataGrid([{id:"data",title:WebInspector.UIString("Data"),sortable:false,weight:88,longText:true},{id:"length",title:WebInspector.UIString("Length"),sortable:false,alig:WebInspector.DataGrid.Align.Right,weight:5},{id:"time",title:WebInspector.UIString("Time"),weight:7}],undefined,undefined,undefined,this._onContextMenu.bind(this));this.refresh();this._dataGrid.setName("ResourceWebSocketFrameView");this._dataGrid.show(this.element);} |
WebInspector.ResourceWebSocketFrameView.OpCodes={ContinuationFrame:0,TextFrame:1,BinaryFrame:2,ConnectionCloseFrame:8,PingFrame:9,PongFrame:10};WebInspector.ResourceWebSocketFrameView.prototype={appendFrame:function(frame) |
@@ -167,12 +170,15 @@ |
{this._dataGrid.rootNode().removeChildren();var frames=this.resource.frames();for(var i=frames.length-1;i>=0;i--){this.appendFrame(frames[i]);}},show:function(parentElement,insertBefore) |
{this.refresh();WebInspector.View.prototype.show.call(this,parentElement,insertBefore);},_onContextMenu:function(contextMenu,node) |
{contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Copy message":"Copy Message"),this._copyMessage.bind(this,node.data));},_copyMessage:function(row) |
-{InspectorFrontendHost.copyText(row.data);},__proto__:WebInspector.View.prototype};WebInspector.NetworkLogView=function(coulmnsVisibilitySetting) |
-{WebInspector.View.call(this);this.registerRequiredCSS("networkLogView.css");this._coulmnsVisibilitySetting=coulmnsVisibilitySetting;this._allowRequestSelection=false;this._requests=[];this._requestsById={};this._requestsByURL={};this._staleRequests={};this._requestGridNodes={};this._lastRequestGridNodeId=0;this._mainRequestLoadTime=-1;this._mainRequestDOMContentLoadedTime=-1;this._typeFilterElements={};this._typeFilter=WebInspector.NetworkLogView._trivialTypeFilter;this._matchedRequests=[];this._highlightedSubstringChanges=[];this._filteredOutRequests=new Map();this._matchedRequestsMap={};this._currentMatchedRequestIndex=-1;this._createStatusbarButtons();this._createStatusBarItems();this._linkifier=new WebInspector.Linkifier();WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestStarted,this._onRequestStarted,this);WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestUpdated,this._onRequestUpdated,this);WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestFinished,this._onRequestUpdated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._mainFrameNavigated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.Load,this._loadEventFired,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded,this._domContentLoadedEventFired,this);this._initializeView();WebInspector.networkLog.requests.forEach(this._appendRequest.bind(this));} |
-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,"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;WebInspector.NetworkLogView.ALL_TYPES="all";WebInspector.NetworkLogView.prototype={_initializeView:function() |
-{this.element.id="network-container";this._createSortingFunctions();this._createTable();this._createTimelineGrid();this._createSummaryBar();if(!this.useLargeRows) |
-this._setLargerRequests(this.useLargeRows);this._allowPopover=true;this._popoverHelper=new WebInspector.PopoverHelper(this.element,this._getPopoverAnchor.bind(this),this._showPopover.bind(this),this._onHidePopover.bind(this));this._popoverHelper.setTimeout(100);this.calculator=new WebInspector.NetworkTransferTimeCalculator();this._toggleTypeFilter(WebInspector.NetworkLogView.ALL_TYPES,false);this.switchToDetailedView();},get statusBarItems() |
-{return[this._largerRequestsButton.element,this._preserveLogToggle.element,this._clearButton.element,this._filterBarElement,this._progressBarContainer];},get useLargeRows() |
+{InspectorFrontendHost.copyText(row.data);},__proto__:WebInspector.View.prototype};WebInspector.NetworkLogView=function(filterBar,coulmnsVisibilitySetting) |
+{WebInspector.View.call(this);this.element.classList.add("vbox","fill");this.registerRequiredCSS("networkLogView.css");this.registerRequiredCSS("filter.css");this._filterBar=filterBar;this._coulmnsVisibilitySetting=coulmnsVisibilitySetting;this._allowRequestSelection=false;this._requests=[];this._requestsById={};this._requestsByURL={};this._staleRequests={};this._requestGridNodes={};this._lastRequestGridNodeId=0;this._mainRequestLoadTime=-1;this._mainRequestDOMContentLoadedTime=-1;this._matchedRequests=[];this._highlightedSubstringChanges=[];this._filteredOutRequests=new Map();this._matchedRequestsMap={};this._currentMatchedRequestIndex=-1;this._createStatusbarButtons();this._createStatusBarItems();this._linkifier=new WebInspector.Linkifier();WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestStarted,this._onRequestStarted,this);WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestUpdated,this._onRequestUpdated,this);WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.RequestFinished,this._onRequestUpdated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated,this._mainFrameNavigated,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.Load,this._loadEventFired,this);WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.DOMContentLoaded,this._domContentLoadedEventFired,this);this._addFilters();this._initializeView();WebInspector.networkLog.requests.forEach(this._appendRequest.bind(this));} |
+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,"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;WebInspector.NetworkLogView.ALL_TYPES="all";WebInspector.NetworkLogView.prototype={_addFilters:function() |
+{this._textFilterUI=new WebInspector.TextFilterUI();this._textFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterChanged,this._filterChanged,this);this._filterBar.addFilter(this._textFilterUI);this._resourceTypeFilterUI=new WebInspector.NamedBitSetFilterUI();for(var typeId in WebInspector.resourceTypes){var resourceType=WebInspector.resourceTypes[typeId];this._resourceTypeFilterUI.addBit(resourceType.name(),resourceType.categoryTitle());} |
+this._resourceTypeFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterChanged,this._filterChanged.bind(this),this);this._filterBar.addFilter(this._resourceTypeFilterUI);},_filterChanged:function(event) |
+{this._removeAllNodeHighlights();this.searchCanceled();this._filterRequests();},_initializeView:function() |
+{this.element.id="network-container";this._createSortingFunctions();this._createTable();this._createTimelineGrid();this._summaryBarElement=this.element.createChild("div","network-summary-bar");if(!this.useLargeRows) |
+this._setLargerRequests(this.useLargeRows);this._allowPopover=true;this._popoverHelper=new WebInspector.PopoverHelper(this.element,this._getPopoverAnchor.bind(this),this._showPopover.bind(this),this._onHidePopover.bind(this));this._popoverHelper.setTimeout(100);this.calculator=new WebInspector.NetworkTransferTimeCalculator();this.switchToDetailedView();},get statusBarItems() |
+{return[this._preserveLogToggle.element,this._clearButton.element,this._filterBar.filterButton(),this._largerRequestsButton.element,this._progressBarContainer];},get useLargeRows() |
{return WebInspector.settings.resourcesLargeRows.get();},set allowPopover(flag) |
{this._allowPopover=flag;},elementsToRestoreScrollPositionsFor:function() |
{if(!this._dataGrid) |
@@ -192,31 +198,17 @@ |
{this._removeAllNodeHighlights();var selectedIndex=this._timelineSortSelector.selectedIndex;if(!selectedIndex) |
selectedIndex=1;var selectedOption=this._timelineSortSelector[selectedIndex];var value=selectedOption.value;var sortingFunction=this._sortingFunctions[value];this._dataGrid.sortNodes(sortingFunction);this.calculator=this._calculators[value];if(this.calculator.startAtZero) |
this._timelineGrid.hideEventDividers();else |
-this._timelineGrid.showEventDividers();this._dataGrid.markColumnAsSortedBy("timeline",WebInspector.DataGrid.Order.Ascending);this._updateOffscreenRows();},_addTypeFilter:function(typeName,label) |
-{var typeFilterElement=this._filterBarElement.createChild("li",typeName);typeFilterElement.typeName=typeName;typeFilterElement.createTextChild(label);typeFilterElement.addEventListener("click",this._onTypeFilterClicked.bind(this),false);this._typeFilterElements[typeName]=typeFilterElement;},_createStatusBarItems:function() |
-{var filterBarElement=document.createElement("div");filterBarElement.className="scope-bar status-bar-item";filterBarElement.title=WebInspector.UIString("Use %s Click to select multiple types.",WebInspector.KeyboardShortcut.shortcutToString("",WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta));this._filterBarElement=filterBarElement;this._addTypeFilter(WebInspector.NetworkLogView.ALL_TYPES,WebInspector.UIString("All"));filterBarElement.createChild("div","scope-bar-divider");for(var typeId in WebInspector.resourceTypes){var type=WebInspector.resourceTypes[typeId];this._addTypeFilter(type.name(),type.categoryTitle());} |
-this._progressBarContainer=document.createElement("div");this._progressBarContainer.className="status-bar-item";},_createSummaryBar:function() |
-{var tbody=this._dataGrid.dataTableBody;var tfoot=document.createElement("tfoot");var tr=tfoot.createChild("tr","revealed network-summary-bar");var td=tr.createChild("td");td.setAttribute("colspan",7);tbody.parentNode.insertBefore(tfoot,tbody);this._summaryBarElement=td;},_updateSummaryBar:function() |
+this._timelineGrid.showEventDividers();this._dataGrid.markColumnAsSortedBy("timeline",WebInspector.DataGrid.Order.Ascending);this._updateOffscreenRows();},_createStatusBarItems:function() |
+{this._progressBarContainer=document.createElement("div");this._progressBarContainer.className="status-bar-item";},_updateSummaryBar:function() |
{var requestsNumber=this._requests.length;if(!requestsNumber){if(this._summaryBarElement._isDisplayingWarning) |
-return;this._summaryBarElement._isDisplayingWarning=true;this._summaryBarElement.removeChildren();this._summaryBarElement.createChild("div","warning-icon-small");this._summaryBarElement.appendChild(document.createTextNode(WebInspector.UIString("No requests captured. Reload the page to see detailed information on the network activity.")));return;} |
+return;this._summaryBarElement._isDisplayingWarning=true;this._summaryBarElement.removeChildren();this._summaryBarElement.createChild("div","warning-icon-small");var text=WebInspector.UIString("No requests captured. Reload the page to see detailed information on the network activity.");this._summaryBarElement.appendChild(document.createTextNode(text));this._summaryBarElement.title=text;return;} |
delete this._summaryBarElement._isDisplayingWarning;var transferSize=0;var selectedRequestsNumber=0;var selectedTransferSize=0;var baseTime=-1;var maxTime=-1;for(var i=0;i<this._requests.length;++i){var request=this._requests[i];var requestTransferSize=request.transferSize;transferSize+=requestTransferSize;if(!this._filteredOutRequests.get(request)){selectedRequestsNumber++;selectedTransferSize+=requestTransferSize;} |
if(request.url===WebInspector.inspectedPageURL) |
baseTime=request.startTime;if(request.endTime>maxTime) |
maxTime=request.endTime;} |
var text="";if(selectedRequestsNumber!==requestsNumber){text+=String.sprintf(WebInspector.UIString("%d / %d requests"),selectedRequestsNumber,requestsNumber);text+=" \u2758 "+String.sprintf(WebInspector.UIString("%s / %s transferred"),Number.bytesToString(selectedTransferSize),Number.bytesToString(transferSize));}else{text+=String.sprintf(WebInspector.UIString("%d requests"),requestsNumber);text+=" \u2758 "+String.sprintf(WebInspector.UIString("%s transferred"),Number.bytesToString(transferSize));} |
if(baseTime!==-1&&this._mainRequestLoadTime!==-1&&this._mainRequestDOMContentLoadedTime!==-1&&this._mainRequestDOMContentLoadedTime>baseTime){text+=" \u2758 "+String.sprintf(WebInspector.UIString("%s (load: %s, DOMContentLoaded: %s)"),Number.secondsToString(maxTime-baseTime),Number.secondsToString(this._mainRequestLoadTime-baseTime),Number.secondsToString(this._mainRequestDOMContentLoadedTime-baseTime));} |
-this._summaryBarElement.textContent=text;},_onTypeFilterClicked:function(e) |
-{var toggle;if(WebInspector.isMac()) |
-toggle=e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey;else |
-toggle=e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey;this._toggleTypeFilter(e.target.typeName,toggle);this._removeAllNodeHighlights();this.searchCanceled();this._filterRequests();},_toggleTypeFilter:function(typeName,allowMultiSelect) |
-{if(allowMultiSelect&&typeName!==WebInspector.NetworkLogView.ALL_TYPES) |
-this._typeFilterElements[WebInspector.NetworkLogView.ALL_TYPES].removeStyleClass("selected");else{for(var key in this._typeFilterElements) |
-this._typeFilterElements[key].removeStyleClass("selected");} |
-var filterElement=this._typeFilterElements[typeName];filterElement.enableStyleClass("selected",!filterElement.hasStyleClass("selected"));var allowedTypes={};for(var key in this._typeFilterElements){if(this._typeFilterElements[key].hasStyleClass("selected")) |
-allowedTypes[key]=true;} |
-if(typeName===WebInspector.NetworkLogView.ALL_TYPES) |
-this._typeFilter=WebInspector.NetworkLogView._trivialTypeFilter;else |
-this._typeFilter=WebInspector.NetworkLogView._typeFilter.bind(null,allowedTypes);},_scheduleRefresh:function() |
+this._summaryBarElement.textContent=text;this._summaryBarElement.title=text;},_scheduleRefresh:function() |
{if(this._needsRefresh) |
return;this._needsRefresh=true;if(this.isShowing()&&!this._refreshTimeout) |
this._refreshTimeout=setTimeout(this.refresh.bind(this),WebInspector.NetworkLogView._defaultRefreshDelay);},_updateDividersIfNeeded:function() |
@@ -286,7 +278,7 @@ |
content=this._generateScriptInitiatedPopoverContent(anchor.request);else |
content=WebInspector.RequestTimingView.createTimingTable(anchor.parentElement.request);popover.show(content,anchor);},_onHidePopover:function() |
{this._linkifier.reset();},_generateScriptInitiatedPopoverContent:function(request) |
-{var stackTrace=request.initiator.stackTrace;var framesTable=document.createElement("table");for(var i=0;i<stackTrace.length;++i){var stackFrame=stackTrace[i];var row=document.createElement("tr");row.createChild("td").textContent=stackFrame.functionName?stackFrame.functionName:WebInspector.UIString("(anonymous function)");row.createChild("td").textContent=" @ ";row.createChild("td").appendChild(this._linkifier.linkifyLocation(stackFrame.url,stackFrame.lineNumber-1,stackFrame.columnNumber-1));framesTable.appendChild(row);} |
+{var stackTrace=request.initiator.stackTrace;var framesTable=document.createElement("table");for(var i=0;i<stackTrace.length;++i){var stackFrame=stackTrace[i];var row=document.createElement("tr");row.createChild("td").textContent=stackFrame.functionName||WebInspector.UIString("(anonymous function)");row.createChild("td").textContent=" @ ";row.createChild("td").appendChild(this._linkifier.linkifyLocation(stackFrame.url,stackFrame.lineNumber-1,stackFrame.columnNumber-1));framesTable.appendChild(row);} |
return framesTable;},_updateColumns:function() |
{var columnsVisibility=this._coulmnsVisibilitySetting.get();var detailedMode=!!this._detailedMode;for(var columnIdentifier in columnsVisibility){var visible=detailedMode&&columnsVisibility[columnIdentifier];this._dataGrid.setColumnVisible(columnIdentifier,visible);} |
this._dataGrid.setColumnVisible("timeline",detailedMode);this._dataGrid.applyColumnWeights();},_toggleColumnVisibility:function(columnIdentifier) |
@@ -297,7 +289,7 @@ |
var columnIDs=Object.keys(this._coulmnsVisibilitySetting.get());this._configurableColumnIDs=columnIDs.sort(compare);return this._configurableColumnIDs;},_contextMenu:function(event) |
{var contextMenu=new WebInspector.ContextMenu(event);if(this._detailedMode&&event.target.isSelfOrDescendant(this._dataGrid.headerTableBody)){var columnsVisibility=this._coulmnsVisibilitySetting.get();var columnIDs=this._getConfigurableColumnIDs();for(var i=0;i<columnIDs.length;++i){var columnIdentifier=columnIDs[i];var column=this._dataGrid.columns[columnIdentifier];contextMenu.appendCheckboxItem(column.title,this._toggleColumnVisibility.bind(this,columnIdentifier),!!columnsVisibility[columnIdentifier]);} |
contextMenu.show();return;} |
-var gridNode=this._dataGrid.dataGridNodeFromNode(event.target);var request=gridNode&&gridNode._request;if(request){contextMenu.appendItem(WebInspector.openLinkExternallyLabel(),WebInspector.openResource.bind(WebInspector,request.url,false));contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.copyLinkAddressLabel(),this._copyLocation.bind(this,request));if(request.requestHeadersText) |
+var gridNode=this._dataGrid.dataGridNodeFromNode(event.target);var request=gridNode&&gridNode._request;if(request){contextMenu.appendItem(WebInspector.openLinkExternallyLabel(),WebInspector.openResource.bind(WebInspector,request.url,false));contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.copyLinkAddressLabel(),this._copyLocation.bind(this,request));if(request.requestHeadersText()) |
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));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));contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Save as HAR with content":"Save as HAR with Content"),this._exportAll.bind(this));contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Clear browser cache":"Clear Browser Cache"),this._clearBrowserCache.bind(this));contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles()?"Clear browser cookies":"Clear Browser Cookies"),this._clearBrowserCookies.bind(this));if(request&&request.type===WebInspector.resourceTypes.XHR){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Replay XHR"),this._replayXHR.bind(this,request.requestId));contextMenu.appendSeparator();} |
@@ -305,7 +297,7 @@ |
{NetworkAgent.replayXHR(requestId);},_copyAll:function() |
{var harArchive={log:(new WebInspector.HARLog(this._requests.filter(WebInspector.NetworkLogView.HTTPRequestsFilter))).build()};InspectorFrontendHost.copyText(JSON.stringify(harArchive,null,2));},_copyLocation:function(request) |
{InspectorFrontendHost.copyText(request.url);},_copyRequestHeaders:function(request) |
-{InspectorFrontendHost.copyText(request.requestHeadersText);},_copyResponseHeaders:function(request) |
+{InspectorFrontendHost.copyText(request.requestHeadersText());},_copyResponseHeaders:function(request) |
{InspectorFrontendHost.copyText(request.responseHeadersText);},_copyCurlCommand:function(request) |
{InspectorFrontendHost.copyText(this._generateCurlCommand(request));},_exportAll:function() |
{var filename=WebInspector.inspectedPageDomain+".har";var stream=new WebInspector.FileOutputStream();stream.open(filename,openCallback.bind(this));function openCallback() |
@@ -342,13 +334,11 @@ |
newMatchedRequestIndex=this._matchedRequests.length-1;} |
this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.SearchCountUpdated,this._matchedRequests.length);if(shouldJump) |
this._highlightNthMatchedRequestForSearch(newMatchedRequestIndex,true);},_applyFilter:function(node) |
-{var filter=this._filterRegExp;var request=node._request;var matches=false;if(this._typeFilter(request)){matches=!filter||filter.test(request.name())||filter.test(request.path());if(filter&&matches) |
+{var filter=this._textFilterUI.regex();var request=node._request;var matches=false;if(this._resourceTypeFilterUI.accept(request.type.name())){matches=!filter||filter.test(request.name())||filter.test(request.path());if(filter&&matches) |
this._highlightMatchedRequest(request,false,filter);} |
node.element.enableStyleClass("filtered-out",!matches);if(matches) |
this._filteredOutRequests.remove(request);else |
-this._filteredOutRequests.put(request,true);},performFilter:function(query) |
-{delete this._filterRegExp;if(query) |
-this._filterRegExp=createPlainTextSearchRegex(query,"i");this._filterRequests();},_filterRequests:function() |
+this._filteredOutRequests.put(request,true);},_filterRequests:function() |
{this._removeAllHighlights();this._filteredOutRequests.clear();var nodes=this._dataGrid.rootNode().children;for(var i=0;i<nodes.length;++i) |
this._applyFilter(nodes[i]);this._updateSummaryBar();this._updateOffscreenRows();},jumpToPreviousSearchResult:function() |
{if(!this._matchedRequests.length) |
@@ -359,28 +349,29 @@ |
{this._removeAllNodeHighlights();var node=this._requestGridNode(request);if(node){this._dataGrid.element.focus();node.reveal();this._highlightNode(node);}},_removeAllNodeHighlights:function() |
{if(this._highlightedNode){this._highlightedNode.element.removeStyleClass("highlighted-row");delete this._highlightedNode;}},_highlightNode:function(node) |
{node.element.addStyleClass("highlighted-row");this._highlightedNode=node;},_generateCurlCommand:function(request) |
-{var command=["curl"];var ignoredHeaders={};function escapeStringWin(str) |
+{var command=["curl"];var ignoredHeaders={"host":1,"method":1,"path":1,"scheme":1,"version":1};function escapeStringWin(str) |
{return"\""+str.replace(/"/g,"\"\"").replace(/%/g,"\"%\"").replace(/\\/g,"\\\\").replace(/[\r\n]+/g,"\"^$&\"")+"\"";} |
function escapeStringPosix(str) |
{function escapeCharacter(x) |
{var code=x.charCodeAt(0);if(code<256){return code<16?"\\x0"+code.toString(16):"\\x"+code.toString(16);} |
code=code.toString(16);return"\\u"+("0000"+code).substr(code.length,4);} |
if(/[^\x20-\x7E]|\'/.test(str)){return"$\'"+str.replace(/\\/g,"\\\\").replace(/\'/g,"\\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[^\x20-\x7E]/g,escapeCharacter)+"'";}else{return"'"+str+"'";}} |
-var escapeString=WebInspector.isWin()?escapeStringWin:escapeStringPosix;command.push(escapeString(request.url).replace(/[[{}\]]/g,"\\$&"));var inferredMethod="GET";var data=[];var requestContentType=request.requestContentType();if(requestContentType&&requestContentType.startsWith("application/x-www-form-urlencoded")&&request.requestFormData){data.push("--data");data.push(escapeString(request.requestFormData));ignoredHeaders["Content-Length"]=true;inferredMethod="POST";}else if(request.requestFormData){data.push("--data-binary");data.push(escapeString(request.requestFormData));ignoredHeaders["Content-Length"]=true;inferredMethod="POST";} |
+var escapeString=WebInspector.isWin()?escapeStringWin:escapeStringPosix;command.push(escapeString(request.url).replace(/[[{}\]]/g,"\\$&"));var inferredMethod="GET";var data=[];var requestContentType=request.requestContentType();if(requestContentType&&requestContentType.startsWith("application/x-www-form-urlencoded")&&request.requestFormData){data.push("--data");data.push(escapeString(request.requestFormData));ignoredHeaders["content-length"]=true;inferredMethod="POST";}else if(request.requestFormData){data.push("--data-binary");data.push(escapeString(request.requestFormData));ignoredHeaders["content-length"]=true;inferredMethod="POST";} |
if(request.requestMethod!==inferredMethod){command.push("-X");command.push(request.requestMethod);} |
-for(var i=0;i<request.requestHeaders.length;i++){var header=request.requestHeaders[i];if(header.name in ignoredHeaders) |
-continue;command.push("-H");command.push(escapeString(header.name+": "+header.value));} |
+var requestHeaders=request.requestHeaders();for(var i=0;i<requestHeaders.length;i++){var header=requestHeaders[i];var name=header.name.replace(/^:/,"");if(name.toLowerCase()in ignoredHeaders) |
+continue;command.push("-H");command.push(escapeString(name+": "+header.value));} |
command=command.concat(data);command.push("--compressed");return command.join(" ");},__proto__:WebInspector.View.prototype} |
WebInspector.NetworkLogView.HTTPRequestsFilter=function(request) |
{return request.parsedURL.isValid&&(request.scheme in WebInspector.NetworkLogView.HTTPSchemas);} |
WebInspector.NetworkLogView.EventTypes={ViewCleared:"ViewCleared",RowSizeChanged:"RowSizeChanged",RequestSelected:"RequestSelected",SearchCountUpdated:"SearchCountUpdated",SearchIndexUpdated:"SearchIndexUpdated"};WebInspector.NetworkPanel=function() |
-{WebInspector.Panel.call(this,"network");this.registerRequiredCSS("networkPanel.css");this._injectStyles();this.createSidebarView();this.splitView.hideMainElement();var defaultColumnsVisibility=WebInspector.NetworkLogView._defaultColumnsVisibility;var networkLogColumnsVisibilitySetting=WebInspector.settings.createSetting("networkLogColumnsVisibility",defaultColumnsVisibility);var savedColumnsVisibility=networkLogColumnsVisibilitySetting.get();var columnsVisibility={};for(var columnId in defaultColumnsVisibility) |
-columnsVisibility[columnId]=savedColumnsVisibility.hasOwnProperty(columnId)?savedColumnsVisibility[columnId]:defaultColumnsVisibility[columnId];networkLogColumnsVisibilitySetting.set(columnsVisibility);this._networkLogView=new WebInspector.NetworkLogView(networkLogColumnsVisibilitySetting);this._networkLogView.show(this.sidebarElement);this._viewsContainerElement=this.splitView.mainElement;this._viewsContainerElement.id="network-views";this._viewsContainerElement.addStyleClass("hidden");if(!this._networkLogView.useLargeRows) |
-this._viewsContainerElement.addStyleClass("small");this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.ViewCleared,this._onViewCleared,this);this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.RowSizeChanged,this._onRowSizeChanged,this);this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.RequestSelected,this._onRequestSelected,this);this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.SearchCountUpdated,this._onSearchCountUpdated,this);this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.SearchIndexUpdated,this._onSearchIndexUpdated,this);this._closeButtonElement=this._viewsContainerElement.createChild("div","close-button");this._closeButtonElement.id="network-close-button";this._closeButtonElement.addEventListener("click",this._toggleGridMode.bind(this),false);this._viewsContainerElement.appendChild(this._closeButtonElement);function viewGetter() |
+{WebInspector.Panel.call(this,"network");this.registerRequiredCSS("networkPanel.css");this._injectStyles();this._panelStatusBarElement=this.element.createChild("div","panel-status-bar");this._filterBar=new WebInspector.FilterBar();this._filtersContainer=this.element.createChild("div","network-filters-header hidden");this._filtersContainer.appendChild(this._filterBar.filtersElement());this._filterBar.addEventListener(WebInspector.FilterBar.Events.FiltersToggled,this._onFiltersToggled,this);this.element.addStyleClass("vbox");this.createSidebarView();this.splitView.element.removeStyleClass("fill");this.splitView.hideMainElement();var defaultColumnsVisibility=WebInspector.NetworkLogView._defaultColumnsVisibility;var networkLogColumnsVisibilitySetting=WebInspector.settings.createSetting("networkLogColumnsVisibility",defaultColumnsVisibility);var savedColumnsVisibility=networkLogColumnsVisibilitySetting.get();var columnsVisibility={};for(var columnId in defaultColumnsVisibility) |
+columnsVisibility[columnId]=savedColumnsVisibility.hasOwnProperty(columnId)?savedColumnsVisibility[columnId]:defaultColumnsVisibility[columnId];networkLogColumnsVisibilitySetting.set(columnsVisibility);this._networkLogView=new WebInspector.NetworkLogView(this._filterBar,networkLogColumnsVisibilitySetting);this._networkLogView.show(this.sidebarElement);this._viewsContainerElement=this.splitView.mainElement;this._viewsContainerElement.id="network-views";this._viewsContainerElement.addStyleClass("hidden");if(!this._networkLogView.useLargeRows) |
+this._viewsContainerElement.addStyleClass("small");this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.ViewCleared,this._onViewCleared,this);this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.RowSizeChanged,this._onRowSizeChanged,this);this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.RequestSelected,this._onRequestSelected,this);this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.SearchCountUpdated,this._onSearchCountUpdated,this);this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes.SearchIndexUpdated,this._onSearchIndexUpdated,this);this._closeButtonElement=this._viewsContainerElement.createChild("div","close-button");this._closeButtonElement.id="network-close-button";this._closeButtonElement.addEventListener("click",this._toggleGridMode.bind(this),false);this._viewsContainerElement.appendChild(this._closeButtonElement);for(var i=0;i<this._networkLogView.statusBarItems.length;++i) |
+this._panelStatusBarElement.appendChild(this._networkLogView.statusBarItems[i]);function viewGetter() |
{return this.visibleView;} |
WebInspector.GoToLineDialog.install(this,viewGetter.bind(this));} |
-WebInspector.NetworkPanel.prototype={get statusBarItems() |
-{return this._networkLogView.statusBarItems;},elementsToRestoreScrollPositionsFor:function() |
+WebInspector.NetworkPanel.prototype={_onFiltersToggled:function(event) |
+{var toggled=(event.data);this._filtersContainer.enableStyleClass("hidden",!toggled);this.element.enableStyleClass("filters-toggled",toggled);},elementsToRestoreScrollPositionsFor:function() |
{return this._networkLogView.elementsToRestoreScrollPositionsFor();},_reset:function() |
{this._networkLogView._reset();},handleShortcut:function(event) |
{if(this._viewingRequestMode&&event.keyCode===WebInspector.KeyboardShortcut.Keys.Esc.code){this._toggleGridMode();event.handled=true;return;} |
@@ -388,9 +379,10 @@ |
{WebInspector.Panel.prototype.wasShown.call(this);},get requests() |
{return this._networkLogView.requests;},requestById:function(id) |
{return this._networkLogView.requestById(id);},_requestByAnchor:function(anchor) |
-{return anchor.requestId?this.requestById(anchor.requestId):this._networkLogView._requestsByURL[anchor.href];},canShowAnchorLocation:function(anchor) |
-{return!!this._requestByAnchor(anchor);},showAnchorLocation:function(anchor) |
-{var request=this._requestByAnchor(anchor);this.revealAndHighlightRequest(request)},revealAndHighlightRequest:function(request) |
+{return anchor.requestId?this.requestById(anchor.requestId):this._networkLogView._requestsByURL[anchor.href];},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(request) |
this._networkLogView.revealAndHighlightRequest(request);},_onViewCleared:function(event) |
{this._closeVisibleRequest();this._toggleGridMode();this._viewsContainerElement.removeChildren();this._viewsContainerElement.appendChild(this._closeButtonElement);},_onRowSizeChanged:function(event) |
@@ -406,9 +398,7 @@ |
this._networkLogView.switchToDetailedView();this._networkLogView.allowPopover=true;this._networkLogView._allowRequestSelection=false;},_toggleViewingRequestMode:function() |
{if(this._viewingRequestMode) |
return;this._viewingRequestMode=true;this.element.addStyleClass("viewing-resource");this.splitView.showMainElement();this._networkLogView.allowPopover=false;this._networkLogView._allowRequestSelection=true;this._networkLogView.switchToBriefView();},performSearch:function(query,shouldJump) |
-{this._networkLogView.performSearch(query,shouldJump);},canFilter:function() |
-{return true;},performFilter:function(query) |
-{this._networkLogView.performFilter(query);},jumpToPreviousSearchResult:function() |
+{this._networkLogView.performSearch(query,shouldJump);},jumpToPreviousSearchResult:function() |
{this._networkLogView.jumpToPreviousSearchResult();},jumpToNextSearchResult:function() |
{this._networkLogView.jumpToNextSearchResult();},searchCanceled:function() |
{this._networkLogView.searchCanceled();},appendApplicableItems:function(event,contextMenu,target) |
@@ -490,8 +480,7 @@ |
{this._element.addStyleClass("offscreen");this._nameCell=this._createDivInTD("name");this._methodCell=this._createDivInTD("method");this._statusCell=this._createDivInTD("status");this._schemeCell=this._createDivInTD("scheme");this._domainCell=this._createDivInTD("domain");this._typeCell=this._createDivInTD("type");this._initiatorCell=this._createDivInTD("initiator");this._cookiesCell=this._createDivInTD("cookies");this._setCookiesCell=this._createDivInTD("setCookies");this._sizeCell=this._createDivInTD("size");this._timeCell=this._createDivInTD("time");this._responseHeaderCells={};var responseHeaderColumns=WebInspector.NetworkLogView._responseHeaderColumns;for(var i=0;i<responseHeaderColumns.length;++i) |
this._responseHeaderCells[responseHeaderColumns[i]]=this._createDivInTD(responseHeaderColumns[i]);this._timelineCell=this._createDivInTD("timeline");this._createTimelineBar(this._timelineCell);this._nameCell.addEventListener("click",this._onClick.bind(this),false);this._nameCell.addEventListener("dblclick",this._openInNewTab.bind(this),false);},wasDetached:function() |
{this._linkifier.reset();},isFilteredOut:function() |
-{if(this._parentView._filteredOutRequests.get(this._request)) |
-return true;return!this._parentView._typeFilter(this._request);},_onClick:function() |
+{return!!this._parentView._filteredOutRequests.get(this._request);},_onClick:function() |
{if(!this._parentView._allowRequestSelection) |
this.select();},select:function() |
{this._parentView.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.RequestSelected,this._request);WebInspector.DataGridNode.prototype.select.apply(this,arguments);WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction,{action:WebInspector.UserMetrics.UserActionNames.NetworkRequestSelected,url:this._request.url});},_highlightMatchedSubstring:function(regexp) |
@@ -517,8 +506,8 @@ |
this._statusCell.setTextAndTitle(WebInspector.UIString("(ping)"));else |
this._statusCell.setTextAndTitle(WebInspector.UIString("(pending)"));this._statusCell.addStyleClass("network-dim-cell");}},_refreshSchemeCell:function() |
{this._schemeCell.setTextAndTitle(this._request.scheme);},_refreshDomainCell:function() |
-{this._typeCell.setTextAndTitle(this._request.domain);},_refreshTypeCell:function() |
-{if(this._request.mimeType){this._typeCell.removeStyleClass("network-dim-cell");this._typeCell.setTextAndTitle(this._request.mimeType);}else if(this._request.isPingRequest()){this._typeCell.removeStyleClass("network-dim-cell");this._typeCell.setTextAndTitle(this._request.requestContentType()||"");}else{this._typeCell.addStyleClass("network-dim-cell");this._typeCell.setTextAndTitle(WebInspector.UIString("Pending"));}},_refreshInitiatorCell:function() |
+{this._domainCell.setTextAndTitle(this._request.domain);},_refreshTypeCell:function() |
+{if(this._request.mimeType){this._typeCell.removeStyleClass("network-dim-cell");this._typeCell.setTextAndTitle(this._request.mimeType);}else{this._typeCell.enableStyleClass("network-dim-cell",!this._request.isPingRequest());this._typeCell.setTextAndTitle(this._request.requestContentType()||"");}},_refreshInitiatorCell:function() |
{this._initiatorCell.removeChildren();this._initiatorCell.removeStyleClass("network-dim-cell");this._initiatorCell.removeStyleClass("network-script-initiated");delete this._initiatorCell.request;var request=this._request;var initiator=request.initiatorInfo();switch(initiator.type){case WebInspector.NetworkRequest.InitiatorType.Parser:this._initiatorCell.title=initiator.url+":"+initiator.lineNumber;this._initiatorCell.appendChild(WebInspector.linkifyResourceAsNode(initiator.url,initiator.lineNumber-1));this._appendSubtitle(this._initiatorCell,WebInspector.UIString("Parser"));break;case WebInspector.NetworkRequest.InitiatorType.Redirect:this._initiatorCell.title=initiator.url;this._initiatorCell.appendChild(WebInspector.linkifyRequestAsNode(request.redirectSource));this._appendSubtitle(this._initiatorCell,WebInspector.UIString("Redirect"));break;case WebInspector.NetworkRequest.InitiatorType.Script:var urlElement=this._linkifier.linkifyLocation(initiator.url,initiator.lineNumber-1,initiator.columnNumber-1);urlElement.title="";this._initiatorCell.appendChild(urlElement);this._appendSubtitle(this._initiatorCell,WebInspector.UIString("Script"));this._initiatorCell.addStyleClass("network-script-initiated");this._initiatorCell.request=request;break;default:this._initiatorCell.title="";this._initiatorCell.addStyleClass("network-dim-cell");this._initiatorCell.setTextAndTitle(WebInspector.UIString("Other"));}},_refreshCookiesCell:function() |
{var requestCookies=this._request.requestCookies;this._cookiesCell.setTextAndTitle(requestCookies?""+requestCookies.length:"");},_refreshSetCookiesCell:function() |
{var responseCookies=this._request.responseCookies;this._setCookiesCell.setTextAndTitle(responseCookies?""+responseCookies.length:"");},_refreshSizeCell:function() |
@@ -537,10 +526,6 @@ |
this._labelLeftElement.addStyleClass("hidden");this._labelLeftElement.style.setProperty("right",(100-this._percentages.start)+"%");this._labelLeftElement.addStyleClass("before");}else{this._labelLeftElement.style.setProperty("left",this._percentages.start+"%");this._labelLeftElement.style.setProperty("right",(100-this._percentages.middle)+"%");} |
if(labelAfter){if(rightHidden) |
this._labelRightElement.addStyleClass("hidden");this._labelRightElement.style.setProperty("left",this._percentages.end+"%");this._labelRightElement.addStyleClass("after");}else{this._labelRightElement.style.setProperty("left",this._percentages.middle+"%");this._labelRightElement.style.setProperty("right",(100-this._percentages.end)+"%");}},__proto__:WebInspector.DataGridNode.prototype} |
-WebInspector.NetworkLogView._trivialTypeFilter=function(request) |
-{return true;} |
-WebInspector.NetworkLogView._typeFilter=function(allowedTypes,request) |
-{return request.type.name()in allowedTypes;} |
WebInspector.NetworkDataGridNode.NameComparator=function(a,b) |
{var aFileName=a._request.name();var bFileName=b._request.name();if(aFileName>bFileName) |
return 1;if(bFileName>aFileName) |