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

Timothy thatcher at opensource.apple.com
Fri Sep 30 23:28:14 PDT 2005


thatcher    05/09/30 23:28:13

  Modified:    .        Tag: Safari-2-0-branch ChangeLog
               kjs      Tag: Safari-2-0-branch nodes.cpp nodes.h
  Log:
  		<rdar://problem/4277521> JS exceptions don't carry file/line information (3327)
  
  		Fixed by Geoffrey Garen.
          Reviewed by Andrew Wooster.
  
  		Sends file and line numbers with JS exceptions.
  
          * kjs/nodes.cpp:
          (Node::setExceptionDetailsIfNeeded):
          * kjs/nodes.h:
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.677.6.43 +13 -0     JavaScriptCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
  retrieving revision 1.677.6.42
  retrieving revision 1.677.6.43
  diff -u -r1.677.6.42 -r1.677.6.43
  --- ChangeLog	30 Sep 2005 17:57:35 -0000	1.677.6.42
  +++ ChangeLog	1 Oct 2005 06:28:09 -0000	1.677.6.43
  @@ -1,3 +1,16 @@
  +2005-09-30  Timothy Hatcher  <timothy at apple.com>
  +
  +		<rdar://problem/4277521> JS exceptions don't carry file/line information (3327)
  +		
  +		Fixed by Geoffrey Garen.
  +        Reviewed by Andrew Wooster.
  +
  +		Sends file and line numbers with JS exceptions.
  +
  +        * kjs/nodes.cpp:
  +        (Node::setExceptionDetailsIfNeeded):
  +        * kjs/nodes.h:
  +
   === JavaScriptCore-417.1 ===
   
   2005-09-30  Timothy Hatcher  <timothy at apple.com>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.52.12.7 +23 -4     JavaScriptCore/kjs/nodes.cpp
  
  Index: nodes.cpp
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/nodes.cpp,v
  retrieving revision 1.52.12.6
  retrieving revision 1.52.12.7
  diff -u -r1.52.12.6 -r1.52.12.7
  --- nodes.cpp	28 Aug 2005 23:26:52 -0000	1.52.12.6
  +++ nodes.cpp	1 Oct 2005 06:28:12 -0000	1.52.12.7
  @@ -58,26 +58,34 @@
       return Completion(Normal);
   
   #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()) \
  +  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()) \
  +  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
   
  @@ -155,6 +163,17 @@
     return result;
   }
   
  +void Node::setExceptionDetailsIfNeeded(ExecState *exec)
  +{
  +    if (exec->exception().isA(ObjectType)) {
  +        ObjectImp *exception = static_cast<ObjectImp *>(exec->exception().imp());
  +        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.19.12.4 +1 -0      JavaScriptCore/kjs/nodes.h
  
  Index: nodes.h
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/nodes.h,v
  retrieving revision 1.19.12.3
  retrieving revision 1.19.12.4
  diff -u -r1.19.12.3 -r1.19.12.4
  --- nodes.h	16 Sep 2005 02:34:04 -0000	1.19.12.3
  +++ nodes.h	1 Oct 2005 06:28:12 -0000	1.19.12.4
  @@ -100,6 +100,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 *);
       int line;
       UString sourceURL;
       unsigned int m_refcount;
  
  
  



More information about the webkit-changes mailing list