зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1497447: Rename "connection" to "runtimeDetails". r=jdescottes
Depends on D9068 Differential Revision: https://phabricator.services.mozilla.com/D9216 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
39993dba21
Коммит
f520571003
|
@ -36,13 +36,13 @@ const {
|
|||
function inspectDebugTarget(type, id) {
|
||||
return async (_, getState) => {
|
||||
const runtime = getCurrentRuntime(getState().runtimes);
|
||||
const { connection, type: runtimeType } = runtime;
|
||||
const { runtimeDetails, type: runtimeType } = runtime;
|
||||
|
||||
switch (type) {
|
||||
case DEBUG_TARGETS.TAB: {
|
||||
// Open tab debugger in new window.
|
||||
if (runtimeType === RUNTIMES.NETWORK || runtimeType === RUNTIMES.USB) {
|
||||
const { host, port } = connection.transportDetails;
|
||||
const { host, port } = runtimeDetails.transportDetails;
|
||||
window.open(`about:devtools-toolbox?type=tab&id=${id}` +
|
||||
`&host=${host}&port=${port}`);
|
||||
} else if (runtimeType === RUNTIMES.THIS_FIREFOX) {
|
||||
|
@ -52,7 +52,7 @@ function inspectDebugTarget(type, id) {
|
|||
}
|
||||
case DEBUG_TARGETS.EXTENSION: {
|
||||
if (runtimeType === RUNTIMES.NETWORK) {
|
||||
await debugRemoteAddon(id, connection.client);
|
||||
await debugRemoteAddon(id, runtimeDetails.client);
|
||||
} else if (runtimeType === RUNTIMES.THIS_FIREFOX) {
|
||||
debugLocalAddon(id);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ function inspectDebugTarget(type, id) {
|
|||
}
|
||||
case DEBUG_TARGETS.WORKER: {
|
||||
// Open worker toolbox in new window.
|
||||
gDevToolsBrowser.openWorkerToolbox(connection.client, id);
|
||||
gDevToolsBrowser.openWorkerToolbox(runtimeDetails.client, id);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,13 +103,13 @@ function connectRuntime(id) {
|
|||
const preferenceFront = await client.mainRoot.getFront("preference");
|
||||
const connectionPromptEnabled =
|
||||
await preferenceFront.getBoolPref(RUNTIME_PREFERENCE.CONNECTION_PROMPT);
|
||||
const connection = { connectionPromptEnabled, client, info, transportDetails };
|
||||
const runtimeDetails = { connectionPromptEnabled, client, info, transportDetails };
|
||||
|
||||
dispatch({
|
||||
type: CONNECT_RUNTIME_SUCCESS,
|
||||
runtime: {
|
||||
id,
|
||||
connection,
|
||||
runtimeDetails,
|
||||
type: runtime.type,
|
||||
},
|
||||
});
|
||||
|
@ -124,7 +124,7 @@ function disconnectRuntime(id) {
|
|||
dispatch({ type: DISCONNECT_RUNTIME_START });
|
||||
try {
|
||||
const runtime = findRuntimeById(id, getState().runtimes);
|
||||
const client = runtime.connection.client;
|
||||
const client = runtime.runtimeDetails.client;
|
||||
|
||||
await client.close();
|
||||
DebuggerServer.destroy();
|
||||
|
@ -147,7 +147,7 @@ function updateConnectionPromptSetting(connectionPromptEnabled) {
|
|||
dispatch({ type: UPDATE_CONNECTION_PROMPT_SETTING_START });
|
||||
try {
|
||||
const runtime = getCurrentRuntime(getState().runtimes);
|
||||
const client = runtime.connection.client;
|
||||
const client = runtime.runtimeDetails.client;
|
||||
const preferenceFront = await client.mainRoot.getFront("preference");
|
||||
await preferenceFront.setBoolPref(RUNTIME_PREFERENCE.CONNECTION_PROMPT,
|
||||
connectionPromptEnabled);
|
||||
|
|
|
@ -76,14 +76,14 @@ class Sidebar extends PureComponent {
|
|||
|
||||
return runtimes.map(runtime => {
|
||||
const pageId = runtime.type + "-" + runtime.id;
|
||||
const runtimeHasConnection = !!runtime.connection;
|
||||
const runtimeHasDetails = !!runtime.runtimeDetails;
|
||||
|
||||
return SidebarRuntimeItem({
|
||||
id: pageId,
|
||||
deviceName: runtime.extra.deviceName,
|
||||
dispatch,
|
||||
icon,
|
||||
isConnected: runtimeHasConnection,
|
||||
isConnected: runtimeHasDetails,
|
||||
isSelected: selectedPage === pageId,
|
||||
key: pageId,
|
||||
name: runtime.name,
|
||||
|
|
|
@ -54,7 +54,7 @@ function debugTargetListenerMiddleware(store) {
|
|||
return next => action => {
|
||||
switch (action.type) {
|
||||
case WATCH_RUNTIME_SUCCESS: {
|
||||
const { client } = action.runtime.connection;
|
||||
const { client } = action.runtime.runtimeDetails;
|
||||
client.addListener("tabListChanged", onTabsUpdated);
|
||||
AddonManager.addAddonListener(extensionsListener);
|
||||
client.addListener("workerListChanged", onWorkersUpdated);
|
||||
|
@ -65,7 +65,7 @@ function debugTargetListenerMiddleware(store) {
|
|||
break;
|
||||
}
|
||||
case UNWATCH_RUNTIME_START: {
|
||||
const { client } = action.runtime.connection;
|
||||
const { client } = action.runtime.runtimeDetails;
|
||||
client.removeListener("tabListChanged", onTabsUpdated);
|
||||
AddonManager.removeAddonListener(extensionsListener);
|
||||
client.removeListener("workerListChanged", onWorkersUpdated);
|
||||
|
|
|
@ -11,20 +11,20 @@ function getCurrentRuntime(runtimesState) {
|
|||
exports.getCurrentRuntime = getCurrentRuntime;
|
||||
|
||||
function getCurrentClient(runtimesState) {
|
||||
const connection = getCurrentConnection(runtimesState);
|
||||
return connection ? connection.client : null;
|
||||
const runtimeDetails = getCurrentRuntimeDetails(runtimesState);
|
||||
return runtimeDetails ? runtimeDetails.client : null;
|
||||
}
|
||||
exports.getCurrentClient = getCurrentClient;
|
||||
|
||||
function getCurrentRuntimeInfo(runtimesState) {
|
||||
const connection = getCurrentConnection(runtimesState);
|
||||
return connection ? connection.info : null;
|
||||
const runtimeDetails = getCurrentRuntimeDetails(runtimesState);
|
||||
return runtimeDetails ? runtimeDetails.info : null;
|
||||
}
|
||||
exports.getCurrentRuntimeInfo = getCurrentRuntimeInfo;
|
||||
|
||||
function getCurrentConnectionPromptSetting(runtimesState) {
|
||||
const connection = getCurrentConnection(runtimesState);
|
||||
return connection ? connection.connectionPromptEnabled : false;
|
||||
const runtimeDetails = getCurrentRuntimeDetails(runtimesState);
|
||||
return runtimeDetails ? runtimeDetails.connectionPromptEnabled : false;
|
||||
}
|
||||
exports.getCurrentConnectionPromptSetting = getCurrentConnectionPromptSetting;
|
||||
|
||||
|
@ -38,7 +38,7 @@ function findRuntimeById(id, runtimesState) {
|
|||
}
|
||||
exports.findRuntimeById = findRuntimeById;
|
||||
|
||||
function getCurrentConnection(runtimesState) {
|
||||
function getCurrentRuntimeDetails(runtimesState) {
|
||||
const runtime = getCurrentRuntime(runtimesState);
|
||||
return runtime ? runtime.connection : null;
|
||||
return runtime ? runtime.runtimeDetails : null;
|
||||
}
|
||||
|
|
|
@ -70,13 +70,13 @@ function _updateRuntimeById(runtimeId, updatedRuntime, state) {
|
|||
function runtimesReducer(state = RuntimesState(), action) {
|
||||
switch (action.type) {
|
||||
case CONNECT_RUNTIME_SUCCESS: {
|
||||
const { id, connection } = action.runtime;
|
||||
return _updateRuntimeById(id, { connection }, state);
|
||||
const { id, runtimeDetails } = action.runtime;
|
||||
return _updateRuntimeById(id, { runtimeDetails }, state);
|
||||
}
|
||||
|
||||
case DISCONNECT_RUNTIME_SUCCESS: {
|
||||
const { id } = action.runtime;
|
||||
return _updateRuntimeById(id, { connection: null }, state);
|
||||
return _updateRuntimeById(id, { runtimeDetails: null }, state);
|
||||
}
|
||||
|
||||
case NETWORK_LOCATIONS_UPDATED: {
|
||||
|
@ -103,9 +103,9 @@ function runtimesReducer(state = RuntimesState(), action) {
|
|||
const { connectionPromptEnabled } = action;
|
||||
const { id: runtimeId } = action.runtime;
|
||||
const runtime = findRuntimeById(runtimeId, state);
|
||||
const connection =
|
||||
Object.assign({}, runtime.connection, { connectionPromptEnabled });
|
||||
return _updateRuntimeById(runtimeId, { connection }, state);
|
||||
const runtimeDetails =
|
||||
Object.assign({}, runtime.runtimeDetails, { connectionPromptEnabled });
|
||||
return _updateRuntimeById(runtimeId, { runtimeDetails }, state);
|
||||
}
|
||||
|
||||
case USB_RUNTIMES_UPDATED: {
|
||||
|
|
|
@ -29,7 +29,7 @@ const runtimeTransportDetails = {
|
|||
port: PropTypes.number.isRequired,
|
||||
};
|
||||
|
||||
const runtimeConnection = {
|
||||
const runtimeDetails = {
|
||||
// debugger client instance
|
||||
client: PropTypes.object.isRequired,
|
||||
|
||||
|
@ -73,7 +73,7 @@ const runtime = {
|
|||
id: PropTypes.string.isRequired,
|
||||
|
||||
// available after the connection to the runtime is established
|
||||
connection: PropTypes.shape(runtimeConnection),
|
||||
runtimeDetails: PropTypes.shape(runtimeDetails),
|
||||
|
||||
// object containing non standard properties that depend on the runtime type,
|
||||
// unavailable on this-firefox runtime
|
||||
|
|
Загрузка…
Ссылка в новой задаче