Bug 1477767 - disconnect request when XPCOM is going to shutdown. r=cpearce a=pascalc
authoralwu <alwu@mozilla.com>
Mon, 17 Sep 2018 16:54:17 +0000
changeset 492616 9f7aaef8e942aa7707b352168bb45a9a2a35f3bd
parent 492615 f5b8fa65dbdf55a44778f0b6daba6765dd9d4226
child 492617 d0e8aadd83231090f63d8823089d23edb5bf8b41
push id1815
push userffxbld-merge
push dateMon, 15 Oct 2018 10:40:45 +0000
treeherdermozilla-release@18d4c09e9378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, pascalc
bugs1477767
milestone63.0
Bug 1477767 - disconnect request when XPCOM is going to shutdown. r=cpearce a=pascalc The reason we hit this assertion is that we still connected to Then() and waited for its result when the resolve or reject runnable which dispatched by ThenValue can't be executed because the target thread had been shutdown. Therefore, when XPCOM is going to shutdown, we should disconnect the Then() because it might not have a chance to execute its resolve/reject method. Differential Revision: https://phabricator.services.mozilla.com/D5893
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -6793,16 +6793,19 @@ HTMLMediaElement::DoRemoveSelfReference(
 {
   mShutdownObserver->ReleaseMediaElement();
 }
 
 void
 HTMLMediaElement::NotifyShutdownEvent()
 {
   mShuttingDown = true;
+  // Since target thread had been shutdown, it's no chance to execute the Then()
+  // afterward. Therefore, we should disconnect the request.
+  mAutoplayPermissionRequest.DisconnectIfExists();
   ResetState();
   AddRemoveSelfReference();
 }
 
 void
 HTMLMediaElement::DispatchAsyncSourceError(nsIContent* aSourceElement)
 {
   LOG_EVENT(LogLevel::Debug, ("%p Queuing simple source error event", this));