[webkit-changes] cvs commit: WebCore/khtml/ecma kjs_binding.cpp kjs_binding.h

Darin darin at opensource.apple.com
Tue Aug 16 21:06:10 PDT 2005


darin       05/08/16 21:06:09

  Modified:    .        ChangeLog
               khtml/ecma kjs_binding.cpp kjs_binding.h
  Log:
          Reviewed by Maciej.
  
          - fixed bug that was causing a crash when running layout tests
  
          * khtml/ecma/kjs_binding.h: Remove unused deleteDOMObject.
          * khtml/ecma/kjs_binding.cpp:
          (KJS::ScriptInterpreter::forgetDOMObject): Move code in here from forgetDOMObject.
          (KJS::ScriptInterpreter::getDOMNodeForDocument): For the null-document case, use the general
          DOM objects map rather than a per-document map.
          (KJS::ScriptInterpreter::forgetDOMNodeForDocument): Ditto.
          (KJS::ScriptInterpreter::putDOMNodeForDocument): Ditto.
          (KJS::ScriptInterpreter::forgetAllDOMNodesForDocument): Assert that document is not null.
  
  Revision  Changes    Path
  1.4591    +15 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4590
  retrieving revision 1.4591
  diff -u -r1.4590 -r1.4591
  --- ChangeLog	17 Aug 2005 01:07:21 -0000	1.4590
  +++ ChangeLog	17 Aug 2005 04:06:05 -0000	1.4591
  @@ -1,5 +1,20 @@
   2005-08-16  Darin Adler  <darin at apple.com>
   
  +        Reviewed by Maciej.
  +
  +        - fixed bug that was causing a crash when running layout tests
  +
  +        * khtml/ecma/kjs_binding.h: Remove unused deleteDOMObject.
  +        * khtml/ecma/kjs_binding.cpp:
  +        (KJS::ScriptInterpreter::forgetDOMObject): Move code in here from forgetDOMObject.
  +        (KJS::ScriptInterpreter::getDOMNodeForDocument): For the null-document case, use the general
  +        DOM objects map rather than a per-document map.
  +        (KJS::ScriptInterpreter::forgetDOMNodeForDocument): Ditto.
  +        (KJS::ScriptInterpreter::putDOMNodeForDocument): Ditto.
  +        (KJS::ScriptInterpreter::forgetAllDOMNodesForDocument): Assert that document is not null.
  +
  +2005-08-16  Darin Adler  <darin at apple.com>
  +
           Reviewed by Geoff.
   
           - changed main_thread_malloc so we don't have two conflicting versions of the same function
  
  
  
  1.40      +12 -7     WebCore/khtml/ecma/kjs_binding.cpp
  
  Index: kjs_binding.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/ecma/kjs_binding.cpp,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- kjs_binding.cpp	16 Aug 2005 00:47:43 -0000	1.39
  +++ kjs_binding.cpp	17 Aug 2005 04:06:09 -0000	1.40
  @@ -95,27 +95,27 @@
       domObjects()->set(objectHandle, obj);
   }
   
  -void ScriptInterpreter::deleteDOMObject(void* objectHandle) 
  -{
  -    domObjects()->remove(objectHandle);
  -}
  -
   void ScriptInterpreter::forgetDOMObject(void* objectHandle)
   {
  -    deleteDOMObject(objectHandle);
  +    domObjects()->remove(objectHandle);
   }
   
   DOMNode *ScriptInterpreter::getDOMNodeForDocument(DOM::DocumentImpl *document, DOM::NodeImpl *node)
   {
  +    if (!document)
  +        return static_cast<DOMNode *>(domObjects()->get(node));
       NodeMap *documentDict = domNodesPerDocument()->get(document);
       if (documentDict)
           return documentDict->get(node);
  -
       return NULL;
   }
   
   void ScriptInterpreter::forgetDOMNodeForDocument(DOM::DocumentImpl *document, NodeImpl *node)
   {
  +    if (!document) {
  +        domObjects()->remove(node);
  +        return;
  +    }
       NodeMap *documentDict = domNodesPerDocument()->get(document);
       if (documentDict)
           documentDict->remove(node);
  @@ -123,6 +123,10 @@
   
   void ScriptInterpreter::putDOMNodeForDocument(DOM::DocumentImpl *document, NodeImpl *nodeHandle, DOMNode *nodeWrapper)
   {
  +    if (!document) {
  +        domObjects()->set(nodeHandle, nodeWrapper);
  +        return;
  +    }
       NodeMap *documentDict = domNodesPerDocument()->get(document);
       if (!documentDict) {
           documentDict = new NodeMap();
  @@ -133,6 +137,7 @@
   
   void ScriptInterpreter::forgetAllDOMNodesForDocument(DOM::DocumentImpl *document)
   {
  +    assert(document);
       NodePerDocMap::iterator it = domNodesPerDocument()->find(document);
       if (it != domNodesPerDocument()->end()) {
           delete it->second;
  
  
  
  1.33      +0 -1      WebCore/khtml/ecma/kjs_binding.h
  
  Index: kjs_binding.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/ecma/kjs_binding.h,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- kjs_binding.h	8 Aug 2005 04:07:40 -0000	1.32
  +++ kjs_binding.h	17 Aug 2005 04:06:09 -0000	1.33
  @@ -78,7 +78,6 @@
   
       static DOMObject* getDOMObject(void* objectHandle);
       static void putDOMObject(void* objectHandle, DOMObject* obj);
  -    static void deleteDOMObject(void* objectHandle);
       static void forgetDOMObject(void* objectHandle);
   
       static DOMNode *getDOMNodeForDocument(DOM::DocumentImpl *document, DOM::NodeImpl *node);
  
  
  



More information about the webkit-changes mailing list