Bug 1559240 - Make sure oop-browser-context passes the BrowsingContext of the crashing subframe. r=rhunt

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Conley 2019-06-13 21:06:23 +00:00
parent 43bd779652
commit 45db9df532
3 changed files with 16 additions and 11 deletions

View File

@ -2738,7 +2738,7 @@ bool nsFrameLoader::TryRemoteBrowser() {
// Check if we should report a browser-crashed error because the browser
// failed to start.
if (XRE_IsParentProcess() && mOwnerContent && mOwnerContent->IsXULElement()) {
MaybeNotifyCrashed(nullptr);
MaybeNotifyCrashed(nullptr, nullptr);
}
return false;
@ -3430,9 +3430,9 @@ nsresult nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
}
}
bool tabContextUpdated = aTabContext->SetTabContext(
OwnerIsMozBrowserFrame(), chromeOuterWindowID, showFocusRings, attrs,
presentationURLStr);
bool tabContextUpdated =
aTabContext->SetTabContext(OwnerIsMozBrowserFrame(), chromeOuterWindowID,
showFocusRings, attrs, presentationURLStr);
NS_ENSURE_STATE(tabContextUpdated);
return NS_OK;
@ -3491,11 +3491,15 @@ void nsFrameLoader::SkipBrowsingContextDetach() {
docshell->SkipBrowsingContextDetach();
}
void nsFrameLoader::MaybeNotifyCrashed(mozilla::ipc::MessageChannel* aChannel) {
void nsFrameLoader::MaybeNotifyCrashed(BrowsingContext* aBrowsingContext,
mozilla::ipc::MessageChannel* aChannel) {
if (mTabProcessCrashFired) {
return;
}
mTabProcessCrashFired = true;
if (mBrowsingContext == aBrowsingContext) {
mTabProcessCrashFired = true;
}
// Fire the crashed observer notification.
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
@ -3527,9 +3531,9 @@ void nsFrameLoader::MaybeNotifyCrashed(mozilla::ipc::MessageChannel* aChannel) {
FrameCrashedEventInit init;
init.mBubbles = true;
init.mCancelable = true;
if (mBrowsingContext) {
init.mBrowsingContextId = mBrowsingContext->Id();
init.mIsTopFrame = !mBrowsingContext->GetParent();
if (aBrowsingContext) {
init.mBrowsingContextId = aBrowsingContext->Id();
init.mIsTopFrame = !aBrowsingContext->GetParent();
}
RefPtr<FrameCrashedEvent> event = FrameCrashedEvent::Constructor(

View File

@ -391,7 +391,8 @@ class nsFrameLoader final : public nsStubMutationObserver,
void SkipBrowsingContextDetach();
void MaybeNotifyCrashed(mozilla::ipc::MessageChannel* aChannel);
void MaybeNotifyCrashed(mozilla::dom::BrowsingContext* aBrowsingContext,
mozilla::ipc::MessageChannel* aChannel);
private:
nsFrameLoader(mozilla::dom::Element* aOwner,

View File

@ -683,7 +683,7 @@ void BrowserParent::ActorDestroy(ActorDestroyReason why) {
// If this was a crash, tell our nsFrameLoader to fire crash events.
if (why == AbnormalShutdown) {
frameLoader->MaybeNotifyCrashed(GetIPCChannel());
frameLoader->MaybeNotifyCrashed(mBrowsingContext, GetIPCChannel());
}
}