зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1540839 - Hold BrowsingContextGroups until ContentChild dies; r=nika
In order to not have detach called on non-existent BrowsingContexts, we need to hold browsing contexts alive until the lifetime of ContentChild has ended. Differential Revision: https://phabricator.services.mozilla.com/D29782
This commit is contained in:
Родитель
76cb0252a1
Коммит
fc723a636c
|
@ -11,6 +11,12 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
BrowsingContextGroup::BrowsingContextGroup() {
|
||||
if (XRE_IsContentProcess()) {
|
||||
ContentChild::GetSingleton()->HoldBrowsingContextGroup(this);
|
||||
}
|
||||
}
|
||||
|
||||
bool BrowsingContextGroup::Contains(BrowsingContext* aBrowsingContext) {
|
||||
return aBrowsingContext->Group() == this;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ class BrowsingContextGroup final : public nsWrapperCache {
|
|||
JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
BrowsingContextGroup() = default;
|
||||
BrowsingContextGroup();
|
||||
|
||||
static already_AddRefed<BrowsingContextGroup> Select(
|
||||
BrowsingContext* aParent, BrowsingContext* aOpener) {
|
||||
|
|
|
@ -2298,6 +2298,8 @@ void ContentChild::ActorDestroy(ActorDestroyReason why) {
|
|||
|
||||
mIdleObservers.Clear();
|
||||
|
||||
mBrowsingContextGroupHolder.Clear();
|
||||
|
||||
nsCOMPtr<nsIConsoleService> svc(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
||||
if (svc) {
|
||||
svc->UnregisterListener(mConsoleListener);
|
||||
|
@ -3798,7 +3800,6 @@ mozilla::ipc::IPCResult ContentChild::RecvRestoreBrowsingContextChildren(
|
|||
mozilla::ipc::IPCResult ContentChild::RecvRegisterBrowsingContextGroup(
|
||||
nsTArray<BrowsingContext::IPCInitializer>&& aInits) {
|
||||
RefPtr<BrowsingContextGroup> group = new BrowsingContextGroup();
|
||||
|
||||
// Each of the initializers in aInits is sorted in pre-order, so our parent
|
||||
// should always be available before the element itself.
|
||||
for (auto& init : aInits) {
|
||||
|
@ -3911,6 +3912,11 @@ mozilla::ipc::IPCResult ContentChild::RecvCommitBrowsingContextTransaction(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
void ContentChild::HoldBrowsingContextGroup(BrowsingContextGroup* aBCG) {
|
||||
RefPtr<BrowsingContextGroup> bcgPtr(aBCG);
|
||||
mBrowsingContextGroupHolder.AppendElement(bcgPtr);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
||||
#if defined(__OpenBSD__) && defined(MOZ_SANDBOX)
|
||||
|
|
|
@ -674,6 +674,8 @@ class ContentChild final : public PContentChild,
|
|||
mozilla::ipc::IPCResult RecvStartDelayedAutoplayMediaComponents(
|
||||
BrowsingContext* aContext);
|
||||
|
||||
void HoldBrowsingContextGroup(BrowsingContextGroup* aBCG);
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
// Fetch the current number of pending input events.
|
||||
//
|
||||
|
@ -814,6 +816,8 @@ class ContentChild final : public PContentChild,
|
|||
|
||||
uint32_t mNetworkLinkType = 0;
|
||||
|
||||
nsTArray<RefPtr<BrowsingContextGroup>> mBrowsingContextGroupHolder;
|
||||
|
||||
DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче