Closed Bug 874592 Opened 11 years ago Closed 11 years ago

nsFrameMessageManager::NewProcessMessageManager constructs child process managers with no parent

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: jimb, Assigned: smaug)

Details

Attachments

(1 file, 1 obsolete file)

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?
Attached patch untested (obsolete) — Splinter Review
Attachment #752350 - Flags: feedback?(jimb)
Attached patch patchSplinter Review
Attachment #752355 - Flags: review?(josh)
Attachment #752350 - Attachment is obsolete: true
Attachment #752350 - Flags: feedback?(jimb)
Assignee: nobody → bugs
Wow, fast work!
Attachment #752355 - Flags: review?(josh) → review+
https://hg.mozilla.org/mozilla-central/rev/4a15bb4360f9
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: