Backout of bug 371976

git-svn-id: svn://10.0.0.236/trunk@258515 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
neil%parkwaycc.co.uk 2009-09-28 23:32:41 +00:00
parent 698863c8a2
commit e4cefb3d15

View File

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