2014-11-29 02:40:58 +03:00
|
|
|
/* 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/. */
|
|
|
|
|
2018-07-11 20:41:27 +03:00
|
|
|
/* globals require, exports */
|
2014-11-29 02:40:58 +03:00
|
|
|
|
2018-07-11 20:41:27 +03:00
|
|
|
"use strict";
|
2017-05-25 16:32:44 +03:00
|
|
|
|
2018-07-27 16:21:29 +03:00
|
|
|
const { DebuggerServer } = require("devtools/server/main");
|
2018-07-11 20:41:27 +03:00
|
|
|
const { RootActor } = require("devtools/server/actors/root");
|
|
|
|
const { BrowserTabList } = require("devtools/server/actors/webbrowser");
|
|
|
|
const Services = require("Services");
|
2018-09-26 11:11:23 +03:00
|
|
|
const {
|
|
|
|
ActorRegistry,
|
|
|
|
} = require("devtools/server/actors/utils/actor-registry");
|
2014-11-29 02:40:58 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* xpcshell-test (XPCST) specific actors.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a root actor appropriate for use in a server running xpcshell
|
|
|
|
* tests. <snip boilerplate> :)
|
|
|
|
*/
|
2017-05-25 16:32:42 +03:00
|
|
|
function createRootActor(connection) {
|
2014-11-29 02:40:58 +03:00
|
|
|
let parameters = {
|
|
|
|
tabList: new XPCSTTabList(connection),
|
2018-09-26 11:06:43 +03:00
|
|
|
globalActorFactories: ActorRegistry.globalActorFactories,
|
2014-11-29 02:40:58 +03:00
|
|
|
onShutdown() {
|
|
|
|
// If the user never switches to the "debugger" tab we might get a
|
|
|
|
// shutdown before we've attached.
|
2017-04-14 22:51:39 +03:00
|
|
|
Services.obs.notifyObservers(null, "xpcshell-test-devtools-shutdown");
|
2018-10-19 15:55:39 +03:00
|
|
|
},
|
2014-11-29 02:40:58 +03:00
|
|
|
};
|
|
|
|
return new RootActor(connection, parameters);
|
|
|
|
}
|
2018-07-11 20:41:27 +03:00
|
|
|
exports.createRootActor = createRootActor;
|
2014-11-29 02:40:58 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A "stub" TabList implementation that provides no tabs.
|
|
|
|
*/
|
|
|
|
|
2017-05-25 16:32:42 +03:00
|
|
|
function XPCSTTabList(connection) {
|
2014-11-29 02:40:58 +03:00
|
|
|
BrowserTabList.call(this, connection);
|
|
|
|
}
|
|
|
|
|
|
|
|
XPCSTTabList.prototype = Object.create(BrowserTabList.prototype);
|
|
|
|
|
|
|
|
XPCSTTabList.prototype.constructor = XPCSTTabList;
|
|
|
|
|
|
|
|
XPCSTTabList.prototype.getList = function() {
|
|
|
|
return Promise.resolve([]);
|
|
|
|
};
|