Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/RequestHeadersView.js

Issue 1832413002: DevTools: Address empty query parameters being displayed fugly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback on code style and string injection Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/network/requestHeadersView.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) IBM Corp. 2009 All rights reserved. 3 * Copyright (C) IBM Corp. 2009 All rights reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 value = value.replace(/\+/g, " "); 116 value = value.replace(/\+/g, " ");
117 if (value.indexOf("%") >= 0) { 117 if (value.indexOf("%") >= 0) {
118 try { 118 try {
119 value = decodeURIComponent(value); 119 value = decodeURIComponent(value);
120 } catch (e) { 120 } catch (e) {
121 errorDecoding = true; 121 errorDecoding = true;
122 } 122 }
123 } 123 }
124 } 124 }
125 var div = createElementWithClass("div", className); 125 var div = createElementWithClass("div", className);
126 if (value === "")
127 div.classList.add("empty-value");
126 if (errorDecoding) 128 if (errorDecoding)
127 div.createChild("span", "error-message").textContent = WebInspector. UIString("(unable to decode value)"); 129 div.createChild("span", "error-message").textContent = WebInspector. UIString("(unable to decode value)");
128 else 130 else
129 div.textContent = value; 131 div.textContent = value;
130 return div; 132 return div;
131 }, 133 },
132 134
133 _refreshURL: function() 135 _refreshURL: function()
134 { 136 {
135 this._urlItem.title = this._formatHeader(WebInspector.UIString("Request URL"), this._request.url); 137 this._urlItem.title = this._formatHeader(WebInspector.UIString("Request URL"), this._request.url);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return; 220 return;
219 } 221 }
220 222
221 var toggleTitle = this._decodeRequestParameters ? WebInspector.UIString( "view URL encoded") : WebInspector.UIString("view decoded"); 223 var toggleTitle = this._decodeRequestParameters ? WebInspector.UIString( "view URL encoded") : WebInspector.UIString("view decoded");
222 var toggleButton = this._createToggleButton(toggleTitle); 224 var toggleButton = this._createToggleButton(toggleTitle);
223 toggleButton.addEventListener("click", this._toggleURLDecoding.bind(this ), false); 225 toggleButton.addEventListener("click", this._toggleURLDecoding.bind(this ), false);
224 paramsTreeElement.listItemElement.appendChild(toggleButton); 226 paramsTreeElement.listItemElement.appendChild(toggleButton);
225 227
226 for (var i = 0; i < params.length; ++i) { 228 for (var i = 0; i < params.length; ++i) {
227 var paramNameValue = createDocumentFragment(); 229 var paramNameValue = createDocumentFragment();
228 var name = this._formatParameter(params[i].name + ":", "header-name" , this._decodeRequestParameters); 230 if (params[i].name !== "") {
229 var value = this._formatParameter(params[i].value, "header-value sou rce-code", this._decodeRequestParameters); 231 var name = this._formatParameter(params[i].name + ":", "header-n ame", this._decodeRequestParameters);
230 paramNameValue.appendChild(name); 232 var value = this._formatParameter(params[i].value, "header-value source-code", this._decodeRequestParameters);
231 paramNameValue.appendChild(value); 233 paramNameValue.appendChild(name);
234 paramNameValue.appendChild(value);
235 } else {
236 paramNameValue.appendChild(this._formatParameter(WebInspector.UI String("(empty)"), "empty-request-header", this._decodeRequestParameters));
237 }
232 238
233 var parmTreeElement = new TreeElement(paramNameValue); 239 var paramTreeElement = new TreeElement(paramNameValue);
234 parmTreeElement.selectable = false; 240 paramTreeElement.selectable = false;
235 paramsTreeElement.appendChild(parmTreeElement); 241 paramsTreeElement.appendChild(paramTreeElement);
236 } 242 }
237 }, 243 },
238 244
239 /** 245 /**
240 * @param {*} parsedObject 246 * @param {*} parsedObject
241 * @param {string} sourceText 247 * @param {string} sourceText
242 */ 248 */
243 _refreshRequestJSONPayload: function(parsedObject, sourceText) 249 _refreshRequestJSONPayload: function(parsedObject, sourceText)
244 { 250 {
245 var treeElement = this._requestPayloadCategory; 251 var treeElement = this._requestPayloadCategory;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 this._expandedSetting.set(true); 524 this._expandedSetting.set(true);
519 }, 525 },
520 526
521 oncollapse: function() 527 oncollapse: function()
522 { 528 {
523 this._expandedSetting.set(false); 529 this._expandedSetting.set(false);
524 }, 530 },
525 531
526 __proto__: TreeElement.prototype 532 __proto__: TreeElement.prototype
527 } 533 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/network/requestHeadersView.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698