Changeset 288029 in webkit
- Timestamp:
- Jan 14, 2022 1:34:39 PM (6 months ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
Localizations/en.lproj/localizedStrings.js (modified) (7 diffs)
-
UserInterface/Controllers/DOMDebuggerManager.js (modified) (1 diff)
-
UserInterface/Views/ContextMenuUtilities.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r287999 r288029 1 2022-01-14 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: add a contextmenu item to create a URL Breakpoint for resources initiated by script 4 https://bugs.webkit.org/show_bug.cgi?id=235216 5 6 Reviewed by Dean Jackson. 7 8 * UserInterface/Views/ContextMenuUtilities.js: 9 (WI.appendContextMenuItemsForSourceCode): 10 Since URL Breakpoints only work with XHR/`fetch`, only offer to create a URL Breakpoint if 11 the `WI.SourceCode` has `initiatorCallFrames`, meaning it was triggered by JS. We could 12 offer this contextmenu item for _all_ resources, but there are many different resource types 13 that are unlikely (if ever) to be loaded via XHR/`fetch` (e.g. favicons, manifests, fonts, 14 initial JS/CSS files, etc.) that it would likely add clutter and possibly confuse developers 15 into thinking that URL Breakpoints can somehow pause things other than JS. Plus, this can 16 always be changed in a followup, so better to do something minimal first. 17 18 * UserInterface/Controllers/DOMDebuggerManager.js: 19 (WI.DOMDebuggerManager.prototype.urlBreakpointsMatchingURL): Added. 20 Helper method to find all `WI.URLBreakpoint` that match a given URL, sorted by how exact 21 they would match (e.g. a regex match is less exact than `===`). 22 23 * Localizations/en.lproj/localizedStrings.js: 24 1 25 2022-01-13 Elliott Williams <emw@apple.com> 2 26 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r287409 r288029 116 116 localizedStrings["Add Cookie"] = "Add Cookie"; 117 117 localizedStrings["Add Header"] = "Add Header"; 118 localizedStrings["Add JavaScript Breakpoint"] = "Add JavaScript Breakpoint"; 118 119 localizedStrings["Add New"] = "Add New"; 119 120 localizedStrings["Add New Class"] = "Add New Class"; … … 123 124 /* Text of button to add a new audit test case to the currently shown audit group. */ 124 125 localizedStrings["Add Test Case @ Audit Tab - Group"] = "Add Test Case"; 126 localizedStrings["Add URL Breakpoint"] = "Add URL Breakpoint"; 125 127 localizedStrings["Add a Class"] = "Add a Class"; 126 128 localizedStrings["Add new breakpoint action after this action"] = "Add new breakpoint action after this action"; … … 362 364 localizedStrings["Condition"] = "Condition"; 363 365 localizedStrings["Conditional expression"] = "Conditional expression"; 366 localizedStrings["Conic Gradient"] = "Conic Gradient"; 364 367 localizedStrings["Connecting"] = "Connecting"; 365 368 localizedStrings["Connection"] = "Connection"; … … 368 371 localizedStrings["Connection ID"] = "Connection ID"; 369 372 localizedStrings["Connection:"] = "Connection:"; 370 localizedStrings["Conic Gradient"] = "Conic Gradient";371 373 localizedStrings["Console"] = "Console"; 372 374 localizedStrings["Console Evaluation"] = "Console Evaluation"; … … 455 457 localizedStrings["Delete Descendant Breakpoints"] = "Delete Descendant Breakpoints"; 456 458 localizedStrings["Delete Inspector Bootstrap Script"] = "Delete Inspector Bootstrap Script"; 459 localizedStrings["Delete JavaScript Breakpoint"] = "Delete JavaScript Breakpoint"; 457 460 localizedStrings["Delete Local Override"] = "Delete Local Override"; 461 localizedStrings["Delete URL Breakpoint"] = "Delete URL Breakpoint"; 462 localizedStrings["Delete URL Breakpoints"] = "Delete URL Breakpoints"; 458 463 localizedStrings["Delete Watch Expression"] = "Delete Watch Expression"; 459 464 localizedStrings["Delete probe"] = "Delete probe"; … … 1183 1188 localizedStrings["Render Pipeline %d"] = "Render Pipeline %d"; 1184 1189 localizedStrings["Rendering Frames"] = "Rendering Frames"; 1190 localizedStrings["Repeating Conic Gradient"] = "Repeating Conic Gradient"; 1185 1191 localizedStrings["Repeating Linear Gradient"] = "Repeating Linear Gradient"; 1186 1192 localizedStrings["Repeating Radial Gradient"] = "Repeating Radial Gradient"; 1187 localizedStrings["Repeating Conic Gradient"] = "Repeating Conic Gradient";1188 1193 localizedStrings["Request"] = "Request"; 1189 1194 localizedStrings["Request & Response"] = "Request & Response"; … … 1604 1609 /* Label for button to show CSS variables ungrouped */ 1605 1610 localizedStrings["Ungrouped @ Computed Style variables grouping mode"] = "Ungrouped"; 1606 /* Section header for ungrouped CSS variables */1607 localizedStrings["Ungrouped @ Computed Style variables section"] = "Ungrouped";1608 1611 /* Property value for `font-variant-capitals: unicase`. */ 1609 1612 localizedStrings["Unicase @ Font Details Sidebar Property Value"] = "Unicase"; -
trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js
r268786 r288029 465 465 } 466 466 467 urlBreakpointsMatchingURL(url) 468 { 469 return this._urlBreakpoints 470 .filter((urlBreakpoint) => { 471 switch (urlBreakpoint.type) { 472 case WI.URLBreakpoint.Type.Text: 473 return urlBreakpoint.url.toLowerCase() === url.toLowerCase(); 474 475 case WI.URLBreakpoint.Type.RegularExpression: 476 return (new RegExp(urlBreakpoint.url, "i")).test(url); 477 } 478 479 return false; 480 }) 481 .sort((a, b) => { 482 // Order URL breakpoints based on how closely they match the given URL. 483 const typeRankings = [ 484 WI.URLBreakpoint.Type.Text, 485 WI.URLBreakpoint.Type.RegularExpression, 486 ]; 487 return typeRankings.indexOf(a.type) - typeRankings.indexOf(b.type); 488 }); 489 } 490 467 491 addURLBreakpoint(breakpoint) 468 492 { -
trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js
r276681 r288029 121 121 122 122 if (location && (sourceCode instanceof WI.Script || (sourceCode instanceof WI.Resource && sourceCode.type === WI.Resource.Type.Script && !sourceCode.localResourceOverride))) { 123 let existing Breakpoint = WI.debuggerManager.breakpointForSourceCodeLocation(location);124 if (existing Breakpoint) {125 contextMenu.appendItem(WI.UIString("Delete Breakpoint"), () => {126 WI.debuggerManager.removeBreakpoint(existing Breakpoint);123 let existingJavaScriptBreakpoint = WI.debuggerManager.breakpointForSourceCodeLocation(location); 124 if (existingJavaScriptBreakpoint) { 125 contextMenu.appendItem(WI.UIString("Delete JavaScript Breakpoint"), () => { 126 WI.debuggerManager.removeBreakpoint(existingJavaScriptBreakpoint); 127 127 }); 128 128 } else { 129 contextMenu.appendItem(WI.UIString("Add Breakpoint"), () => {129 contextMenu.appendItem(WI.UIString("Add JavaScript Breakpoint"), () => { 130 130 WI.debuggerManager.addBreakpoint(new WI.JavaScriptBreakpoint(location)); 131 }); 132 } 133 } 134 135 if (sourceCode?.initiatorCallFrames) { 136 let existingURLBreakpoints = WI.domDebuggerManager.urlBreakpointsMatchingURL(sourceCode.url); 137 if (existingURLBreakpoints.length) { 138 contextMenu.appendItem(existingURLBreakpoints.length === 1 ? WI.UIString("Delete URL Breakpoint") : WI.UIString("Delete URL Breakpoints"), () => { 139 for (let urlBreakpoint of existingURLBreakpoints) 140 WI.domDebuggerManager.removeURLBreakpoint(urlBreakpoint); 141 }); 142 } else { 143 contextMenu.appendItem(WI.UIString("Add URL Breakpoint"), () => { 144 WI.domDebuggerManager.addURLBreakpoint(new WI.URLBreakpoint(WI.URLBreakpoint.Type.Text, sourceCode.url)); 131 145 }); 132 146 }
Note: See TracChangeset
for help on using the changeset viewer.