Bug 495883 - ASSERTION: Unable to get an nsIScriptGlobalObject from the ScriptGlobalObjectOwner, r=sicking

--HG--
extra : rebase_source : 7e0670c8165de7e761ed5adec653dac676e00982
This commit is contained in:
Olli Pettay 2009-08-19 12:09:26 +03:00
parent 321ef99a87
commit 2f12596208
5 changed files with 22 additions and 20 deletions

View File

@ -130,6 +130,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
nsFrameLoader*
nsFrameLoader::Create(nsIContent* aOwner)
{
NS_ENSURE_TRUE(aOwner, nsnull);
nsIDocument* doc = aOwner->GetCurrentDoc();
NS_ENSURE_TRUE(doc && !doc->GetDisplayDocument() &&
!doc->IsLoadedAsData(), nsnull);
return new nsFrameLoader(aOwner);
}
NS_IMETHODIMP
nsFrameLoader::LoadFrame()
{

View File

@ -54,7 +54,7 @@ class nsIURI;
class nsFrameLoader : public nsIFrameLoader
{
public:
protected:
nsFrameLoader(nsIContent *aOwner) :
mOwnerContent(aOwner),
mDepthTooGreat(PR_FALSE),
@ -64,11 +64,14 @@ public:
mInSwap(PR_FALSE)
{}
public:
~nsFrameLoader() {
mNeedsAsyncDestroy = PR_TRUE;
nsFrameLoader::Destroy();
}
static nsFrameLoader* Create(nsIContent* aOwner);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsFrameLoader)
NS_DECL_NSIFRAMELOADER

View File

@ -504,15 +504,11 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
break;
case eType_Document: {
if (!mFrameLoader) {
if (!thisContent->IsInDoc()) {
// XXX frameloaders can't deal with not being in a document
mFrameLoader = nsFrameLoader::Create(thisContent);
if (!mFrameLoader) {
Fallback(PR_FALSE);
return NS_ERROR_UNEXPECTED;
}
mFrameLoader = new nsFrameLoader(thisContent);
if (!mFrameLoader) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
rv = mFrameLoader->CheckForRecursiveLoad(uri);
@ -1143,16 +1139,11 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
// Must have a frameloader before creating a frame, or the frame will
// create its own.
if (!mFrameLoader && newType == eType_Document) {
if (!thisContent->IsInDoc()) {
// XXX frameloaders can't deal with not being in a document
mFrameLoader = nsFrameLoader::Create(thisContent);
if (!mFrameLoader) {
mURI = nsnull;
return NS_OK;
}
mFrameLoader = new nsFrameLoader(thisContent);
if (!mFrameLoader) {
return NS_ERROR_OUT_OF_MEMORY;
}
}
// Must notify here for plugins

View File

@ -2793,10 +2793,7 @@ nsGenericHTMLFrameElement::EnsureFrameLoader()
return NS_OK;
}
mFrameLoader = new nsFrameLoader(this);
if (!mFrameLoader)
return NS_ERROR_OUT_OF_MEMORY;
mFrameLoader = nsFrameLoader::Create(this);
return NS_OK;
}

View File

@ -1997,8 +1997,8 @@ nsXULElement::LoadSrc()
nsXULSlots* slots = static_cast<nsXULSlots*>(GetSlots());
NS_ENSURE_TRUE(slots, NS_ERROR_OUT_OF_MEMORY);
if (!slots->mFrameLoader) {
slots->mFrameLoader = new nsFrameLoader(this);
NS_ENSURE_TRUE(slots->mFrameLoader, NS_ERROR_OUT_OF_MEMORY);
slots->mFrameLoader = nsFrameLoader::Create(this);
NS_ENSURE_TRUE(slots->mFrameLoader, NS_OK);
}
return slots->mFrameLoader->LoadFrame();