Bug 1533955 - Fire oop-browser-crashed event again if a subframe crashes. r=nika

This also adds an isTopFrame attribute to the FrameCrashedEvent binding, which
returns true if the frame that crashed was the top-most one.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Conley 2019-05-01 20:04:50 +00:00
Родитель 0678c2e034
Коммит a51a8650de
2 изменённых файлов: 15 добавлений и 2 удалений

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

@ -485,11 +485,17 @@ void BrowserParent::ActorDestroy(ActorDestroyReason why) {
// out-of-process iframe.
RefPtr<nsFrameLoader> frameLoader = GetFrameLoader(true);
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
if (frameLoader && !mBrowserBridgeParent) {
if (frameLoader) {
nsCOMPtr<Element> frameElement(mFrameElement);
ReceiveMessage(CHILD_PROCESS_SHUTDOWN_MESSAGE, false, nullptr, nullptr,
nullptr);
frameLoader->DestroyComplete();
if (!mBrowsingContext->GetParent()) {
// If this is a top-level BrowsingContext, tell the frameloader it's time
// to go away. Otherwise, this is a subframe crash, and we can keep the
// frameloader around.
frameLoader->DestroyComplete();
}
if (why == AbnormalShutdown && os) {
os->NotifyObservers(ToSupports(frameLoader), "oop-frameloader-crashed",
@ -513,6 +519,7 @@ void BrowserParent::ActorDestroy(ActorDestroyReason why) {
init.mBubbles = true;
init.mCancelable = true;
init.mBrowsingContextId = mBrowsingContext->Id();
init.mIsTopFrame = !mBrowsingContext->GetParent();
RefPtr<dom::FrameCrashedEvent> event =
dom::FrameCrashedEvent::Constructor(frameElement->OwnerDoc(),

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

@ -11,9 +11,15 @@ interface FrameCrashedEvent : Event
* The browsingContextId of the frame that crashed.
*/
readonly attribute unsigned long long browsingContextId;
/**
* True if the top-most frame crashed.
*/
readonly attribute boolean isTopFrame;
};
dictionary FrameCrashedEventInit : EventInit
{
unsigned long long browsingContextId = 0;
boolean isTopFrame = false;
};