Bug 1163735 - Ensure that we don't hand out a destroyed TabChild from WorkerPrivate::InterfaceRequestor (r=khuey)

If the actor we hand out has been __delete__d, then we'll crash when
Necko tries to send the actor to the parent to open connections.
This commit is contained in:
Bill McCloskey 2015-08-18 17:25:02 -07:00
Родитель 8c304b3e3b
Коммит c2ac89de85
1 изменённых файлов: 4 добавлений и 2 удалений

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

@ -63,6 +63,7 @@
#include "mozilla/dom/PromiseDebugging.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/StructuredClone.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/WebCryptoCommon.h"
#include "mozilla/dom/WorkerBinding.h"
#include "mozilla/dom/WorkerDebuggerGlobalScopeBinding.h"
@ -2395,8 +2396,9 @@ InterfaceRequestor::GetAnyLiveTabChild()
nsCOMPtr<nsITabChild> tabChild =
do_QueryReferent(mTabChildList.LastElement());
// Does this tab child still exist? If so, return it. We are done.
if (tabChild) {
// Does this tab child still exist? If so, return it. We are done. If the
// PBrowser actor is no longer useful, don't bother returning this tab.
if (tabChild && !static_cast<TabChild*>(tabChild.get())->IsDestroyed()) {
return tabChild.forget();
}