Bug 1722880 - Part 2: Expose windowContext getter to JSWindowActors, r=smaug

This will be used by the Pdfjs actor to get isInBFCache

Differential Revision: https://phabricator.services.mozilla.com/D124099
This commit is contained in:
Nika Layzell 2021-09-03 15:26:13 +00:00
Родитель c525c65ff8
Коммит 537f680c5a
5 изменённых файлов: 24 добавлений и 0 удалений

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

@ -27,6 +27,14 @@ interface JSWindowActorParent {
*/
readonly attribute WindowGlobalParent? manager;
/**
* The WindowContext associated with this JSWindowActorParent. For
* JSWindowActorParent this is identical to `manager`, but is also exposed as
* `windowContext` for consistency with `JSWindowActorChild`. Until the actor
* is initialized, accesses to windowContext will fail.
*/
readonly attribute WindowContext? windowContext;
[Throws]
readonly attribute CanonicalBrowsingContext? browsingContext;
};
@ -44,6 +52,12 @@ interface JSWindowActorChild {
*/
readonly attribute WindowGlobalChild? manager;
/**
* The WindowContext associated with this JSWindowActorChild. Until the actor
* is initialized, accesses to windowContext will fail.
*/
readonly attribute WindowContext? windowContext;
[Throws]
readonly attribute Document? document;

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

@ -25,6 +25,10 @@ JSObject* JSWindowActorChild::WrapObject(JSContext* aCx,
WindowGlobalChild* JSWindowActorChild::GetManager() const { return mManager; }
WindowContext* JSWindowActorChild::GetWindowContext() const {
return mManager ? mManager->WindowContext() : nullptr;
}
void JSWindowActorChild::Init(const nsACString& aName,
WindowGlobalChild* aManager) {
MOZ_ASSERT(!mManager, "Cannot Init() a JSWindowActorChild twice!");

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

@ -57,6 +57,7 @@ class JSWindowActorChild final : public JSActor {
}
WindowGlobalChild* GetManager() const;
WindowContext* GetWindowContext() const;
void Init(const nsACString& aName, WindowGlobalChild* aManager);
void ClearManager() override;
Document* GetDocument(ErrorResult& aRv);

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

@ -23,6 +23,10 @@ JSObject* JSWindowActorParent::WrapObject(JSContext* aCx,
WindowGlobalParent* JSWindowActorParent::GetManager() const { return mManager; }
WindowContext* JSWindowActorParent::GetWindowContext() const {
return mManager;
}
void JSWindowActorParent::Init(const nsACString& aName,
WindowGlobalParent* aManager) {
MOZ_ASSERT(!mManager, "Cannot Init() a JSWindowActorParent twice!");

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

@ -46,6 +46,7 @@ class JSWindowActorParent final : public JSActor {
}
WindowGlobalParent* GetManager() const;
WindowContext* GetWindowContext() const;
void Init(const nsACString& aName, WindowGlobalParent* aManager);
void ClearManager() override;
CanonicalBrowsingContext* GetBrowsingContext(ErrorResult& aRv);