зеркало из https://github.com/mozilla/gecko-dev.git
Bug 458100. Make sure that we'll also instantiate the plug-in even if the nsPluginDocument has no presshell yet at OnStartRequest time. Thanks to Evgeny <evg.salmin@gmail.com> for pointing out the problem. r+sr=jst
This commit is contained in:
Родитель
df524887d2
Коммит
5c7541d076
|
@ -798,8 +798,12 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
|
|||
// instantiate
|
||||
nsCOMPtr<nsIPluginDocument> pDoc (do_QueryInterface(GetOurDocument()));
|
||||
if (pDoc) {
|
||||
PRBool willHandleInstantiation;
|
||||
pDoc->GetWillHandleInstantiation(&willHandleInstantiation);
|
||||
if (willHandleInstantiation) {
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
new nsAsyncInstantiateEvent(this, aFrame, mContentType, mURI);
|
||||
|
|
|
@ -71,12 +71,21 @@ public:
|
|||
const nsCString& GetType() const { return mMimeType; }
|
||||
nsIContent* GetPluginContent() { return mPluginContent; }
|
||||
|
||||
void SkippedInstantiation() {
|
||||
mWillHandleInstantiation = PR_FALSE;
|
||||
}
|
||||
|
||||
protected:
|
||||
nsresult CreateSyntheticPluginDocument();
|
||||
|
||||
nsCOMPtr<nsIContent> mPluginContent;
|
||||
nsRefPtr<nsMediaDocumentStreamListener> mStreamListener;
|
||||
nsCString mMimeType;
|
||||
|
||||
// Hack to handle the fact that plug-in loading lives in frames and that the
|
||||
// frames may not be around when we need to instantiate. Once plug-in
|
||||
// loading moves to content, this can all go away.
|
||||
PRBool mWillHandleInstantiation;
|
||||
};
|
||||
|
||||
class nsPluginStreamListener : public nsMediaDocumentStreamListener
|
||||
|
@ -104,6 +113,7 @@ nsPluginStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
|
|||
nsIPresShell* shell = mDocument->GetPrimaryShell();
|
||||
if (!shell) {
|
||||
// Can't instantiate w/o a shell
|
||||
mPluginDoc->SkippedInstantiation();
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
|
@ -114,12 +124,14 @@ nsPluginStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
|
|||
|
||||
nsIFrame* frame = shell->GetPrimaryFrameFor(embed);
|
||||
if (!frame) {
|
||||
mPluginDoc->SkippedInstantiation();
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIObjectFrame* objFrame;
|
||||
CallQueryInterface(frame, &objFrame);
|
||||
if (!objFrame) {
|
||||
mPluginDoc->SkippedInstantiation();
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
|
@ -138,6 +150,7 @@ nsPluginStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
|
|||
// bother initializing members to 0.
|
||||
|
||||
nsPluginDocument::nsPluginDocument()
|
||||
: mWillHandleInstantiation(PR_TRUE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -323,6 +336,13 @@ nsPluginDocument::Print()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPluginDocument::GetWillHandleInstantiation(PRBool* aWillHandle)
|
||||
{
|
||||
*aWillHandle = mWillHandleInstantiation;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewPluginDocument(nsIDocument** aResult)
|
||||
{
|
||||
|
|
|
@ -878,9 +878,13 @@ nsObjectFrame::InstantiatePlugin(nsIPluginHost* aPluginHost,
|
|||
|
||||
nsIDocument* doc = mContent->GetOwnerDoc();
|
||||
nsCOMPtr<nsIPluginDocument> pDoc (do_QueryInterface(doc));
|
||||
PRBool fullPageMode = PR_FALSE;
|
||||
if (pDoc) {
|
||||
pDoc->GetWillHandleInstantiation(&fullPageMode);
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
if (pDoc) { /* full-page mode */
|
||||
if (fullPageMode) { /* full-page mode */
|
||||
nsCOMPtr<nsIStreamListener> stream;
|
||||
rv = aPluginHost->InstantiateFullPagePlugin(aMimeType, aURI,
|
||||
/* resulting stream listener */ *getter_AddRefs(stream),
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "nsISupports.idl"
|
||||
#include "nsIStreamListener.idl"
|
||||
|
||||
[uuid(0d8129f1-5a55-4eaa-851f-15e43ce3d183)]
|
||||
[uuid(e4be1d0a-9f24-4d69-bec5-245726ab85fb)]
|
||||
interface nsIPluginDocument : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -51,4 +51,11 @@ interface nsIPluginDocument : nsISupports
|
|||
* Causes the plugin to print in full-page mode
|
||||
*/
|
||||
void print();
|
||||
|
||||
/**
|
||||
* Check whether the document is planning to handle plug-in instantiation
|
||||
* itself. If not, then the plugin content node should do it.
|
||||
*/
|
||||
// XXXbz once we move plug-in loading to content, this can go away.
|
||||
readonly attribute boolean willHandleInstantiation;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче