mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 887781 - Send message-manager-disconnect notification event when any message manager get disconnected. r=smaug
This commit is contained in:
parent
ab9f3b6fdf
commit
fef5051523
@ -817,6 +817,13 @@ nsFrameMessageManager::RemoveFromParent()
|
||||
void
|
||||
nsFrameMessageManager::Disconnect(bool aRemoveFromParent)
|
||||
{
|
||||
if (!mDisconnected) {
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
obs->NotifyObservers(NS_ISUPPORTS_CAST(nsIContentFrameMessageManager*, this),
|
||||
"message-manager-disconnect", nullptr);
|
||||
}
|
||||
}
|
||||
if (mParentManager && aRemoveFromParent) {
|
||||
mParentManager->RemoveChildManager(this);
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ const CHILD_PROCESS_SHUTDOWN_MESSAGE = "child-process-shutdown";
|
||||
|
||||
let ppmm = SpecialPowers.Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(SpecialPowers.Ci.nsIMessageBroadcaster);
|
||||
let obs = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIObserverService);
|
||||
|
||||
/**
|
||||
* Load the example.org site in an <iframe mozbrowser>
|
||||
@ -71,7 +73,7 @@ function prepareProcess(frameMM, callback) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Expects an OOP frame's process to shut down and report three
|
||||
* Expects an OOP frame's process to shut down and report four
|
||||
* events/messages: an error event on the browser element, and a
|
||||
* 'child-process-shutdown' message on both the frame and process
|
||||
* message managers.
|
||||
@ -80,8 +82,8 @@ function expectFrameProcessShutdown(iframe, frameMM, processMM, callback) {
|
||||
let msgCount = 0;
|
||||
function countMessage() {
|
||||
msgCount += 1;
|
||||
if (msgCount == 3) {
|
||||
ok(true, "Observed all three expected events.");
|
||||
if (msgCount == 4) {
|
||||
ok(true, "Observed all four expected events.");
|
||||
callback();
|
||||
}
|
||||
};
|
||||
@ -103,6 +105,15 @@ function expectFrameProcessShutdown(iframe, frameMM, processMM, callback) {
|
||||
ok(true, "Received 'child-process-shutdown' message from frame message manager.");
|
||||
countMessage();
|
||||
});
|
||||
|
||||
obs.addObserver(function observe(subject, type, data) {
|
||||
if (subject == SpecialPowers.unwrap(processMM)) {
|
||||
obs.removeObserver(observe, "message-manager-disconnect");
|
||||
ok(true, "Received 'message-manager-disconnect' notification with " +
|
||||
"frame message manager");
|
||||
countMessage();
|
||||
}
|
||||
}, "message-manager-disconnect", false);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
|
Loading…
Reference in New Issue
Block a user