Skip to content

Commit dc93192

Browse files
author
Erica Wright
committed
Bug 1448918 - Create about:welcome page in preparation for firstrun migration. r=dmose
MozReview-Commit-ID: L34uRsOeziS --HG-- extra : rebase_source : 9e783e9ba1a8473c8867aa9c2a87337005acbab2
1 parent 77bb637 commit dc93192

File tree

12 files changed

+32
-21
lines changed

12 files changed

+32
-21
lines changed

browser/base/content/browser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@ var gInitialPages = [
315315
"about:home",
316316
"about:privatebrowsing",
317317
"about:welcomeback",
318-
"about:sessionrestore"
318+
"about:sessionrestore",
319+
"about:welcome"
319320
];
320321

321322
function isInitialPage(url) {
@@ -1252,7 +1253,7 @@ var gBrowserInit = {
12521253
// Hack to ensure that the about:home favicon is loaded
12531254
// instantaneously, to avoid flickering and improve perceived performance.
12541255
this._callWithURIToLoad(uriToLoad => {
1255-
if (uriToLoad == "about:home") {
1256+
if (uriToLoad == "about:home" || uriToLoad == "about:newtab" || uriToLoad == "about:welcome") {
12561257
gBrowser.setIcon(gBrowser.selectedTab, "chrome://branding/content/icon32.png");
12571258
} else if (uriToLoad == "about:privatebrowsing") {
12581259
gBrowser.setIcon(gBrowser.selectedTab, "chrome://browser/skin/privatebrowsing/favicon.svg");

browser/base/content/tabbrowser.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,9 +2449,9 @@ window._gBrowser = {
24492449
throw e;
24502450
}
24512451

2452-
// Hack to ensure that the about:newtab favicon is loaded
2452+
// Hack to ensure that the about:newtab, and about:welcome favicon is loaded
24532453
// instantaneously, to avoid flickering and improve perceived performance.
2454-
if (aURI == "about:newtab") {
2454+
if (aURI == "about:newtab" || aURI == "about:home" || aURI == "about:welcome") {
24552455
this.setIcon(t, "chrome://branding/content/icon32.png");
24562456
} else if (aURI == "about:privatebrowsing") {
24572457
this.setIcon(t, "chrome://browser/skin/privatebrowsing/favicon.svg");
@@ -4501,13 +4501,14 @@ class TabProgressListener {
45014501

45024502
// Ignore initial about:blank to prevent flickering.
45034503
if (!this.mBrowser.mIconURL && !ignoreBlank) {
4504-
// Don't switch to the default icon on about:home or about:newtab,
4505-
// since these pages get their favicon set in browser code to
4506-
// improve perceived performance.
4504+
// Don't switch to the default icon on about:home, about:newtab,
4505+
// about:privatebrowsing, or about:welcome since these pages get
4506+
// their favicon set in browser code to improve perceived performance.
45074507
let isNewTab = originalLocation &&
4508-
(originalLocation.spec == "about:newtab" ||
4508+
(originalLocation.spec == "about:newtab" ||
45094509
originalLocation.spec == "about:privatebrowsing" ||
4510-
originalLocation.spec == "about:home");
4510+
originalLocation.spec == "about:home" ||
4511+
originalLocation.spec == "about:welcome");
45114512
if (!isNewTab) {
45124513
gBrowser.useDefaultIcon(this.mTab);
45134514
}

browser/base/content/utilityOverlay.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var gBidiUI = false;
4444
function isBlankPageURL(aURL) {
4545
return aURL == "about:blank" ||
4646
aURL == "about:home" ||
47+
aURL == "about:welcome" ||
4748
aURL == BROWSER_NEW_TAB_URL;
4849
}
4950

browser/components/about/AboutRedirector.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ static const RedirEntry kRedirMap[] = {
8686
// Actual activity stream URL for home and newtab are set in channel creation
8787
{ "home", "about:blank", ACTIVITY_STREAM_FLAGS | nsIAboutModule::MAKE_LINKABLE }, // Bug 1438367 to try removing MAKE_LINKABLE again
8888
{ "newtab", "about:blank", ACTIVITY_STREAM_FLAGS },
89+
{ "welcome", "about:blank",
90+
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
91+
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
92+
nsIAboutModule::ALLOW_SCRIPT },
8993
{ "library", "chrome://browser/content/aboutLibrary.xhtml",
9094
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
9195
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT },
@@ -148,9 +152,10 @@ AboutRedirector::NewChannel(nsIURI* aURI,
148152
nsAutoCString url;
149153

150154
// Let the aboutNewTabService decide where to redirect for about:home and
151-
// enabled about:newtab. Disabled about:newtab page uses fallback.
155+
// enabled about:newtab. Disabledx about:newtab page uses fallback.
152156
if (path.EqualsLiteral("home") ||
153-
(sNewTabPageEnabled && path.EqualsLiteral("newtab"))) {
157+
(sNewTabPageEnabled && path.EqualsLiteral("newtab")) ||
158+
path.EqualsLiteral("welcome")) {
154159
nsCOMPtr<nsIAboutNewTabService> aboutNewTabService =
155160
do_GetService("@mozilla.org/browser/aboutnewtab-service;1", &rv);
156161
NS_ENSURE_SUCCESS(rv, rv);

browser/components/build/nsModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
101101
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "downloads", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
102102
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "reader", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
103103
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "restartrequired", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
104+
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "welcome", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
104105
#if defined(XP_WIN)
105106
{ NS_IEHISTORYENUMERATOR_CONTRACTID, &kNS_WINIEHISTORYENUMERATOR_CID },
106107
#elif defined(XP_MACOSX)

browser/extensions/onboarding/OnboardingTelemetry.jsm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function isValidCategory(category) {
4747

4848
// Validate the page value is within the list
4949
function isValidPage(page) {
50-
return ["about:newtab", "about:home"].includes(page);
50+
return ["about:newtab", "about:home", "about:welcome"].includes(page);
5151
}
5252

5353
// Validate the tour_type value is within the list

browser/extensions/onboarding/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ And make sure the value of `browser.onboarding.tourset-verion` and `browser.onbo
1616

1717
Besides above settings, notification will wait 5 minutes before showing the first notification on a new profile or the updated user profile (to not put too much information to the user at once).
1818

19-
To manually remove the mute duration, set pref `browser.onboarding.notification.mute-duration-on-first-session-ms` to `0` and notification will be shown at the next time you open `about:home` or `about:newtab`.
19+
To manually remove the mute duration, set pref `browser.onboarding.notification.mute-duration-on-first-session-ms` to `0` and notification will be shown at the next time you open `about:home`, `about:newtab`, or `about:welcome`.
2020

2121
## How to show the snippets
2222

@@ -28,7 +28,7 @@ Snippets (the remote notification that handled by activity stream) will only be
2828

2929
During booting from `bootstrap.js`, `OnboardingTourType.jsm` will check the onboarding tour type (`new` and `update` are supported types) and set required initial states into preferences.
3030

31-
Everytime `about:home` or `about:newtab` page is opened, `onboarding.js` is injected into that page via [frame scripts](https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Message_Manager/Communicating_with_frame_scripts).
31+
Everytime `about:home`, `about:newtab`, or `about:welcome` page is opened, `onboarding.js` is injected into that page via [frame scripts](https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Message_Manager/Communicating_with_frame_scripts).
3232

3333
Then in `onboarding.js`, all tours are defined inside of `onboardingTourset` dictionary. `getTourIDList` function will load tours from proper preferences. (Check `How to change the order of tours` section for more detail).
3434

browser/extensions/onboarding/content/onboarding.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ChromeUtils.defineModuleGetter(this, "Onboarding", "resource://onboarding/Onboar
1111

1212
const ABOUT_HOME_URL = "about:home";
1313
const ABOUT_NEWTAB_URL = "about:newtab";
14+
const ABOUT_WELCOME_URL = "about:welcome";
1415

1516
// Load onboarding module only when we enable it.
1617
if (Services.prefs.getBoolPref("browser.onboarding.enabled", false)) {
@@ -21,7 +22,7 @@ if (Services.prefs.getBoolPref("browser.onboarding.enabled", false)) {
2122

2223
let window = evt.target.defaultView;
2324
let location = window.location.href;
24-
if (location == ABOUT_NEWTAB_URL || location == ABOUT_HOME_URL) {
25+
if (location == ABOUT_NEWTAB_URL || location == ABOUT_HOME_URL || location == ABOUT_WELCOME_URL) {
2526
// We just want to run tests as quickly as possible
2627
// so in the automation test, we don't do `requestIdleCallback`.
2728
if (Cu.isInAutomation) {

browser/extensions/onboarding/data_events.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ For reference, Onyx is a Mozilla owned service to serve tiles for the current ne
2020
"client_id": "374dc4d8-0cb2-4ac5-a3cf-c5a9bc3c602e",
2121
"locale": "en-US",
2222
"type": ["onboarding_session" | "overlay_session" | "notification_session"],
23-
"page": ["about:newtab" | "about:home"],
23+
"page": ["about:newtab" | "about:home" | "about:welcome"],
2424
"parent_session_id": "{45cddbeb-2bec-4f3a-bada-fb87d4b79a6c}",
2525
"root_session_id": "{45cddbeb-2bec-4f3a-bada-fb87d4b79a6c}",
2626
"session_begin": 1505440017018,
@@ -43,7 +43,7 @@ For reference, Onyx is a Mozilla owned service to serve tiles for the current ne
4343
| `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:
4444
| `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:
4545
| `locale` | The browser chrome's language (e.g. en-US). | :two:
46-
| `page` | [Required] One of ["about:newtab", "about:home"]| :one:
46+
| `page` | [Required] One of ["about:newtab", "about:home", "about:welcome"]| :one:
4747
| `parent_session_id` | [Required] The unique identifier generated by `gUUIDGenerator` service to identify this event belongs to which parent session. Events happen upon overlay will have the `overlay session uuid` as its `parent_session_id`. Events happen upon notification will have the `notification session uuid` as its `parent_session_id`. | :one:
4848
| `root_session_id` | [Required] The unique identifier generated by `gUUIDGenerator` service to identify this event belongs to which root session. Every event will have the same `onboarding session uuid` as its `root_session_id` when interact in the same tab. | :one:
4949
| `session_begin` | [Required] Timestamp in (integer) milliseconds when onboarding/overlay/notification becoming visible. | :one:
@@ -66,7 +66,7 @@ For reference, Onyx is a Mozilla owned service to serve tiles for the current ne
6666
"logo_state": ["logo" | "watermark"],
6767
"notification_impression": [1-8],
6868
"notification_state": ["show" | "hide" | "finished"],
69-
"page": ["about:newtab" | "about:home"],
69+
"page": ["about:newtab" | "about:home" | "about:welcome"],
7070
"parent_session_id": "{45cddbeb-2bec-4f3a-bada-fb87d4b79a6c}",
7171
"root_session_id": "{45cddbeb-2bec-4f3a-bada-fb87d4b79a6c}",
7272
"current_tour_id": ["onboarding-tour-private-browsing" | "onboarding-tour-addons"|...], // tour ids defined in 'onboardingTourset'

browser/extensions/onboarding/jar.mn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
44

55
[features/onboarding@mozilla.org] chrome.jar:
6-
# resource://onboarding/ is referenced in about:home and about:newtab,
6+
# resource://onboarding/ is referenced in about:home about:newtab and about:welcome,
77
# so make it content-accessible.
88
% resource onboarding %content/ contentaccessible=yes
99
content/ (content/*)

0 commit comments

Comments
 (0)