Bug 1619221 - Remove service-workers-debug-helper and check isParentIntercept in device actor r=ladybenko,daisuke

Depends on D81344

If we only care about isParentInterceptEnabled, a dedicated module should no longer be relevant.

Differential Revision: https://phabricator.services.mozilla.com/D81346
This commit is contained in:
Julian Descottes 2020-07-07 15:21:54 +00:00
Родитель 17460eb5c7
Коммит e897d9edf5
3 изменённых файлов: 12 добавлений и 49 удалений

Просмотреть файл

@ -8,10 +8,14 @@ const { Ci, Cc } = require("chrome");
const Services = require("Services");
const protocol = require("devtools/shared/protocol");
const { LongStringActor } = require("devtools/server/actors/string");
const {
canDebugServiceWorkers,
isParentInterceptEnabled,
} = require("devtools/shared/service-workers-debug-helper");
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(
this,
"swm",
"@mozilla.org/serviceworkers/manager;1",
"nsIServiceWorkerManager"
);
const { DevToolsServer } = require("devtools/server/devtools-server");
const { getSystemInfo } = require("devtools/shared/system");
@ -40,8 +44,10 @@ exports.DeviceActor = protocol.ActorClassWithSpec(deviceSpec, {
getDescription: function() {
return Object.assign({}, getSystemInfo(), {
canDebugServiceWorkers: canDebugServiceWorkers(),
isParentInterceptEnabled: isParentInterceptEnabled(),
// ServiceWorker debugging is only supported when parent-intercept is
// enabled. This cannot change at runtime, so it can be treated as a
// constant for the device.
canDebugServiceWorkers: swm.isParentInterceptEnabled(),
});
},

Просмотреть файл

@ -71,7 +71,6 @@ DevToolsModules(
'picker-constants.js',
'plural-form.js',
'protocol.js',
'service-workers-debug-helper.js',
'system.js',
'task.js',
'ThreadSafeDevToolsUtils.js',

Просмотреть файл

@ -1,42 +0,0 @@
/* 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/. */
"use strict";
const Services = require("Services");
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(
this,
"swm",
"@mozilla.org/serviceworkers/manager;1",
"nsIServiceWorkerManager"
);
/**
* This helper provides info on whether we can debug service workers or not.
* This depends both on the current multiprocess (e10s) configuration and on the
* usage of the new service worker implementation
* (dom.serviceWorkers.parent_intercept = true).
*/
function canDebugServiceWorkers() {
const isE10s = Services.appinfo.browserTabsRemoteAutostart;
const processCount = Services.appinfo.maxWebProcessCount;
const multiE10s = isE10s && processCount > 1;
const isNewSWImplementation = swm.isParentInterceptEnabled();
// When can we debug Service Workers?
// If we're running the new implementation, OR if not in multiprocess mode
return isNewSWImplementation || !multiE10s;
}
function isParentInterceptEnabled() {
return swm.isParentInterceptEnabled();
}
module.exports = {
canDebugServiceWorkers,
isParentInterceptEnabled,
};