Skip to content

Commit eb73069

Browse files
committed
Bug 1527625 - Fill required arguments for ReceiveMessageArgument, r=nika
Differential Revision: https://phabricator.services.mozilla.com/D21987 --HG-- extra : moz-landing-system : lando
1 parent d0a9b39 commit eb73069

8 files changed

+31
-16
lines changed

dom/ipc/JSWindowActorChild.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,15 @@ void JSWindowActorChild::SendAsyncMessage(JSContext* aCx,
108108
}
109109
}
110110

111-
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(JSWindowActorChild, mManager)
111+
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(JSWindowActorChild)
112+
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
113+
NS_INTERFACE_MAP_ENTRY(nsISupports)
114+
NS_INTERFACE_MAP_END
115+
116+
NS_IMPL_CYCLE_COLLECTING_ADDREF(JSWindowActorChild)
117+
NS_IMPL_CYCLE_COLLECTING_RELEASE(JSWindowActorChild)
112118

113-
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(JSWindowActorChild, AddRef)
114-
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(JSWindowActorChild, Release)
119+
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(JSWindowActorChild, mManager)
115120

116121
} // namespace dom
117122
} // namespace mozilla

dom/ipc/JSWindowActorChild.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class WindowGlobalChild;
2525
namespace mozilla {
2626
namespace dom {
2727

28-
class JSWindowActorChild final : public nsWrapperCache {
28+
class JSWindowActorChild final : public nsISupports, public nsWrapperCache {
2929
public:
30-
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(JSWindowActorChild)
31-
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(JSWindowActorChild)
30+
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
31+
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(JSWindowActorChild)
3232

3333
protected:
3434
~JSWindowActorChild() = default;

dom/ipc/JSWindowActorParent.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,15 @@ void JSWindowActorParent::SendAsyncMessage(JSContext* aCx,
107107
}
108108
}
109109

110-
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(JSWindowActorParent, mManager)
110+
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(JSWindowActorParent)
111+
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
112+
NS_INTERFACE_MAP_ENTRY(nsISupports)
113+
NS_INTERFACE_MAP_END
114+
115+
NS_IMPL_CYCLE_COLLECTING_ADDREF(JSWindowActorParent)
116+
NS_IMPL_CYCLE_COLLECTING_RELEASE(JSWindowActorParent)
111117

112-
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(JSWindowActorParent, AddRef)
113-
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(JSWindowActorParent, Release)
118+
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(JSWindowActorParent, mManager)
114119

115120
} // namespace dom
116121
} // namespace mozilla

dom/ipc/JSWindowActorParent.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class WindowGlobalParent;
2525
namespace mozilla {
2626
namespace dom {
2727

28-
class JSWindowActorParent final : public nsWrapperCache {
28+
class JSWindowActorParent final : public nsISupports, public nsWrapperCache {
2929
public:
30-
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(JSWindowActorParent)
31-
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(JSWindowActorParent)
30+
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
31+
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(JSWindowActorParent)
3232

3333
protected:
3434
~JSWindowActorParent() = default;

dom/ipc/JSWindowActorService.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,8 @@ void JSWindowActorService::ConstructActor(const nsAString& aName,
557557
}
558558
}
559559

560-
void JSWindowActorService::ReceiveMessage(JS::RootedObject& aObj,
560+
void JSWindowActorService::ReceiveMessage(nsISupports* aTarget,
561+
JS::RootedObject& aObj,
561562
const nsString& aMessageName,
562563
ipc::StructuredCloneData& aData) {
563564
IgnoredErrorResult error;
@@ -579,9 +580,12 @@ void JSWindowActorService::ReceiveMessage(JS::RootedObject& aObj,
579580

580581
RootedDictionary<ReceiveMessageArgument> argument(cx);
581582
argument.mObjects = JS_NewPlainObject(cx);
583+
argument.mTarget = aTarget;
582584
argument.mName = aMessageName;
583585
argument.mData = json;
584586
argument.mJson = json;
587+
argument.mSync = false;
588+
585589
JS::RootedValue argv(cx);
586590
if (NS_WARN_IF(!ToJSValue(cx, argument, &argv))) {
587591
return;

dom/ipc/JSWindowActorService.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ class JSWindowActorService final {
4343
BrowsingContext* aBrowsingContext,
4444
JS::MutableHandleObject aActor, ErrorResult& aRv);
4545

46-
void ReceiveMessage(JS::RootedObject& aObj, const nsString& aMessageName,
46+
void ReceiveMessage(nsISupports* aActor, JS::RootedObject& aObj,
47+
const nsString& aMessageName,
4748
ipc::StructuredCloneData& aData);
4849

4950
// Register or unregister a WindowRoot object from this JSWindowActorService.

dom/ipc/WindowGlobalChild.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void WindowGlobalChild::HandleAsyncMessage(const nsString& aActorName,
148148
return;
149149
}
150150

151-
actorSvc->ReceiveMessage(obj, aMessageName, aData);
151+
actorSvc->ReceiveMessage(actor, obj, aMessageName, aData);
152152
}
153153

154154
already_AddRefed<JSWindowActorChild> WindowGlobalChild::GetActor(

dom/ipc/WindowGlobalParent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ void WindowGlobalParent::HandleAsyncMessage(const nsString& aActorName,
191191
return;
192192
}
193193

194-
actorSvc->ReceiveMessage(obj, aMessageName, aData);
194+
actorSvc->ReceiveMessage(actor, obj, aMessageName, aData);
195195
}
196196

197197
already_AddRefed<JSWindowActorParent> WindowGlobalParent::GetActor(

0 commit comments

Comments
 (0)