Changeset 223058 in webkit
- Timestamp:
- Oct 9, 2017 12:32:28 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 12 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r223055 r223058 1 2017-10-09 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Network Tab - Cookies Detail View 4 https://bugs.webkit.org/show_bug.cgi?id=177988 5 <rdar://problem/34071927> 6 7 Reviewed by Brian Burg. 8 9 * inspector/unit-tests/cookie-expected.txt: Added. 10 * inspector/unit-tests/cookie.html: Added. 11 1 12 2017-10-09 Matt Lewis <jlewis3@apple.com> 2 13 -
trunk/Source/WebInspectorUI/ChangeLog
r223057 r223058 1 2017-10-09 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Network Tab - Cookies Detail View 4 https://bugs.webkit.org/show_bug.cgi?id=177988 5 <rdar://problem/34071927> 6 7 Reviewed by Brian Burg. 8 9 * Localizations/en.lproj/localizedStrings.js: 10 * UserInterface/Main.html: 11 * UserInterface/Test.html: 12 New strings and resources. 13 14 * UserInterface/Models/Cookie.js: Added. 15 (WI.Cookie): 16 (WI.Cookie.parseCookieRequestHeader): 17 (WI.Cookie.parseSetCookieResponseHeader): 18 Encapsulation for Cookie attributes. 19 20 * UserInterface/Models/Resource.js: 21 (WI.Resource.prototype.get requestCookies): 22 (WI.Resource.prototype.get responseCookies): 23 (WI.Resource.prototype.updateForRedirectResponse): 24 (WI.Resource.prototype.updateForResponse): 25 (WI.Resource.prototype.updateWithMetrics): 26 New computed accessors for requestCookies and responseCookies. 27 28 * UserInterface/Views/NetworkResourceDetailView.js: 29 (WI.NetworkResourceDetailView.prototype._showContentViewForNavigationItem): 30 Show the new Cookie View. 31 32 * UserInterface/Views/NetworkTableContentView.css: 33 (.content-view.network .network-table .icon): 34 (.network-table li:not(.filler) .cell.name): 35 (.network-table .cache-type): 36 (.network-table .error): 37 (body[dir=ltr] .network-table .cell.name > .status): 38 (body[dir=rtl] .network-table .cell.name > .status): 39 (.network-table .cell.name > .status .indeterminate-progress-spinner): 40 (.showing-detail .network-table .cell:not(.name)): 41 (.showing-detail .network-table .resizer:not(:first-of-type)): 42 (.network-table :not(.header) .cell:first-of-type): 43 Rework these styles to be specific to the .network-table. 44 45 * UserInterface/Views/Table.css: 46 (.table :not(.header) .cell:first-of-type): Deleted. 47 Move this to the network table styles, it shouldn't apply to all tables. 48 49 * UserInterface/Views/ResourceCookiesContentView.css: 50 (.resource-cookies > section > .details.has-table): 51 (.resource-cookies .table): 52 (.resource-cookies .table > .header): 53 Styles for Cookies view and table. 54 55 * UserInterface/Views/ResourceCookiesContentView.js: Added. 56 (WI.ResourceCookiesContentView): 57 (WI.ResourceCookiesContentView.prototype.tableNumberOfRows): 58 (WI.ResourceCookiesContentView.prototype.tableSortChanged): 59 (WI.ResourceCookiesContentView.prototype.tablePopulateCell): 60 (WI.ResourceCookiesContentView.prototype.initialLayout): 61 (WI.ResourceCookiesContentView.prototype._incompleteSectionWithMessage): 62 (WI.ResourceCookiesContentView.prototype._incompleteSectionWithLoadingIndicator): 63 (WI.ResourceCookiesContentView.prototype._dataSourceForTable): 64 (WI.ResourceCookiesContentView.prototype._generateSortComparator): 65 (WI.ResourceCookiesContentView.prototype._refreshRequestCookiesSection): 66 (WI.ResourceCookiesContentView.prototype._refreshResponseCookiesSection): 67 (WI.ResourceCookiesContentView.prototype._sizeForTable): 68 (WI.ResourceCookiesContentView.prototype._resourceRequestHeadersDidChange): 69 (WI.ResourceCookiesContentView.prototype._resourceResponseReceived): 70 Tables for Request and Response cookies. They are simliar with slightly different columns. 71 Handle simple display and sorting for the tables. 72 73 * UserInterface/Views/ResourceHeadersContentView.js: 74 (WI.ResourceHeadersContentView.prototype._refreshResponseHeadersSection): 75 Break out Set-Cookie headers as multiple headers. THey should never be combined. 76 77 * UserInterface/Views/Table.js: 78 (WI.Table.prototype.showColumn): 79 (WI.Table.prototype.hideColumn): 80 (WI.Table.prototype._handleHeaderContextMenu): 81 * UserInterface/Views/TableColumn.js: 82 (WI.TableColumn.prototype.get hideable): 83 (WI.TableColumn.prototype.set hidden): 84 (WI.TableColumn): 85 (WI.TableColumn.prototype.setHidden): Deleted. 86 Make it so some columns can not be hidden. For example the "value" column 87 in the Cookie tables. 88 1 89 2017-10-09 Joseph Pecoraro <pecoraro@apple.com> 2 90 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r223011 r223058 610 610 localizedStrings["No matching ARIA role"] = "No matching ARIA role"; 611 611 localizedStrings["No preview available"] = "No preview available"; 612 localizedStrings["No request cookies."] = "No request cookies."; 612 613 localizedStrings["No request headers"] = "No request headers"; 613 614 localizedStrings["No request, served from the disk cache."] = "No request, served from the disk cache."; 614 615 localizedStrings["No request, served from the memory cache."] = "No request, served from the memory cache."; 616 localizedStrings["No response cookies."] = "No response cookies."; 615 617 localizedStrings["No response headers"] = "No response headers"; 616 618 localizedStrings["Node"] = "Node"; … … 725 727 localizedStrings["Request"] = "Request"; 726 728 localizedStrings["Request & Response"] = "Request & Response"; 729 localizedStrings["Request Cookies"] = "Request Cookies"; 727 730 localizedStrings["Request Data"] = "Request Data"; 728 731 localizedStrings["Request Headers"] = "Request Headers"; … … 739 742 localizedStrings["Resources"] = "Resources"; 740 743 localizedStrings["Response"] = "Response"; 744 localizedStrings["Response Cookies"] = "Response Cookies"; 741 745 localizedStrings["Response Headers"] = "Response Headers"; 742 746 localizedStrings["Restart (%s)"] = "Restart (%s)"; -
trunk/Source/WebInspectorUI/UserInterface/Main.html
r223011 r223058 154 154 <link rel="stylesheet" href="Views/RenderingFrameTimelineView.css"> 155 155 <link rel="stylesheet" href="Views/Resizer.css"> 156 <link rel="stylesheet" href="Views/ResourceCookiesContentView.css"> 156 157 <link rel="stylesheet" href="Views/ResourceDetailsSection.css"> 157 158 <link rel="stylesheet" href="Views/ResourceDetailsSidebarPanel.css"> … … 353 354 <script src="Models/Color.js"></script> 354 355 <script src="Models/ConsoleCommandResultMessage.js"></script> 356 <script src="Models/Cookie.js"></script> 355 357 <script src="Models/CookieStorageObject.js"></script> 356 358 <script src="Models/DOMBreakpoint.js"></script> … … 697 699 <script src="Views/ResourceDetailsSidebarPanel.js"></script> 698 700 <script src="Views/ResourceHeadersContentView.js"></script> 701 <script src="Views/ResourceCookiesContentView.js"></script> 699 702 <script src="Views/ResourceSidebarPanel.js"></script> 700 703 <script src="Views/ResourceTimelineDataGridNode.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js
r223006 r223058 47 47 this._requestHeaders = requestHeaders || {}; 48 48 this._responseHeaders = {}; 49 this._requestCookies = null; 50 this._responseCookies = null; 49 51 this._parentFrame = null; 50 52 this._initiatorSourceCodeLocation = initiatorSourceCodeLocation || null; … … 424 426 } 425 427 428 get requestCookies() 429 { 430 if (!this._requestCookies) 431 this._requestCookies = WI.Cookie.parseCookieRequestHeader(this._requestHeaders.valueForCaseInsensitiveKey("Cookie")); 432 433 return this._requestCookies; 434 } 435 436 get responseCookies() 437 { 438 if (!this._responseCookies) { 439 // FIXME: The backend sends multiple "Set-Cookie" headers in one "Set-Cookie" with multiple values 440 // separated by ", ". This doesn't allow us to safely distinguish between a ", " that separates 441 // multiple headers or one that may be valid part of a Cookie's value or attribute, such as the 442 // ", " in the the date format "Expires=Tue, 03-Oct-2017 04:39:21 GMT". To improve heuristics 443 // we do a negative lookahead for numbers, but we can still fail on cookie values containing ", ". 444 let rawCombinedHeader = this._responseHeaders.valueForCaseInsensitiveKey("Set-Cookie") || ""; 445 let setCookieHeaders = rawCombinedHeader.split(/, (?![0-9])/); 446 let cookies = []; 447 for (let header of setCookieHeaders) { 448 let cookie = WI.Cookie.parseSetCookieResponseHeader(header); 449 if (cookie) 450 cookies.push(cookie); 451 } 452 this._responseCookies = cookies; 453 } 454 455 return this._responseCookies; 456 } 457 426 458 get requestSentTimestamp() 427 459 { … … 606 638 this._url = url; 607 639 this._requestHeaders = requestHeaders || {}; 640 this._requestCookies = null; 608 641 this._lastRedirectReceivedTimestamp = elapsedTime || NaN; 609 642 … … 643 676 this._statusText = statusText; 644 677 this._responseHeaders = responseHeaders || {}; 678 this._responseCookies = null; 645 679 this._responseReceivedTimestamp = elapsedTime || NaN; 646 680 this._timingData = WI.ResourceTimingData.fromPayload(timingData, this); … … 703 737 if (metrics.requestHeaders) { 704 738 this._requestHeaders = metrics.requestHeaders; 739 this._requestCookies = null; 705 740 this.dispatchEventToListeners(WI.Resource.Event.RequestHeadersDidChange); 706 741 } -
trunk/Source/WebInspectorUI/UserInterface/Test.html
r222782 r223058 117 117 <script src="Models/Color.js"></script> 118 118 <script src="Models/ConsoleCommandResultMessage.js"></script> 119 <script src="Models/Cookie.js"></script> 119 120 <script src="Models/CookieStorageObject.js"></script> 120 121 <script src="Models/DOMBreakpoint.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Views/NetworkResourceDetailView.js
r223006 r223058 162 162 break; 163 163 case "cookies": 164 // FIXME: Provide a Resource Cookies View.165 164 if (!this._cookiesContentView) 166 this._cookiesContentView = new WI. DebugContentView("Cookies");165 this._cookiesContentView = new WI.ResourceCookiesContentView(this._resource); 167 166 this._contentBrowser.showContentView(this._cookiesContentView); 168 167 break; -
trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.css
r222868 r223058 24 24 */ 25 25 26 .content-view.network . table .icon {26 .content-view.network .network-table .icon { 27 27 position: relative; 28 28 width: 16px; … … 33 33 } 34 34 35 . content-view.network .table li:not(.filler) .cell.name {35 .network-table li:not(.filler) .cell.name { 36 36 cursor: pointer; 37 37 } 38 38 39 . content-view.network .table .cache-type {39 .network-table .cache-type { 40 40 color: var(--text-color-gray-medium); 41 41 } 42 42 43 . content-view.network .table .error {43 .network-table .error { 44 44 color: var(--error-text-color); 45 45 } 46 46 47 body[dir=ltr] . content-view.network .table .cell.name > .status {47 body[dir=ltr] .network-table .cell.name > .status { 48 48 float: right; 49 49 margin-left: 4px; 50 50 } 51 51 52 body[dir=rtl] . content-view.network .table .cell.name > .status {52 body[dir=rtl] .network-table .cell.name > .status { 53 53 float: left; 54 54 margin-right: 4px; 55 55 } 56 56 57 . content-view.network .table .cell.name > .status .indeterminate-progress-spinner {57 .network-table .cell.name > .status .indeterminate-progress-spinner { 58 58 margin-top: 3px; 59 59 width: 14px; … … 61 61 } 62 62 63 .showing-detail . table .cell:not(.name) {63 .showing-detail .network-table .cell:not(.name) { 64 64 display: none; 65 65 } 66 66 67 .showing-detail . table .resizer:not(:first-of-type) {67 .showing-detail .network-table .resizer:not(:first-of-type) { 68 68 display: none; 69 69 } 70 71 .network-table :not(.header) .cell:first-of-type { 72 background: rgba(0, 0, 0, 0.07); 73 } -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceCookiesContentView.css
r223057 r223058 24 24 */ 25 25 26 .content-view.network .table .icon { 27 position: relative; 28 width: 16px; 29 height: 16px; 30 bottom: 1px; 31 vertical-align: middle; 32 -webkit-margin-end: 4px; 26 .resource-cookies.resource-details > section > .details.has-table { 27 border-left: none; 33 28 } 34 29 35 . content-view.network .table li:not(.filler) .cell.name {36 cursor: pointer;30 .resource-cookies .table { 31 border: 1px solid var(--border-color); 37 32 } 38 33 39 . content-view.network .table .cache-type{40 color: var(--text-color-gray-medium);34 .resource-cookies .table > .header { 35 -webkit-user-select: none; 41 36 } 42 43 .content-view.network .table .error {44 color: var(--error-text-color);45 }46 47 body[dir=ltr] .content-view.network .table .cell.name > .status {48 float: right;49 margin-left: 4px;50 }51 52 body[dir=rtl] .content-view.network .table .cell.name > .status {53 float: left;54 margin-right: 4px;55 }56 57 .content-view.network .table .cell.name > .status .indeterminate-progress-spinner {58 margin-top: 3px;59 width: 14px;60 height: 14px;61 }62 63 .showing-detail .table .cell:not(.name) {64 display: none;65 }66 67 .showing-detail .table .resizer:not(:first-of-type) {68 display: none;69 } -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js
r223057 r223058 202 202 // Private 203 203 204 _ incompleteSectionWithMessage(section, message)204 _markIncompleteSectionWithMessage(section, message) 205 205 { 206 206 section.toggleIncomplete(true); … … 210 210 } 211 211 212 _ incompleteSectionWithLoadingIndicator(section)212 _markIncompleteSectionWithLoadingIndicator(section) 213 213 { 214 214 section.toggleIncomplete(true); … … 283 283 if (this._resource.statusCode !== 304) { 284 284 if (this._resource.responseSource === WI.Resource.ResponseSource.MemoryCache) { 285 this._ incompleteSectionWithMessage(this._requestHeadersSection, WI.UIString("No request, served from the memory cache."));285 this._markIncompleteSectionWithMessage(this._requestHeadersSection, WI.UIString("No request, served from the memory cache.")); 286 286 return; 287 287 } 288 288 if (this._resource.responseSource === WI.Resource.ResponseSource.DiskCache) { 289 this._ incompleteSectionWithMessage(this._requestHeadersSection, WI.UIString("No request, served from the disk cache."));289 this._markIncompleteSectionWithMessage(this._requestHeadersSection, WI.UIString("No request, served from the disk cache.")); 290 290 return; 291 291 } … … 313 313 314 314 if (!detailsElement.firstChild) 315 this._ incompleteSectionWithMessage(this._requestHeadersSection, WI.UIString("No request headers"));315 this._markIncompleteSectionWithMessage(this._requestHeadersSection, WI.UIString("No request headers")); 316 316 } 317 317 … … 322 322 323 323 if (!this._resource.hasResponse()) { 324 this._ incompleteSectionWithLoadingIndicator(this._responseHeadersSection);324 this._markIncompleteSectionWithLoadingIndicator(this._responseHeadersSection); 325 325 return; 326 326 } … … 341 341 342 342 let responseHeaders = this._resource.responseHeaders; 343 for (let key in responseHeaders) 343 for (let key in responseHeaders) { 344 // Split multiple Set-Cookie response headers out into their multiple headers instead of as a combined value. 345 if (key.toLowerCase() === "set-cookie") { 346 let responseCookies = this._resource.responseCookies; 347 console.assert(responseCookies.length > 0); 348 for (let cookie of responseCookies) 349 this._appendKeyValuePair(detailsElement, key, cookie.rawHeader, "header"); 350 continue; 351 } 352 344 353 this._appendKeyValuePair(detailsElement, key, responseHeaders[key], "header"); 354 } 345 355 346 356 if (!detailsElement.firstChild) 347 this._ incompleteSectionWithMessage(this._responseHeadersSection, WI.UIString("No response headers"));357 this._markIncompleteSectionWithMessage(this._responseHeadersSection, WI.UIString("No response headers")); 348 358 } 349 359 -
trunk/Source/WebInspectorUI/UserInterface/Views/Table.css
r223006 r223058 161 161 } 162 162 163 .table :not(.header) .cell:first-of-type {164 background: rgba(0, 0, 0, 0.07);165 }166 167 163 .table .cell.align-right { 168 164 text-align: right; -
trunk/Source/WebInspectorUI/UserInterface/Views/Table.js
r222988 r223058 45 45 // respect different vertical / horizontal scroll containers. 46 46 47 this.element.classList.add("table" );47 this.element.classList.add("table", identifier); 48 48 this.element.tabIndex = 0; 49 49 this.element.addEventListener("keydown", this._handleKeyDown.bind(this)); … … 335 335 return; 336 336 337 column. setHidden(false);337 column.hidden = false; 338 338 339 339 let columnIndex = this._hiddenColumns.indexOf(column); … … 389 389 return; 390 390 391 console.assert(column.hideable, "Column is not hideable so should always be shown."); 392 if (!column.hideable) 393 return; 394 391 395 if (column.hidden) 392 396 return; 393 397 394 column. setHidden(true);398 column.hidden = true; 395 399 396 400 this._hiddenColumns.push(column); … … 1175 1179 if (column.locked) 1176 1180 continue; 1181 if (!column.hideable) 1182 continue; 1177 1183 1178 1184 let checked = !column.hidden; -
trunk/Source/WebInspectorUI/UserInterface/Views/TableColumn.js
r222470 r223058 26 26 WI.TableColumn = class TableColumn extends WI.Object 27 27 { 28 constructor(identifier, name, {initialWidth, minWidth, maxWidth, hidden, sortable, align, resizeType} = {})28 constructor(identifier, name, {initialWidth, minWidth, maxWidth, hidden, sortable, hideable, align, resizeType} = {}) 29 29 { 30 30 super(); … … 45 45 this._defaultHidden = hidden || false; 46 46 this._sortable = typeof sortable === "boolean" ? sortable : true; 47 this._hideable = typeof hideable === "boolean" ? hideable : true; 47 48 this._align = align || null; 48 49 this._resizeType = resizeType || TableColumn.ResizeType.Auto; … … 61 62 get defaultHidden() { return this._defaultHidden; } 62 63 get sortable() { return this._sortable; } 64 get hideable() { return this._hideable; } 63 65 get align() { return this._align; } 64 66 … … 91 93 } 92 94 93 set Hidden(x)95 set hidden(x) 94 96 { 97 console.assert(!this.locked && this._hideable, "Should not be able to hide a non-hideable column."); 95 98 this._hidden = x; 96 99 }
Note: See TracChangeset
for help on using the changeset viewer.