Bug 1566806 - Check discarded status before forwarding WindowProxy messages between processes, r=farre

Differential Revision: https://phabricator.services.mozilla.com/D38545

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-07-22 01:54:36 +00:00
parent da68c7c366
commit 2f4cd365ad

View File

@ -5825,7 +5825,7 @@ mozilla::ipc::IPCResult ContentParent::RecvDetachBrowsingContext(
// NOTE: It's OK if we don't have this context anymore. It was just already
// detached, return.
RefPtr<BrowsingContext> context = BrowsingContext::Get(aContextId);
if (!context) {
if (!context || context->IsDiscarded()) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
("ParentIPC: Trying to detach already detached"));
return IPC_OK();
@ -5859,7 +5859,7 @@ mozilla::ipc::IPCResult ContentParent::RecvDetachBrowsingContext(
mozilla::ipc::IPCResult ContentParent::RecvCacheBrowsingContextChildren(
BrowsingContext* aContext) {
if (!aContext) {
if (!aContext || aContext->IsDiscarded()) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
("ParentIPC: Trying to cache already detached"));
return IPC_OK();
@ -5889,7 +5889,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCacheBrowsingContextChildren(
mozilla::ipc::IPCResult ContentParent::RecvRestoreBrowsingContextChildren(
BrowsingContext* aContext, BrowsingContext::Children&& aChildren) {
if (!aContext) {
if (!aContext || aContext->IsDiscarded()) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Debug,
("ParentIPC: Trying to restore already detached"));
return IPC_OK();
@ -5939,7 +5939,7 @@ void ContentParent::UnregisterRemoveWorkerActor() {
mozilla::ipc::IPCResult ContentParent::RecvWindowClose(
BrowsingContext* aContext, bool aTrustedCaller) {
if (!aContext) {
if (!aContext || aContext->IsDiscarded()) {
MOZ_LOG(
BrowsingContext::GetLog(), LogLevel::Debug,
("ParentIPC: Trying to send a message to dead or detached context"));
@ -5959,7 +5959,7 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowClose(
mozilla::ipc::IPCResult ContentParent::RecvWindowFocus(
BrowsingContext* aContext) {
if (!aContext) {
if (!aContext || aContext->IsDiscarded()) {
MOZ_LOG(
BrowsingContext::GetLog(), LogLevel::Debug,
("ParentIPC: Trying to send a message to dead or detached context"));
@ -5975,7 +5975,7 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowFocus(
mozilla::ipc::IPCResult ContentParent::RecvWindowBlur(
BrowsingContext* aContext) {
if (!aContext) {
if (!aContext || aContext->IsDiscarded()) {
MOZ_LOG(
BrowsingContext::GetLog(), LogLevel::Debug,
("ParentIPC: Trying to send a message to dead or detached context"));
@ -5992,7 +5992,7 @@ mozilla::ipc::IPCResult ContentParent::RecvWindowBlur(
mozilla::ipc::IPCResult ContentParent::RecvWindowPostMessage(
BrowsingContext* aContext, const ClonedMessageData& aMessage,
const PostMessageData& aData) {
if (!aContext) {
if (!aContext || aContext->IsDiscarded()) {
MOZ_LOG(
BrowsingContext::GetLog(), LogLevel::Debug,
("ParentIPC: Trying to send a message to dead or detached context"));
@ -6034,7 +6034,7 @@ void ContentParent::OnBrowsingContextGroupUnsubscribe(
mozilla::ipc::IPCResult ContentParent::RecvCommitBrowsingContextTransaction(
BrowsingContext* aContext, BrowsingContext::Transaction&& aTransaction,
BrowsingContext::FieldEpochs&& aEpochs) {
if (!aContext) {
if (!aContext || aContext->IsDiscarded()) {
MOZ_LOG(BrowsingContext::GetLog(), LogLevel::Warning,
("ParentIPC: Trying to run transaction on missing context."));
return IPC_OK();