Changeset 272139 in webkit


Ignore:
Timestamp:
Feb 1, 2021 3:04:22 AM (18 months ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Add @ in Error.stack if URL exists
https://bugs.webkit.org/show_bug.cgi?id=221184

Reviewed by Keith Miller.

JSTests:

  • ChakraCore/test/Error/NativeErrors_v4.baseline-jsc:
  • ChakraCore/test/Error/validate_line_column.baseline-jsc:
  • ChakraCore/test/StackTrace/FunctionName.js.baseline-jsc:
  • ChakraCore/test/fieldopts/fieldhoist6.baseline-jsc:
  • ChakraCore/test/fieldopts/fieldhoist6b.baseline-jsc:
  • ChakraCore/test/fieldopts/fieldhoist7.baseline-jsc:
  • ChakraCore/test/fieldopts/fieldhoist_negzero.baseline-jsc:
  • ChakraCore/test/fieldopts/fieldhoist_undefined_global.baseline-jsc:
  • ChakraCore/test/fieldopts/fieldhoist_unreachable.baseline-jsc:
  • stress/error-stack-at.js: Added.

(shouldBe):
(catch):
(try.eval):

Source/JavaScriptCore:

Append '@' if URL exists even if function name does not exist to make the
format simple for parsing in JS (splitting with '@' to extract URL and function name).

  • runtime/StackFrame.cpp:

(JSC::StackFrame::toString const):

Source/WebInspectorUI:

  • UserInterface/Models/StackTrace.js:

(WI.StackTrace.isLikelyStackTrace):

Tools:

  • TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp:

(testJSCExceptions):

LayoutTests:

  • inspector/model/remote-object/error-expected.txt:
  • inspector/unit-tests/globals-unhandled-rejection-in-timer-callback-expected.txt:
  • js/dom/line-column-numbers-expected.txt:
  • js/dom/script-tests/stack-trace.js:

(catch):

  • js/dom/stack-trace-expected.txt:
  • js/script-tests/stack-trace.js:

(catch):

  • js/stack-trace-expected.txt:
Location:
trunk
Files:
1 added
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChakraCore/test/Error/NativeErrors_v4.baseline-jsc

    r250436 r272139  
    22description    = (undefined)undefined
    33number         = (undefined)undefined
    4 stack          = (string)  eval code
     4stack          = (string)  eval code@
    55eval@[native code]
    66Test@NativeErrors.js:49:20
     
    1111description    = (undefined)undefined
    1212number         = (undefined)undefined
    13 stack          = (string)  eval code
     13stack          = (string)  eval code@
    1414eval@[native code]
    1515Test@NativeErrors.js:49:20
     
    2020description    = (undefined)undefined
    2121number         = (undefined)undefined
    22 stack          = (string)  eval code
     22stack          = (string)  eval code@
    2323eval@[native code]
    2424Test@NativeErrors.js:49:20
     
    2929description    = (undefined)undefined
    3030number         = (undefined)undefined
    31 stack          = (string)  eval code
     31stack          = (string)  eval code@
    3232eval@[native code]
    3333Test@NativeErrors.js:49:20
     
    3838description    = (undefined)undefined
    3939number         = (undefined)undefined
    40 stack          = (string)  eval code
     40stack          = (string)  eval code@
    4141eval@[native code]
    4242Test@NativeErrors.js:49:20
     
    4747description    = (undefined)undefined
    4848number         = (undefined)undefined
    49 stack          = (string)  eval code
     49stack          = (string)  eval code@
    5050eval@[native code]
    5151Test@NativeErrors.js:49:20
  • trunk/JSTests/ChakraCore/test/Error/validate_line_column.baseline-jsc

    r205387 r272139  
    1 validate_line_column.js:17:9
     1@validate_line_column.js:17:9
    22foo@validate_line_column.js:10:17
    33global code@validate_line_column.js:16:4
    4 validate_line_column.js:21:11
     4@validate_line_column.js:21:11
    55foo@validate_line_column.js:10:17
    66global code@validate_line_column.js:20:4
    7 validate_line_column.js:26:7
     7@validate_line_column.js:26:7
    88foo@validate_line_column.js:10:17
    99global code@validate_line_column.js:24:4
    10 validate_line_column.js:30:14
     10@validate_line_column.js:30:14
    1111foo@validate_line_column.js:10:17
    1212global code@validate_line_column.js:29:4
    13 validate_line_column.js:35:7
     13@validate_line_column.js:35:7
    1414foo@validate_line_column.js:10:17
    1515global code@validate_line_column.js:33:4
    16 validate_line_column.js:40:7
     16@validate_line_column.js:40:7
    1717foo@validate_line_column.js:10:17
    1818global code@validate_line_column.js:38:4
    19 validate_line_column.js:45:7
     19@validate_line_column.js:45:7
    2020foo@validate_line_column.js:10:17
    2121global code@validate_line_column.js:43:4
    22 validate_line_column.js:50:7
     22@validate_line_column.js:50:7
    2323foo@validate_line_column.js:10:17
    2424global code@validate_line_column.js:48:4
    25 validate_line_column.js:55:7
     25@validate_line_column.js:55:7
    2626foo@validate_line_column.js:10:17
    2727global code@validate_line_column.js:53:4
    28 validate_line_column.js:60:9
     28@validate_line_column.js:60:9
    2929foo@validate_line_column.js:10:17
    3030global code@validate_line_column.js:58:4
  • trunk/JSTests/ChakraCore/test/StackTrace/FunctionName.js.baseline-jsc

    r205387 r272139  
    11foo@FunctionName.js:24:24
    22func@FunctionName.js:28:12
    3 anonymous
    4 eval code
     3anonymous@
     4eval code@
    55eval@[native code]
    6 FunctionName.js:35:17
     6@FunctionName.js:35:17
    77bar@FunctionName.js:36:11
    88global code@FunctionName.js:39:8
  • trunk/JSTests/ChakraCore/test/fieldopts/fieldhoist6.baseline-jsc

    r205387 r272139  
    11Exception: ReferenceError: Can't find variable: f
    2 fieldhoist6.js:13:6
     2@fieldhoist6.js:13:6
    33global code@fieldhoist6.js:20:3
  • trunk/JSTests/ChakraCore/test/fieldopts/fieldhoist6b.baseline-jsc

    r205387 r272139  
    11Exception: ReferenceError: Can't find variable: f
    2 fieldhoist6b.js:13:6
     2@fieldhoist6b.js:13:6
    33global code@fieldhoist6b.js:20:3
  • trunk/JSTests/ChakraCore/test/fieldopts/fieldhoist7.baseline-jsc

    r205387 r272139  
    11Exception: ReferenceError: Can't find variable: obj3
    2 fieldhoist7.js:7:32
     2@fieldhoist7.js:7:32
    33global code@fieldhoist7.js:18:3
  • trunk/JSTests/ChakraCore/test/fieldopts/fieldhoist_negzero.baseline-jsc

    r205387 r272139  
    11Exception: ReferenceError: Can't find variable: obj0
    2 fieldhoist_negzero.js:9:32
     2@fieldhoist_negzero.js:9:32
    33global code@fieldhoist_negzero.js:12:3
  • trunk/JSTests/ChakraCore/test/fieldopts/fieldhoist_undefined_global.baseline-jsc

    r205387 r272139  
    11Exception: ReferenceError: Can't find variable: d
    2 fieldhoist_undefined_global.js:12:10
     2@fieldhoist_undefined_global.js:12:10
    33global code@fieldhoist_undefined_global.js:15:3
  • trunk/JSTests/ChakraCore/test/fieldopts/fieldhoist_unreachable.baseline-jsc

    r205387 r272139  
    11Exception: ReferenceError: Can't find variable: obj9
    2 fieldhoist_unreachable.js:13:9
     2@fieldhoist_unreachable.js:13:9
    33global code@fieldhoist_unreachable.js:15:3
  • trunk/JSTests/ChangeLog

    r272127 r272139  
     12021-02-01  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Add @ in Error.stack if URL exists
     4        https://bugs.webkit.org/show_bug.cgi?id=221184
     5
     6        Reviewed by Keith Miller.
     7
     8        * ChakraCore/test/Error/NativeErrors_v4.baseline-jsc:
     9        * ChakraCore/test/Error/validate_line_column.baseline-jsc:
     10        * ChakraCore/test/StackTrace/FunctionName.js.baseline-jsc:
     11        * ChakraCore/test/fieldopts/fieldhoist6.baseline-jsc:
     12        * ChakraCore/test/fieldopts/fieldhoist6b.baseline-jsc:
     13        * ChakraCore/test/fieldopts/fieldhoist7.baseline-jsc:
     14        * ChakraCore/test/fieldopts/fieldhoist_negzero.baseline-jsc:
     15        * ChakraCore/test/fieldopts/fieldhoist_undefined_global.baseline-jsc:
     16        * ChakraCore/test/fieldopts/fieldhoist_unreachable.baseline-jsc:
     17        * stress/error-stack-at.js: Added.
     18        (shouldBe):
     19        (catch):
     20        (try.eval):
     21
    1222021-01-31  Yusuke Suzuki  <ysuzuki@apple.com>
    223
  • trunk/LayoutTests/ChangeLog

    r272125 r272139  
     12021-02-01  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Add @ in Error.stack if URL exists
     4        https://bugs.webkit.org/show_bug.cgi?id=221184
     5
     6        Reviewed by Keith Miller.
     7
     8        * inspector/model/remote-object/error-expected.txt:
     9        * inspector/unit-tests/globals-unhandled-rejection-in-timer-callback-expected.txt:
     10        * js/dom/line-column-numbers-expected.txt:
     11        * js/dom/script-tests/stack-trace.js:
     12        (catch):
     13        * js/dom/stack-trace-expected.txt:
     14        * js/script-tests/stack-trace.js:
     15        (catch):
     16        * js/stack-trace-expected.txt:
     17
    1182021-01-31  Sam Weinig  <weinig@apple.com>
    219
  • trunk/LayoutTests/inspector/model/remote-object/error-expected.txt

    r252202 r272139  
    3232        "_name": "stack",
    3333        "_type": "string",
    34         "_value": "global code\nevaluateWithScopeExtension@[native code]\n\n_wrapCall"
     34        "_value": "global code@\nevaluateWithScopeExtension@[native code]\n@\n_wrapCall@"
    3535      }
    3636    ],
     
    7171        "_name": "stack",
    7272        "_type": "string",
    73         "_value": "eval@[native code]\nglobal code\nevaluateWithScopeExtension@[native code]\n\n_wrapCall"
     73        "_value": "eval@[native code]\nglobal code@\nevaluateWithScopeExtension@[native code]\n@\n_wrapCall@"
    7474      }
    7575    ],
     
    105105        "_name": "stack",
    106106        "_type": "string",
    107         "_value": "splitText@[native code]\nglobal code\nevaluateWithScopeExtension@[native code]\n\n_wrapCall"
     107        "_value": "splitText@[native code]\nglobal code@\nevaluateWithScopeExtension@[native code]\n@\n_wrapCall@"
    108108      },
    109109      {
  • trunk/LayoutTests/inspector/unit-tests/globals-unhandled-rejection-in-timer-callback-expected.txt

    r210367 r272139  
    33Unhandled promise rejection in inspector page: This is an exception thrown in the inspector page.
    44
     5Stack Trace: (suppressed)
    56
     7
  • trunk/LayoutTests/js/dom/line-column-numbers-expected.txt

    r267644 r272139  
    7272
    7373--> Case 15 Stack Trace:
    74     0    at eval code
     74    0   eval code at
    7575    1   eval at [native code]
    7676    2   global code at line-column-numbers.html:130:5
    7777
    7878--> Case 16 Stack Trace:
    79     0    at doThrow16
    80     1    at eval code
     79    0   doThrow16 at
     80    1   eval code at
    8181    2   eval at [native code]
    8282    3   global code at line-column-numbers.html:136:5
     
    8484--> Case 17 Stack Trace:
    8585    0    at
    86     1    at eval code
     86    1   eval code at
    8787    2   eval at [native code]
    8888    3   global code at line-column-numbers.html:149:5
     
    9090--> Case 18 Stack Trace:
    9191    0    at
    92     1    at eval code
     92    1   eval code at
    9393    2   eval at [native code]
    9494    3   global code at line-column-numbers.html:155:5
     
    214214
    215215--> Case 15 Stack Trace:
    216     0    at eval code
     216    0   eval code at
    217217    1   eval at [native code]
    218218    2   global code at line-column-numbers.js:77:5
    219219
    220220--> Case 16 Stack Trace:
    221     0    at doThrow15b
    222     1    at eval code
     221    0   doThrow15b at
     222    1   eval code at
    223223    2   eval at [native code]
    224224    3   global code at line-column-numbers.js:81:5
     
    226226--> Case 17 Stack Trace:
    227227    0    at
    228     1    at eval code
     228    1   eval code at
    229229    2   eval at [native code]
    230230    3   global code at line-column-numbers.js:92:5
     
    232232--> Case 18 Stack Trace:
    233233    0    at
    234     1    at eval code
     234    1   eval code at
    235235    2   eval at [native code]
    236236    3   global code at line-column-numbers.js:96:5
  • trunk/LayoutTests/js/dom/script-tests/stack-trace.js

    r182495 r272139  
    127127} catch (e) {
    128128    var pattern = [
    129         " at eval code",
     129        "eval code at ",
    130130        "eval at [native code]",
    131131        "selfRecursive3 at stack-trace.js"
  • trunk/LayoutTests/js/dom/stack-trace-expected.txt

    r206660 r272139  
    1111--> Stack Trace:
    1212    0   inner at stack-trace.js:81:44
    13     1    at eval code
     13    1   eval code at
    1414    2   eval at [native code]
    1515    3   evaler at stack-trace.js:82:29
     
    1919    0   inner at stack-trace.js:81:44
    2020    1   outer at stack-trace.js:80:34
    21     2    at eval code
     21    2   eval code at
    2222    3   eval at [native code]
    2323    4   evaler at stack-trace.js:82:29
     
    254254
    255255--> Stack Trace matches pattern:
    256     0    at eval code
     256    0   eval code at
    257257    1   eval at [native code]
    258258    2   selfRecursive3 at stack-trace.js
  • trunk/LayoutTests/js/script-tests/stack-trace.js

    r225129 r272139  
    130130} catch (e) {
    131131    var pattern = [
    132         " at eval code",
     132        "eval code at ",
    133133        "eval at [native code]",
    134134        "selfRecursive3 at stack-trace.js"
  • trunk/LayoutTests/js/stack-trace-expected.txt

    r225129 r272139  
    77--> Stack Trace:
    88    0   inner at stack-trace.js:84:44
    9     1    at eval code
     9    1   eval code at
    1010    2   eval at [native code]
    1111    3   evaler at stack-trace.js:85:29
     
    1515    0   inner at stack-trace.js:84:44
    1616    1   outer at stack-trace.js:83:34
    17     2    at eval code
     17    2   eval code at
    1818    3   eval at [native code]
    1919    4   evaler at stack-trace.js:85:29
     
    246246
    247247--> Stack Trace matches pattern:
    248     0    at eval code
     248    0   eval code at
    249249    1   eval at [native code]
    250250    2   selfRecursive3 at stack-trace.js
  • trunk/Source/JavaScriptCore/ChangeLog

    r272119 r272139  
     12021-02-01  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Add @ in Error.stack if URL exists
     4        https://bugs.webkit.org/show_bug.cgi?id=221184
     5
     6        Reviewed by Keith Miller.
     7
     8        Append '@' if URL exists even if function name does not exist to make the
     9        format simple for parsing in JS (splitting with '@' to extract URL and function name).
     10
     11        * runtime/StackFrame.cpp:
     12        (JSC::StackFrame::toString const):
     13
    1142021-01-30  Yusuke Suzuki  <ysuzuki@apple.com>
    215
  • trunk/Source/JavaScriptCore/runtime/StackFrame.cpp

    r261895 r272139  
    125125    String sourceURL = this->sourceURL();
    126126    traceBuild.append(functionName);
     127    traceBuild.append('@');
    127128    if (!sourceURL.isEmpty()) {
    128         if (!functionName.isEmpty())
    129             traceBuild.append('@');
    130129        traceBuild.append(sourceURL);
    131130        if (hasLineAndColumnInfo()) {
  • trunk/Source/WebInspectorUI/ChangeLog

    r271953 r272139  
     12021-02-01  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Add @ in Error.stack if URL exists
     4        https://bugs.webkit.org/show_bug.cgi?id=221184
     5
     6        Reviewed by Keith Miller.
     7
     8        * UserInterface/Models/StackTrace.js:
     9        (WI.StackTrace.isLikelyStackTrace):
     10
    1112021-01-27  Razvan Caliman  <rcaliman@apple.com>
    212
  • trunk/Source/WebInspectorUI/UserInterface/Models/StackTrace.js

    r253087 r272139  
    7878            return false;
    7979
    80         if (/^[^a-z$_]/i.test(stack[0]))
     80        if (/^[^a-z$_@]/i.test(stack[0]))
    8181            return false;
    8282
  • trunk/Tools/ChangeLog

    r272093 r272139  
     12021-02-01  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Add @ in Error.stack if URL exists
     4        https://bugs.webkit.org/show_bug.cgi?id=221184
     5
     6        Reviewed by Keith Miller.
     7
     8        * TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp:
     9        (testJSCExceptions):
     10
    1112021-01-29  Don Olmstead  <don.olmstead@sony.com>
    212
  • trunk/Tools/TestWebKitAPI/Tests/JavaScriptCore/glib/TestJSC.cpp

    r261159 r272139  
    28062806        g_assert_cmpuint(jsc_exception_get_column_number(exception), ==, 4);
    28072807        g_assert_null(jsc_exception_get_source_uri(exception));
    2808         g_assert_cmpstr(jsc_exception_get_backtrace_string(exception), ==, "global code");
     2808        g_assert_cmpstr(jsc_exception_get_backtrace_string(exception), ==, "global code@");
    28092809        GUniquePtr<char> errorString(jsc_exception_to_string(exception));
    28102810        g_assert_cmpstr(errorString.get(), ==, "ReferenceError: Can't find variable: foo");
    28112811        GUniquePtr<char> reportString(jsc_exception_report(exception));
    2812         g_assert_cmpstr(reportString.get(), ==, ":1:4 ReferenceError: Can't find variable: foo\n  global code\n");
     2812        g_assert_cmpstr(reportString.get(), ==, ":1:4 ReferenceError: Can't find variable: foo\n  global code@\n");
    28132813
    28142814        jsc_context_clear_exception(context.get());
     
    29032903        g_assert_cmpuint(jsc_exception_get_column_number(exception), ==, 24);
    29042904        g_assert_null(jsc_exception_get_source_uri(exception));
    2905         g_assert_cmpstr(jsc_exception_get_backtrace_string(exception), ==, "createError@[native code]\nglobal code");
     2905        g_assert_cmpstr(jsc_exception_get_backtrace_string(exception), ==, "createError@[native code]\nglobal code@");
    29062906        GUniquePtr<char> errorString(jsc_exception_to_string(exception));
    29072907        g_assert_cmpstr(errorString.get(), ==, "Error: API exception");
    29082908        GUniquePtr<char> reportString(jsc_exception_report(exception));
    2909         g_assert_cmpstr(reportString.get(), ==, ":1:24 Error: API exception\n  createError@[native code]\n  global code\n");
     2909        g_assert_cmpstr(reportString.get(), ==, ":1:24 Error: API exception\n  createError@[native code]\n  global code@\n");
    29102910
    29112911        jsc_context_clear_exception(context.get());
     
    29342934        g_assert_cmpuint(jsc_exception_get_column_number(exception), ==, 30);
    29352935        g_assert_null(jsc_exception_get_source_uri(exception));
    2936         g_assert_cmpstr(jsc_exception_get_backtrace_string(exception), ==, "createCustomError@[native code]\nglobal code");
     2936        g_assert_cmpstr(jsc_exception_get_backtrace_string(exception), ==, "createCustomError@[native code]\nglobal code@");
    29372937        GUniquePtr<char> errorString(jsc_exception_to_string(exception));
    29382938        g_assert_cmpstr(errorString.get(), ==, "CustomAPIError: API custom exception");
    29392939        GUniquePtr<char> reportString(jsc_exception_report(exception));
    2940         g_assert_cmpstr(reportString.get(), ==, ":1:30 CustomAPIError: API custom exception\n  createCustomError@[native code]\n  global code\n");
     2940        g_assert_cmpstr(reportString.get(), ==, ":1:30 CustomAPIError: API custom exception\n  createCustomError@[native code]\n  global code@\n");
    29412941
    29422942        jsc_context_clear_exception(context.get());
     
    29652965        g_assert_cmpuint(jsc_exception_get_column_number(exception), ==, 33);
    29662966        g_assert_null(jsc_exception_get_source_uri(exception));
    2967         g_assert_cmpstr(jsc_exception_get_backtrace_string(exception), ==, "createFormattedError@[native code]\nglobal code");
     2967        g_assert_cmpstr(jsc_exception_get_backtrace_string(exception), ==, "createFormattedError@[native code]\nglobal code@");
    29682968        GUniquePtr<char> errorString(jsc_exception_to_string(exception));
    29692969        g_assert_cmpstr(errorString.get(), ==, "Error: API exception: error details");
    29702970        GUniquePtr<char> reportString(jsc_exception_report(exception));
    2971         g_assert_cmpstr(reportString.get(), ==, ":1:33 Error: API exception: error details\n  createFormattedError@[native code]\n  global code\n");
     2971        g_assert_cmpstr(reportString.get(), ==, ":1:33 Error: API exception: error details\n  createFormattedError@[native code]\n  global code@\n");
    29722972
    29732973        jsc_context_clear_exception(context.get());
     
    29962996        g_assert_cmpuint(jsc_exception_get_column_number(exception), ==, 39);
    29972997        g_assert_null(jsc_exception_get_source_uri(exception));
    2998         g_assert_cmpstr(jsc_exception_get_backtrace_string(exception), ==, "createCustomFormattedError@[native code]\nglobal code");
     2998        g_assert_cmpstr(jsc_exception_get_backtrace_string(exception), ==, "createCustomFormattedError@[native code]\nglobal code@");
    29992999        GUniquePtr<char> errorString(jsc_exception_to_string(exception));
    30003000        g_assert_cmpstr(errorString.get(), ==, "CustomFormattedAPIError: API custom exception: error details");
    30013001        GUniquePtr<char> reportString(jsc_exception_report(exception));
    3002         g_assert_cmpstr(reportString.get(), ==, ":1:39 CustomFormattedAPIError: API custom exception: error details\n  createCustomFormattedError@[native code]\n  global code\n");
     3002        g_assert_cmpstr(reportString.get(), ==, ":1:39 CustomFormattedAPIError: API custom exception: error details\n  createCustomFormattedError@[native code]\n  global code@\n");
    30033003
    30043004        jsc_context_clear_exception(context.get());
Note: See TracChangeset for help on using the changeset viewer.