Bug 1539344 - Part 1: share constants between about:debugging and DebugTargetInfo r=jdescottes,Ola

Differential Revision: https://phabricator.services.mozilla.com/D25374

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Belén Albeza 2019-04-08 09:18:58 +00:00
parent 4a7a96d20f
commit 5b663e7187
8 changed files with 37 additions and 23 deletions

View File

@ -57,14 +57,14 @@ function inspectDebugTarget(type, id) {
// updated so this is not an issue. On remote runtimes however, trying to inspect a
// worker a second time after closing the corresponding about:devtools-toolbox tab
// will fail. See Bug 1534201.
window.open(`about:devtools-toolbox?type=${type.toLowerCase()}&id=${id}`);
window.open(`about:devtools-toolbox?type=${type}&id=${id}`);
} else {
window.open(`about:devtools-toolbox?type=${type.toLowerCase()}&id=${id}` +
window.open(`about:devtools-toolbox?type=${type}&id=${id}` +
`&remoteId=${remoteId}`);
}
dispatch(Actions.recordTelemetryEvent("inspect", {
"target_type": type,
"target_type": type.toUpperCase(),
"runtime_type": runtime.type,
}));
};

View File

@ -4,8 +4,8 @@
"use strict";
const { CONNECTION_TYPES } =
require("devtools/client/shared/remote-debugging/remote-client-manager");
const { CONNECTION_TYPES, DEBUG_TARGET_TYPES } =
require("devtools/client/shared/remote-debugging/constants");
const actionTypes = {
ADB_ADDON_INSTALL_START: "ADB_ADDON_INSTALL_START",
@ -67,12 +67,7 @@ const actionTypes = {
WATCH_RUNTIME_SUCCESS: "WATCH_RUNTIME_SUCCESS",
};
const DEBUG_TARGETS = {
EXTENSION: "EXTENSION",
PROCESS: "PROCESS",
TAB: "TAB",
WORKER: "WORKER",
};
const DEBUG_TARGETS = DEBUG_TARGET_TYPES;
const DEBUG_TARGET_PANE = {
INSTALLED_EXTENSION: "installedExtension",

View File

@ -5,6 +5,7 @@
"use strict";
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { DEBUG_TARGETS } = require("../constants");
const extensionTargetDetails = {
// actor ID for this extention.
@ -59,8 +60,8 @@ const debugTarget = {
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
// display name for the debug target.
name: PropTypes.string.isRequired,
// one of "EXTENSION", "TAB", "WORKER".
type: PropTypes.string.isRequired,
// one of "extension", "tab", "worker", "process".
type: PropTypes.oneOf(Object.values(DEBUG_TARGETS)).isRequired,
};
exports.debugTarget = PropTypes.shape(debugTarget);

View File

@ -7,7 +7,7 @@ const { PureComponent } = require("devtools/client/shared/vendor/react");
const dom = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { CONNECTION_TYPES } =
require("devtools/client/shared/remote-debugging/remote-client-manager");
require("devtools/client/shared/remote-debugging/constants");
/**
* This is header that should be displayed on top of the toolbox when using

View File

@ -10,7 +10,7 @@
const renderer = require("react-test-renderer");
const React = require("devtools/client/shared/vendor/react");
const DebugTargetInfo = React.createFactory(require("devtools/client/framework/components/DebugTargetInfo"));
const { CONNECTION_TYPES } = require("devtools/client/shared/remote-debugging/remote-client-manager");
const { CONNECTION_TYPES } = require("devtools/client/shared/remote-debugging/constants");
/**
* Stub for the L10N property expected by the DebugTargetInfo component.

View File

@ -0,0 +1,24 @@
/* 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 CONNECTION_TYPES = {
NETWORK: "network",
THIS_FIREFOX: "this-firefox",
UNKNOWN: "unknown",
USB: "usb",
};
const DEBUG_TARGET_TYPES = {
EXTENSION: "extension",
PROCESS: "process",
TAB: "tab",
WORKER: "worker",
};
module.exports = {
CONNECTION_TYPES,
DEBUG_TARGET_TYPES,
};

View File

@ -5,6 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DevToolsModules(
'constants.js',
'remote-client-manager.js',
'version-checker.js',
)

View File

@ -4,13 +4,7 @@
"use strict";
/* connection types for remote clients */
const CONNECTION_TYPES = {
NETWORK: "network",
THIS_FIREFOX: "this-firefox",
UNKNOWN: "unknown",
USB: "usb",
};
const { CONNECTION_TYPES } = require("devtools/client/shared/remote-debugging/constants");
/**
* This class is designed to be a singleton shared by all DevTools to get access to
@ -126,5 +120,4 @@ class RemoteClientManager {
// Expose a singleton of RemoteClientManager.
module.exports = {
remoteClientManager: new RemoteClientManager(),
CONNECTION_TYPES,
};