Bug 1412761 - copy editing;r=Fischer
authorFred Lin <gasolin@gmail.com>
Wed, 01 Nov 2017 09:55:09 +0800
changeset 443920 a17c2be449037a40006e9d9041cb20fca4317fcc
parent 443919 a8c72ed6284859fd0617ff09c3ad99b33e2f2ca8
child 443921 b72eaedcdfaa1154fb33e1638e4bd090375789ad
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFischer
bugs1412761
milestone58.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 1412761 - copy editing;r=Fischer MozReview-Commit-ID: LDZFo94cMNZ
browser/extensions/onboarding/bootstrap.js
browser/extensions/onboarding/content/onboarding.js
browser/extensions/onboarding/data_events.md
--- a/browser/extensions/onboarding/bootstrap.js
+++ b/browser/extensions/onboarding/bootstrap.js
@@ -38,22 +38,22 @@ const PREF_WHITELIST = [
   "onboarding-tour-singlesearch",
   "onboarding-tour-sync",
 ].forEach(tourId => PREF_WHITELIST.push([`browser.onboarding.tour.${tourId}.completed`, PREF_BOOL]));
 
 let waitingForBrowserReady = true;
 let startupData;
 
 /**
- * Set pref. Why no `getPrefs` function is due to the priviledge level.
+ * Set pref. Why no `getPrefs` function is due to the privilege level.
  * We cannot set prefs inside a framescript but can read.
- * For simplicity and effeciency, we still read prefs inside the framescript.
+ * For simplicity and efficiency, we still read prefs inside the framescript.
  *
  * @param {Array} prefs the array of prefs to set.
- *   The array element carrys info to set pref, should contain
+ *   The array element carries info to set pref, should contain
  *   - {String} name the pref name, such as `browser.onboarding.state`
  *   - {*} value the value to set
  **/
 function setPrefs(prefs) {
   prefs.forEach(pref => {
     let prefObj = PREF_WHITELIST.find(([name, ]) => name == pref.name);
     if (!prefObj) {
       return;
--- a/browser/extensions/onboarding/content/onboarding.js
+++ b/browser/extensions/onboarding/content/onboarding.js
@@ -26,17 +26,17 @@ const SPEECH_BUBBLE_NEWTOUR_STRING_ID = 
 const SPEECH_BUBBLE_UPDATETOUR_STRING_ID = "onboarding.overlay-icon-tooltip-updated2";
 const ICON_STATE_WATERMARK = "watermark";
 const ICON_STATE_DEFAULT = "default";
 /**
  * Add any number of tours, key is the tourId, value should follow the format below
  * "tourId": { // The short tour id which could be saved in pref
  *   // The unique tour id
  *   id: "onboarding-tour-addons",
- *   // (optional) mark tour as complete instantly when user enters the tour
+ *   // (optional) mark tour as complete instantly when the user enters the tour
  *   instantComplete: false,
  *   // The string id of tour name which would be displayed on the navigation bar
  *   tourNameId: "onboarding.tour-addon",
  *   // The method returing strings used on tour notification
  *   getNotificationStrings(bundle):
  *     - title: // The string of tour notification title
  *     - message: // The string of tour notification message
  *     - button: // The string of tour notification action button title
@@ -367,17 +367,17 @@ function registerNewTelemetrySession(dat
 class Onboarding {
   constructor(contentWindow) {
     this.init(contentWindow);
   }
 
   async init(contentWindow) {
     this._window = contentWindow;
     // session_key is used for telemetry to track the current tab.
-    // The number will renew after reload the page.
+    // The number will renew after reloading the page.
     this._session_key = Date.now();
     this._tours = [];
     this._tourType = Services.prefs.getStringPref("browser.onboarding.tour-type", "update");
 
     let tourIds = this._getTourIDList();
     tourIds.forEach(tourId => {
       if (onboardingTourset[tourId]) {
         this._tours.push(onboardingTourset[tourId]);
@@ -392,17 +392,17 @@ class Onboarding {
     // no flash of style changes and no additional reflow.
     await this._loadCSS();
     this._bundle = Services.strings.createBundle(BUNDLE_URI);
 
     this._loadJS(UITOUR_JS_URI);
 
     this._window.addEventListener("resize", this);
 
-    // Destroy on unload. This is to ensure we remove all the stuff we left.
+    // Destroy on unloading. This is to ensure we remove all the stuff we left.
     // No any leak out there.
     this._window.addEventListener("unload", () => this.destroy());
 
     this.uiInitialized = false;
     this._resizeTimerId =
       this._window.requestIdleCallback(() => this._resizeUI());
     registerNewTelemetrySession({
       page: this._window.location.href,
@@ -463,17 +463,17 @@ class Onboarding {
     let tours = Services.prefs.getStringPref(`browser.onboarding.${this._tourType}tour`, "");
     return tours.split(",").filter(tourId => tourId !== "").map(tourId => tourId.trim());
   }
 
   _initNotification() {
     let doc = this._window.document;
     if (doc.hidden) {
       // When the preloaded-browser feature is on,
-      // it would preload an hidden about:newtab in the background.
+      // it would preload a hidden about:newtab in the background.
       // We don't want to show notification in that hidden state.
       let onVisible = () => {
         if (!doc.hidden) {
           doc.removeEventListener("visibilitychange", onVisible);
           this.showNotification();
         }
       };
       doc.addEventListener("visibilitychange", onVisible);
@@ -590,19 +590,22 @@ class Onboarding {
         event: "overlay-cta-click",
         tour_id: activeItem.id,
         session_key: this._session_key,
       });
     }
   }
 
   /**
-   * Wrap keyboard focus within the dialog and focus on first element after last
-   * when moving forward or last element after first when moving backwards. Do
-   * nothing if focus is moving in the middle of the list of dialog's focusable
+   * Wrap keyboard focus within the dialog.
+   * When moving forward, focus on the first element when the current focused
+   * element is the last one.
+   * When moving backward, focus on the last element when the current focused
+   * element is the first one.
+   * Do nothing if focus is moving in the middle of the list of dialog's focusable
    * elements.
    *
    * @param  {DOMNode} current  currently focused element
    * @param  {Boolean} back     direction
    * @return {DOMNode}          newly focused element if any
    */
   wrapMoveFocus(current, back) {
     let elms = [...this._dialog.querySelectorAll(
@@ -628,17 +631,17 @@ class Onboarding {
         // Remember that the dialog was opened with a keyboard.
         this._overlayIcon.dataset.keyboardFocus = true;
         this.handleClick(target);
         event.preventDefault();
       }
       return;
     }
 
-    // Current focused item can be tab container if previous navigation was done
+    // Currently focused item could be tab container if previous navigation was done
     // via mouse.
     if (target.classList.contains("onboarding-tour-item-container")) {
       target = target.firstChild;
     }
     let targetIndex;
     switch (key) {
       case " ":
       case "Enter":
@@ -765,30 +768,30 @@ class Onboarding {
    */
   toggleModal(opened) {
     let { document: doc } = this._window;
     if (opened) {
       // Set aria-hidden to true for the rest of the document.
       [...doc.body.children].forEach(
         child => child.id !== "onboarding-overlay" &&
                  child.setAttribute("aria-hidden", true));
-      // When dialog is opened with the keyboard, focus on the 1st uncomplete tour
-      // because it will be the selected tour
+      // When dialog is opened with the keyboard, focus on the first
+      // uncomplete tour because it will be the selected tour.
       if (this._overlayIcon.dataset.keyboardFocus) {
         doc.getElementById(this._firstUncompleteTour.id).focus();
       } else {
-        // When dialog is opened with mouse, focus on the dialog itself to avoid
-        // visible keyboard focus styling.
+        // When the dialog is opened with the mouse, focus on the dialog
+        // itself to avoid visible keyboard focus styling.
         this._dialog.focus();
       }
     } else {
       // Remove all set aria-hidden attributes.
       [...doc.body.children].forEach(
         child => child.removeAttribute("aria-hidden"));
-      // If dialog was opened with a keyboard, set the focus back on the overlay
+      // If dialog was opened with a keyboard, set the focus back to the overlay
       // button.
       if (this._overlayIcon.dataset.keyboardFocus) {
         delete this._overlayIcon.dataset.keyboardFocus;
         this._overlayIcon.focus();
       } else {
         this._window.document.activeElement.blur();
       }
     }
@@ -809,20 +812,20 @@ class Onboarding {
         tab.classList.add("onboarding-active");
         tab.setAttribute("aria-selected", true);
         telemetry({
           event: "overlay-nav-click",
           tour_id: tourId,
           session_key: this._session_key,
         });
 
-        // some tours should completed instantly upon showing.
+        // Some tours should complete instantly upon showing.
         if (tab.getAttribute("data-instant-complete")) {
           this.setToursCompleted([tourId]);
-          // also track auto completed tour so we can filter data with the same event
+          // Also track auto-completed tour so we can filter data with the same event.
           telemetry({
             event: "overlay-cta-click",
             tour_id: tourId,
             session_key: this._session_key,
           });
         }
       } else {
         tab.classList.remove("onboarding-active");
@@ -1001,17 +1004,17 @@ class Onboarding {
       queue = [];
     }
 
     let startQueueLength = queue.length;
     // See if need to move on to the next tour
     if (queue.length > 0 && this._isTimeForNextTourNotification(lastTime)) {
       queue.shift();
     }
-    // We don't want to prompt completed tour.
+    // We don't want to prompt the completed tour.
     while (queue.length > 0 && this.isTourCompleted(queue[0])) {
       queue.shift();
     }
 
     if (queue.length == 0) {
       sendMessageToChrome("set-prefs", [
         {
           name: "browser.onboarding.notification.finished",
@@ -1237,17 +1240,17 @@ class Onboarding {
       let div = tour.getPage(this._window, this._bundle);
 
       // Do a traverse for elements in the page that need to be localized.
       let l10nElements = div.querySelectorAll("[data-l10n-id]");
       for (let i = 0; i < l10nElements.length; i++) {
         let element = l10nElements[i];
         // We always put brand short name as the first argument for it's the
         // only and frequently used arguments in our l10n case. Rewrite it if
-        // other arguments appears.
+        // other arguments appear.
         element.textContent = this._bundle.formatStringFromName(
                                 element.dataset.l10nId, [BRAND_SHORT_NAME], 1);
       }
 
       div.id = tourPanelId;
       div.classList.add("onboarding-tour-page");
       div.setAttribute("role", "tabpanel");
       div.setAttribute("aria-labelledby", tour.id);
@@ -1294,17 +1297,17 @@ if (Services.prefs.getBoolPref("browser.
   addEventListener("load", function onLoad(evt) {
     if (!content || evt.target != content.document) {
       return;
     }
 
     let window = evt.target.defaultView;
     let location = window.location.href;
     if (location == ABOUT_NEWTAB_URL || location == ABOUT_HOME_URL) {
-      // We just want to run tests as quick as possible
+      // We just want to run tests as quickly as possible
       // so in the automation test, we don't do `requestIdleCallback`.
       if (Cu.isInAutomation) {
         new Onboarding(window);
         return;
       }
       window.requestIdleCallback(() => {
         new Onboarding(window);
       });
--- a/browser/extensions/onboarding/data_events.md
+++ b/browser/extensions/onboarding/data_events.md
@@ -61,25 +61,25 @@ For reference, Onyx is a Mozilla owned s
 }
 ```
 
 
 | KEY | DESCRIPTION | &nbsp; |
 |-----|-------------|:-----:|
 | `addon_version` | [Required] The version of the Onboarding addon. | :one:
 | `category` | [Required] Either ("overlay-interactions", "notification-interactions") to identify which kind of the interaction | :one:
-| `client_id` | [Required] An identifier generated by [ClientID](https://github.com/mozilla/gecko-dev/blob/master/toolkit/modules/ClientID.jsm) module to provide an identifier for this device. Auto append by `ping-centre` module | :one:
+| `client_id` | [Required] An identifier generated by [ClientID](https://github.com/mozilla/gecko-dev/blob/master/toolkit/modules/ClientID.jsm) module to provide an identifier for this device. This data is automatically appended by `ping-centre` module | :one:
 | `event` | [Required] The type of event. allowed event strings are defined in the below section | :one:
 | `impression` | [Optional] An integer to record how many times the current notification tour is shown to the user. Each Notification tour can show not more than 8 times. We put `-1` when this field is not relevant to this event | :one:
-| `ip` | [Auto populated by Onyx] The IP address of the client. Onyx does use (with the permission) the IP address to infer user's geo information so that it could prepare the corresponding tiles for the country she lives in. However, Ping-centre will NOT store IP address in the database, where only authorized Mozilla employees can access the telemetry data, and all the raw logs are being strictly managed by the Ops team and will expire according to the Mozilla's data retention policy.| :two:
-| `locale` | The browser chrome's language (eg. en-US). | :two:
+| `ip` | [Auto populated by Onyx] The IP address of the client. Onyx does use (with the permission) the IP address to infer user's geo-information so that it could prepare the corresponding tiles for the country she lives in. However, Ping-centre will NOT store IP address in the database, where only authorized Mozilla employees can access the telemetry data, and all the raw logs are being strictly managed by the Ops team and will expire according to the Mozilla's data retention policy.| :two:
+| `locale` | The browser chrome's language (e.g. en-US). | :two:
 | `page` | [Required] One of ["about:newtab", "about:home"]| :one:
 | `session_begin` | Timestamp in (integer) milliseconds when onboarding/overlay/notification becoming visible. | :one:
 | `session_end` | Timestamp in (integer) milliseconds when onboarding/overlay/notification losing focus. | :one:
-| `session_id` | [Required] The unique identifier generated by `gUUIDGenerator` service to identify the specific user session when onboarding is inited/when overlay is opened/when notification is shown. | :one:
+| `session_id` | [Required] The unique identifier generated by `gUUIDGenerator` service to identify the specific user session when onboarding is inited/when the overlay is opened/when notification is shown. | :one:
 | `timestamp` | Timestamp in (integer) milliseconds when the event triggered | :one:
 | `tour_id` | id of the current tour. The number of open from notification can be retrieved via 'notification-cta-click event'. We put ` ` when this field is not relevant to this event | :one:
 | `tour_source` | [Required] One of ["default", "watermark"] indicates the overlay is opened while in the default or the watermark state. Open from the notification bar is counted via 'notification-cta-click event'. | :one:
 | `tour_type` | [Required] One of ["new", "update"] indicates the user is a `new` user or the `update` user upgrade from the older version | :one:
 | `ua` | [Auto populated by Onyx] The user agent string. | :two:
 | `ver` | [Auto populated by Onyx] The version of the Onyx API the ping was sent to. | :one:
 
 **Where:**
@@ -91,32 +91,31 @@ For reference, Onyx is a Mozilla owned s
 
 Here are all allowed `event` strings that defined in `OnboardingTelemetry::EVENT_WHITELIST`.
 ### Session events
 
 | EVENT | DESCRIPTION |
 |-----------|---------------------|
 | `onboarding-register-session` | internal event triggered to register a new page session. Called when the onboarding script is inited in a browser tab. Will not send out any data. |
 | `onboarding-session-begin` | internal event triggered when the onboarding script is inited, will not send out any data. |
-| `onboarding-session-end` | internal event triggered when the onboarding script is destoryed. `onboarding-session` event is sent to the server. |
-| `onboarding-session` | event is sent when the onboarding script is destoryed |
+| `onboarding-session-end` | internal event triggered when the onboarding script is destroyed. `onboarding-session` event is sent to the server. |
+| `onboarding-session` | event is sent when the onboarding script is destroyed |
 
 ### Overlay events
 
 | EVENT | DESCRIPTION |
 |-----------|---------------------|
 | `overlay-session-begin` | internal event triggered when user open the overlay, will not send out any data. |
-| `overlay-session-end` | internal event is triggered when user close the overlay. `overlay-session` event is sent to the server. |
+| `overlay-session-end` | internal event is triggered when user closes the overlay. `overlay-session` event is sent to the server. |
 | `overlay-session` | event is sent when user close the overlay |
-| `overlay-nav-click` | event is sent when click or auto select the overlay navigate item |
+| `overlay-nav-click` | event is sent when clicking or auto select the overlay navigate item |
 | `overlay-cta-click` | event is sent when user click the overlay CTA button |
-| `overlay-skip-tour` | event is sent when click the overlay `skip tour` button |
+| `overlay-skip-tour` | event is sent when clicking the overlay `skip tour` button |
 
 ### Notification events
 
 | EVENT | DESCRIPTION |
 |-----------|---------------------|
 | `notification-session-begin` | internal event triggered when user open the notification, will not send out any data. |
-| `notification-session-end` | internal event is triggered when user close the notification. `notification-session` event is sent to the server. |
-| `notification-session` | event is sent when user close the notification |
-| `notification-close-button-click` | event is sent when click the notification close button |
-| `notification-cta-click` | event is sent when click the notification CTA button |
-
+| `notification-session-end` | internal event is triggered when user closes the notification. `notification-session` event is sent to the server. |
+| `notification-session` | event is sent when user closes the notification |
+| `notification-close-button-click` | event is sent when clicking the notification close button |
+| `notification-cta-click` | event is sent when clicking the notification CTA button |