From e4cefb3d15f7f033ce1f40dd0290c5f100bd5587 Mon Sep 17 00:00:00 2001 From: "neil%parkwaycc.co.uk" Date: Mon, 28 Sep 2009 23:32:41 +0000 Subject: [PATCH] Backout of bug 371976 git-svn-id: svn://10.0.0.236/trunk@258515 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsPluginDocument.cpp | 46 ++++++++----------- 1 file changed, 19 insertions(+), 27 deletions(-) diff --git a/mozilla/content/html/document/src/nsPluginDocument.cpp b/mozilla/content/html/document/src/nsPluginDocument.cpp index 5d2d1d1fd56..0a88515a733 100644 --- a/mozilla/content/html/document/src/nsPluginDocument.cpp +++ b/mozilla/content/html/document/src/nsPluginDocument.cpp @@ -153,22 +153,11 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsPluginDocument, nsMediaDocument, void nsPluginDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject) { - // Set the script global object on the superclass before doing - // anything that might require it.... - nsMediaDocument::SetScriptGlobalObject(aScriptGlobalObject); - - if (aScriptGlobalObject) { - if (!mPluginContent) { - // Create synthetic document -#ifdef DEBUG - nsresult rv = -#endif - CreateSyntheticPluginDocument(); - NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create synthetic document"); - } - } else { + if (!aScriptGlobalObject) { mStreamListener = nsnull; } + + nsMediaDocument::SetScriptGlobalObject(aScriptGlobalObject); } @@ -190,17 +179,6 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand, PRBool aReset, nsIContentSink* aSink) { - // do not allow message panes to host full-page plugins - // returning an error causes helper apps to take over - nsCOMPtr dsti (do_QueryInterface(aContainer)); - if (dsti) { - PRBool isMsgPane = PR_FALSE; - dsti->NameEquals(NS_LITERAL_STRING("messagepane").get(), &isMsgPane); - if (isMsgPane) { - return NS_ERROR_FAILURE; - } - } - nsresult rv = nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer, aDocListener, aReset, @@ -214,6 +192,12 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand, return rv; } + // Create synthetic document + rv = CreateSyntheticPluginDocument(); + if (NS_FAILED(rv)) { + return rv; + } + mStreamListener = new nsPluginStreamListener(this); if (!mStreamListener) { return NS_ERROR_OUT_OF_MEMORY; @@ -227,8 +211,16 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand, nsresult nsPluginDocument::CreateSyntheticPluginDocument() { - NS_ASSERTION(!GetPrimaryShell() || !GetPrimaryShell()->DidInitialReflow(), - "Creating synthetic plugin document content too late"); + // do not allow message panes to host full-page plugins + // returning an error causes helper apps to take over + nsCOMPtr dsti (do_QueryReferent(mDocumentContainer)); + if (dsti) { + PRBool isMsgPane = PR_FALSE; + dsti->NameEquals(NS_LITERAL_STRING("messagepane").get(), &isMsgPane); + if (isMsgPane) { + return NS_ERROR_FAILURE; + } + } // make our generic document nsresult rv = nsMediaDocument::CreateSyntheticDocument();