Ignore:
Timestamp:
Dec 29, 2006, 4:48:56 PM (18 years ago)
Author:
ggaren
Message:

JavaScriptCore:

Reviewed by Brian Dash... err... Mark Rowe.

More cleanup in preparation for fixing <rdar://problem/4608404>
WebScriptObject's _executionContext lack of ownership policy causes
crashes (e.g., in Dashcode)


The key change here is to RootObject::RootObject().


  • bindings/c/c_utility.cpp: (KJS::Bindings::convertValueToNPVariant): Changed to use new constructor.
  • bindings/jni/jni_jsobject.cpp: (JavaJSObject::createNative): Changed to use new constructor. Replaced large 'if' followed by default condition with "if !" and explicit default condition.
  • bindings/objc/objc_runtime.mm: (convertValueToObjcObject): Changed to use new constructor.
  • bindings/runtime_root.cpp: (KJS::Bindings::RootObject::destroy): "removeAllNativeReferences" => "destroy" because this function actually destroys the RootObject.
  • bindings/runtime_root.h: Changed Interpreter* to RefPtr<Interpreter> to prevent a RootObject from holding a stale Interperter*.


(KJS::Bindings::RootObject::RootObject): Changed constructor to take an
Interpreter*, since it's pointless to create a RootObject without one.
Removed setRootObjectImp() and rootObjectImp() because they were just
a confusing way of setting and getting the Interpreter's global object.

(KJS::Bindings::RootObject::nativeHandle): "_nativeHandle" => "m_nativeHandle"
(KJS::Bindings::RootObject::interpreter): "_interpreter" => "m_interpreter"

WebCore:

Reviewed by Brian Dash... err... Mark Rowe.

More cleanup in preparation for fixing <rdar://problem/4608404>
WebScriptObject's _executionContext lack of ownership policy causes
crashes (e.g., in Dashcode)


The key change here is to RootObject::RootObject().


Layout tests pass.


Renamed "_bindingRoot" => "_bindingRootObject" because "RootObject" is the
type name.


  • bindings/objc/WebScriptObject.mm: (_didExecute): Use Interpreter::globalObject(), since RootObject::rootObjectImp() no longer exists.
  • page/mac/FrameMac.mm: (WebCore::FrameMac::bindingRootObject): Use the new RootObject constructor. Stop lying about who deletes _bindingRoot.

(WebCore::FrameMac::cleanupPluginObjects): => "destroy". Fixed a bug where
the RootObject would only free its own memory if there were a ReferencesSet*
associated with it.

  • page/mac/WebCoreFrameBridge.mm: (-[WebCoreFrameBridge rootObjectForView:]): Use new constructor. Changed misleading comment.
File:
1 edited

Legend:

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

    r18461 r18481  
    283283}
    284284#endif
    285 // Must be called when the applet is shutdown.
    286 void RootObject::removeAllNativeReferences ()
    287 {
    288     ReferencesSet* referencesSet = getReferencesSet (this);
     285
     286// Destroys the RootObject and unprotects all JSObjects associated with it.
     287void RootObject::destroy()
     288{
     289    ReferencesSet* referencesSet = getReferencesSet(this);
    289290   
    290291    if (referencesSet) {
     
    298299        refsByRoot->remove(this);
    299300        delete referencesSet;
    300         delete this;
    301     }
    302 }
    303 
    304 void RootObject::setInterpreter (Interpreter* interpreter)
    305 {
    306     _interpreter = interpreter;
     301    }
     302
     303    delete this;
    307304}
    308305
Note: See TracChangeset for help on using the changeset viewer.