Bug 1511019 - Localize runtime name This Firefox in aboutdebugging state;r=Ola,ladybenko
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 16 Jan 2019 16:55:37 +0000
changeset 511214 0eafc7a464331f4955977d169485c24b8b57661c
parent 511213 7484d3a99bfc3de6b40f28bd1fe2c71dd456eb3f
child 511215 fb629855a3bbed86fb68cb7d2e42f9486f7f81be
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersOla, ladybenko
bugs1511019
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1511019 - Localize runtime name This Firefox in aboutdebugging state;r=Ola,ladybenko This approach forces to have a new action here, but the alternative was to create the store after initializing l10n.js, which breaks all the tests because our current helper waitForRequestsSuccess is quite fragile. Differential Revision: https://phabricator.services.mozilla.com/D16455
devtools/client/aboutdebugging-new/aboutdebugging.js
devtools/client/aboutdebugging-new/src/actions/runtimes.js
devtools/client/aboutdebugging-new/src/constants.js
devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js
devtools/client/aboutdebugging-new/tmp-locale/en-US/aboutdebugging.notftl
--- a/devtools/client/aboutdebugging-new/aboutdebugging.js
+++ b/devtools/client/aboutdebugging-new/aboutdebugging.js
@@ -52,16 +52,18 @@ const AboutDebugging = {
     this.onNetworkLocationsUpdated = this.onNetworkLocationsUpdated.bind(this);
     this.onUSBRuntimesUpdated = this.onUSBRuntimesUpdated.bind(this);
 
     this.store = configureStore();
     this.actions = bindActionCreators(actions, this.store.dispatch);
 
     await l10n.init();
 
+    this.actions.createThisFirefoxRuntime();
+
     render(
       Provider(
         {
           store: this.store,
         },
         LocalizationProvider(
           { messages: l10n.getBundles() },
           Router(
--- a/devtools/client/aboutdebugging-new/src/actions/runtimes.js
+++ b/devtools/client/aboutdebugging-new/src/actions/runtimes.js
@@ -8,16 +8,17 @@ const Actions = require("./index");
 
 const {
   getAllRuntimes,
   getCurrentRuntime,
   findRuntimeById,
 } = require("../modules/runtimes-state-helper");
 const { isSupportedDebugTarget } = require("../modules/debug-target-support");
 
+const { l10n } = require("../modules/l10n");
 const { createClientForRuntime } = require("../modules/runtime-client-factory");
 
 const { remoteClientManager } =
   require("devtools/client/shared/remote-debugging/remote-client-manager");
 
 const {
   CONNECT_RUNTIME_FAILURE,
   CONNECT_RUNTIME_START,
@@ -25,16 +26,17 @@ const {
   DEBUG_TARGETS,
   DISCONNECT_RUNTIME_FAILURE,
   DISCONNECT_RUNTIME_START,
   DISCONNECT_RUNTIME_SUCCESS,
   PAGE_TYPES,
   REMOTE_RUNTIMES_UPDATED,
   RUNTIME_PREFERENCE,
   RUNTIMES,
+  THIS_FIREFOX_RUNTIME_CREATED,
   UNWATCH_RUNTIME_FAILURE,
   UNWATCH_RUNTIME_START,
   UNWATCH_RUNTIME_SUCCESS,
   UPDATE_CONNECTION_PROMPT_SETTING_FAILURE,
   UPDATE_CONNECTION_PROMPT_SETTING_START,
   UPDATE_CONNECTION_PROMPT_SETTING_SUCCESS,
   UPDATE_RUNTIME_MULTIE10S_FAILURE,
   UPDATE_RUNTIME_MULTIE10S_START,
@@ -111,16 +113,28 @@ function connectRuntime(id) {
         },
       });
     } catch (e) {
       dispatch({ type: CONNECT_RUNTIME_FAILURE, error: e });
     }
   };
 }
 
+function createThisFirefoxRuntime() {
+  return (dispatch, getState) => {
+    const thisFirefoxRuntime = {
+      id: RUNTIMES.THIS_FIREFOX,
+      isUnknown: false,
+      name: l10n.getString("about-debugging-this-firefox-runtime-name"),
+      type: RUNTIMES.THIS_FIREFOX,
+    };
+    dispatch({ type: THIS_FIREFOX_RUNTIME_CREATED, runtime: thisFirefoxRuntime });
+  };
+}
+
 function disconnectRuntime(id) {
   return async (dispatch, getState) => {
     dispatch({ type: DISCONNECT_RUNTIME_START });
     try {
       const runtime = findRuntimeById(id, getState().runtimes);
       const { clientWrapper } = runtime.runtimeDetails;
 
       const deviceFront = await clientWrapper.getFront("device");
@@ -353,16 +367,17 @@ function removeRuntimeListeners() {
         clientWrapper.removeListener("closed", onRemoteDebuggerClientClosed);
       }
     }
   };
 }
 
 module.exports = {
   connectRuntime,
+  createThisFirefoxRuntime,
   disconnectRuntime,
   removeRuntimeListeners,
   unwatchRuntime,
   updateConnectionPromptSetting,
   updateNetworkRuntimes,
   updateUSBRuntimes,
   watchRuntime,
 };
--- a/devtools/client/aboutdebugging-new/src/constants.js
+++ b/devtools/client/aboutdebugging-new/src/constants.js
@@ -31,16 +31,17 @@ const actionTypes = {
   REQUEST_WORKERS_START: "REQUEST_WORKERS_START",
   REQUEST_WORKERS_SUCCESS: "REQUEST_WORKERS_SUCCESS",
   SELECT_PAGE_FAILURE: "SELECT_PAGE_FAILURE",
   SELECT_PAGE_START: "SELECT_PAGE_START",
   SELECT_PAGE_SUCCESS: "SELECT_PAGE_SUCCESS",
   TEMPORARY_EXTENSION_INSTALL_FAILURE: "TEMPORARY_EXTENSION_INSTALL_FAILURE",
   TEMPORARY_EXTENSION_INSTALL_START: "TEMPORARY_EXTENSION_INSTALL_START",
   TEMPORARY_EXTENSION_INSTALL_SUCCESS: "TEMPORARY_EXTENSION_INSTALL_SUCCESS",
+  THIS_FIREFOX_RUNTIME_CREATED: "THIS_FIREFOX_RUNTIME_CREATED",
   UNWATCH_RUNTIME_FAILURE: "UNWATCH_RUNTIME_FAILURE",
   UNWATCH_RUNTIME_START: "UNWATCH_RUNTIME_START",
   UNWATCH_RUNTIME_SUCCESS: "UNWATCH_RUNTIME_SUCCESS",
   UPDATE_CONNECTION_PROMPT_SETTING_FAILURE: "UPDATE_CONNECTION_PROMPT_SETTING_FAILURE",
   UPDATE_CONNECTION_PROMPT_SETTING_START: "UPDATE_CONNECTION_PROMPT_SETTING_START",
   UPDATE_CONNECTION_PROMPT_SETTING_SUCCESS: "UPDATE_CONNECTION_PROMPT_SETTING_SUCCESS",
   UPDATE_RUNTIME_MULTIE10S_FAILURE: "UPDATE_RUNTIME_MULTIE10S_FAILURE",
   UPDATE_RUNTIME_MULTIE10S_START: "UPDATE_RUNTIME_MULTIE10S_START",
--- a/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js
+++ b/devtools/client/aboutdebugging-new/src/reducers/runtimes-state.js
@@ -7,16 +7,17 @@
 const {
   CONNECT_RUNTIME_SUCCESS,
   DISCONNECT_RUNTIME_SUCCESS,
   RUNTIMES,
   UNWATCH_RUNTIME_SUCCESS,
   UPDATE_CONNECTION_PROMPT_SETTING_SUCCESS,
   UPDATE_RUNTIME_MULTIE10S_SUCCESS,
   REMOTE_RUNTIMES_UPDATED,
+  THIS_FIREFOX_RUNTIME_CREATED,
   WATCH_RUNTIME_SUCCESS,
 } = require("../constants");
 
 const {
   findRuntimeById,
 } = require("../modules/runtimes-state-helper");
 
 const { remoteClientManager } =
@@ -28,22 +29,20 @@ const TYPE_TO_RUNTIMES_KEY = {
   [RUNTIMES.NETWORK]: "networkRuntimes",
   [RUNTIMES.USB]: "usbRuntimes",
 };
 
 function RuntimesState() {
   return {
     networkRuntimes: [],
     selectedRuntimeId: null,
-    thisFirefoxRuntimes: [{
-      id: RUNTIMES.THIS_FIREFOX,
-      isUnknown: false,
-      name: "This Firefox",
-      type: RUNTIMES.THIS_FIREFOX,
-    }],
+    // "This Firefox" runtimes is an array for consistency, but it should only contain one
+    // runtime. This runtime will be added after initializing the application via
+    // THIS_FIREFOX_RUNTIME_CREATED.
+    thisFirefoxRuntimes: [],
     usbRuntimes: [],
   };
 }
 
 /**
  * Update the runtime matching the provided runtimeId with the content of updatedRuntime,
  * and return the new state.
  *
@@ -110,16 +109,23 @@ function runtimesReducer(state = Runtime
     case REMOTE_RUNTIMES_UPDATED: {
       const { runtimes, runtimeType } = action;
       const key = TYPE_TO_RUNTIMES_KEY[runtimeType];
       return Object.assign({}, state, {
         [key]: runtimes,
       });
     }
 
+    case THIS_FIREFOX_RUNTIME_CREATED: {
+      const { runtime } = action;
+      return Object.assign({}, state, {
+        thisFirefoxRuntimes: [runtime],
+      });
+    }
+
     case WATCH_RUNTIME_SUCCESS: {
       const { id } = action.runtime;
       return Object.assign({}, state, { selectedRuntimeId: id });
     }
 
     default:
       return state;
   }
--- a/devtools/client/aboutdebugging-new/tmp-locale/en-US/aboutdebugging.notftl
+++ b/devtools/client/aboutdebugging-new/tmp-locale/en-US/aboutdebugging.notftl
@@ -1,18 +1,25 @@
 # 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/.
 
 ### These strings are used inside the about:debugging panel which is available
 ### by setting the preference `devtools.aboutdebugging.new-enabled` to true.
 
+# Display name of the runtime "This Firefox". Reused as the sidebar name for This Firefox
+# (about-debugging-sidebar-this-firefox.name). Not displayed elsewhere in the application
+# at the moment.
+# This should the same string as the part outside of the parentheses in toolbox.properties
+# toolbox.debugTargetInfo.runtimeLabel.thisFirefox. See 1520525.
+about-debugging-this-firefox-runtime-name = This Firefox
+
 # Sidebar heading for selecting the currently running instance of Firefox
 about-debugging-sidebar-this-firefox =
-  .name = This Firefox
+  .name = { about-debugging-this-firefox-runtime-name }
 
 # Sidebar heading for connecting to some remote source
 about-debugging-sidebar-connect =
   .name = Connect
 
 # Text displayed in the about:debugging sidebar when USB devices discovery is enabled.
 about-debugging-sidebar-usb-enabled = USB devices enabled
 
@@ -243,18 +250,18 @@ about-debugging-connection-prompt-enable
 # "devtools.debugger.prompt-connection" is true on the target runtime.
 about-debugging-connection-prompt-disable-button = Disable connection prompt
 
 # Title of the application displayed in the tab
 -application-title = Debugging
 
 # Page title of connect / runtime page
 # Part of "about-debugging-page-title" string defined below
-about-debugging-page-title-selected-page = 
-  { $selectedPage -> 
+about-debugging-page-title-selected-page =
+  { $selectedPage ->
      [connect] Connect
      *[runtime] Runtime
   }
 
 # Page title with the runtime displayed in the tab
 about-debugging-page-title-with-runtime = { -application-title } - { about-debugging-page-title-selected-page } / { $selectedRuntime }
 
 # Page title without the runtime displayed in the tab