mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1630208 part 2: Drop events for DocAccessibleParents which are already shut down. r=yzen
We can receive IPC events after a DocAccessibleParent is shut down if the BrowserParent is in the process of being destroyed (probably the tab closed) but there are still events in the IPC queue. Most Recv*Event methods in BrowserParent check mShutdown, but a few don't. For the events that don't, if the event is for a document, we'll successfully fire the platform event, and then successfully get and cache an xpcAccessibleDocument. However, that xpcAccessibleDocument will never be removed from the cache because it's already shut down, so NotifyOfRemoteDocShutdown (which would normally remove it from the XPC cache) won't get called. This results in a leaked object. Thus, it's important that all Recv*Event methods drop the event if mShutdown is true. This patch adds that check to the methods which didn't have it already. Differential Revision: https://phabricator.services.mozilla.com/D79780
This commit is contained in:
parent
dffc53d36b
commit
6a5821c667
@ -395,6 +395,10 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvVirtualCursorChangeEvent(
|
||||
const uint64_t& aNewPositionID, const int32_t& aNewStartOffset,
|
||||
const int32_t& aNewEndOffset, const int16_t& aReason,
|
||||
const int16_t& aBoundaryType, const bool& aFromUser) {
|
||||
if (mShutdown) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
ProxyAccessible* target = GetAccessible(aID);
|
||||
ProxyAccessible* oldPosition = GetAccessible(aOldPositionID);
|
||||
ProxyAccessible* newPosition = GetAccessible(aNewPositionID);
|
||||
@ -431,8 +435,11 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvScrollingEvent(
|
||||
const uint64_t& aID, const uint64_t& aType, const uint32_t& aScrollX,
|
||||
const uint32_t& aScrollY, const uint32_t& aMaxScrollX,
|
||||
const uint32_t& aMaxScrollY) {
|
||||
ProxyAccessible* target = GetAccessible(aID);
|
||||
if (mShutdown) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
ProxyAccessible* target = GetAccessible(aID);
|
||||
if (!target) {
|
||||
NS_ERROR("no proxy for event!");
|
||||
return IPC_OK();
|
||||
@ -465,8 +472,11 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvScrollingEvent(
|
||||
mozilla::ipc::IPCResult DocAccessibleParent::RecvAnnouncementEvent(
|
||||
const uint64_t& aID, const nsString& aAnnouncement,
|
||||
const uint16_t& aPriority) {
|
||||
ProxyAccessible* target = GetAccessible(aID);
|
||||
if (mShutdown) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
ProxyAccessible* target = GetAccessible(aID);
|
||||
if (!target) {
|
||||
NS_ERROR("no proxy for event!");
|
||||
return IPC_OK();
|
||||
|
Loading…
Reference in New Issue
Block a user