зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1412761 - copy editing;r=Fischer
MozReview-Commit-ID: LDZFo94cMNZ --HG-- extra : rebase_source : 08092941d743679ed54a5e849af575e699310d67
This commit is contained in:
Родитель
a7374bf64f
Коммит
aeed887beb
|
@ -43,12 +43,12 @@ 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
|
||||
**/
|
||||
|
|
|
@ -31,7 +31,7 @@ const ICON_STATE_DEFAULT = "default";
|
|||
* "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",
|
||||
|
@ -372,7 +372,7 @@ class Onboarding {
|
|||
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");
|
||||
|
@ -397,7 +397,7 @@ class Onboarding {
|
|||
|
||||
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());
|
||||
|
||||
|
@ -468,7 +468,7 @@ class Onboarding {
|
|||
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) {
|
||||
|
@ -595,9 +595,12 @@ class Onboarding {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -633,7 +636,7 @@ class Onboarding {
|
|||
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;
|
||||
|
@ -770,20 +773,20 @@ class Onboarding {
|
|||
[...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;
|
||||
|
@ -814,10 +817,10 @@ class Onboarding {
|
|||
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,
|
||||
|
@ -1006,7 +1009,7 @@ class Onboarding {
|
|||
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();
|
||||
}
|
||||
|
@ -1242,7 +1245,7 @@ class Onboarding {
|
|||
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);
|
||||
}
|
||||
|
@ -1299,7 +1302,7 @@ if (Services.prefs.getBoolPref("browser.onboarding.enabled", false)) {
|
|||
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);
|
||||
|
|
|
@ -66,15 +66,15 @@ For reference, Onyx is a Mozilla owned service to serve tiles for the current ne
|
|||
|-----|-------------|:-----:|
|
||||
| `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:
|
||||
|
@ -96,27 +96,26 @@ Here are all allowed `event` strings that defined in `OnboardingTelemetry::EVENT
|
|||
|-----------|---------------------|
|
||||
| `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 |
|
||||
|
|
Загрузка…
Ссылка в новой задаче