зеркало из https://github.com/mozilla/pjs.git
Additional fixes to allow child webshells in framesets to be properly released.
This commit is contained in:
Родитель
6d094cdbd0
Коммит
7cea4a3946
|
@ -173,7 +173,24 @@ DocumentViewerImpl::~DocumentViewerImpl()
|
||||||
NS_IF_RELEASE(mViewManager);
|
NS_IF_RELEASE(mViewManager);
|
||||||
NS_IF_RELEASE(mWindow);
|
NS_IF_RELEASE(mWindow);
|
||||||
|
|
||||||
NS_IF_RELEASE(mDocument);
|
if (nsnull != mDocument) {
|
||||||
|
//XXX I don't think we'll need to do this eventually but for
|
||||||
|
//now we need it to drop JS objects - joki
|
||||||
|
nsIScriptContextOwner *mOwner = mDocument->GetScriptContextOwner();
|
||||||
|
if (nsnull != mOwner) {
|
||||||
|
nsIScriptContext *mContext;
|
||||||
|
mOwner->GetScriptContext(&mContext);
|
||||||
|
if (nsnull != mContext) {
|
||||||
|
mContext->RunGC();
|
||||||
|
NS_RELEASE(mContext);
|
||||||
|
}
|
||||||
|
NS_RELEASE(mOwner);
|
||||||
|
}
|
||||||
|
//Need to break documents circular reference on
|
||||||
|
//the webshell created in the DocViewer Init
|
||||||
|
mDocument->SetScriptContextOwner(nsnull);
|
||||||
|
NS_RELEASE(mDocument);
|
||||||
|
}
|
||||||
|
|
||||||
// Note: release context then shell
|
// Note: release context then shell
|
||||||
NS_IF_RELEASE(mPresContext);
|
NS_IF_RELEASE(mPresContext);
|
||||||
|
@ -301,22 +318,17 @@ DocumentViewerImpl::Init(nsNativeWidget aNativeParent,
|
||||||
mContainer->QueryCapability(kIScriptContextOwnerIID, (void**)&owner);
|
mContainer->QueryCapability(kIScriptContextOwnerIID, (void**)&owner);
|
||||||
if (nsnull != owner) {
|
if (nsnull != owner) {
|
||||||
aDocument->SetScriptContextOwner(owner);
|
aDocument->SetScriptContextOwner(owner);
|
||||||
nsIScriptContext* scriptcx = nsnull;
|
nsIScriptGlobalObject* global;
|
||||||
owner->GetScriptContext(&scriptcx);
|
owner->GetScriptGlobalObject(&global);
|
||||||
if (nsnull != scriptcx) {
|
if (nsnull != global) {
|
||||||
nsIScriptGlobalObject* global;
|
nsIDOMDocument *domdoc = nsnull;
|
||||||
global = scriptcx->GetGlobalObject();
|
aDocument->QueryInterface(kIDOMDocumentIID,
|
||||||
if (nsnull != global) {
|
(void**) &domdoc);
|
||||||
nsIDOMDocument *domdoc = nsnull;
|
if (nsnull != domdoc) {
|
||||||
aDocument->QueryInterface(kIDOMDocumentIID,
|
global->SetNewDocument(domdoc);
|
||||||
(void**) &domdoc);
|
NS_RELEASE(domdoc);
|
||||||
if (nsnull != domdoc) {
|
|
||||||
global->SetNewDocument(domdoc);
|
|
||||||
NS_RELEASE(domdoc);
|
|
||||||
}
|
|
||||||
NS_RELEASE(global);
|
|
||||||
}
|
}
|
||||||
NS_RELEASE(scriptcx);
|
NS_RELEASE(global);
|
||||||
}
|
}
|
||||||
NS_RELEASE(owner);
|
NS_RELEASE(owner);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче