Closed Bug 887781 Opened 11 years ago Closed 11 years ago

Need event for when message manager is disconnected

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

(Keywords: dev-doc-complete)

Attachments

(2 files, 2 obsolete files)

For implementing devtools on b2g, we do have to stop using app iframe's message manager when the app is closed/crashed. There is various observer notification being sent: ipc:browser-destroyed, child-process-shutdown or ipc:content-shutdown But none of them are sent for non-OOP message managers. I haven't found any message, event or notification that would allow me to know, when I should stop listening for message and stop sending messages for a given message manager. We should have an event for that that would fire no matter if the frame is remote or not. After some prototyping and discussion with smaug, we end up suggesting to send a `message-manager-disconnected` nsIObserverService notification, from http://mxr.mozilla.org/mozilla-central/source/content/base/src/nsFrameMessageManager.cpp#808 nsFrameMessageManager::Disconnect(bool aRemoveFromParent)
Blocks: 817580
Attachment #768286 - Attachment is obsolete: true
Comment on attachment 768390 [details] [diff] [review] Send message-manager-disconnect notification event when any message manager get disconnected. Have I transcribed correctly what you explained to me on irc?
Attachment #768390 - Flags: review?(bugs)
Comment on attachment 768390 [details] [diff] [review] Send message-manager-disconnect notification event when any message manager get disconnected. ># HG changeset patch ># User Alexandre Poirot <poirot.alex@gmail.com> > >Bug 887781 - Send message-manager-disconnect notification event when any message manager get disconnected. > >diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp >index 10549d9..d9e0bc9 100644 >--- a/content/base/src/nsFrameMessageManager.cpp >+++ b/content/base/src/nsFrameMessageManager.cpp >@@ -1,15 +1,16 @@ > /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ > /* This Source Code Form is subject to the terms of the Mozilla Public > * License, v. 2.0. If a copy of the MPL was not distributed with this > * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ > > #include "base/basictypes.h" > >+ Please don't add this empty line > function expectFrameProcessShutdown(iframe, frameMM, processMM, callback) { > let msgCount = 0; > function countMessage() { > msgCount += 1; >- if (msgCount == 3) { >+ if (msgCount == 4) { > ok(true, "Observed all three expected events."); s/three/four/
Attachment #768390 - Flags: review?(bugs) → review+
Attachment #768390 - Attachment is obsolete: true
Comment on attachment 768422 [details] [diff] [review] Send message-manager-disconnect notification event when any message manager get disconnected. Carry over the r+ after having addressed review comments.
Attachment #768422 - Flags: review+
Keywords: checkin-needed
Assignee: nobody → poirot.alex
Flags: in-testsuite+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Conflicts: content/base/test/test_child_process_shutdown_message.html
Comment on attachment 771317 [details] [diff] [review] b2g18 - Send message-manager-disconnect notification event when any message manager get disconnected. Patch rebased for b2g18
Attachment #771317 - Attachment description: Send message-manager-disconnect notification event when any message manager get disconnected. → b2g18 - Send message-manager-disconnect notification event when any message manager get disconnected.
Should we perhaps take this to b2g18 so that fixing Bug 899354 would become easier (I assume one could observe the notification and oop-frameloader-crashed notification and remove the event listener if either one happens).
Depends on: 901312
Keywords: dev-doc-needed
I've had a go at some docs for this: https://developer.mozilla.org/en-US/docs/Observer_Notifications#Message_manager Alex/Wladimir, does this look all right? In particular, is the example sensible? If so, I'll add a link here from the main message manager docs.
Flags: needinfo?(poirot.alex)
Flags: needinfo?(trev.moz)
Yes, the documentation looks good to me - more extensive than what I expected.
Flags: needinfo?(trev.moz)
Thanks Will, that looks great! But I would keep Observer_notifications page simple and just list all events, so that I would move this example in a message manager related page. I imagine we already have some ?
Flags: needinfo?(poirot.alex)
I've moved the example into the main message manager article (https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/The_message_manager) - I'm thinking of reorganizing that article a bit, but that's another story. Thanks for the reviews. I'm marking this ddc, but please don't hesitate to let me know if you see anything else.
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: