Ignore:
Timestamp:
Jun 14, 2007, 2:43:03 PM (18 years ago)
Author:
andersca
Message:

JavaScriptCore:

Reviewed by Darin.

<rdar://problem/5103077>
Crash at _NPN_ReleaseObject when quitting page at http://eshop.macsales.com/shop/ModBook


<rdar://problem/5183692>
http://bugs.webkit.org/show_bug.cgi?id=13547
REGRESSION: Crash in _NPN_ReleaseObject when closing Safari on nba.com (13547)


<rdar://problem/5261499>
CrashTracer: [USER] 75 crashes in Safari at com.apple.JavaScriptCore: KJS::Bindings::CInstance::~CInstance + 40


Have the root object track all live instances of RuntimeObjectImp. When invalidating
the root object, also invalidate all live runtime objects by zeroing out their instance ivar.
This prevents instances from outliving their plug-ins which lead to crashes.


  • bindings/c/c_utility.cpp: (KJS::Bindings::convertValueToNPVariant):
  • bindings/jni/jni_jsobject.cpp: (JavaJSObject::convertValueToJObject):
  • bindings/jni/jni_utility.cpp: (KJS::Bindings::convertValueToJValue):
  • bindings/objc/objc_runtime.mm: (ObjcFallbackObjectImp::callAsFunction):
  • bindings/runtime_array.cpp: (RuntimeArray::RuntimeArray):
  • bindings/runtime_array.h: (KJS::RuntimeArray::getConcreteArray):
  • bindings/runtime_method.cpp: (RuntimeMethod::callAsFunction):
  • bindings/runtime_method.h:
  • bindings/runtime_object.cpp: (RuntimeObjectImp::RuntimeObjectImp): (RuntimeObjectImp::~RuntimeObjectImp): (RuntimeObjectImp::invalidate): (RuntimeObjectImp::fallbackObjectGetter): (RuntimeObjectImp::fieldGetter): (RuntimeObjectImp::methodGetter): (RuntimeObjectImp::getOwnPropertySlot): (RuntimeObjectImp::put): (RuntimeObjectImp::canPut): (RuntimeObjectImp::defaultValue): (RuntimeObjectImp::implementsCall): (RuntimeObjectImp::callAsFunction): (RuntimeObjectImp::getPropertyNames): (RuntimeObjectImp::throwInvalidAccessError):
  • bindings/runtime_object.h:
  • bindings/runtime_root.cpp: (KJS::Bindings::RootObject::invalidate): (KJS::Bindings::RootObject::addRuntimeObject): (KJS::Bindings::RootObject::removeRuntimeObject):
  • bindings/runtime_root.h:

LayoutTests:

Reviewed by Darin.

Add test that manipulates plug-in script objects after the plug-in has been destroyed.


  • plugins/netscape-destroy-plugin-script-objects-expected.txt: Added.
  • plugins/netscape-destroy-plugin-script-objects.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bindings/runtime_root.cpp

    r19183 r23538  
    2424 */
    2525#include "config.h"
     26#include "runtime_root.h"
    2627
    2728#include "object.h"
    28 #include "runtime_root.h"
     29#include "runtime.h"
     30#include "runtime_object.h"
     31
    2932#include <wtf/HashCountedSet.h>
    3033#include <wtf/HashSet.h>
     
    219222        return;
    220223
     224    {
     225        HashSet<RuntimeObjectImp*>::iterator end = m_runtimeObjects.end();
     226        for (HashSet<RuntimeObjectImp*>::iterator it = m_runtimeObjects.begin(); it != end; ++it)
     227            (*it)->invalidate();
     228       
     229        m_runtimeObjects.clear();
     230    }
     231   
    221232    m_isValid = false;
    222233
     
    277288}
    278289
     290void RootObject::addRuntimeObject(RuntimeObjectImp* object)
     291{
     292    ASSERT(m_isValid);
     293    ASSERT(!m_runtimeObjects.contains(object));
     294   
     295    m_runtimeObjects.add(object);
     296}       
     297   
     298void RootObject::removeRuntimeObject(RuntimeObjectImp* object)
     299{
     300    ASSERT(m_isValid);
     301    ASSERT(m_runtimeObjects.contains(object));
     302   
     303    m_runtimeObjects.remove(object);
     304}
     305
    279306} } // namespace KJS::Bindings
Note: See TracChangeset for help on using the changeset viewer.