Changeset 15593 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jul 23, 2006, 11:06:30 PM (19 years ago)
Author:
thatcher
Message:

JavaScriptCore:

Reviewed by Maciej.

Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
http://bugzilla.opendarwin.org/show_bug.cgi?id=9686

JavaScriptCore portion of the fix.

  • JavaScriptCore.exp: Update symbol for change in argument type.
  • kjs/debugger.cpp: (Debugger::detach): Clear map of recent exceptions. (Debugger::hasHandledException): Track the most recent exception thrown by an interpreter. (Debugger::exception): Change exception argument to a JSValue.
  • kjs/debugger.h:
  • kjs/nodes.cpp: (Node::debugExceptionIfNeeded): Notify the debugger of an exception if it hasn't seen it before. (ThrowNode::execute): Notify the debugger that an exception is being thrown.
  • kjs/nodes.h:

2006-07-23 Geoffrey Garen <[email protected]>

Patch by Eric Albert, reviewed by Darin and me.


  • Fixed <rdar://problem/4645931> JavaScriptCore stack-scanning code crashes (Collector::markStackObjectsConservatively)


  • bindings/jni/jni_jsobject.cpp: On 64bit systems, jint is a long, not an int. (JavaJSObject::getSlot): (JavaJSObject::setSlot):
  • kjs/collector.cpp: (KJS::Collector::markCurrentThreadConservatively): Use a pointer instead of an int as 'dummy,' because on LP64 systems, an int is not pointer-aligned, and we want to scan the stack for pointers.
  • JavaScriptCore.xcodeproj/project.pbxproj: After a tense cease-fire, the XCode war has started up again!

WebCore:

Reviewed by maciej.

Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
http://bugzilla.opendarwin.org/show_bug.cgi?id=9686

WebCore portion of the fix.

  • bridge/mac/WebCoreScriptDebugger.h: (-[WebScriptDebugger exceptionRaised:sourceId:line::]): Add delegate method.
  • bridge/mac/WebCoreScriptDebugger.mm: (WebCoreScriptDebuggerImp::exception): Call delegate method when an exception is raised.

WebKit:

Reviewed by Maciej.

Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
http://bugzilla.opendarwin.org/show_bug.cgi?id=9686

WebKit portion of the fix.

  • DefaultDelegates/WebDefaultScriptDebugDelegate.m: (-[WebDefaultScriptDebugDelegate webView:exceptionWasRaised:sourceId:line:forWebFrame:]):
  • DefaultDelegates/WebScriptDebugServer.h:
  • DefaultDelegates/WebScriptDebugServer.m: (-[WebScriptDebugServer webView:exceptionWasRaised:sourceId:line:forWebFrame:]): Notify listeners that an exception has been raised.
  • WebView/WebScriptDebugDelegate.h:
  • WebView/WebScriptDebugDelegate.m: (-[WebScriptCallFrame exceptionRaised:sourceId:line:]): Dispatch through to delegate and WebScriptDebugServer.
