Title: [288029] trunk/Source/WebInspectorUI
- Revision
- 288029
- Author
- [email protected]
- Date
- 2022-01-14 13:34:39 -0800 (Fri, 14 Jan 2022)
Log Message
Web Inspector: add a contextmenu item to create a URL Breakpoint for resources initiated by script
https://bugs.webkit.org/show_bug.cgi?id=235216
Reviewed by Dean Jackson.
* UserInterface/Views/ContextMenuUtilities.js:
(WI.appendContextMenuItemsForSourceCode):
Since URL Breakpoints only work with XHR/`fetch`, only offer to create a URL Breakpoint if
the `WI.SourceCode` has `initiatorCallFrames`, meaning it was triggered by JS. We could
offer this contextmenu item for _all_ resources, but there are many different resource types
that are unlikely (if ever) to be loaded via XHR/`fetch` (e.g. favicons, manifests, fonts,
initial JS/CSS files, etc.) that it would likely add clutter and possibly confuse developers
into thinking that URL Breakpoints can somehow pause things other than JS. Plus, this can
always be changed in a followup, so better to do something minimal first.
* UserInterface/Controllers/DOMDebuggerManager.js:
(WI.DOMDebuggerManager.prototype.urlBreakpointsMatchingURL): Added.
Helper method to find all `WI.URLBreakpoint` that match a given URL, sorted by how exact
they would match (e.g. a regex match is less exact than `===`).
* Localizations/en.lproj/localizedStrings.js:
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (288028 => 288029)
--- trunk/Source/WebInspectorUI/ChangeLog 2022-01-14 21:07:47 UTC (rev 288028)
+++ trunk/Source/WebInspectorUI/ChangeLog 2022-01-14 21:34:39 UTC (rev 288029)
@@ -1,3 +1,27 @@
+2022-01-14 Devin Rousso <[email protected]>
+
+ Web Inspector: add a contextmenu item to create a URL Breakpoint for resources initiated by script
+ https://bugs.webkit.org/show_bug.cgi?id=235216
+
+ Reviewed by Dean Jackson.
+
+ * UserInterface/Views/ContextMenuUtilities.js:
+ (WI.appendContextMenuItemsForSourceCode):
+ Since URL Breakpoints only work with XHR/`fetch`, only offer to create a URL Breakpoint if
+ the `WI.SourceCode` has `initiatorCallFrames`, meaning it was triggered by JS. We could
+ offer this contextmenu item for _all_ resources, but there are many different resource types
+ that are unlikely (if ever) to be loaded via XHR/`fetch` (e.g. favicons, manifests, fonts,
+ initial JS/CSS files, etc.) that it would likely add clutter and possibly confuse developers
+ into thinking that URL Breakpoints can somehow pause things other than JS. Plus, this can
+ always be changed in a followup, so better to do something minimal first.
+
+ * UserInterface/Controllers/DOMDebuggerManager.js:
+ (WI.DOMDebuggerManager.prototype.urlBreakpointsMatchingURL): Added.
+ Helper method to find all `WI.URLBreakpoint` that match a given URL, sorted by how exact
+ they would match (e.g. a regex match is less exact than `===`).
+
+ * Localizations/en.lproj/localizedStrings.js:
+
2022-01-13 Elliott Williams <[email protected]>
[XCBuild] Add "product dependencies" which influence workspace build order
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (288028 => 288029)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2022-01-14 21:07:47 UTC (rev 288028)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2022-01-14 21:34:39 UTC (rev 288029)
@@ -115,6 +115,7 @@
localizedStrings["Add Breakpoints"] = "Add Breakpoints";
localizedStrings["Add Cookie"] = "Add Cookie";
localizedStrings["Add Header"] = "Add Header";
+localizedStrings["Add _javascript_ Breakpoint"] = "Add _javascript_ Breakpoint";
localizedStrings["Add New"] = "Add New";
localizedStrings["Add New Class"] = "Add New Class";
localizedStrings["Add New Probe _expression_"] = "Add New Probe _expression_";
@@ -122,6 +123,7 @@
localizedStrings["Add Pattern"] = "Add Pattern";
/* Text of button to add a new audit test case to the currently shown audit group. */
localizedStrings["Add Test Case @ Audit Tab - Group"] = "Add Test Case";
+localizedStrings["Add URL Breakpoint"] = "Add URL Breakpoint";
localizedStrings["Add a Class"] = "Add a Class";
localizedStrings["Add new breakpoint action after this action"] = "Add new breakpoint action after this action";
localizedStrings["Add new rule"] = "Add new rule";
@@ -361,6 +363,7 @@
localizedStrings["Computed"] = "Computed";
localizedStrings["Condition"] = "Condition";
localizedStrings["Conditional _expression_"] = "Conditional _expression_";
+localizedStrings["Conic Gradient"] = "Conic Gradient";
localizedStrings["Connecting"] = "Connecting";
localizedStrings["Connection"] = "Connection";
localizedStrings["Connection Close Frame"] = "Connection Close Frame";
@@ -367,7 +370,6 @@
localizedStrings["Connection Closed"] = "Connection Closed";
localizedStrings["Connection ID"] = "Connection ID";
localizedStrings["Connection:"] = "Connection:";
-localizedStrings["Conic Gradient"] = "Conic Gradient";
localizedStrings["Console"] = "Console";
localizedStrings["Console Evaluation"] = "Console Evaluation";
localizedStrings["Console Evaluation %d"] = "Console Evaluation %d";
@@ -454,7 +456,10 @@
localizedStrings["Delete Breakpoints"] = "Delete Breakpoints";
localizedStrings["Delete Descendant Breakpoints"] = "Delete Descendant Breakpoints";
localizedStrings["Delete Inspector Bootstrap Script"] = "Delete Inspector Bootstrap Script";
+localizedStrings["Delete _javascript_ Breakpoint"] = "Delete _javascript_ Breakpoint";
localizedStrings["Delete Local Override"] = "Delete Local Override";
+localizedStrings["Delete URL Breakpoint"] = "Delete URL Breakpoint";
+localizedStrings["Delete URL Breakpoints"] = "Delete URL Breakpoints";
localizedStrings["Delete Watch _expression_"] = "Delete Watch _expression_";
localizedStrings["Delete probe"] = "Delete probe";
localizedStrings["Delete this breakpoint action"] = "Delete this breakpoint action";
@@ -1182,9 +1187,9 @@
localizedStrings["Removed descendant "] = "Removed descendant ";
localizedStrings["Render Pipeline %d"] = "Render Pipeline %d";
localizedStrings["Rendering Frames"] = "Rendering Frames";
+localizedStrings["Repeating Conic Gradient"] = "Repeating Conic Gradient";
localizedStrings["Repeating Linear Gradient"] = "Repeating Linear Gradient";
localizedStrings["Repeating Radial Gradient"] = "Repeating Radial Gradient";
-localizedStrings["Repeating Conic Gradient"] = "Repeating Conic Gradient";
localizedStrings["Request"] = "Request";
localizedStrings["Request & Response"] = "Request & Response";
localizedStrings["Request (DOM Tree)"] = "Request (DOM Tree)";
@@ -1603,8 +1608,6 @@
localizedStrings["Undefined custom element"] = "Undefined custom element";
/* Label for button to show CSS variables ungrouped */
localizedStrings["Ungrouped @ Computed Style variables grouping mode"] = "Ungrouped";
-/* Section header for ungrouped CSS variables */
-localizedStrings["Ungrouped @ Computed Style variables section"] = "Ungrouped";
/* Property value for `font-variant-capitals: unicase`. */
localizedStrings["Unicase @ Font Details Sidebar Property Value"] = "Unicase";
localizedStrings["Unique"] = "Unique";
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js (288028 => 288029)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js 2022-01-14 21:07:47 UTC (rev 288028)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js 2022-01-14 21:34:39 UTC (rev 288029)
@@ -464,6 +464,30 @@
return this._urlBreakpoints.find((breakpoint) => breakpoint.url ="" url) || null;
}
+ urlBreakpointsMatchingURL(url)
+ {
+ return this._urlBreakpoints
+ .filter((urlBreakpoint) => {
+ switch (urlBreakpoint.type) {
+ case WI.URLBreakpoint.Type.Text:
+ return urlBreakpoint.url.toLowerCase() === url.toLowerCase();
+
+ case WI.URLBreakpoint.Type.RegularExpression:
+ return (new RegExp(urlBreakpoint.url, "i")).test(url);
+ }
+
+ return false;
+ })
+ .sort((a, b) => {
+ // Order URL breakpoints based on how closely they match the given URL.
+ const typeRankings = [
+ WI.URLBreakpoint.Type.Text,
+ WI.URLBreakpoint.Type.RegularExpression,
+ ];
+ return typeRankings.indexOf(a.type) - typeRankings.indexOf(b.type);
+ });
+ }
+
addURLBreakpoint(breakpoint)
{
console.assert(breakpoint instanceof WI.URLBreakpoint, breakpoint);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js (288028 => 288029)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js 2022-01-14 21:07:47 UTC (rev 288028)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js 2022-01-14 21:34:39 UTC (rev 288029)
@@ -120,18 +120,32 @@
contextMenu.appendSeparator();
if (location && (sourceCode instanceof WI.Script || (sourceCode instanceof WI.Resource && sourceCode.type === WI.Resource.Type.Script && !sourceCode.localResourceOverride))) {
- let existingBreakpoint = WI.debuggerManager.breakpointForSourceCodeLocation(location);
- if (existingBreakpoint) {
- contextMenu.appendItem(WI.UIString("Delete Breakpoint"), () => {
- WI.debuggerManager.removeBreakpoint(existingBreakpoint);
+ let existingJavaScriptBreakpoint = WI.debuggerManager.breakpointForSourceCodeLocation(location);
+ if (existingJavaScriptBreakpoint) {
+ contextMenu.appendItem(WI.UIString("Delete _javascript_ Breakpoint"), () => {
+ WI.debuggerManager.removeBreakpoint(existingJavaScriptBreakpoint);
});
} else {
- contextMenu.appendItem(WI.UIString("Add Breakpoint"), () => {
+ contextMenu.appendItem(WI.UIString("Add _javascript_ Breakpoint"), () => {
WI.debuggerManager.addBreakpoint(new WI._javascript_Breakpoint(location));
});
}
}
+ if (sourceCode?.initiatorCallFrames) {
+ let existingURLBreakpoints = WI.domDebuggerManager.urlBreakpointsMatchingURL(sourceCode.url);
+ if (existingURLBreakpoints.length) {
+ contextMenu.appendItem(existingURLBreakpoints.length === 1 ? WI.UIString("Delete URL Breakpoint") : WI.UIString("Delete URL Breakpoints"), () => {
+ for (let urlBreakpoint of existingURLBreakpoints)
+ WI.domDebuggerManager.removeURLBreakpoint(urlBreakpoint);
+ });
+ } else {
+ contextMenu.appendItem(WI.UIString("Add URL Breakpoint"), () => {
+ WI.domDebuggerManager.addURLBreakpoint(new WI.URLBreakpoint(WI.URLBreakpoint.Type.Text, sourceCode.url));
+ });
+ }
+ }
+
if (sourceCode.supportsScriptBlackboxing) {
let blackboxData = WI.debuggerManager.blackboxDataForSourceCode(sourceCode);
if (blackboxData && blackboxData.type === WI.DebuggerManager.BlackboxType.Pattern) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes