Changeset 9352 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jun 10, 2005, 11:02:33 AM (20 years ago)
Author:
darin
Message:

Change by Mark Rowe <[email protected]>.
Reviewed by me.

  • further improvements to exception file/line number fix
  • kjs/nodes.h: Added setExceptionDetailsIfNeeded function.
  • kjs/nodes.cpp: Updated macros to call the new setExceptionDetailsIfNeeded function. (Node::setExceptionDetailsIfNeeded): Added.
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r9347 r9352  
     12005-06-10  Darin Adler  <[email protected]>
     2
     3        Change by Mark Rowe <[email protected]>.
     4        Reviewed by me.
     5
     6        - further improvements to exception file/line number fix
     7
     8        * kjs/nodes.h: Added setExceptionDetailsIfNeeded function.
     9        * kjs/nodes.cpp: Updated macros to call the new setExceptionDetailsIfNeeded function.
     10        (Node::setExceptionDetailsIfNeeded): Added.
     11
    1122005-06-09  Darin Adler  <[email protected]>
    213
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r9347 r9352  
    6868
    6969#define KJS_CHECKEXCEPTION \
    70   if (exec->hadException()) \
     70  if (exec->hadException()) { \
     71    setExceptionDetailsIfNeeded(exec); \
    7172    return Completion(Throw, exec->exception()); \
     73  } \
    7274  if (Collector::outOfMemory()) \
    7375    return Completion(Throw, Error::create(exec,GeneralError,"Out of memory"));
    7476
    7577#define KJS_CHECKEXCEPTIONVALUE \
    76   if (exec->hadException()) {\
    77     Object exception = exec->exception().toObject(exec); \
    78     exception.put(exec, "line", Number(line)); \
    79     exception.put(exec, "sourceURL", String(sourceURL)); \
     78  if (exec->hadException()) { \
     79    setExceptionDetailsIfNeeded(exec); \
    8080    return exec->exception(); \
    81   }\
     81  } \
    8282  if (Collector::outOfMemory()) \
    8383    return Undefined(); // will be picked up by KJS_CHECKEXCEPTION
    8484
    8585#define KJS_CHECKEXCEPTIONREFERENCE \
    86   if (exec->hadException()) \
    87     return Reference::makeValueReference(Undefined());; \
     86  if (exec->hadException()) { \
     87    setExceptionDetailsIfNeeded(exec); \
     88    return Reference::makeValueReference(Undefined()); \
     89  } \
    8890  if (Collector::outOfMemory()) \
    8991    return Reference::makeValueReference(Undefined()); // will be picked up by KJS_CHECKEXCEPTION
    9092
    9193#define KJS_CHECKEXCEPTIONLIST \
    92   if (exec->hadException()) \
     94  if (exec->hadException()) { \
     95    setExceptionDetailsIfNeeded(exec); \
    9396    return List(); \
     97  } \
    9498  if (Collector::outOfMemory()) \
    9599    return List(); // will be picked up by KJS_CHECKEXCEPTION
     
    176180  return result;
    177181}
     182
     183void Node::setExceptionDetailsIfNeeded(ExecState *exec)
     184{
     185    if (exec->hadException()) {
     186        Object exception = exec->exception().toObject(exec);
     187        if (!exception.hasProperty(exec, "line") &&
     188            !exception.hasProperty(exec, "sourceURL")) {
     189            exception.put(exec, "line", Number(line));
     190            exception.put(exec, "sourceURL", String(sourceURL));
     191        }
     192    }
     193}
     194
    178195
    179196// ------------------------------ StatementNode --------------------------------
  • trunk/JavaScriptCore/kjs/nodes.h

    r9009 r9352  
    107107    Value throwError(ExecState *exec, ErrorType e, const char *msg, Value v, Node *expr);
    108108    Value throwError(ExecState *exec, ErrorType e, const char *msg, Identifier label);
     109    void setExceptionDetailsIfNeeded(ExecState *exec);
    109110    int line;
    110111    UString sourceURL;
Note: See TracChangeset for help on using the changeset viewer.