Changeset 106468 in webkit


Ignore:
Timestamp:
Feb 1, 2012 9:03:16 AM (12 years ago)
Author:
yurys@chromium.org
Message:

Web Inspector: debugger reports wrong sources when paused in inline script on page reload
https://bugs.webkit.org/show_bug.cgi?id=77548

Source/WebCore:

V8 returns treats each script source as ending with \n, now we take
this into account when reporting script line count to the inspector
front-end.

Reviewed by Vsevolod Vlasov.

Test: inspector/debugger/pause-in-inline-script.html

  • bindings/js/ScriptDebugServer.cpp:

(WebCore::ScriptDebugServer::dispatchDidParseSource):

  • bindings/v8/DebuggerScript.js:

LayoutTests:

Reviewed by Vsevolod Vlasov.

  • inspector/debugger/debugger-scripts-expected.txt:
  • inspector/debugger/pause-in-inline-script-expected.txt: Added.
  • inspector/debugger/pause-in-inline-script.html: Added.
  • platform/chromium/inspector/debugger/debugger-scripts-expected.txt:
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r106465 r106468  
     12012-02-01  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: debugger reports wrong sources when paused in inline script on page reload
     4        https://bugs.webkit.org/show_bug.cgi?id=77548
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        * inspector/debugger/debugger-scripts-expected.txt:
     9        * inspector/debugger/pause-in-inline-script-expected.txt: Added.
     10        * inspector/debugger/pause-in-inline-script.html: Added.
     11        * platform/chromium/inspector/debugger/debugger-scripts-expected.txt:
     12
    1132012-02-01  Shinya Kawanaka  <shinyak@google.com>
    214
  • trunk/LayoutTests/inspector/debugger/debugger-scripts-expected.txt

    r99167 r106468  
    44script 1:
    55    start: 5:8
    6     end: 37:2
     6    end: 38:0
    77script 2:
    88    start: 38:21
    9     end: 41:2
     9    end: 42:0
    1010script 3:
    1111    start: 43:11
     
    1313script 4:
    1414    start: 44:11
    15     end: 44:28
     15    end: 45:0
    1616script 5:
    1717    start: 46:11
    18     end: 47:20
     18    end: 48:0
    1919script 6:
    2020    start: 51:56
  • trunk/LayoutTests/platform/chromium/inspector/debugger/debugger-scripts-expected.txt

    r99167 r106468  
    44script 1:
    55    start: 5:8
    6     end: 37:2
     6    end: 38:0
    77script 2:
    88    start: 38:21
    9     end: 41:2
     9    end: 42:0
    1010script 3:
    1111    start: 43:11
     
    1313script 4:
    1414    start: 44:11
    15     end: 44:28
     15    end: 45:0
    1616script 5:
    1717    start: 46:11
    18     end: 47:20
     18    end: 48:0
    1919script 6:
    2020    start: 51:56
  • trunk/Source/WebCore/ChangeLog

    r106465 r106468  
     12012-02-01  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: debugger reports wrong sources when paused in inline script on page reload
     4        https://bugs.webkit.org/show_bug.cgi?id=77548
     5
     6        V8 returns treats each script source as ending with \n, now we take
     7        this into account when reporting script line count to the inspector
     8        front-end.
     9
     10        Reviewed by Vsevolod Vlasov.
     11
     12        Test: inspector/debugger/pause-in-inline-script.html
     13
     14        * bindings/js/ScriptDebugServer.cpp:
     15        (WebCore::ScriptDebugServer::dispatchDidParseSource):
     16        * bindings/v8/DebuggerScript.js:
     17
    1182012-02-01  Shinya Kawanaka  <shinyak@google.com>
    219
  • trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp

    r104831 r106468  
    243243    int lineCount = 1;
    244244    int lastLineStart = 0;
    245     for (int i = 0; i < sourceLength - 1; ++i) {
     245    for (int i = 0; i < sourceLength; ++i) {
    246246        if (script.source[i] == '\n') {
    247247            lineCount += 1;
  • trunk/Source/WebCore/bindings/v8/DebuggerScript.js

    r95083 r106468  
    9191    var endLine = script.line_offset + lineCount - 1;
    9292    var endColumn;
    93     if (lineCount === 1)
    94         endColumn = script.source.length + script.column_offset;
    95     else
    96         endColumn = script.source.length - (script.line_ends[lineCount - 2] + 1);
     93    // V8 will not count last line if script source ends with \n.
     94    if (script.source[script.source.length - 1] === '\n') {
     95        endLine += 1;
     96        endColumn = 0;
     97    } else {
     98        if (lineCount === 1)
     99            endColumn = script.source.length + script.column_offset;
     100        else
     101            endColumn = script.source.length - (lineEnds[lineCount - 2] + 1);
     102    }
    97103
    98104    return {
Note: See TracChangeset for help on using the changeset viewer.