Changeset 202498 in webkit


Ignore:
Timestamp:
Jun 27, 2016 11:18:37 AM (8 years ago)
Author:
Joseph Pecoraro
Message:

REGRESSION: Web Inspector: Text search broken in resources with <CR>
https://bugs.webkit.org/show_bug.cgi?id=159110
<rdar://problem/27008485>

Reviewed by Brian Burg.

Source/JavaScriptCore:

  • inspector/ContentSearchUtilities.cpp:

(Inspector::ContentSearchUtilities::lineEndings):
The frontend moved to only treated newlines as line endings in
the TextEditor. The backend however was looking for many
different types of line endings (\r\n, \r, \n). This caused
the line endings to ultimately differ between the frontend
and the backend, so the frontend couldn't find the lines that
the backend was claiming search results were on. Change the
backend to only look for \n line endings.

LayoutTests:

  • inspector/debugger/searchInContent-linebreaks-expected.txt:
  • inspector/debugger/searchInContent-linebreaks.html:

Now that the backend responds with lines that end in \n, this test changes
the number of line results. The frontend interprets this correctly.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202497 r202498  
     12016-06-27  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        REGRESSION: Web Inspector: Text search broken in resources with <CR>
     4        https://bugs.webkit.org/show_bug.cgi?id=159110
     5        <rdar://problem/27008485>
     6
     7        Reviewed by Brian Burg.
     8
     9        * inspector/debugger/searchInContent-linebreaks-expected.txt:
     10        * inspector/debugger/searchInContent-linebreaks.html:
     11        Now that the backend responds with lines that end in \n, this test changes
     12        the number of line results. The frontend interprets this correctly.
     13
    1142016-06-27  Joanmarie Diggs  <jdiggs@igalia.com>
    215
  • trunk/LayoutTests/inspector/debugger/searchInContent-linebreaks-expected.txt

    r188142 r202498  
    33
    44Script: mac-linebreaks.js
    5 Results found: 4
    6 Line 0: "// test one\r"
    7 Line 2: "//  test two\r"
    8 Line 6: "    //   test three test four\r"
    9 Line 9: "// test no newline"
     5Lines with matches: 1
     6Line 0: "// test one\r// \r//  test two\r\rfunction boo()\r{\r    //   test three test four\r}\r\r// test no newline"
    107
    118Script: mixed-linebreaks.js
    12 Results found: 4
     9Lines with matches: 4
    1310Line 0: "// test one\n"
    14 Line 2: "// test two\r"
    15 Line 6: "    //   test three test four\r\n"
    16 Line 9: "// test no newline"
     11Line 2: "// test two\r\r\n"
     12Line 5: "    //   test three test four\r\n"
     13Line 8: "// test no newline"
    1714
    1815Script: unix-linebreaks.js
    19 Results found: 4
     16Lines with matches: 4
    2017Line 0: "// test one\n"
    2118Line 2: "//  test two\n"
     
    2421
    2522Script: windows-linebreaks.js
    26 Results found: 4
     23Lines with matches: 4
    2724Line 0: "// test one\r\n"
    2825Line 2: "//  test two\r\n"
  • trunk/LayoutTests/inspector/debugger/searchInContent-linebreaks.html

    r188267 r202498  
    4949            var fileName = /([\w-]+\.js)$/.exec(testResult.url)[1];
    5050            ProtocolTest.log("Script: " + fileName);
    51             ProtocolTest.log("Results found: " + testResult.count);
     51            ProtocolTest.log("Lines with matches: " + testResult.count);
    5252   
    5353            for (var match of testResult.matches)
  • trunk/Source/JavaScriptCore/ChangeLog

    r202492 r202498  
     12016-06-27  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        REGRESSION: Web Inspector: Text search broken in resources with <CR>
     4        https://bugs.webkit.org/show_bug.cgi?id=159110
     5        <rdar://problem/27008485>
     6
     7        Reviewed by Brian Burg.
     8
     9        * inspector/ContentSearchUtilities.cpp:
     10        (Inspector::ContentSearchUtilities::lineEndings):
     11        The frontend moved to only treated newlines as line endings in
     12        the TextEditor. The backend however was looking for many
     13        different types of line endings (\r\n, \r, \n). This caused
     14        the line endings to ultimately differ between the frontend
     15        and the backend, so the frontend couldn't find the lines that
     16        the backend was claiming search results were on. Change the
     17        backend to only look for \n line endings.
     18
    1192016-06-27  Brian Burg  <bburg@apple.com>
    220
  • trunk/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp

    r199075 r202498  
    105105    size_t start = 0;
    106106    while (start < text.length()) {
    107         size_t nextStart = text.findNextLineStart(start);
    108         if (nextStart == notFound) {
     107        size_t nextStart = text.find('\n', start);
     108        if (nextStart == notFound || nextStart == (text.length() - 1)) {
    109109            result->append(text.length());
    110110            break;
    111111        }
    112112
     113        nextStart += 1;
    113114        result->append(nextStart);
    114115        start = nextStart;
Note: See TracChangeset for help on using the changeset viewer.