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)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: ochameau, Assigned: ochameau)
References
Details
(Keywords: dev-doc-complete)
Attachments
(2 files, 2 obsolete files)
4.31 KB,
patch
|
ochameau
:
review+
|
Details | Diff | Splinter Review |
4.27 KB,
patch
|
Details | Diff | Splinter Review |
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)
Assignee | ||
Comment 1•11 years ago
|
||
Assignee | ||
Comment 2•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Attachment #768286 -
Attachment is obsolete: true
Assignee | ||
Comment 3•11 years ago
|
||
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+
Assignee | ||
Comment 5•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Attachment #768390 -
Attachment is obsolete: true
Assignee | ||
Comment 6•11 years ago
|
||
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+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 7•11 years ago
|
||
Comment 8•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Assignee | ||
Comment 9•11 years ago
|
||
Conflicts:
content/base/test/test_child_process_shutdown_message.html
Assignee | ||
Comment 10•11 years ago
|
||
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).
Updated•10 years ago
|
Keywords: dev-doc-needed
Comment 12•10 years ago
|
||
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)
Updated•10 years ago
|
Flags: needinfo?(trev.moz)
Comment 13•10 years ago
|
||
Yes, the documentation looks good to me - more extensive than what I expected.
Flags: needinfo?(trev.moz)
Assignee | ||
Comment 14•10 years ago
|
||
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)
Comment 15•10 years ago
|
||
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.
Keywords: dev-doc-needed → dev-doc-complete
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•