delete mRoot;
if (mRoot) mRoot->ReleaseSubtree();
nsXULPrototypeDocument::~nsXULPrototypeDocument(){    if (mGlobalObject) {        mGlobalObject->SetContext(nsnull); // remove circular reference        mGlobalObject->SetGlobalObjectOwner(nsnull); // just in case    }    delete mRoot;}