Ignore:
Timestamp:
Aug 2, 2013, 2:32:20 PM (12 years ago)
Author:
[email protected]
Message:

Have vm's exceptionStack match java's vm's exceptionStack.
https://bugs.webkit.org/show_bug.cgi?id=119362

Source/JavaScriptCore:

Patch by Chris Curtis <[email protected]> on 2013-08-02
Reviewed by Geoffrey Garen.

The error object's stack is only updated if it does not exist yet. This matches
the functionality of other browsers, and Java VMs.

  • interpreter/Interpreter.cpp:

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

  • runtime/VM.cpp:

(JSC::VM::clearExceptionStack):

  • runtime/VM.h:

(JSC::VM::lastExceptionStack):

LayoutTests:

Patch by Chris Curtis <[email protected]> on 2013-08-02
Reviewed by Geoffrey Garen.

All modifications to the tests below are column number changes. If the thrown
object was created by the user the column number references the error object,
otherwise it references the the throw.

  • fast/events/window-onerror5-expected.txt:
  • fast/js/line-column-numbers-expected.txt:
  • fast/js/stack-trace-expected.txt:
  • http/tests/workers/worker-importScriptsOnError-expected.txt:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r153457 r153669  
    575575    ASSERT(callFrame == vm->topCallFrame || callFrame == callFrame->lexicalGlobalObject()->globalExec() || callFrame == callFrame->dynamicGlobalObject()->globalExec());
    576576
    577     if (vm->exceptionStack().size()) {
    578         if (!error.isObject() || asObject(error)->hasProperty(callFrame, vm->propertyNames->stack))
    579             return;
    580     }
    581    
    582577    Vector<StackFrame> stackTrace;
    583578    vm->interpreter->getStackTrace(stackTrace);
     
    586581        return;
    587582
    588     // Note: 'error' might already have a stack property if it was created by the user (e.g. "new Error"). The stack
    589     // now, as the error is thrown, might be different from the stack when it was created, so we overwrite it with
    590     // the current stack unconditionally.
     583    if (asObject(error)->hasProperty(callFrame, vm->propertyNames->stack))
     584        return;
     585   
    591586    asObject(error)->putDirect(*vm, vm->propertyNames->stack, vm->interpreter->stackTraceAsString(vm->topCallFrame, stackTrace), ReadOnly | DontDelete);
    592587
Note: See TracChangeset for help on using the changeset viewer.