Bug 1325255 - Don't crash during shutdown if the deserialization of the principal fails; r=bkelly

This commit is contained in:
Ehsan Akhgari 2016-12-22 15:04:05 -05:00
Родитель 7702c68f7a
Коммит 41b2cc8dd4
3 изменённых файлов: 13 добавлений и 2 удалений

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

@ -4800,7 +4800,8 @@ ContentParent::RecvPURLClassifierConstructor(PURLClassifierParent* aActor,
auto* actor = static_cast<URLClassifierParent*>(aActor);
nsCOMPtr<nsIPrincipal> principal(aPrincipal);
if (!principal) {
return IPC_FAIL_NO_REASON(this);
actor->ClassificationFailed();
return IPC_OK();
}
return actor->StartClassify(principal, aUseTrackingProtection, aSuccess);
}

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

@ -34,7 +34,7 @@ URLClassifierParent::StartClassify(nsIPrincipal* aPrincipal,
// without ever calling out callback in both cases.
// This means that code using this in the child process will only get a hit
// on its callback if some classification actually happens.
Unused << Send__delete__(this, void_t());
ClassificationFailed();
}
return IPC_OK();
}
@ -48,6 +48,14 @@ URLClassifierParent::OnClassifyComplete(nsresult aRv)
return NS_OK;
}
void
URLClassifierParent::ClassificationFailed()
{
if (mIPCOpen) {
Unused << Send__delete__(this, void_t());
}
}
void
URLClassifierParent::ActorDestroy(ActorDestroyReason aWhy)
{

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

@ -27,6 +27,8 @@ class URLClassifierParent : public nsIURIClassifierCallback,
bool* aSuccess);
void ActorDestroy(ActorDestroyReason aWhy) override;
void ClassificationFailed();
private:
~URLClassifierParent() = default;