Changeset 147872 in webkit


Ignore:
Timestamp:
Apr 7, 2013, 11:47:20 AM (12 years ago)
Author:
[email protected]
Message:

Inspector should display information about non-object exceptions
https://bugs.webkit.org/show_bug.cgi?id=114123

Reviewed by Adele Peterson.

Source/JavaScriptCore:

Make sure we store the right stack information, even when throwing
a primitive.

  • interpreter/CallFrame.h:

(JSC::ExecState::clearSupplementaryExceptionInfo):
(ExecState):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::addStackTraceIfNecessary):
(JSC::Interpreter::throwException):

Source/WebCore:

Make use of the stack trace for line information when we're reporting
an exception

  • bindings/js/JSDOMBinding.cpp:

(WebCore::reportException):

LayoutTests:

All these tests throw primitives as exceptions, and now they have source
and line number information

  • fast/dom/exception-getting-event-handler-expected.txt:
  • fast/dom/javascript-url-exception-isolation-expected.txt:
  • fast/dom/nested-script-exceptions-expected.txt:
  • fast/events/onerror-no-constructor-expected.txt:
  • fast/events/window-onerror13-expected.txt:
  • fast/events/window-onerror16-expected.txt:
  • fast/events/window-onerror2-expected.txt:
  • fast/events/window-onerror8-expected.txt:
  • fast/js/uncaught-exception-line-number-expected.txt:
  • fast/sub-pixel/inline-block-with-padding-expected.txt:
  • platform/mac/fast/AppleScript/001-expected.txt:
Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r147871 r147872  
     12013-04-07  Oliver Hunt  <[email protected]>
     2
     3        Inspector should display information about non-object exceptions
     4        https://bugs.webkit.org/show_bug.cgi?id=114123
     5
     6        Reviewed by Adele Peterson.
     7
     8        All these tests throw primitives as exceptions, and now they have source
     9        and line number information
     10
     11        * fast/dom/exception-getting-event-handler-expected.txt:
     12        * fast/dom/javascript-url-exception-isolation-expected.txt:
     13        * fast/dom/nested-script-exceptions-expected.txt:
     14        * fast/events/onerror-no-constructor-expected.txt:
     15        * fast/events/window-onerror13-expected.txt:
     16        * fast/events/window-onerror16-expected.txt:
     17        * fast/events/window-onerror2-expected.txt:
     18        * fast/events/window-onerror8-expected.txt:
     19        * fast/js/uncaught-exception-line-number-expected.txt:
     20        * fast/sub-pixel/inline-block-with-padding-expected.txt:
     21        * platform/mac/fast/AppleScript/001-expected.txt:
     22
    1232013-04-07  Robert Hogan  <[email protected]>
    224
  • trunk/LayoutTests/fast/dom/exception-getting-event-handler-expected.txt

    r104810 r147872  
    1 CONSOLE MESSAGE: 42
     1CONSOLE MESSAGE: line 12: 42
    22This test checks that an exception thrown when getting the handleEvent property of an event listener does not crash.
    33
  • trunk/LayoutTests/fast/dom/javascript-url-exception-isolation-expected.txt

    r104810 r147872  
    1 CONSOLE MESSAGE: 42
     1CONSOLE MESSAGE: line 1: 42
    22CONSOLE MESSAGE: line 1: SyntaxError: Unexpected token '<'
    33Exceptions thrown in javascript URLs should not propagate to the main script.
  • trunk/LayoutTests/fast/dom/nested-script-exceptions-expected.txt

    r104810 r147872  
    1 CONSOLE MESSAGE: Badness 10,000
     1CONSOLE MESSAGE: line 1: Badness 10,000
    22This test checks that exceptions in nested scripts are logged properly. An exception named "Badness 10,000" should be logged properly.
  • trunk/LayoutTests/fast/events/onerror-no-constructor-expected.txt

    r142953 r147872  
    11CONSOLE MESSAGE: line 8: FAIL
    2 CONSOLE MESSAGE: PASS if this is reported as an uncaught exception.
     2CONSOLE MESSAGE: line 20: PASS if this is reported as an uncaught exception.
    33
  • trunk/LayoutTests/fast/events/window-onerror13-expected.txt

    r104810 r147872  
    1 CONSOLE MESSAGE: An Error
     1CONSOLE MESSAGE: line 24: An Error
    22Test that error is treated as not handled when window.onerror return value is not 'true'. Bug 67119.
    33
  • trunk/LayoutTests/fast/events/window-onerror16-expected.txt

    r104810 r147872  
    1 CONSOLE MESSAGE: An Error
     1CONSOLE MESSAGE: line 25: An Error
    22Test that error is treated as not handled when window.onerror return value is 'false'. Bug 67119.
    33
  • trunk/LayoutTests/fast/events/window-onerror2-expected.txt

    r76244 r147872  
    22
    33Main frame window.onerror: Error: Inline script exception at window-onerror2.html:34
    4 Main frame window.onerror: Exception in onload at undefined:0
     4Main frame window.onerror: Exception in onload at window-onerror2.html:2
    55Main frame window.onerror: Error: Exception in setTimeout at window-onerror2.html:29
    66
  • trunk/LayoutTests/fast/events/window-onerror8-expected.txt

    r76216 r147872  
    11Test that window.onerror is called on window object. Bug 8519.
    22
    3 Main frame window.onerror: 2010 at undefined:0
     3Main frame window.onerror: 2010 at window-onerror8.html:24
    44PASSED: this === window
    55
  • trunk/LayoutTests/fast/js/uncaught-exception-line-number-expected.txt

    r104810 r147872  
    1 CONSOLE MESSAGE: uh oh, an exception!
     1CONSOLE MESSAGE: line 11: uh oh, an exception!
    22This tests that uncaught exceptions have the right line numbers, for example for display in the JavaScript error console. To run the test manually, look in the JS console for an uncaught exception on line 11.
    33
  • trunk/LayoutTests/fast/sub-pixel/inline-block-with-padding-expected.txt

    r119461 r147872  
    1 PASS links[0].offsetWidth is within 1 of 167
     1PASS links[0].offsetWidth is within 1 of 175
    22Both links should render the same and not wrap.
    33
  • trunk/LayoutTests/platform/mac/fast/AppleScript/001-expected.txt

    r111579 r147872  
    1 CONSOLE MESSAGE: this is an exception
     1CONSOLE MESSAGE: line 1: this is an exception
    22An automated test for basic AppleScript "do JavaScript" support.
    334 ('long')
  • trunk/Source/JavaScriptCore/ChangeLog

    r147858 r147872  
     12013-04-07  Oliver Hunt  <[email protected]>
     2
     3        Inspector should display information about non-object exceptions
     4        https://bugs.webkit.org/show_bug.cgi?id=114123
     5
     6        Reviewed by Adele Peterson.
     7
     8        Make sure we store the right stack information, even when throwing
     9        a primitive.
     10
     11        * interpreter/CallFrame.h:
     12        (JSC::ExecState::clearSupplementaryExceptionInfo):
     13        (ExecState):
     14        * interpreter/Interpreter.cpp:
     15        (JSC::Interpreter::addStackTraceIfNecessary):
     16        (JSC::Interpreter::throwException):
     17
    1182013-04-06  Oliver Hunt  <[email protected]>
    219
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.h

    r146089 r147872  
    6969
    7070        void clearException() { globalData().exception = JSValue(); }
     71        void clearSupplementaryExceptionInfo()
     72        {
     73            globalData().exceptionStack = RefCountedArray<StackFrame>();
     74        }
     75
    7176        JSValue exception() const { return globalData().exception; }
    7277        bool hadException() const { return globalData().exception; }
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r147858 r147872  
    762762    Vector<StackFrame> stackTrace;
    763763    getStackTrace(&callFrame->globalData(), stackTrace);
    764    
     764    globalData->exceptionStack = RefCountedArray<StackFrame>(stackTrace);
    765765    if (stackTrace.isEmpty() || !error.isObject())
    766766        return;
     767
    767768    JSObject* errorObject = asObject(error);
    768769    JSGlobalObject* globalObject = 0;
     
    811812
    812813        isInterrupt = isInterruptedExecutionException(exception) || isTerminatedExecutionException(exception);
     814    } else {
     815        if (!callFrame->globalData().exceptionStack.size()) {
     816            Vector<StackFrame> stack;
     817            Interpreter::getStackTrace(&callFrame->globalData(), stack);
     818            callFrame->globalData().exceptionStack = RefCountedArray<StackFrame>(stack);
     819        }
    813820    }
    814821
  • trunk/Source/WebCore/ChangeLog

    r147871 r147872  
     12013-04-07  Oliver Hunt  <[email protected]>
     2
     3        Inspector should display information about non-object exceptions
     4        https://bugs.webkit.org/show_bug.cgi?id=114123
     5
     6        Reviewed by Adele Peterson.
     7
     8        Make use of the stack trace for line information when we're reporting
     9        an exception
     10
     11        * bindings/js/JSDOMBinding.cpp:
     12        (WebCore::reportException):
     13
    1142013-04-07  Robert Hogan  <[email protected]>
    215
  • trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp

    r146430 r147872  
    148148    Interpreter::ErrorHandlingMode mode(exec);
    149149    String errorMessage = exception.toString(exec)->value(exec);
    150     JSObject* exceptionObject = exception.toObject(exec);
    151     int lineNumber = exceptionObject->get(exec, Identifier(exec, "line")).toInt32(exec);
    152     String exceptionSourceURL = exceptionObject->get(exec, Identifier(exec, "sourceURL")).toString(exec)->value(exec);
     150    int lineNumber = 0;
     151    String exceptionSourceURL;
     152
     153    RefCountedArray<StackFrame> stackTrace = exec->globalData().exceptionStack;
    153154    exec->clearException();
     155    exec->clearSupplementaryExceptionInfo();
     156
     157    if (exception.isObject()) {
     158        JSObject* exceptionObject = exception.toObject(exec);
     159        lineNumber = exceptionObject->get(exec, Identifier(exec, "line")).toInt32(exec);
     160        exceptionSourceURL = exceptionObject->get(exec, Identifier(exec, "sourceURL")).toString(exec)->value(exec);
     161    } else if (stackTrace.size()) {
     162        lineNumber = stackTrace[0].line();
     163        exceptionSourceURL = stackTrace[0].friendlySourceURL();
     164    }
    154165
    155166    if (ExceptionBase* exceptionBase = toExceptionBase(exception))
Note: See TracChangeset for help on using the changeset viewer.