382378 call NotifyContentObjectWrapper after the plugin has been instantiated so that scriptable plugins work correctly r+sr=bz

This commit is contained in:
cbiesinger@gmx.at 2007-08-02 14:15:05 -07:00
Родитель bae72986cf
Коммит b29067127d
4 изменённых файлов: 29 добавлений и 11 удалений

Просмотреть файл

@ -504,6 +504,14 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest, nsISupports *aConte
}
#endif
Fallback(PR_FALSE);
} else if (mType == eType_Plugin) {
nsIObjectFrame* frame = GetFrame(PR_FALSE);
if (frame) {
// We have to notify the wrapper here instead of right after
// Instantiate because the plugin only gets instantiated by
// OnStartRequest, not by Instantiate.
frame->TryNotifyContentObjectWrapper();
}
}
return rv;
}

Просмотреть файл

@ -47,9 +47,9 @@
class nsIPluginInstance;
// {F455B51F-7A1F-4bbe-B55D-679F033AD3FE}
// {3e2df1fe-a898-4e2e-8763-4ca904fa338e}
#define NS_IOBJECTFRAME_IID \
{ 0xf455b51f, 0x7a1f, 0x4bbe, { 0xb5, 0x5d, 0x67, 0x9f, 0x3, 0x3a, 0xd3, 0xfe } }
{ 0x3e2df1fe, 0xa898, 0x4e2e, { 0x87, 0x63, 0x4c, 0xa9, 0x4, 0xfa, 0x33, 0x8e } }
class nsIObjectFrame : public nsISupports {
public:
@ -63,6 +63,8 @@ public:
*/
virtual nsresult Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamListener) = 0;
virtual void TryNotifyContentObjectWrapper() = 0;
/**
* Instantiate a plugin that loads the data itself.
* @param aMimeType Type of the plugin to instantiate. May be null.

Просмотреть файл

@ -1395,6 +1395,7 @@ nsObjectFrame::Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamList
// to FixupWindow.
PresContext()->GetPresShell()->
FrameNeedsReflow(this, nsIPresShell::eStyleChange, NS_FRAME_IS_DIRTY);
return rv;
}
@ -1418,20 +1419,26 @@ nsObjectFrame::Instantiate(const char* aMimeType, nsIURI* aURI)
// finish up
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPluginInstance> inst;
mInstanceOwner->GetInstance(*getter_AddRefs(inst));
if (inst) {
// The plugin may have set up new interfaces; we need to mess with our JS
// wrapper. Note that we DO NOT want to call this if there is no plugin
// instance! That would just reenter Instantiate(), trying to create
// said plugin instance.
NotifyContentObjectWrapper();
}
TryNotifyContentObjectWrapper();
}
return rv;
}
void
nsObjectFrame::TryNotifyContentObjectWrapper()
{
nsCOMPtr<nsIPluginInstance> inst;
mInstanceOwner->GetInstance(*getter_AddRefs(inst));
if (inst) {
// The plugin may have set up new interfaces; we need to mess with our JS
// wrapper. Note that we DO NOT want to call this if there is no plugin
// instance! That would just reenter Instantiate(), trying to create
// said plugin instance.
NotifyContentObjectWrapper();
}
}
void
nsObjectFrame::StopPlugin()
{

Просмотреть файл

@ -110,6 +110,7 @@ public:
NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance);
virtual nsresult Instantiate(nsIChannel* aChannel, nsIStreamListener** aStreamListener);
virtual nsresult Instantiate(const char* aMimeType, nsIURI* aURI);
virtual void TryNotifyContentObjectWrapper();
virtual void StopPlugin();