Bug 1578070 - Add ClientInfo to WindowGlobalParent, r=nika

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kashav Madan 2020-03-10 20:25:57 +00:00
Родитель b298b8e4cb
Коммит a33f05c04e
4 изменённых файлов: 24 добавлений и 0 удалений

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

@ -1770,6 +1770,10 @@ nsresult nsGlobalWindowInner::EnsureClientSource() {
DocGroup* docGroup = GetDocGroup();
MOZ_DIAGNOSTIC_ASSERT(docGroup);
mClientSource->SetAgentClusterId(docGroup->AgentClusterId());
if (mWindowGlobalChild) {
mWindowGlobalChild->SendSetClientInfo(mClientSource->Info().ToIPC());
}
}
// Its possible that we got a client just after being frozen in

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

@ -11,6 +11,7 @@ include protocol PInProcess;
include protocol PBrowserBridge;
include DOMTypes;
include ClientIPCTypes;
using JSWindowActorMessageKind from "mozilla/dom/JSWindowActor.h";
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
@ -96,6 +97,9 @@ parent:
// Get content blocking events from the parent process.
async GetContentBlockingEvents() returns (uint32_t events);
// Send the ClientInfo associated with a top-level document load.
async SetClientInfo(IPCClientInfo aClientInfo);
async Destroy();
};

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

@ -10,6 +10,8 @@
#include "mozilla/ipc/InProcessParent.h"
#include "mozilla/dom/BrowserBridgeParent.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/ClientInfo.h"
#include "mozilla/dom/ClientIPCTypes.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/BrowserHost.h"
#include "mozilla/dom/BrowserParent.h"
@ -257,6 +259,12 @@ IPCResult WindowGlobalParent::RecvSetHasBeforeUnload(bool aHasBeforeUnload) {
return IPC_OK();
}
mozilla::ipc::IPCResult WindowGlobalParent::RecvSetClientInfo(
const IPCClientInfo& aIPCClientInfo) {
mClientInfo = Some(ClientInfo(aIPCClientInfo));
return IPC_OK();
}
IPCResult WindowGlobalParent::RecvDestroy() {
// Make a copy so that we can avoid potential iterator invalidation when
// calling the user-provided Destroy() methods.

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

@ -10,6 +10,8 @@
#include "mozilla/ContentBlockingLog.h"
#include "mozilla/ContentBlockingNotifier.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/ClientInfo.h"
#include "mozilla/dom/ClientIPCTypes.h"
#include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/PWindowGlobalParent.h"
#include "mozilla/dom/BrowserParent.h"
@ -108,6 +110,8 @@ class WindowGlobalParent final : public WindowContext,
return mDocContentBlockingAllowListPrincipal;
}
Maybe<ClientInfo> GetClientInfo() { return mClientInfo; }
uint64_t ContentParentId();
int32_t OsPid();
@ -169,6 +173,8 @@ class WindowGlobalParent final : public WindowContext,
return IPC_OK();
}
mozilla::ipc::IPCResult RecvSetHasBeforeUnload(bool aHasBeforeUnload);
mozilla::ipc::IPCResult RecvSetClientInfo(
const IPCClientInfo& aIPCClientInfo);
mozilla::ipc::IPCResult RecvDestroy();
mozilla::ipc::IPCResult RecvRawMessage(const JSWindowActorMessageMeta& aMeta,
const ClonedMessageData& aData,
@ -208,6 +214,8 @@ class WindowGlobalParent final : public WindowContext,
// this WindowGlobalParent. This is only stored on top-level documents and
// includes the activity log for all of the nested subdocuments as well.
ContentBlockingLog mContentBlockingLog;
Maybe<ClientInfo> mClientInfo;
};
} // namespace dom