Bug 1218817 - Implement RootActor.listServiceWorkerRegistrations;r=janx
This commit is contained in:
@@ -95,6 +95,7 @@ function RootActor(aConnection, aParameters) {
|
||||
this._onTabListChanged = this.onTabListChanged.bind(this);
|
||||
this._onAddonListChanged = this.onAddonListChanged.bind(this);
|
||||
this._onWorkerListChanged = this.onWorkerListChanged.bind(this);
|
||||
this._onServiceWorkerRegistrationListChanged = this.onServiceWorkerRegistrationListChanged.bind(this);
|
||||
this._extraActors = {};
|
||||
|
||||
this._globalActorPool = new ActorPool(this.conn);
|
||||
@@ -386,6 +387,37 @@ RootActor.prototype = {
|
||||
this._parameters.workerList.onListChanged = null;
|
||||
},
|
||||
|
||||
onListServiceWorkerRegistrations: function () {
|
||||
let registrationList = this._parameters.serviceWorkerRegistrationList;
|
||||
if (!registrationList) {
|
||||
return { from: this.actorID, error: "noServiceWorkerRegistrations",
|
||||
message: "This root actor has no service worker registrations." };
|
||||
}
|
||||
|
||||
return registrationList.getList().then(actors => {
|
||||
let pool = new ActorPool(this.conn);
|
||||
for (let actor of actors) {
|
||||
pool.addActor(actor);
|
||||
}
|
||||
|
||||
this.conn.removeActorPool(this._serviceWorkerRegistrationActorPool);
|
||||
this._serviceWorkerRegistrationActorPool = pool;
|
||||
this.conn.addActorPool(this._serviceWorkerRegistrationActorPool);
|
||||
|
||||
registrationList.onListChanged = this._onServiceWorkerRegistrationListChanged;
|
||||
|
||||
return {
|
||||
"from": this.actorID,
|
||||
"registrations": actors.map(actor => actor.form())
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
onServiceWorkerRegistrationListChanged: function () {
|
||||
this.conn.send({ from: this.actorID, type: "serviceWorkerRegistrationListChanged" });
|
||||
this._parameters.serviceWorkerRegistrationList.onListChanged = null;
|
||||
},
|
||||
|
||||
onListProcesses: function () {
|
||||
let processes = [];
|
||||
for (let i = 0; i < ppmm.childCount; i++) {
|
||||
@@ -473,6 +505,7 @@ RootActor.prototype.requestTypes = {
|
||||
"getTab": RootActor.prototype.onGetTab,
|
||||
"listAddons": RootActor.prototype.onListAddons,
|
||||
"listWorkers": RootActor.prototype.onListWorkers,
|
||||
"listServiceWorkerRegistrations": RootActor.prototype.onListServiceWorkerRegistrations,
|
||||
"listProcesses": RootActor.prototype.onListProcesses,
|
||||
"getProcess": RootActor.prototype.onGetProcess,
|
||||
"echo": RootActor.prototype.onEcho,
|
||||
|
||||
@@ -12,7 +12,7 @@ var promise = require("promise");
|
||||
var { ActorPool, createExtraActors, appendExtraActors } = require("devtools/server/actors/common");
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||
var { assert } = DevToolsUtils;
|
||||
var { assert } = DevToolsUtils;
|
||||
var { TabSources } = require("./utils/TabSources");
|
||||
var makeDebugger = require("./utils/make-debugger");
|
||||
|
||||
@@ -23,6 +23,7 @@ loader.lazyRequireGetter(this, "ThreadActor", "devtools/server/actors/script", t
|
||||
loader.lazyRequireGetter(this, "unwrapDebuggerObjectGlobal", "devtools/server/actors/script", true);
|
||||
loader.lazyRequireGetter(this, "BrowserAddonActor", "devtools/server/actors/addon", true);
|
||||
loader.lazyRequireGetter(this, "WorkerActorList", "devtools/server/actors/worker", true);
|
||||
loader.lazyRequireGetter(this, "ServiceWorkerRegistrationActorList", "devtools/server/actors/worker", true);
|
||||
loader.lazyImporter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm");
|
||||
|
||||
// Assumptions on events module:
|
||||
@@ -130,6 +131,7 @@ function createRootActor(aConnection)
|
||||
tabList: new BrowserTabList(aConnection),
|
||||
addonList: new BrowserAddonList(aConnection),
|
||||
workerList: new WorkerActorList({}),
|
||||
serviceWorkerRegistrationList: new ServiceWorkerRegistrationActorList(),
|
||||
globalActorFactories: DebuggerServer.globalActorFactories,
|
||||
onShutdown: sendShutdownEvent
|
||||
});
|
||||
|
||||
@@ -160,6 +160,7 @@ const UnsolicitedNotifications = {
|
||||
"reflowActivity": "reflowActivity",
|
||||
"addonListChanged": "addonListChanged",
|
||||
"workerListChanged": "workerListChanged",
|
||||
"serviceWorkerRegistrationListChanged": "serviceWorkerRegistrationList",
|
||||
"tabNavigated": "tabNavigated",
|
||||
"frameUpdate": "frameUpdate",
|
||||
"pageError": "pageError",
|
||||
@@ -1529,6 +1530,15 @@ RootClient.prototype = {
|
||||
listWorkers: DebuggerClient.requester({ type: "listWorkers" },
|
||||
{ telemetry: "LISTWORKERS" }),
|
||||
|
||||
/**
|
||||
* List the registered service workers.
|
||||
*
|
||||
* @param function aOnResponse
|
||||
* Called with the response packet.
|
||||
*/
|
||||
listServiceWorkerRegistrations: DebuggerClient.requester({ type: "listServiceWorkerRegistrations" },
|
||||
{ telemetry: "LISTSERVICEWORKERREGISTRATIONS" }),
|
||||
|
||||
/**
|
||||
* List the running processes.
|
||||
*
|
||||
|
||||
@@ -6112,6 +6112,22 @@
|
||||
"n_buckets": "1000",
|
||||
"description": "The time (in milliseconds) that it took a 'listTabs' request to go round trip."
|
||||
},
|
||||
"DEVTOOLS_DEBUGGER_RDP_LOCAL_LISTSERVICEWORKERREGISTRATIONS_MS": {
|
||||
"alert_emails": ["dev-developer-tools@lists.mozilla.org", "ejpbruel@mozilla.com"],
|
||||
"expires_in_version": "50",
|
||||
"kind": "exponential",
|
||||
"high": "10000",
|
||||
"n_buckets": "100",
|
||||
"description": "The time (in milliseconds) that it took a 'listServiceWorkerRegistrations' request to go round trip."
|
||||
},
|
||||
"DEVTOOLS_DEBUGGER_RDP_REMOTE_LISTSERVICEWORKERREGISTRATIONS_MS": {
|
||||
"alert_emails": ["dev-developer-tools@lists.mozilla.org", "ejpbruel@mozilla.com"],
|
||||
"expires_in_version": "50",
|
||||
"kind": "exponential",
|
||||
"high": "10000",
|
||||
"n_buckets": "100",
|
||||
"description": "The time (in milliseconds) that it took a 'listServiceWorkerRegistrations' request to go round trip."
|
||||
},
|
||||
"DEVTOOLS_DEBUGGER_RDP_LOCAL_PROTOCOLDESCRIPTION_MS": {
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
|
||||
Reference in New Issue
Block a user