Bug 1250871 - only send messages to child scripts when the docShell is still around. r=smaug

This commit is contained in:
Mike de Boer 2016-02-29 12:25:48 +01:00
parent faddffed3f
commit ba2ab36261
2 changed files with 3 additions and 6 deletions

View File

@ -65,11 +65,6 @@ SocialErrorListener = {
},
receiveMessage(message) {
if (!content) {
Cu.reportError("Message received whilst `content` is null: " + message.name);
return;
}
let document = content.document;
switch (message.name) {

View File

@ -2466,7 +2466,9 @@ public:
{
nsInProcessTabChildGlobal* tabChild =
static_cast<nsInProcessTabChildGlobal*>(mFrameLoader->mChildMessageManager.get());
if (tabChild && tabChild->GetInnerManager()) {
// Since bug 1126089, messages can arrive even when the docShell is destroyed.
// Here we make sure that those messages are not delivered.
if (tabChild && tabChild->GetInnerManager() && mFrameLoader->GetExistingDocShell()) {
nsCOMPtr<nsIXPConnectJSObjectHolder> kungFuDeathGrip(tabChild->GetGlobal());
ReceiveMessage(static_cast<EventTarget*>(tabChild), mFrameLoader,
tabChild->GetInnerManager());