[webkit-changes] cvs commit: JavaScriptCore/kjs nodes.cpp nodes.h

Darin darin at opensource.apple.com
Fri Jun 10 11:02:33 PDT 2005


darin       05/06/10 11:02:33

  Modified:    .        ChangeLog
               kjs      nodes.cpp nodes.h
  Log:
          Change by Mark Rowe <opendarwin.org at bdash.net.nz>.
          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.
  
  Revision  Changes    Path
  1.709     +11 -0     JavaScriptCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
  retrieving revision 1.708
  retrieving revision 1.709
  diff -u -r1.708 -r1.709
  --- ChangeLog	9 Jun 2005 13:03:35 -0000	1.708
  +++ ChangeLog	10 Jun 2005 18:02:32 -0000	1.709
  @@ -1,3 +1,14 @@
  +2005-06-10  Darin Adler  <darin at apple.com>
  +
  +        Change by Mark Rowe <opendarwin.org at bdash.net.nz>.
  +        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.
  +
   2005-06-09  Darin Adler  <darin at apple.com>
   
           Change by Mark Rowe <opendarwin.org at bdash.net.nz>
  
  
  
  1.57      +26 -9     JavaScriptCore/kjs/nodes.cpp
  
  Index: nodes.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/nodes.cpp,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- nodes.cpp	9 Jun 2005 13:03:36 -0000	1.56
  +++ nodes.cpp	10 Jun 2005 18:02:33 -0000	1.57
  @@ -67,30 +67,34 @@
   #endif
   
   #define KJS_CHECKEXCEPTION \
  -  if (exec->hadException()) \
  +  if (exec->hadException()) { \
  +    setExceptionDetailsIfNeeded(exec); \
       return Completion(Throw, exec->exception()); \
  +  } \
     if (Collector::outOfMemory()) \
       return Completion(Throw, Error::create(exec,GeneralError,"Out of memory"));
   
   #define KJS_CHECKEXCEPTIONVALUE \
  -  if (exec->hadException()) {\
  -    Object exception = exec->exception().toObject(exec); \
  -    exception.put(exec, "line", Number(line)); \
  -    exception.put(exec, "sourceURL", String(sourceURL)); \
  +  if (exec->hadException()) { \
  +    setExceptionDetailsIfNeeded(exec); \
       return exec->exception(); \
  -  }\
  +  } \
     if (Collector::outOfMemory()) \
       return Undefined(); // will be picked up by KJS_CHECKEXCEPTION
   
   #define KJS_CHECKEXCEPTIONREFERENCE \
  -  if (exec->hadException()) \
  -    return Reference::makeValueReference(Undefined());; \
  +  if (exec->hadException()) { \
  +    setExceptionDetailsIfNeeded(exec); \
  +    return Reference::makeValueReference(Undefined()); \
  +  } \
     if (Collector::outOfMemory()) \
       return Reference::makeValueReference(Undefined()); // will be picked up by KJS_CHECKEXCEPTION
   
   #define KJS_CHECKEXCEPTIONLIST \
  -  if (exec->hadException()) \
  +  if (exec->hadException()) { \
  +    setExceptionDetailsIfNeeded(exec); \
       return List(); \
  +  } \
     if (Collector::outOfMemory()) \
       return List(); // will be picked up by KJS_CHECKEXCEPTION
   
  @@ -176,6 +180,19 @@
     return result;
   }
   
  +void Node::setExceptionDetailsIfNeeded(ExecState *exec)
  +{
  +    if (exec->hadException()) {
  +        Object exception = exec->exception().toObject(exec);
  +        if (!exception.hasProperty(exec, "line") &&
  +            !exception.hasProperty(exec, "sourceURL")) {
  +            exception.put(exec, "line", Number(line));
  +            exception.put(exec, "sourceURL", String(sourceURL));
  +        }
  +    }
  +}
  +
  +
   // ------------------------------ StatementNode --------------------------------
   StatementNode::StatementNode() : l0(-1), l1(-1), sid(-1), breakPoint(false)
   {
  
  
  
  1.21      +1 -0      JavaScriptCore/kjs/nodes.h
  
  Index: nodes.h
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/nodes.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- nodes.h	15 Apr 2005 01:26:26 -0000	1.20
  +++ nodes.h	10 Jun 2005 18:02:33 -0000	1.21
  @@ -106,6 +106,7 @@
       Value throwError(ExecState *exec, ErrorType e, const char *msg);
       Value throwError(ExecState *exec, ErrorType e, const char *msg, Value v, Node *expr);
       Value throwError(ExecState *exec, ErrorType e, const char *msg, Identifier label);
  +    void setExceptionDetailsIfNeeded(ExecState *exec);
       int line;
       UString sourceURL;
       unsigned int refcount;
  
  
  



More information about the webkit-changes mailing list