nsFrameMessageManager::NewProcessMessageManager constructs child process managers with no parent

RESOLVED FIXED in mozilla24

Status

()

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: jimb, Assigned: smaug)

Tracking

Trunk
mozilla24
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

5 years ago
An nsFrameMessageManager representing a child process (MM_CHROME | MM_PROCESSMANAGER) ought to have the process message manager (@mozilla.org/parentprocessmessagemanager;1) as its parent, but nsFrameMessageManager::NewProcessMessageManager sometimes constructs them with a null parent, so that messages from children don't propagate up to the parent.

To reproduce, add an assertion like this to nsFrameMessageManager::NewProcessMessageManager:

   nsFrameMessageManager* mm;
   if (aProcess) {
+    NS_ABORT_IF_FALSE(nsFrameMessageManager::sParentProcessManager,
+                      "parent process manager not created");
     mm = new nsFrameMessageManager(aProcess,
                                    nsFrameMessageManager::sParentProcessManager,

and then run: ./mach xpcshell-test netwerk/test/unit_ipc

The problem is that nsFrameMessageManager::NewProcessMessageManager tries to ensure that sParentProcessManager has been created, but doesn't actually store a pointer it anywhere that holds a reference to it long enough to keep it alive when we create the message manager for the particular child. nsFrameMessageManager::~nsFrameMessageManager recognizes that it's destroying the root, and clears sParentProcessManager, leaving it null by the time NewProcessMessageManager calls 'new nsFrameMessageManager'.
Make if (!nsFrameMessageManager::sParentProcessManager) { to create
parent process mm using GetInterface?
Attachment #752350 - Attachment is obsolete: true
Attachment #752350 - Flags: feedback?(jimb)
(Reporter)

Comment 4

5 years ago
Wow, fast work!

Updated

5 years ago
Attachment #752355 - Flags: review?(josh) → review+
https://hg.mozilla.org/mozilla-central/rev/4a15bb4360f9
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.