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 80583 6f089d64ae6432f84835d6e57d6ad0aad8033b1b
parent 80582 fa1aaea9b7e6fe5a47fc91fb03a6717faf5f1b30
child 80584 380444ff2108ff59d804af1da371b8089d575a3f
child 80589 8dfc790e62e86449955c997a839c82b535775ae4
push id21511
push userbmo@edmorley.co.uk
push dateTue, 22 Nov 2011 02:38:00 +0000
treeherdermozilla-central@b8955ff00aae [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");