Bug 1158427 - r=roc
authorPaul Adenot <paul@paul.cx>
Wed, 29 Apr 2015 11:02:55 +0200 (2015-04-29)
changeset 241565 47e6dfbe1b90088a00b27adb371af4533050a864
parent 241564 aae6f17ccc1ee176c6a850e68c95a9c0520e7464
child 241566 0a9693ebe7f52e3dc76c9aab981bd0dd21b9fc39
push id28665
push userkwierso@gmail.com
push dateWed, 29 Apr 2015 23:43:43 +0000 (2015-04-29)
treeherdermozilla-central@a86ed85747d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1158427
milestone40.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 1158427 - r=roc
dom/media/MediaStreamGraph.cpp
dom/media/test/crashtests/1158427.html
dom/media/test/crashtests/crashtests.list
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -1864,19 +1864,19 @@ MediaStreamGraphImpl::EnsureStableStateE
   nsCOMPtr<nsIRunnable> event = new MediaStreamGraphStableStateRunnable(this, true);
   NS_DispatchToMainThread(event);
 }
 
 void
 MediaStreamGraphImpl::AppendMessage(ControlMessage* aMessage)
 {
   MOZ_ASSERT(NS_IsMainThread(), "main thread only");
-  NS_ASSERTION(!aMessage->GetStream() ||
-               !aMessage->GetStream()->IsDestroyed(),
-               "Stream already destroyed");
+  MOZ_ASSERT(!aMessage->GetStream() ||
+             !aMessage->GetStream()->IsDestroyed(),
+             "Stream already destroyed");
 
   if (mDetectedNotRunning &&
       mLifecycleState > LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP) {
     // The graph control loop is not running and main thread cleanup has
     // happened. From now on we can't append messages to mCurrentTaskMessageQueue,
     // because that will never be processed again, so just RunDuringShutdown
     // this message.
     // This should only happen during forced shutdown, or after a non-realtime
@@ -3202,16 +3202,18 @@ public:
 private:
   nsRefPtr<AudioNodeStream> mStream;
   MediaStreamGraph* mGraph;
 };
 
 void
 MediaStreamGraph::NotifyWhenGraphStarted(AudioNodeStream* aStream)
 {
+  MOZ_ASSERT(NS_IsMainThread());
+
   class GraphStartedNotificationControlMessage : public ControlMessage
   {
   public:
     explicit GraphStartedNotificationControlMessage(AudioNodeStream* aStream)
       : ControlMessage(aStream)
     {
     }
     virtual void Run()
@@ -3232,18 +3234,20 @@ MediaStreamGraph::NotifyWhenGraphStarted
       }
     }
     virtual void RunDuringShutdown()
     {
       MOZ_ASSERT(false, "We should be reviving the graph?");
     }
   };
 
-  MediaStreamGraphImpl* graphImpl = static_cast<MediaStreamGraphImpl*>(this);
-  graphImpl->AppendMessage(new GraphStartedNotificationControlMessage(aStream));
+  if (!aStream->IsDestroyed()) {
+    MediaStreamGraphImpl* graphImpl = static_cast<MediaStreamGraphImpl*>(this);
+    graphImpl->AppendMessage(new GraphStartedNotificationControlMessage(aStream));
+  }
 }
 
 void
 MediaStreamGraphImpl::ResetVisitedStreamState()
 {
   // Reset the visited/consumed/blocked state of the streams.
   nsTArray<MediaStream*>* runningAndSuspendedPair[2];
   runningAndSuspendedPair[0] = &mStreams;
new file mode 100644
--- /dev/null
+++ b/dom/media/test/crashtests/1158427.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+
+function boom()
+{
+  document.createElement("audio").mozCaptureStreamUntilEnded();
+  new window.AudioContext();
+  navigator.mozApps;
+  SpecialPowers.forceCC();
+}
+
+</script>
+</head>
+<body onload="boom();"></body>
+</html>
+
--- a/dom/media/test/crashtests/crashtests.list
+++ b/dom/media/test/crashtests/crashtests.list
@@ -70,12 +70,13 @@ load 990794.html
 load 1015662.html
 skip-if(Android||B2G) test-pref(media.navigator.permission.disabled,true) load 1028458.html # bug 1048863
 load buffer-source-ended-1.html
 HTTP load media-element-source-seek-1.html
 load offline-buffer-source-ended-1.html
 load oscillator-ended-1.html
 load oscillator-ended-2.html
 load 1080986.html
+load 1158427.html
 include ../../mediasource/test/crashtests/crashtests.list
 
 # This needs to run at the end to avoid leaking busted state into other tests.
 skip-if(B2G||winWidget||OSX==1006||OSX==1010&&isDebugBuild) load 691096-1.html