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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
alwu 2018-09-17 16:54:17 +00:00
Родитель 60ca3b7481
Коммит 1506a7fce4
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -6798,6 +6798,9 @@ 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();
}