mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1644911, add access to the childID from the frame crashed event, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D98206
This commit is contained in:
parent
fdab0ce3d7
commit
2ae4d6a15b
@ -2672,7 +2672,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, nullptr);
|
||||
MaybeNotifyCrashed(nullptr, ContentParentId(), nullptr);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -3684,6 +3684,7 @@ void nsFrameLoader::SetWillChangeProcess() {
|
||||
}
|
||||
|
||||
void nsFrameLoader::MaybeNotifyCrashed(BrowsingContext* aBrowsingContext,
|
||||
ContentParentId aChildID,
|
||||
mozilla::ipc::MessageChannel* aChannel) {
|
||||
if (mTabProcessCrashFired) {
|
||||
return;
|
||||
@ -3731,6 +3732,7 @@ void nsFrameLoader::MaybeNotifyCrashed(BrowsingContext* aBrowsingContext,
|
||||
if (aBrowsingContext) {
|
||||
init.mBrowsingContextId = aBrowsingContext->Id();
|
||||
init.mIsTopFrame = aBrowsingContext->IsTop();
|
||||
init.mChildID = aChildID;
|
||||
}
|
||||
|
||||
RefPtr<FrameCrashedEvent> event = FrameCrashedEvent::Constructor(
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/WindowProxyHolder.h"
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
@ -410,6 +411,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
|
||||
mozilla::dom::ContentParent* aContentParent);
|
||||
|
||||
void MaybeNotifyCrashed(mozilla::dom::BrowsingContext* aBrowsingContext,
|
||||
mozilla::dom::ContentParentId aChildID,
|
||||
mozilla::ipc::MessageChannel* aChannel);
|
||||
|
||||
void FireErrorEvent();
|
||||
|
@ -742,7 +742,8 @@ void BrowserParent::ActorDestroy(ActorDestroyReason why) {
|
||||
|
||||
// If this was a crash, tell our nsFrameLoader to fire crash events.
|
||||
if (why == AbnormalShutdown) {
|
||||
frameLoader->MaybeNotifyCrashed(mBrowsingContext, GetIPCChannel());
|
||||
frameLoader->MaybeNotifyCrashed(mBrowsingContext, Manager()->ChildID(),
|
||||
GetIPCChannel());
|
||||
|
||||
auto* bridge = GetBrowserBridgeParent();
|
||||
if (bridge && bridge->CanSend() && !mBrowsingContext->IsDiscarded()) {
|
||||
|
@ -51,6 +51,7 @@ add_task(async function() {
|
||||
info("Waiting for oop-browser-crashed event.");
|
||||
await eventFiredPromise.then(event => {
|
||||
ok(!event.isTopFrame, "should not be reporting top-level frame crash");
|
||||
ok(event.childID != 0, "childID is non-zero");
|
||||
|
||||
isnot(
|
||||
event.browsingContextId,
|
||||
|
@ -20,10 +20,18 @@ interface FrameCrashedEvent : Event
|
||||
* True if the top-most frame crashed.
|
||||
*/
|
||||
readonly attribute boolean isTopFrame;
|
||||
|
||||
/**
|
||||
* Internal process identifier of the frame that crashed. This will be
|
||||
* 0 if this identifier is not known, for example a process that failed
|
||||
* to start.
|
||||
*/
|
||||
readonly attribute unsigned long long childID;
|
||||
};
|
||||
|
||||
dictionary FrameCrashedEventInit : EventInit
|
||||
{
|
||||
unsigned long long browsingContextId = 0;
|
||||
boolean isTopFrame = true;
|
||||
unsigned long long childID = 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user