Bug 159110 - REGRESSION: Web Inspector: Text search broken in resources with <CR>
Summary: REGRESSION: Web Inspector: Text search broken in resources with <CR>
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-06-24 18:00 PDT by Joseph Pecoraro
Modified: 2016-06-27 11:19 PDT (History)
11 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (5.14 KB, patch)
2016-06-24 18:19 PDT, Joseph Pecoraro
bburg: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-06-24 18:00:00 PDT
Summary:
Text search broken in resources with <CR>.

Steps To Reproduce:
1. Inspect <http://daringfireball.net>
2. Open main resource (daringfireball.net) in Resources tab
3. Click in the editor
4. ⌘F to show find banner
5. Search for "href" or "title="
  => few results, all broken after the first <CR>

Notes:
- We changed CodeMirror to only \n as lineEndings earlier. The backend still treats \r as a line ending, which is causing slow drifting in line number differences between the frontend and backend.

Comment 1 Joseph Pecoraro 2016-06-24 18:00:14 PDT
<rdar://problem/27008485>
Comment 2 Joseph Pecoraro 2016-06-24 18:19:46 PDT
Created attachment 282040 [details]
[PATCH] Proposed Fix
Comment 3 Brian Burg 2016-06-25 09:49:46 PDT
Comment on attachment 282040 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=282040&action=review

r=me with comments

> Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp:-107
> -        size_t nextStart = text.findNextLineStart(start);

Does this still have other callers?

> Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp:108
> +        if (nextStart == notFound || nextStart == text.length()) {

Good catch, although wouldn't the last character be text.length() - 1?
Comment 4 Joseph Pecoraro 2016-06-27 11:12:27 PDT
(In reply to comment #3)
> Comment on attachment 282040 [details]
> [PATCH] Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=282040&action=review
> 
> r=me with comments
> 
> > Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp:-107
> > -        size_t nextStart = text.findNextLineStart(start);
> 
> Does this still have other callers?

Hmm, no it doesn't.

> > Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp:108
> > +        if (nextStart == notFound || nextStart == text.length()) {
> 
> Good catch, although wouldn't the last character be text.length() - 1?

Yes! Good catch.
Comment 5 Joseph Pecoraro 2016-06-27 11:19:32 PDT
<https://trac.webkit.org/changeset/202498>