Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 35b88e1f0340e1bd10162a408df14ddd9b923cb7
      
https://github.com/WebKit/WebKit/commit/35b88e1f0340e1bd10162a408df14ddd9b923cb7
  Author: Devin Rousso <h...@devinrousso.com>
  Date:   2025-03-27 (Thu, 27 Mar 2025)

  Changed paths:
    M Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp
    M Source/JavaScriptCore/inspector/ContentSearchUtilities.h
    M Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
    M Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
    M Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp
    M Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h
    M Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
    M Source/WebCore/inspector/agents/InspectorNetworkAgent.h
    M Source/WebCore/inspector/agents/InspectorPageAgent.cpp

  Log Message:
  -----------
  Web Inspector: don't create a regex when searching by exact case-sensitive 
string
https://bugs.webkit.org/show_bug.cgi?id=290507

Reviewed by BJ Burg.

Most developers will probably be creating symbolic breakpoints and blackboxing 
and etc. with exact case-sensitive strings as that's the default behavior (i.e. 
they have to uncheck a box to change this).

As such, we should have a fast path to just do `==` in that case instead of 
having to regex escape the string and add `^` before and `$` after.

There are no new tests as the end result behavior should be the same (just more 
efficinet).

* Source/JavaScriptCore/inspector/ContentSearchUtilities.h:
* Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp:
(Inspector::ContentSearchUtilities::createSearcherForString): Added.
(Inspector::ContentSearchUtilities::searcherMatchesText): Added.
(Inspector::ContentSearchUtilities::createRegularExpressionForString): Renamed 
from `createRegularExpressionForSearchString`.
(Inspector::ContentSearchUtilities::searchInTextByLines):
Create a new `Searcher` type that's either a `String` for exact case-sensitive 
matching or a `RegularExpression` for all other cases.
When checking if it matches text, do a quicker `==` check if it's the former 
instead of a full regex match for the latter.

* Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h:
* Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::setBlackboxConfiguration):
(Inspector::InspectorDebuggerAgent::BlackboxedScript::matches):
(Inspector::InspectorDebuggerAgent::SymbolicBreakpoint::matches):
* Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h:
* Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::breakOnURLIfNeeded):
(WebCore::InspectorDOMDebuggerAgent::EventBreakpoint::matches):
* Source/WebCore/inspector/agents/InspectorNetworkAgent.h:
* Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::shouldIntercept):
(WebCore::InspectorNetworkAgent::Intercept::matches):
(WebCore::InspectorNetworkAgent::Intercept::operator== const):
* Source/WebCore/inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::searchInResources):
None of these care about where in the text the regex matches, instead just 
caring if it matches at all, so we can use this new fast path.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to