Changeset 243614 in webkit
- Timestamp:
- Mar 28, 2019 11:47:05 AM (5 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r243507 r243614 1 2019-03-28 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Show Resource Initiator in Network Tab detail views 4 https://bugs.webkit.org/show_bug.cgi?id=196316 5 <rdar://problem/49352679> 6 7 Reviewed by Devin Rousso. 8 9 * UserInterface/Controllers/NetworkManager.js: 10 (WI.NetworkManager.prototype.resourceRequestWillBeSent): 11 (WI.NetworkManager.prototype.resourceRequestWasServedFromMemoryCache): 12 (WI.NetworkManager.prototype._initiatorCallFramesFromPayload): 13 Initialize call frames from the initiator payload. 14 15 * UserInterface/Models/Resource.js: 16 (WI.Resource.prototype.get initiatorCallFrames): 17 Initialization and accessor. 18 19 * UserInterface/Views/CallFrameTreeElement.js: 20 (WI.CallFrameTreeElement): 21 Selecting a native element won't do anything so just don't allow selection. 22 23 * UserInterface/Views/ResourceHeadersContentView.css: 24 (.resource-headers .go-to-link): 25 (.resource-headers .call-stack): 26 (.resource-headers .call-stack:hover): 27 (@media (prefers-color-scheme: dark)): 28 * UserInterface/Views/ResourceHeadersContentView.js: 29 (WI.ResourceHeadersContentView): 30 (WI.ResourceHeadersContentView.prototype.hidden): 31 (WI.ResourceHeadersContentView.prototype._refreshSummarySection): 32 Add an "Initiator" line in the summary with a way to view the whole 33 initiator backtrace if one exists. 34 1 35 2019-03-26 Devin Rousso <drousso@apple.com> 2 36 -
trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
r242948 r243614 307 307 requestSentTimestamp: elapsedTime, 308 308 requestSentWalltime: walltime, 309 initiatorCallFrames: this._initiatorCallFramesFromPayload(initiator), 309 310 initiatorSourceCodeLocation: this._initiatorSourceCodeLocationFromPayload(initiator), 310 311 initiatorNode: this._initiatorNodeFromPayload(initiator), … … 451 452 requestMethod: "GET", 452 453 requestSentTimestamp: elapsedTime, 454 initiatorCallFrames: this._initiatorCallFramesFromPayload(initiator), 453 455 initiatorSourceCodeLocation: this._initiatorSourceCodeLocationFromPayload(initiator), 454 456 initiatorNode: this._initiatorNodeFromPayload(initiator), … … 763 765 } 764 766 767 _initiatorCallFramesFromPayload(initiatorPayload) 768 { 769 if (!initiatorPayload) 770 return null; 771 772 let callFrames = initiatorPayload.stackTrace; 773 if (!callFrames) 774 return null; 775 776 return callFrames.map((payload) => WI.CallFrame.fromPayload(WI.assumingMainTarget(), payload)); 777 } 778 765 779 _initiatorSourceCodeLocationFromPayload(initiatorPayload) 766 780 { -
trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js
r243452 r243614 27 27 WI.Resource = class Resource extends WI.SourceCode 28 28 { 29 constructor(url, {mimeType, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, requestSentTimestamp, requestSentWalltime, initiator SourceCodeLocation, initiatorNode, originalRequestWillBeSentTimestamp} = {})29 constructor(url, {mimeType, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, requestSentTimestamp, requestSentWalltime, initiatorCallFrames, initiatorSourceCodeLocation, initiatorNode, originalRequestWillBeSentTimestamp} = {}) 30 30 { 31 31 super(); … … 53 53 this._serverTimingEntries = null; 54 54 this._parentFrame = null; 55 this._initiatorCallFrames = initiatorCallFrames || null; 55 56 this._initiatorSourceCodeLocation = initiatorSourceCodeLocation || null; 56 57 this._initiatorNode = initiatorNode || null; … … 302 303 get requestMethod() { return this._requestMethod; } 303 304 get requestData() { return this._requestData; } 305 get initiatorCallFrames() { return this._initiatorCallFrames; } 304 306 get initiatorSourceCodeLocation() { return this._initiatorSourceCodeLocation; } 305 307 get initiatorNode() { return this._initiatorNode; } -
trunk/Source/WebInspectorUI/UserInterface/Views/CallFrameTreeElement.js
r224433 r243614 45 45 if (this._callFrame.nativeCode || !this._callFrame.sourceCodeLocation) { 46 46 this.subtitle = ""; 47 this.selectable = false; 47 48 return; 48 49 } -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.css
r238122 r243614 48 48 color: var(--network-pseudo-header-color); 49 49 } 50 51 .resource-headers .go-to-link { 52 -webkit-user-select: text; 53 } 54 55 .resource-headers .pair.initiator > .value { 56 display: inline-flex; 57 align-items: center; 58 } 59 60 .resource-headers .call-stack { 61 position: relative; 62 width: 16px; 63 height: 13px; 64 margin-left: 3px; 65 content: url(../Images/CallStack.svg); 66 opacity: 0.5; 67 -webkit-user-select: none; 68 } 69 70 .resource-headers .call-stack:hover { 71 opacity: 0.8; 72 } 73 74 @media (prefers-color-scheme: dark) { 75 .resource-headers .call-stack { 76 filter: invert(); 77 } 78 } -
trunk/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js
r242018 r243614 46 46 this._automaticallyRevealFirstSearchResult = false; 47 47 this._bouncyHighlightElement = null; 48 this._popover = null; 49 this._popoverCallStackIconElement = null; 48 50 49 51 this._redirectDetailsSections = []; … … 119 121 this._needsResponseHeadersRefresh = false; 120 122 } 123 } 124 125 hidden() 126 { 127 super.hidden(); 128 129 if (this._popover) 130 this._popover.dismiss(); 121 131 } 122 132 … … 252 262 if (this._resource.remoteAddress) 253 263 this._summarySection.appendKeyValuePair(WI.UIString("Address"), this._resource.remoteAddress); 264 265 let initiatorLocation = this._resource.initiatorSourceCodeLocation; 266 if (initiatorLocation) { 267 268 let fragment = document.createDocumentFragment(); 269 270 const options = { 271 dontFloat: true, 272 ignoreSearchTab: true, 273 }; 274 let link = WI.createSourceCodeLocationLink(initiatorLocation, options); 275 fragment.appendChild(link); 276 277 let callFrames = this._resource.initiatorCallFrames; 278 if (callFrames) { 279 this._popoverCallStackIconElement = document.createElement("img"); 280 this._popoverCallStackIconElement.className = "call-stack"; 281 fragment.appendChild(this._popoverCallStackIconElement); 282 283 this._popoverCallStackIconElement.addEventListener("click", (event) => { 284 if (!this._popover) { 285 this._popover = new WI.Popover(this); 286 this._popover.windowResizeHandler = () => { this._presentPopoverBelowCallStackElement() }; 287 } 288 289 const selectable = false; 290 let callFramesTreeOutline = new WI.TreeOutline(selectable); 291 callFramesTreeOutline.disclosureButtons = false; 292 let callFrameTreeController = new WI.CallFrameTreeController(callFramesTreeOutline); 293 callFrameTreeController.callFrames = callFrames; 294 295 let popoverContent = document.createElement("div"); 296 popoverContent.appendChild(callFrameTreeController.treeOutline.element); 297 this._popover.content = popoverContent; 298 299 this._presentPopoverBelowCallStackElement(); 300 }); 301 } 302 303 let pair = this._summarySection.appendKeyValuePair(WI.UIString("Initiator"), fragment); 304 pair.classList.add("initiator"); 305 306 if (this._popover && this._popover.visible) 307 this._presentPopoverBelowCallStackElement(); 308 } 254 309 } 255 310 … … 469 524 } 470 525 526 _presentPopoverBelowCallStackElement() 527 { 528 let bounds = WI.Rect.rectFromClientRect(this._popoverCallStackIconElement.getBoundingClientRect()); 529 this._popover.present(bounds.pad(2), [WI.RectEdge.MAX_Y, WI.RectEdge.MIN_Y, WI.RectEdge.MAX_X]); 530 } 531 471 532 _resourceMetricsDidChange(event) 472 533 {
Note: See TracChangeset
for help on using the changeset viewer.