Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6c448aeddb27e63740344078d13cfc9fada21a38
      
https://github.com/WebKit/WebKit/commit/6c448aeddb27e63740344078d13cfc9fada21a38
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-21 (Tue, 21 Jul 2026)

  Changed paths:
    A 
LayoutTests/inspector/dom-debugger/url-breakpoints-dom-text-and-regex-expected.txt
    A LayoutTests/inspector/dom-debugger/url-breakpoints-dom-text-and-regex.html
    M LayoutTests/platform/mac-site-isolation/TestExpectations
    M Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp
    M Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h

  Log Message:
  -----------
  Web Inspector: URL breakpoints recompile their search pattern on every 
network request
https://bugs.webkit.org/show_bug.cgi?id=319424
rdar://182245860

Reviewed by Devin Rousso.

InspectorDOMDebuggerAgent::breakOnURLIfNeeded() runs on every outgoing
request (willSendRequest / willFetch / willSendXMLHttpRequest). For each
call it iterated over every URL breakpoint and called
ContentSearchUtilities::createSearcherForString() from scratch, which
compiles a JSC::Yarr::RegularExpression. Even plain-text breakpoints hit
this, since SearchType::ContainsString escapes the query and compiles a
regex rather than taking the cheap string path. The result was
O(breakpoints x requests) Yarr compiles during any inspection session
with URL breakpoints active.

Compile each breakpoint's searcher once, when the breakpoint is added,
and cache it alongside the breakpoint -- mirroring how EventBreakpoint
already caches m_eventNameSearcher. breakOnURLIfNeeded() then just reuses
the stored searcher.

Store the breakpoints in a single Vector<URLBreakpoint> that carries the
pattern and whether it is a regular expression, mirroring the sibling
Vector<EventBreakpoint>. A map keyed by the pattern string would not
suffice: a text breakpoint and a regex breakpoint may share the same
pattern string (the frontend allows both, deduping on type and url), so
the isRegex flag is what keeps them distinct. URLBreakpoint gets an
operator== (comparing only url and isRegex, mirroring EventBreakpoint)
so setURLBreakpoint/removeURLBreakpoint can rely on appendIfNotContains/
removeFirstMatching instead of duplicating the comparison as a lambda.

* LayoutTests/inspector/dom-debugger/url-breakpoints-dom-text-and-regex.html: 
Added.
* 
LayoutTests/inspector/dom-debugger/url-breakpoints-dom-text-and-regex-expected.txt:
 Added.
Check that a text breakpoint and a regex breakpoint sharing the same
pattern string are stored and matched independently: removing one leaves
the other still able to pause.

* Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h:
Store URL breakpoints in a single Vector<URLBreakpoint>; the struct holds
the pattern, an isRegex flag, the breakpoint (specialBreakpoint, mirroring
EventBreakpoint's naming), its cached Searcher, and an operator== that
compares by url and isRegex.

* Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::setURLBreakpoint): Compile the
searcher once here and store it; reject a duplicate breakpoint with the
same pattern and type via appendIfNotContains.
(WebCore::InspectorDOMDebuggerAgent::removeURLBreakpoint): Remove the
breakpoint matching the pattern and type.
(WebCore::InspectorDOMDebuggerAgent::breakOnURLIfNeeded): Match using
each breakpoint's cached searcher instead of recompiling one per request.

Canonical link: https://commits.webkit.org/317623@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to