mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-29 18:18:27 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1182537 - Use channel->ascynOpen2 in dom/security/nsCORSListenerProxy (r=sicking) (5c4b779a12) - Bug 1155758 - Make about:serviceworkers work in B2G. r=fabrice (195eca3894) - Bug 1162920 - JavaScript error at aboutServiceWorkers.js when updating the service worker. r=fabrice (2d3a831a8c) - Bug 1155153 - [e10s] about:serviceworkers should work in e10s mode. Update B2G implementation. r=baku (0d1c2999c1) - Bug 1171915 - about:serviceworkers in b2g should use originAttributes when calling ServiceWorkerManager. r=baku,fabrice (faa3725da9) - Bug 1179161 - originAttributes does not have such isInBrowser member (follow-up bug 1171915). r=ferjm (a217140ae5) - Bug 1171917 - Improve about:serviceworkers tests on b2g. r=ferjm (5fd9d2f478) - Bug 1179557 - Add userContextId to originAttributes with tests. r=bholley, r=tanvi (8ddf96d921) - Bug 1179557 - Add getters for userContextId. r=bholley, r=tanvi (ebec5f7c7e) - Bug 1174110 - The service worker still remains registered when uninstalling the service-worker-enabled application. r=fabrice (c1c93b1250) - Bug 1144689 - Allow setting manually a fetch time and modified time for cache entries. r=fabrice (8e9dd47425) - Bug 1150199 - Langpacks should not have to be privileged r=ferjm (d41af25648) - Bug 1111961 - Developer mode support r=ferjm,pauljt (9b523402ac) - Bug 1168300 - notify clear-cookiejar-data. r=sicking (7d88bff29d) - Bug 1136434 - RequestSync API should delete all the timers when a task is unregistered, r=ehsan (5f92977920) - Bug 1151082 - RequestSyncAPI - avoid infinite loop when processing pending messages, r=ehsan (b5afcd55e8) - Bug 1165787 - Use origin in RequestSyncService.jsm. r=ehsan (b6fad2bd68) - Bug 1182347 - Migrate existing code away from .cookieJar. r=sicking,r=allstars.chh (304cbfd660) - Bug 1118946 - API to provide localized properties r=ferjm,sicking (a28aecaf19) - Bug 1077168 - Cancel in-flight Webapp install jobs from windows that change location. r=myk. (d55dc8ff6d) - Bug 1150660 - Fix sendAsyncMessage() uses to not trigger warnings in dom/apps r=fabrice (b087adcc23) - Bug 1169344 - Allow server apps to restrict access to their IAC ports. r=ferjm (82c8570555) - Bug 1068400 - Fix devtools when morphing non-e10s tab into e10s one. r=jryans (55be5ccdf5) - Bug 1145049 - Prevent caching tab actors in child processes. r=jryans (1a3ee9f278) - Bug 1145049 - Stop leaking tab actors and root actor on disconnect. r=jryans (26f259b441) - Bug 1181930 - Refactoring: move the message broadcaster out of Webapps.jsm r=ferjm (b1f8bb8b6d) - Bu 1115619 - Use a preference to guarantee app permission loading to permissions.sqlite. r=fabrice (5689c459d7) - Bug 1191579 - Remove useless getAll() implementation in Webapps.jsm (74f0d6874a)
This commit is contained in:
@@ -21,28 +21,29 @@ let { TabActor } = require("devtools/server/actors/webbrowser");
|
||||
* The conection to the client.
|
||||
* @param chromeGlobal
|
||||
* The content script global holding |content| and |docShell| properties for a tab.
|
||||
* @param prefix
|
||||
* the prefix used in protocol to create IDs for each actor.
|
||||
* Used as ID identifying this particular TabActor from the parent process.
|
||||
*/
|
||||
function ContentActor(connection, chromeGlobal)
|
||||
function ContentActor(connection, chromeGlobal, prefix)
|
||||
{
|
||||
this._chromeGlobal = chromeGlobal;
|
||||
this._prefix = prefix;
|
||||
TabActor.call(this, connection, chromeGlobal);
|
||||
this.traits.reconfigure = false;
|
||||
this._sendForm = this._sendForm.bind(this);
|
||||
this._chromeGlobal.addMessageListener("debug:form", this._sendForm);
|
||||
|
||||
Object.defineProperty(this, "docShell", {
|
||||
value: this._chromeGlobal.docShell,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
|
||||
ContentActor.prototype = Object.create(TabActor.prototype);
|
||||
|
||||
ContentActor.prototype.constructor = ContentActor;
|
||||
|
||||
Object.defineProperty(ContentActor.prototype, "docShell", {
|
||||
get: function() {
|
||||
return this._chromeGlobal.docShell;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(ContentActor.prototype, "title", {
|
||||
get: function() {
|
||||
return this.window.document.title;
|
||||
@@ -52,32 +53,11 @@ Object.defineProperty(ContentActor.prototype, "title", {
|
||||
});
|
||||
|
||||
ContentActor.prototype.exit = function() {
|
||||
this._chromeGlobal.removeMessageListener("debug:form", this._sendForm);
|
||||
this._sendForm = null;
|
||||
TabActor.prototype.exit.call(this);
|
||||
};
|
||||
|
||||
// Override form just to rename this._tabActorPool to this._tabActorPool2
|
||||
// in order to prevent it to be cleaned on detach.
|
||||
// We have to keep tab actors alive as we keep the ContentActor
|
||||
// alive after detach and reuse it for multiple debug sessions.
|
||||
ContentActor.prototype.form = function () {
|
||||
let response = {
|
||||
"actor": this.actorID,
|
||||
"title": this.title,
|
||||
"url": this.url
|
||||
};
|
||||
|
||||
// Walk over tab actors added by extensions and add them to a new ActorPool.
|
||||
let actorPool = new ActorPool(this.conn);
|
||||
this._createExtraActors(DebuggerServer.tabActorFactories, actorPool);
|
||||
if (!actorPool.isEmpty()) {
|
||||
this._tabActorPool2 = actorPool;
|
||||
this.conn.addActorPool(this._tabActorPool2);
|
||||
if (this._sendForm) {
|
||||
this._chromeGlobal.removeMessageListener("debug:form", this._sendForm);
|
||||
this._sendForm = null;
|
||||
}
|
||||
|
||||
this._appendExtraActors(response);
|
||||
return response;
|
||||
return TabActor.prototype.exit.call(this);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -111,7 +111,7 @@ const DirectorRegistry = exports.DirectorRegistry = {
|
||||
|
||||
let gTrackedMessageManager = new Set();
|
||||
|
||||
exports.setupParentProcess = function setupParentProcess({mm, childID}) {
|
||||
exports.setupParentProcess = function setupParentProcess({mm, prefix}) {
|
||||
// prevents multiple subscriptions on the same messagemanager
|
||||
if (gTrackedMessageManager.has(mm)) {
|
||||
return;
|
||||
@@ -121,7 +121,7 @@ exports.setupParentProcess = function setupParentProcess({mm, childID}) {
|
||||
// listen for director-script requests from the child process
|
||||
mm.addMessageListener("debug:director-registry-request", handleChildRequest);
|
||||
|
||||
DebuggerServer.once("disconnected-from-child:" + childID, handleMessageManagerDisconnected);
|
||||
DebuggerServer.once("disconnected-from-child:" + prefix, handleMessageManagerDisconnected);
|
||||
|
||||
/* parent process helpers */
|
||||
|
||||
|
||||
@@ -196,6 +196,11 @@ RootActor.prototype = {
|
||||
this._parameters.onShutdown();
|
||||
}
|
||||
this._extraActors = null;
|
||||
this.conn = null;
|
||||
this._tabActorPool = null;
|
||||
this._globalActorPool = null;
|
||||
this._parameters = null;
|
||||
this._chromeActor = null;
|
||||
},
|
||||
|
||||
/* The 'listTabs' request and the 'tabListChanged' notification. */
|
||||
|
||||
@@ -212,10 +212,14 @@ function WebappsActor(aConnection) {
|
||||
Cu.import("resource://gre/modules/Webapps.jsm");
|
||||
Cu.import("resource://gre/modules/AppsUtils.jsm");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/MessageBroadcaster.jsm");
|
||||
|
||||
// Keep reference of already created app actors.
|
||||
// key: app frame message manager, value: ContentActor's grip() value
|
||||
this._appActorsMap = new Map();
|
||||
this.appsChild = {};
|
||||
Cu.import("resource://gre/modules/AppsServiceChild.jsm", this.appsChild);
|
||||
|
||||
// Keep reference of already connected app processes.
|
||||
// values: app frame message manager
|
||||
this._connectedApps = new Set();
|
||||
|
||||
this.conn = aConnection;
|
||||
this._uploads = [];
|
||||
@@ -289,17 +293,17 @@ WebappsActor.prototype = {
|
||||
// Needed to evict manifest cache on content side
|
||||
// (has to be dispatched first, otherwise other messages like
|
||||
// Install:Return:OK are going to use old manifest version)
|
||||
reg.broadcastMessage("Webapps:UpdateState", {
|
||||
MessageBroadcaster.broadcastMessage("Webapps:UpdateState", {
|
||||
app: aApp,
|
||||
manifest: manifest,
|
||||
id: aApp.id
|
||||
});
|
||||
reg.broadcastMessage("Webapps:FireEvent", {
|
||||
MessageBroadcaster.broadcastMessage("Webapps:FireEvent", {
|
||||
eventType: ["downloadsuccess", "downloadapplied"],
|
||||
manifestURL: aApp.manifestURL
|
||||
});
|
||||
reg.broadcastMessage("Webapps:AddApp", { id: aId, app: aApp });
|
||||
reg.broadcastMessage("Webapps:Install:Return:OK", {
|
||||
MessageBroadcaster.broadcastMessage("Webapps:AddApp", { id: aId, app: aApp });
|
||||
MessageBroadcaster.broadcastMessage("Webapps:Install:Return:OK", {
|
||||
app: aApp,
|
||||
oid: "foo",
|
||||
requestID: "bar"
|
||||
@@ -687,8 +691,7 @@ WebappsActor.prototype = {
|
||||
debug("getAll");
|
||||
|
||||
let deferred = promise.defer();
|
||||
let reg = DOMApplicationRegistry;
|
||||
reg.getAll(apps => {
|
||||
this.appsChild.DOMApplicationRegistry.getAll(apps => {
|
||||
deferred.resolve({ apps: this._filterAllowedApps(apps) });
|
||||
});
|
||||
|
||||
@@ -960,24 +963,33 @@ WebappsActor.prototype = {
|
||||
|
||||
// Only create a new actor, if we haven't already
|
||||
// instanciated one for this connection.
|
||||
let map = this._appActorsMap;
|
||||
let set = this._connectedApps;
|
||||
let mm = appFrame.QueryInterface(Ci.nsIFrameLoaderOwner)
|
||||
.frameLoader
|
||||
.messageManager;
|
||||
let actor = map.get(mm);
|
||||
if (!actor) {
|
||||
if (!set.has(mm)) {
|
||||
let onConnect = actor => {
|
||||
map.set(mm, actor);
|
||||
set.add(mm);
|
||||
return { actor: actor };
|
||||
};
|
||||
let onDisconnect = mm => {
|
||||
map.delete(mm);
|
||||
set.delete(mm);
|
||||
};
|
||||
return DebuggerServer.connectToChild(this.conn, appFrame, onDisconnect)
|
||||
.then(onConnect);
|
||||
}
|
||||
|
||||
return { actor: actor };
|
||||
// We have to update the form as it may have changed
|
||||
// if we detached the TabActor
|
||||
let deferred = promise.defer();
|
||||
let onFormUpdate = msg => {
|
||||
mm.removeMessageListener("debug:form", onFormUpdate);
|
||||
deferred.resolve({ actor: msg.json });
|
||||
};
|
||||
mm.addMessageListener("debug:form", onFormUpdate);
|
||||
mm.sendAsyncMessage("debug:form");
|
||||
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
watchApps: function () {
|
||||
|
||||
@@ -799,10 +799,7 @@ TabActor.prototype = {
|
||||
* Called when the actor is removed from the connection.
|
||||
*/
|
||||
disconnect: function BTA_disconnect() {
|
||||
this._detach();
|
||||
this._extraActors = null;
|
||||
this._styleSheetActors.clear();
|
||||
this._exited = true;
|
||||
this.exit();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -824,6 +821,14 @@ TabActor.prototype = {
|
||||
type: "tabDetached" });
|
||||
}
|
||||
|
||||
Object.defineProperty(this, "docShell", {
|
||||
value: null,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
this._extraActors = null;
|
||||
this._styleSheetActors.clear();
|
||||
|
||||
this._exited = true;
|
||||
},
|
||||
|
||||
@@ -1635,24 +1640,17 @@ function BrowserTabActor(aConnection, aBrowser, aTabBrowser)
|
||||
TabActor.call(this, aConnection, aBrowser);
|
||||
this._browser = aBrowser;
|
||||
this._tabbrowser = aTabBrowser;
|
||||
|
||||
Object.defineProperty(this, "docShell", {
|
||||
value: this._browser.docShell,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
|
||||
BrowserTabActor.prototype = Object.create(TabActor.prototype);
|
||||
|
||||
BrowserTabActor.prototype.constructor = BrowserTabActor;
|
||||
|
||||
Object.defineProperty(BrowserTabActor.prototype, "docShell", {
|
||||
get: function() {
|
||||
if (this._browser) {
|
||||
return this._browser.docShell;
|
||||
}
|
||||
// The tab is closed.
|
||||
return null;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Object.defineProperty(BrowserTabActor.prototype, "title", {
|
||||
get: function() {
|
||||
// On Fennec, we can check the session store data for zombie tabs
|
||||
@@ -1735,7 +1733,10 @@ function RemoteBrowserTabActor(aConnection, aBrowser)
|
||||
|
||||
RemoteBrowserTabActor.prototype = {
|
||||
connect: function() {
|
||||
let connect = DebuggerServer.connectToChild(this._conn, this._browser);
|
||||
let onDestroy = () => {
|
||||
this._form = null;
|
||||
};
|
||||
let connect = DebuggerServer.connectToChild(this._conn, this._browser, onDestroy);
|
||||
return connect.then(form => {
|
||||
this._form = form;
|
||||
return this;
|
||||
@@ -1748,15 +1749,21 @@ RemoteBrowserTabActor.prototype = {
|
||||
},
|
||||
|
||||
update: function() {
|
||||
let deferred = promise.defer();
|
||||
let onFormUpdate = msg => {
|
||||
this._mm.removeMessageListener("debug:form", onFormUpdate);
|
||||
this._form = msg.json;
|
||||
deferred.resolve(this);
|
||||
};
|
||||
this._mm.addMessageListener("debug:form", onFormUpdate);
|
||||
this._mm.sendAsyncMessage("debug:form");
|
||||
return deferred.promise;
|
||||
// If the child happens to be crashed/close/detach, it won't have _form set,
|
||||
// so only request form update if some code is still listening on the other side.
|
||||
if (this._form) {
|
||||
let deferred = promise.defer();
|
||||
let onFormUpdate = msg => {
|
||||
this._mm.removeMessageListener("debug:form", onFormUpdate);
|
||||
this._form = msg.json;
|
||||
deferred.resolve(this);
|
||||
};
|
||||
this._mm.addMessageListener("debug:form", onFormUpdate);
|
||||
this._mm.sendAsyncMessage("debug:form");
|
||||
return deferred.promise;
|
||||
} else {
|
||||
return this.connect();
|
||||
}
|
||||
},
|
||||
|
||||
form: function() {
|
||||
|
||||
@@ -17,10 +17,6 @@ let chromeGlobal = this;
|
||||
const { dumpn } = DevToolsUtils;
|
||||
const { DebuggerServer, ActorPool } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
|
||||
|
||||
if (!DebuggerServer.childID) {
|
||||
DebuggerServer.childID = 1;
|
||||
}
|
||||
|
||||
if (!DebuggerServer.initialized) {
|
||||
DebuggerServer.init();
|
||||
|
||||
@@ -44,17 +40,16 @@ let chromeGlobal = this;
|
||||
|
||||
let mm = msg.target;
|
||||
let prefix = msg.data.prefix;
|
||||
let id = DebuggerServer.childID++;
|
||||
|
||||
let conn = DebuggerServer.connectToParent(prefix, mm);
|
||||
connections.set(id, conn);
|
||||
connections.set(prefix, conn);
|
||||
|
||||
let actor = new DebuggerServer.ContentActor(conn, chromeGlobal);
|
||||
let actor = new DebuggerServer.ContentActor(conn, chromeGlobal, prefix);
|
||||
let actorPool = new ActorPool(conn);
|
||||
actorPool.addActor(actor);
|
||||
conn.addActorPool(actorPool);
|
||||
|
||||
sendAsyncMessage("debug:actor", {actor: actor.form(), childID: id});
|
||||
sendAsyncMessage("debug:actor", {actor: actor.form(), prefix: prefix});
|
||||
});
|
||||
|
||||
addMessageListener("debug:connect", onConnect);
|
||||
@@ -95,11 +90,11 @@ let chromeGlobal = this;
|
||||
// Call DebuggerServerConnection.close to destroy all child actors
|
||||
// (It should end up calling DebuggerServerConnection.onClosed
|
||||
// that would actually cleanup all actor pools)
|
||||
let childID = msg.data.childID;
|
||||
let conn = connections.get(childID);
|
||||
let prefix = msg.data.prefix;
|
||||
let conn = connections.get(prefix);
|
||||
if (conn) {
|
||||
conn.close();
|
||||
connections.delete(childID);
|
||||
connections.delete(prefix);
|
||||
}
|
||||
});
|
||||
addMessageListener("debug:disconnect", onDisconnect);
|
||||
|
||||
@@ -76,7 +76,7 @@ connected to the child process as parameter, e.g. in the **director-registry**:
|
||||
|
||||
let gTrackedMessageManager = new Set();
|
||||
|
||||
exports.setupParentProcess = function setupParentProcess({ mm, childID }) {
|
||||
exports.setupParentProcess = function setupParentProcess({ mm, prefix }) {
|
||||
if (gTrackedMessageManager.has(mm)) { return; }
|
||||
gTrackedMessageManager.add(mm);
|
||||
|
||||
@@ -84,7 +84,7 @@ exports.setupParentProcess = function setupParentProcess({ mm, childID }) {
|
||||
mm.addMessageListener("debug:director-registry-request", handleChildRequest);
|
||||
|
||||
// time to unsubscribe from the disconnected message manager
|
||||
DebuggerServer.once("disconnected-from-child:" + childID, handleMessageManagerDisconnected);
|
||||
DebuggerServer.once("disconnected-from-child:" + prefix, handleMessageManagerDisconnected);
|
||||
|
||||
function handleMessageManagerDisconnected(evt, { mm: disconnected_mm }) {
|
||||
...
|
||||
@@ -109,8 +109,8 @@ In the child process:
|
||||
In the parent process:
|
||||
- The DebuggerServer receives the DebuggerServer.setupInParent request
|
||||
- it tries to load the required module
|
||||
- it tries to call the **mod[setupParent]** method with the frame message manager and the childID
|
||||
in the json parameter **{ mm, childID }**
|
||||
- it tries to call the **mod[setupParent]** method with the frame message manager and the prefix
|
||||
in the json parameter **{ mm, prefix }**
|
||||
- the module setupParent helper use the mm to subscribe the messagemanager events
|
||||
- the module setupParent helper use the DebuggerServer object to subscribe *once* the
|
||||
**"disconnected-from-child:CHILDID"** event (needed to unsubscribe the messagemanager events)
|
||||
**"disconnected-from-child:PREFIX"** event (needed to unsubscribe the messagemanager events)
|
||||
|
||||
@@ -832,13 +832,15 @@ var DebuggerServer = {
|
||||
* The debugger server connection to use.
|
||||
* @param nsIDOMElement aFrame
|
||||
* The browser element that holds the child process.
|
||||
* @param function [aOnDisconnect]
|
||||
* Optional function to invoke when the child is disconnected.
|
||||
* @param function [aOnDestroy]
|
||||
* Optional function to invoke when the child process closes
|
||||
* or the connection shuts down. (Need to forget about the
|
||||
* related TabActor)
|
||||
* @return object
|
||||
* A promise object that is resolved once the connection is
|
||||
* established.
|
||||
*/
|
||||
connectToChild: function(aConnection, aFrame, aOnDisconnect) {
|
||||
connectToChild: function(aConnection, aFrame, aOnDestroy) {
|
||||
let deferred = defer();
|
||||
|
||||
let mm = aFrame.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader
|
||||
@@ -847,7 +849,6 @@ var DebuggerServer = {
|
||||
|
||||
let actor, childTransport;
|
||||
let prefix = aConnection.allocID("child");
|
||||
let childID = null;
|
||||
let netMonitor = null;
|
||||
|
||||
// provides hook to actor modules that need to exchange messages
|
||||
@@ -864,7 +865,7 @@ var DebuggerServer = {
|
||||
return false;
|
||||
}
|
||||
|
||||
m[setupParent]({ mm: mm, childID: childID });
|
||||
m[setupParent]({ mm: mm, prefix: prefix });
|
||||
|
||||
return true;
|
||||
} catch(e) {
|
||||
@@ -878,10 +879,11 @@ var DebuggerServer = {
|
||||
mm.addMessageListener("debug:setup-in-parent", onSetupInParent);
|
||||
|
||||
let onActorCreated = DevToolsUtils.makeInfallible(function (msg) {
|
||||
if (msg.json.prefix != prefix) {
|
||||
return;
|
||||
}
|
||||
mm.removeMessageListener("debug:actor", onActorCreated);
|
||||
|
||||
childID = msg.json.childID;
|
||||
|
||||
// Pipe Debugger message from/to parent/child via the message manager
|
||||
childTransport = new ChildDebuggerTransport(mm, prefix);
|
||||
childTransport.hooks = {
|
||||
@@ -905,70 +907,65 @@ var DebuggerServer = {
|
||||
}).bind(this);
|
||||
mm.addMessageListener("debug:actor", onActorCreated);
|
||||
|
||||
let onMessageManagerClose = DevToolsUtils.makeInfallible(function (subject, topic, data) {
|
||||
if (subject == mm) {
|
||||
Services.obs.removeObserver(onMessageManagerClose, topic);
|
||||
let destroy = DevToolsUtils.makeInfallible(function () {
|
||||
// provides hook to actor modules that need to exchange messages
|
||||
// between e10s parent and child processes
|
||||
DebuggerServer.emit("disconnected-from-child:" + prefix, { mm: mm, prefix: prefix });
|
||||
|
||||
// provides hook to actor modules that need to exchange messages
|
||||
// between e10s parent and child processes
|
||||
this.emit("disconnected-from-child:" + childID, { mm: mm, childID: childID });
|
||||
|
||||
mm.removeMessageListener("debug:setup-in-parent", onSetupInParent);
|
||||
|
||||
if (childTransport) {
|
||||
// If we have a child transport, the actor has already
|
||||
// been created. We need to stop using this message manager.
|
||||
childTransport.close();
|
||||
childTransport = null;
|
||||
aConnection.cancelForwarding(prefix);
|
||||
|
||||
// ... and notify the child process to clean the tab actors.
|
||||
mm.sendAsyncMessage("debug:disconnect", { childID: childID });
|
||||
} else {
|
||||
// Otherwise, the app has been closed before the actor
|
||||
// had a chance to be created, so we are not able to create
|
||||
// the actor.
|
||||
deferred.resolve(null);
|
||||
}
|
||||
if (actor) {
|
||||
// The ContentActor within the child process doesn't necessary
|
||||
// have to time to uninitialize itself when the app is closed/killed.
|
||||
// So ensure telling the client that the related actor is detached.
|
||||
aConnection.send({ from: actor.actor, type: "tabDetached" });
|
||||
actor = null;
|
||||
}
|
||||
|
||||
if (netMonitor) {
|
||||
netMonitor.destroy();
|
||||
netMonitor = null;
|
||||
}
|
||||
|
||||
if (aOnDisconnect) {
|
||||
aOnDisconnect(mm);
|
||||
}
|
||||
}
|
||||
}).bind(this);
|
||||
Services.obs.addObserver(onMessageManagerClose,
|
||||
"message-manager-close", false);
|
||||
|
||||
events.once(aConnection, "closed", () => {
|
||||
if (childTransport) {
|
||||
// When the client disconnects, we have to unplug the dedicated
|
||||
// ChildDebuggerTransport...
|
||||
// If we have a child transport, the actor has already
|
||||
// been created. We need to stop using this message manager.
|
||||
childTransport.close();
|
||||
childTransport = null;
|
||||
aConnection.cancelForwarding(prefix);
|
||||
|
||||
// ... and notify the child process to clean the tab actors.
|
||||
mm.sendAsyncMessage("debug:disconnect", { childID: childID });
|
||||
|
||||
if (netMonitor) {
|
||||
netMonitor.destroy();
|
||||
netMonitor = null;
|
||||
}
|
||||
mm.sendAsyncMessage("debug:disconnect", { prefix: prefix });
|
||||
} else {
|
||||
// Otherwise, the app has been closed before the actor
|
||||
// had a chance to be created, so we are not able to create
|
||||
// the actor.
|
||||
deferred.resolve(null);
|
||||
}
|
||||
if (actor) {
|
||||
// The ContentActor within the child process doesn't necessary
|
||||
// have time to uninitialize itself when the app is closed/killed.
|
||||
// So ensure telling the client that the related actor is detached.
|
||||
aConnection.send({ from: actor.actor, type: "tabDetached" });
|
||||
actor = null;
|
||||
}
|
||||
|
||||
if (netMonitor) {
|
||||
netMonitor.destroy();
|
||||
netMonitor = null;
|
||||
}
|
||||
|
||||
if (aOnDestroy) {
|
||||
aOnDestroy(mm);
|
||||
}
|
||||
|
||||
// Cleanup all listeners
|
||||
Services.obs.removeObserver(onMessageManagerClose, "message-manager-close");
|
||||
mm.removeMessageListener("debug:setup-in-parent", onSetupInParent);
|
||||
if (!actor) {
|
||||
mm.removeMessageListener("debug:actor", onActorCreated);
|
||||
}
|
||||
events.off(aConnection, "closed", destroy);
|
||||
});
|
||||
|
||||
// Listen for app process exit
|
||||
let onMessageManagerClose = function (subject, topic, data) {
|
||||
if (subject == mm) {
|
||||
destroy();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(onMessageManagerClose,
|
||||
"message-manager-close", false);
|
||||
|
||||
// Listen for connection close to cleanup things
|
||||
// when user unplug the device or we lose the connection somehow.
|
||||
events.on(aConnection, "closed", destroy);
|
||||
|
||||
mm.sendAsyncMessage("debug:connect", { prefix: prefix });
|
||||
|
||||
return deferred.promise;
|
||||
@@ -1576,6 +1573,8 @@ DebuggerServerConnection.prototype = {
|
||||
this._extraPools.map(function(p) { p.cleanup(); });
|
||||
this._extraPools = null;
|
||||
|
||||
this.rootActor = null;
|
||||
this._transport = null;
|
||||
DebuggerServer._connectionClosed(this);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user