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();