diff --git a/dom/plugins/BrowserStreamChild.cpp b/dom/plugins/BrowserStreamChild.cpp index 23506929a62..f1a06dcc676 100644 --- a/dom/plugins/BrowserStreamChild.cpp +++ b/dom/plugins/BrowserStreamChild.cpp @@ -37,6 +37,7 @@ #include "BrowserStreamChild.h" #include "PluginInstanceChild.h" +#include "StreamNotifyChild.h" namespace mozilla { namespace plugins { @@ -45,6 +46,7 @@ BrowserStreamChild::BrowserStreamChild(PluginInstanceChild* instance, const nsCString& url, const uint32_t& length, const uint32_t& lastmodified, + const PStreamNotifyChild* notifyData, const nsCString& headers, const nsCString& mimeType, const bool& seekable, @@ -61,6 +63,9 @@ BrowserStreamChild::BrowserStreamChild(PluginInstanceChild* instance, mStream.url = mURL.get(); mStream.end = length; mStream.lastmodified = lastmodified; + if (notifyData) + mStream.notifyData = + static_cast(notifyData)->mClosure; if (!mHeaders.IsEmpty()) mStream.headers = mHeaders.get(); @@ -99,9 +104,6 @@ BrowserStreamChild::AnswerNPP_Write(const int32_t& offset, *consumed = mInstance->mPluginIface->write(&mInstance->mData, &mStream, offset, data.Length(), const_cast(data.get())); - if (*consumed < 0) - mClosed = true; - return true; } diff --git a/dom/plugins/BrowserStreamChild.h b/dom/plugins/BrowserStreamChild.h index 794712199fb..f7ce12ac124 100644 --- a/dom/plugins/BrowserStreamChild.h +++ b/dom/plugins/BrowserStreamChild.h @@ -45,6 +45,7 @@ namespace mozilla { namespace plugins { class PluginInstanceChild; +class PStreamNotifyChild; class BrowserStreamChild : public PBrowserStreamChild, public AStream { @@ -53,6 +54,7 @@ public: const nsCString& url, const uint32_t& length, const uint32_t& lastmodified, + const PStreamNotifyChild* notifyData, const nsCString& headers, const nsCString& mimeType, const bool& seekable, diff --git a/dom/plugins/BrowserStreamParent.cpp b/dom/plugins/BrowserStreamParent.cpp index aea2e86f526..575f9b14268 100644 --- a/dom/plugins/BrowserStreamParent.cpp +++ b/dom/plugins/BrowserStreamParent.cpp @@ -11,9 +11,15 @@ BrowserStreamParent::BrowserStreamParent(PluginInstanceParent* npp, : mNPP(npp) , mStream(stream) { + printf("BrowserStreamParent::BrowserStreamParent<%p>\n", (void*) this); mStream->pdata = static_cast(this); } +BrowserStreamParent::~BrowserStreamParent() +{ + printf("BrowserStreamParent::~BrowserStreamParent<%p>\n", (void*) this); +} + bool BrowserStreamParent::AnswerNPN_RequestRead(const IPCByteRanges& ranges, NPError* result) @@ -64,12 +70,9 @@ BrowserStreamParent::Write(int32_t offset, int32_t result; if (!CallNPP_Write(offset, nsCString(static_cast(buffer), len), - &result)) { + &result)) return -1; - } - if (result == -1) - mNPP->CallPBrowserStreamDestructor(this, NPRES_USER_BREAK, true); return result; } diff --git a/dom/plugins/BrowserStreamParent.h b/dom/plugins/BrowserStreamParent.h index cf18e909565..8a3e05db5c3 100644 --- a/dom/plugins/BrowserStreamParent.h +++ b/dom/plugins/BrowserStreamParent.h @@ -54,7 +54,7 @@ class BrowserStreamParent : public PBrowserStreamParent, public AStream public: BrowserStreamParent(PluginInstanceParent* npp, NPStream* stream); - virtual ~BrowserStreamParent() { } + virtual ~BrowserStreamParent(); NS_OVERRIDE virtual bool IsBrowserStream() { return true; } diff --git a/dom/plugins/PluginInstanceChild.cpp b/dom/plugins/PluginInstanceChild.cpp index 4c790ff6197..a724e6cbc3a 100644 --- a/dom/plugins/PluginInstanceChild.cpp +++ b/dom/plugins/PluginInstanceChild.cpp @@ -462,8 +462,8 @@ PluginInstanceChild::AllocPBrowserStream(const nsCString& url, NPError* rv, uint16_t *stype) { - return new BrowserStreamChild(this, url, length, lastmodified, headers, - mimeType, seekable, rv, stype); + return new BrowserStreamChild(this, url, length, lastmodified, notifyData, + headers, mimeType, seekable, rv, stype); } bool diff --git a/dom/plugins/StreamNotifyChild.h b/dom/plugins/StreamNotifyChild.h index e875a809af0..935f9144c17 100644 --- a/dom/plugins/StreamNotifyChild.h +++ b/dom/plugins/StreamNotifyChild.h @@ -47,6 +47,7 @@ namespace plugins { class StreamNotifyChild : public PStreamNotifyChild { friend class PluginInstanceChild; + friend class BrowserStreamChild; public: StreamNotifyChild(const nsCString& aURL, void* aClosure)