Bug 565953 - Intermittent failure in test_pluginstream_err.html because we're sometimes delivering NPP_StreamAsFile even after NPP_Write has failed, which is probably a violation of NPAPI expectations, although this behavior isn't actually specced out explicitly anywhere. r=josh
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 21 Nov 2011 13:40:19 -0500
changeset 80572 6f089d64ae64
parent 80571 fa1aaea9b7e6
child 80573 380444ff2108
child 80578 8dfc790e62e8
push id3506
push userjosh@mozilla.com
push date2011-11-21 18:40 +0000
treeherdermozilla-inbound@6f089d64ae64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjosh
bugs565953
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 565953 - Intermittent failure in test_pluginstream_err.html because we're sometimes delivering NPP_StreamAsFile even after NPP_Write has failed, which is probably a violation of NPAPI expectations, although this behavior isn't actually specced out explicitly anywhere. r=josh
dom/plugins/ipc/BrowserStreamChild.cpp
--- a/dom/plugins/ipc/BrowserStreamChild.cpp
+++ b/dom/plugins/ipc/BrowserStreamChild.cpp
@@ -244,18 +244,19 @@ BrowserStreamChild::Deliver()
   // NPP_StreamAsFile() is documented (at MDN) to be called "when the stream
   // is complete" -- i.e. after all calls to NPP_WriteReady() and NPP_Write()
   // have finished.  We make these calls asynchronously (from
   // DeliverPendingData()).  So we need to make sure all the "pending data"
   // has been "delivered" before calling NPP_StreamAsFile() (also
   // asynchronously).  Doing this resolves bug 687610, bug 670036 and possibly
   // also other bugs.
   if (mStreamAsFilePending) {
-    mInstance->mPluginIface->asfile(&mInstance->mData, &mStream,
-                                    mStreamAsFileName.get());
+    if (mStreamStatus == kStreamOpen)
+      mInstance->mPluginIface->asfile(&mInstance->mData, &mStream,
+                                      mStreamAsFileName.get());
     mStreamAsFilePending = false;
   }
 
   if (DESTROY_PENDING == mDestroyPending) {
     mDestroyPending = DESTROYED;
     if (mState != DYING)
       NS_RUNTIMEABORT("mDestroyPending but state not DYING");