Location:
trunk/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r15583 r15593  
     12006-07-23  Mark Rowe  <[email protected]>
     2
     3        Reviewed by Maciej.
     4
     5        Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
     6        http://bugzilla.opendarwin.org/show_bug.cgi?id=9686
     7
     8        JavaScriptCore portion of the fix.
     9
     10        * JavaScriptCore.exp: Update symbol for change in argument type.
     11        * kjs/debugger.cpp:
     12        (Debugger::detach): Clear map of recent exceptions.
     13        (Debugger::hasHandledException): Track the most recent exception
     14        thrown by an interpreter.
     15        (Debugger::exception): Change exception argument to a JSValue.
     16        * kjs/debugger.h:
     17        * kjs/nodes.cpp:
     18        (Node::debugExceptionIfNeeded): Notify the debugger of an exception
     19        if it hasn't seen it before.
     20        (ThrowNode::execute): Notify the debugger that an exception is being thrown.
     21        * kjs/nodes.h:
     22
    123    2006-07-23  Geoffrey Garen  <[email protected]>
    224
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r15557 r15593  
    194194__ZN3KJS8Debugger12sourceUnusedEPNS_9ExecStateEi
    195195__ZN3KJS8Debugger6attachEPNS_11InterpreterE
    196 __ZN3KJS8Debugger9exceptionEPNS_9ExecStateEiiPNS_8JSObjectE
     196__ZN3KJS8Debugger9exceptionEPNS_9ExecStateEiiPNS_7JSValueE
    197197__ZN3KJS8DebuggerC2Ev
    198198__ZN3KJS8DebuggerD2Ev
  • trunk/JavaScriptCore/kjs/debugger.cpp

    r15026 r15593  
    8181      p = &q->next;
    8282  }
     83
     84  if (interp)
     85    latestExceptions.remove(interp);
     86  else
     87    latestExceptions.clear();
     88}
     89
     90bool Debugger::hasHandledException(ExecState *exec, JSValue *exception)
     91{
     92    if (latestExceptions.get(exec->dynamicInterpreter()).get() == exception)
     93        return true;
     94
     95    latestExceptions.set(exec->dynamicInterpreter(), exception);
     96    return false;
    8397}
    8498
     
    95109
    96110bool Debugger::exception(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
    97                          JSObject */*exceptionObj*/)
     111                         JSValue */*exception*/)
    98112{
    99113  return true;
  • trunk/JavaScriptCore/kjs/debugger.h

    r15026 r15593  
    2424#define _KJSDEBUGGER_H_
    2525
     26#include <wtf/HashMap.h>
     27#include "protect.h"
     28
    2629namespace KJS {
    2730
     
    3033  class ExecState;
    3134  class JSObject;
     35  class JSValue;
    3236  class UString;
    3337  class List;
     
    145149     */
    146150    virtual bool exception(ExecState *exec, int sourceId, int lineno,
    147                            JSObject *exceptionObj);
     151                           JSValue *exception);
     152
     153    bool hasHandledException(ExecState *, JSValue *);
    148154
    149155    /**
     
    210216  private:
    211217    DebuggerImp *rep;
     218    HashMap<Interpreter*, ProtectedPtr<JSValue> > latestExceptions;
    212219
    213220  public:
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r15468 r15593  
    5858    JSValue *ex = exec->exception(); \
    5959    exec->clearException(); \
     60    debugExceptionIfNeeded(exec, ex); \
    6061    return Completion(Throw, ex); \
    6162  } \
     
    6667  if (exec->hadException()) { \
    6768    setExceptionDetailsIfNeeded(exec); \
     69    debugExceptionIfNeeded(exec, exec->exception()); \
    6870    return jsUndefined(); \
    6971  } \
     
    7476  if (exec->hadException()) { \
    7577    setExceptionDetailsIfNeeded(exec); \
     78    debugExceptionIfNeeded(exec, exec->exception()); \
    7679    return List(); \
    7780  } \
     
    267270            exception->put(exec, "sourceURL", jsString(currentSourceURL(exec)));
    268271        }
     272    }
     273}
     274
     275void Node::debugExceptionIfNeeded(ExecState* exec, JSValue* exceptionValue)
     276{
     277    Debugger* dbg = exec->dynamicInterpreter()->debugger();
     278    if (dbg && !dbg->hasHandledException(exec, exceptionValue)) {
     279        bool cont = dbg->exception(exec, currentSourceId(exec), m_line, exceptionValue);
     280        if (!cont)
     281            dbg->imp()->abort();
    269282    }
    270283}
     
    22702283  KJS_CHECKEXCEPTION
    22712284
     2285  debugExceptionIfNeeded(exec, v);
     2286
    22722287  return Completion(Throw, v);
    22732288}
  • trunk/JavaScriptCore/kjs/nodes.h

    r15468 r15593  
    110110
    111111    void setExceptionDetailsIfNeeded(ExecState*);
     112    void debugExceptionIfNeeded(ExecState*, JSValue*);
    112113
    113114    int m_line;
Note: See TracChangeset for help on using the changeset viewer.