Bug 1477767 - disconnect request when XPCOM is going to shutdown. r=cpearce
authoralwu <alwu@mozilla.com>
Mon, 17 Sep 2018 16:54:17 +0000
changeset 495221 02bd8c7d626e38bc0d37c5acbf17ad0935ea886c
parent 495220 a1f7d4f32d36ba0afb6b3f14668b3d79b9ac461e
child 495222 d706e4a7016f7d79800450ade0474ffdf0850b37
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1477767
milestone64.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 1477767 - disconnect request when XPCOM is going to shutdown. r=cpearce 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));