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

Timothy thatcher at opensource.apple.com
Fri Sep 30 19:52:27 PDT 2005


thatcher    05/09/30 19:52:26

  Modified:    .        Tag: Safari-Den-branch ChangeLog
               kjs      Tag: Safari-Den-branch nodes.cpp nodes.h
  Log:
  		<rdar://problem/4277521> JS exceptions don't carry file/line information (3327)
  
          Reviewed by Geoff someone.
  
  		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.34.2.11 +12 -0     JavaScriptCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
  retrieving revision 1.677.6.34.2.10
  retrieving revision 1.677.6.34.2.11
  diff -u -r1.677.6.34.2.10 -r1.677.6.34.2.11
  --- ChangeLog	30 Sep 2005 17:47:41 -0000	1.677.6.34.2.10
  +++ ChangeLog	1 Oct 2005 02:52:21 -0000	1.677.6.34.2.11
  @@ -1,3 +1,15 @@
  +2005-09-30  Timothy Hatcher  <timothy at apple.com>
  +
  +		<rdar://problem/4277521> JS exceptions don't carry file/line information (3327)
  +
  +        Reviewed by Geoff someone.
  +
  +		Sends file and line numbers with JS exceptions.
  +
  +        * kjs/nodes.cpp:
  +        (Node::setExceptionDetailsIfNeeded):
  +        * kjs/nodes.h:
  +
   === JavaScriptCore-416.11 ===
   
   2005-09-30  Timothy Hatcher  <timothy at apple.com>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.52.12.6.2.1 +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.6.2.1
  diff -u -r1.52.12.6 -r1.52.12.6.2.1
  --- nodes.cpp	28 Aug 2005 23:26:52 -0000	1.52.12.6
  +++ nodes.cpp	1 Oct 2005 02:52:24 -0000	1.52.12.6.2.1
  @@ -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.2.2.2 +1 -0      JavaScriptCore/kjs/nodes.h
  
  Index: nodes.h
  ===================================================================
  RCS file: /cvs/root/JavaScriptCore/kjs/nodes.h,v
  retrieving revision 1.19.12.2.2.1
  retrieving revision 1.19.12.2.2.2
  diff -u -r1.19.12.2.2.1 -r1.19.12.2.2.2
  --- nodes.h	16 Sep 2005 02:54:25 -0000	1.19.12.2.2.1
  +++ nodes.h	1 Oct 2005 02:52:24 -0000	1.19.12.2.2.2
  @@ -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