Bug 1366056 - showing v57 tourset for new user tour and update user tour;r=Fischer,mossop,rexboy

MozReview-Commit-ID: JUmPyJiNKFx

--HG--
extra : rebase_source : 0a7a603a780102ba13ebce4c49d43b9145ce13df
This commit is contained in:
gasolin 2017-08-14 14:30:46 +08:00
Родитель 38ce1ea2a0
Коммит 64c7e01a30
12 изменённых файлов: 81 добавлений и 110 удалений

Просмотреть файл

@ -1705,7 +1705,7 @@ pref("browser.suppress_first_window_animation", true);
// Preferences for Photon onboarding system extension
pref("browser.onboarding.enabled", true);
// Mark this as an upgraded profile so we don't offer the initial new user onboarding tour.
pref("browser.onboarding.tourset-version", 1);
pref("browser.onboarding.tourset-version", 2);
pref("browser.onboarding.hidden", false);
// On the Activity-Stream page, the snippet's position overlaps with our notification.
// So use `browser.onboarding.notification.finished` to let the AS page know
@ -1714,8 +1714,8 @@ pref("browser.onboarding.notification.finished", false);
pref("browser.onboarding.notification.mute-duration-on-first-session-ms", 300000); // 5 mins
pref("browser.onboarding.notification.max-life-time-per-tour-ms", 432000000); // 5 days
pref("browser.onboarding.notification.max-prompt-count-per-tour", 8);
pref("browser.onboarding.newtour", "private,addons,customize,search,default,sync");
pref("browser.onboarding.updatetour", "");
pref("browser.onboarding.newtour", "performance,private,screenshots,addons,customize,default");
pref("browser.onboarding.updatetour", "performance,library,screenshots,singlesearch,customize,sync");
// Preference that allows individual users to disable Screenshots.
pref("extensions.screenshots.disabled", false);

1
browser/extensions/onboarding/bootstrap.js поставляемый
Просмотреть файл

@ -34,7 +34,6 @@ const PREF_WHITELIST = [
"onboarding-tour-library",
"onboarding-tour-performance",
"onboarding-tour-private-browsing",
"onboarding-tour-search",
"onboarding-tour-singlesearch",
"onboarding-tour-sync",
].forEach(tourId => PREF_WHITELIST.push([`browser.onboarding.tour.${tourId}.completed`, PREF_BOOL]));

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

До

Ширина:  |  Высота:  |  Размер: 13 KiB

Просмотреть файл

@ -1 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><defs><style>.cls-1{fill:none;}.cls-2{fill:#fff;}.cls-3{fill:#e1e1e5;}.cls-4{fill:#767aa8;}.cls-5{fill:#f9f9fa;}.cls-6{fill:#cd6f14;}</style></defs><title>icons</title><path class="cls-1" d="M5.36,20.85H19.86l5.33,5.81a.63.63,0,0,0,.46.17,2.31,2.31,0,0,0,1.47-.76,2.17,2.17,0,0,0,.75-1.57A2.22,2.22,0,0,1,27.12,26c-.69.69-1.56,1-1.93.59L19.86,20.8H5.36A1.32,1.32,0,0,1,4,19.48V14.35H4v5.17A1.32,1.32,0,0,0,5.36,20.85Z"/><path class="cls-1" d="M24.12,20.8l0,0a1.32,1.32,0,0,0,1.27-1.31v0A1.32,1.32,0,0,1,24.12,20.8Z"/><path class="cls-2" d="M23.6,20.32h.51a.84.84,0,0,0,.84-.84V14.31a.84.84,0,0,0-.84-.84H21.33a7.34,7.34,0,0,1-1.45,3.86l.63.63a.82.82,0,0,1,.77.22Z"/><path class="cls-2" d="M19.06,19.41l-.63-.63a7.39,7.39,0,0,1-11.82-5.3H5.36a.84.84,0,0,0-.84.84v5.17a.84.84,0,0,0,.84.84h14l-.13-.14A.82.82,0,0,1,19.06,19.41Z"/><path class="cls-3" d="M5.36,20.8H19.86l-.44-.48h-14a.84.84,0,0,1-.84-.84V14.31a.84.84,0,0,1,.84-.84H6.61c0-.16,0-.31,0-.47,0,0,0,0,0,0H5.36A1.32,1.32,0,0,0,4,14.35v5.13A1.32,1.32,0,0,0,5.36,20.8Z"/><path class="cls-3" d="M24.1,13.48a.84.84,0,0,1,.84.84v5.17a.84.84,0,0,1-.84.84H23.6l.26.24.26.24a1.32,1.32,0,0,0,1.3-1.32V14.36A1.32,1.32,0,0,0,24.1,13H21.34v0c0,.15,0,.31,0,.46Z"/><path class="cls-4" d="M8.75,18.11a7.4,7.4,0,0,0,9.68.67l.63.63A2.22,2.22,0,0,1,20.51,18l-.63-.63a7.34,7.34,0,0,0,1.45-3.86c0-.15,0-.31,0-.46a7.37,7.37,0,0,0-1.59-4.71l-.1-.12c-.14-.17-.29-.34-.45-.5A7.39,7.39,0,0,0,6.59,13c0,.16,0,.31,0,.47A7.36,7.36,0,0,0,8.75,18.11ZM8.28,10.9a6,6,0,0,1,.43-1h0a6,6,0,0,1,10.46,0h0c0,.07.06.15.1.22s.08.13.11.2l-.06-.08a6.15,6.15,0,0,1,.28.63A6,6,0,0,1,8.87,16.08l0,.08c-.06-.09-.1-.19-.15-.28l-.14-.26c-.05-.11-.11-.21-.15-.32a6,6,0,0,1-.25-.66v0A6,6,0,0,1,8,13.83v-.05a5.79,5.79,0,0,1,.27-2.87Z"/><path class="cls-5" d="M14.36,7.56A6,6,0,0,0,9.58,9.93h9.56A6,6,0,0,0,14.36,7.56Z"/><path class="cls-2" d="M8,12.92a6,6,0,0,1,.35-2h0A5.79,5.79,0,0,0,8,13.77,6.05,6.05,0,0,1,8,12.92Z"/><path class="cls-2" d="M8.33,13.59a6,6,0,0,0,.54,2.49A6,6,0,0,0,19.66,10.9H9A6,6,0,0,0,8.33,13.59Z"/><path class="cls-3" d="M8,12.92a6.05,6.05,0,0,0,.06.86v.05a6,6,0,0,0,.17.78v0a6,6,0,0,0,.25.66c0,.11.1.21.15.32l.14.26c.05.09.1.19.15.28l0-.08A6,6,0,0,1,9,10.9H19.66a6.15,6.15,0,0,0-.28-.63l.06.08c0-.07-.07-.13-.11-.2s-.06-.15-.1-.22h0a6,6,0,0,0-10.46,0h0a6,6,0,0,0-.43,1h0A6,6,0,0,0,8,12.92Zm6.41-5.35a6,6,0,0,1,4.78,2.37H9.58A6,6,0,0,1,14.36,7.56Z"/><path class="cls-6" d="M21.1,22.15,23.25,20l.61.56-.26-.24-2.32-2.13a.82.82,0,0,0-.77-.22,2.22,2.22,0,0,0-1.44,1.44.82.82,0,0,0,.22.77l.13.14.44.48,5.33,5.81c.37.37,1.24.1,1.93-.59a2.22,2.22,0,0,0,.75-1.53.59.59,0,0,0-.16-.36L26.4,22.93,24,25.32Z"/><path class="cls-4" d="M23.86,20.56,23.25,20,21.1,22.15,24,25.32l2.39-2.39-2.28-2.09h0l0,0Z"/><path class="cls-2" d="M5.36,21.85H19.42l5,5.49a1.65,1.65,0,0,0,1.2.49,3.27,3.27,0,0,0,2.18-1c1.12-1.12,1.37-2.56.59-3.34l-2.58-2.37a2.31,2.31,0,0,0,.59-1.54V14.36A2.32,2.32,0,0,0,24.1,12H22.3A8.37,8.37,0,0,0,8,7,8.31,8.31,0,0,0,5.63,12H5.36A2.32,2.32,0,0,0,3,14.36v5.17A2.32,2.32,0,0,0,5.36,21.85ZM4,14.36H4A1.32,1.32,0,0,1,5.36,13H6.59s0,0,0,0A7.39,7.39,0,0,1,19.2,7.69c.16.16.31.33.45.5l.1.12A7.37,7.37,0,0,1,21.34,13v0H24.1a1.32,1.32,0,0,1,1.32,1.32v5.17a1.32,1.32,0,0,1-1.27,1.31h0l2.28,2.09,1.31,1.21a.59.59,0,0,1,.16.36,2.17,2.17,0,0,1-.75,1.57,2.31,2.31,0,0,1-1.47.76.63.63,0,0,1-.46-.17l-5.33-5.81H5.36A1.32,1.32,0,0,1,4,19.52Z"/></svg>

До

Ширина:  |  Высота:  |  Размер: 3.4 KiB

Просмотреть файл

@ -48,9 +48,6 @@ document.getElementById("onboarding-overlay")
case "onboarding-tour-private-browsing-button":
Mozilla.UITour.showHighlight("privateWindow");
break;
case "onboarding-tour-search-button":
Mozilla.UITour.openSearchPanel(() => {});
break;
case "onboarding-tour-singlesearch-button":
Mozilla.UITour.showMenu("urlbar");
break;

Просмотреть файл

@ -349,22 +349,15 @@
}
/* Tour Icons */
#onboarding-tour-search,
#onboarding-tour-singlesearch {
background-image: url("img/icons_singlesearch.svg");
}
#onboarding-tour-search.onboarding-active,
#onboarding-tour-search:hover,
#onboarding-tour-singlesearch.onboarding-active,
#onboarding-tour-singlesearch:hover {
background-image: url("img/icons_singlesearch-colored.svg");
}
#onboarding-notification-bar[data-target-tour-id=onboarding-tour-search] #onboarding-notification-tour-icon {
background-image: url("img/icons_search-notification.svg");
}
#onboarding-notification-bar[data-target-tour-id=onboarding-tour-singlesearch] #onboarding-notification-tour-icon {
background-image: url("img/icons_singlesearch-notification.svg");
}

Просмотреть файл

@ -123,33 +123,6 @@ var onboardingTourset = {
return div;
},
},
"search": {
id: "onboarding-tour-search",
tourNameId: "onboarding.tour-search2",
getNotificationStrings(bundle) {
return {
title: bundle.GetStringFromName("onboarding.notification.onboarding-tour-search.title"),
message: bundle.GetStringFromName("onboarding.notification.onboarding-tour-search.message"),
button: bundle.GetStringFromName("onboarding.button.learnMore"),
};
},
getPage(win) {
let div = win.document.createElement("div");
div.innerHTML = `
<section class="onboarding-tour-description">
<h1 data-l10n-id="onboarding.tour-search.title2"></h1>
<p data-l10n-id="onboarding.tour-search.description2"></p>
</section>
<section class="onboarding-tour-content">
<img src="resource://onboarding/img/figure_search.svg" role="presentation"/>
</section>
<aside class="onboarding-tour-button-container">
<button id="onboarding-tour-search-button" class="onboarding-tour-action-button" data-l10n-id="onboarding.tour-search.button"></button>
</aside>
`;
return div;
},
},
"default": {
id: "onboarding-tour-default-browser",
tourNameId: "onboarding.tour-default-browser",

Просмотреть файл

@ -23,18 +23,6 @@ onboarding.notification-icon-tooltip-updated=See whats new!
# LOCALIZATION NOTE(onboarding.notification-close-button-tooltip): The notification close button is an icon button. This tooltip would be shown when mousing hovering on the button.
onboarding.notification-close-button-tooltip=Dismiss
onboarding.tour-search2=Search
onboarding.tour-search.title2=Find it faster.
# LOCALIZATION NOTE (onboarding.tour-search.description2): If Amazon is not part
# of the default searchplugins for your locale, you can replace it with another
# ecommerce website (if you're shipping one), but not with a general purpose
# search engine (Google, Bing, Yandex, etc.). Alternatively, only reference
# Wikipedia and drop Amazon from the text.
onboarding.tour-search.description2=Having a default search engine doesnt mean its the only one you can use. Choose a search engine or a site, like Amazon or Wikipedia, right from the search box.
onboarding.tour-search.button=Open One-Click Search
onboarding.notification.onboarding-tour-search.title=Find it faster.
onboarding.notification.onboarding-tour-search.message=Access all of your favorite search engines with a click. Search the whole Web or just one website right from the search box.
onboarding.tour-private-browsing=Private Browsing
onboarding.tour-private-browsing.title2=Browse by yourself.
# LOCALIZATION NOTE(onboarding.tour-private-browsing.description3): This string will be used in the private-browsing tour description. %S is brandShortName.

Просмотреть файл

@ -3,6 +3,7 @@ support-files =
head.js
[browser_onboarding_accessibility.js]
[browser_onboarding_hide_all.js]
[browser_onboarding_notification.js]
[browser_onboarding_notification_2.js]
[browser_onboarding_notification_3.js]

Просмотреть файл

@ -0,0 +1,47 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function assertOnboardingDestroyed(browser) {
return ContentTask.spawn(browser, {}, function() {
let expectedRemovals = [
"#onboarding-overlay",
"#onboarding-overlay-button"
];
for (let selector of expectedRemovals) {
let removal = content.document.querySelector(selector);
ok(!removal, `Should remove ${selector} onboarding element`);
}
});
}
add_task(async function test_hide_onboarding_tours() {
resetOnboardingDefaultState();
let tourIds = TOUR_IDs;
let expectedPrefUpdates = [
promisePrefUpdated("browser.onboarding.hidden", true),
promisePrefUpdated("browser.onboarding.notification.finished", true)
];
tourIds.forEach((id, idx) => expectedPrefUpdates.push(promisePrefUpdated(`browser.onboarding.tour.${id}.completed`, true)));
let tabs = [];
for (let url of URLs) {
let tab = await openTab(url);
await promiseOnboardingOverlayLoaded(tab.linkedBrowser);
await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-button", {}, tab.linkedBrowser);
await promiseOnboardingOverlayOpened(tab.linkedBrowser);
tabs.push(tab);
}
await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-tour-hidden-checkbox", {}, gBrowser.selectedBrowser);
await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-close-btn", {}, gBrowser.selectedBrowser);
await Promise.all(expectedPrefUpdates);
for (let i = tabs.length - 1; i >= 0; --i) {
let tab = tabs[i];
await assertOnboardingDestroyed(tab.linkedBrowser);
await BrowserTestUtils.removeTab(tab);
}
});

Просмотреть файл

@ -5,19 +5,6 @@
requestLongerTimeout(2);
function assertOnboardingDestroyed(browser) {
return ContentTask.spawn(browser, {}, function() {
let expectedRemovals = [
"#onboarding-overlay",
"#onboarding-overlay-button"
];
for (let selector of expectedRemovals) {
let removal = content.document.querySelector(selector);
ok(!removal, `Should remove ${selector} onboarding element`);
}
});
}
function assertTourCompletedStyle(tourId, expectComplete, browser) {
return ContentTask.spawn(browser, { tourId, expectComplete }, function(args) {
let item = content.document.querySelector(`#${args.tourId}.onboarding-tour-item`);
@ -29,10 +16,15 @@ function assertTourCompletedStyle(tourId, expectComplete, browser) {
});
}
add_task(async function test_hide_onboarding_tours() {
add_task(async function test_set_right_tour_completed_style_on_overlay() {
resetOnboardingDefaultState();
let tourIds = TOUR_IDs;
// Mark the tours of even number as completed
for (let i = 0; i < tourIds.length; ++i) {
setTourCompletedState(tourIds[i], i % 2 == 0);
}
let tabs = [];
for (let url of URLs) {
let tab = await openTab(url);
@ -42,27 +34,27 @@ add_task(async function test_hide_onboarding_tours() {
tabs.push(tab);
}
let expectedPrefUpdates = [
promisePrefUpdated("browser.onboarding.hidden", true),
promisePrefUpdated("browser.onboarding.notification.finished", true)
];
tourIds.forEach(id => expectedPrefUpdates.push(promisePrefUpdated(`browser.onboarding.tour.${id}.completed`, true)));
await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-tour-hidden-checkbox", {}, gBrowser.selectedBrowser);
await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-close-btn", {}, gBrowser.selectedBrowser);
await Promise.all(expectedPrefUpdates);
for (let i = tabs.length - 1; i >= 0; --i) {
let tab = tabs[i];
await assertOnboardingDestroyed(tab.linkedBrowser);
for (let j = 0; j < tourIds.length; ++j) {
await assertTourCompletedStyle(tourIds[j], j % 2 == 0, tab.linkedBrowser);
}
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_click_action_button_to_set_tour_completed() {
resetOnboardingDefaultState();
const CUSTOM_TOUR_IDs = [
"onboarding-tour-private-browsing",
"onboarding-tour-addons",
"onboarding-tour-customize",
];
await SpecialPowers.pushPrefEnv({set: [
["browser.onboarding.newtour", "private,addons,customize"],
]});
let tourIds = TOUR_IDs;
let tourIds = CUSTOM_TOUR_IDs;
let tabs = [];
for (let url of URLs) {
let tab = await openTab(url);
@ -85,30 +77,3 @@ add_task(async function test_click_action_button_to_set_tour_completed() {
await BrowserTestUtils.removeTab(tab);
}
});
add_task(async function test_set_right_tour_completed_style_on_overlay() {
resetOnboardingDefaultState();
let tourIds = TOUR_IDs;
// Make the tours of even number as completed
for (let i = 0; i < tourIds.length; ++i) {
setTourCompletedState(tourIds[i], i % 2 == 0);
}
let tabs = [];
for (let url of URLs) {
let tab = await openTab(url);
await promiseOnboardingOverlayLoaded(tab.linkedBrowser);
await BrowserTestUtils.synthesizeMouseAtCenter("#onboarding-overlay-button", {}, tab.linkedBrowser);
await promiseOnboardingOverlayOpened(tab.linkedBrowser);
tabs.push(tab);
}
for (let i = tabs.length - 1; i >= 0; --i) {
let tab = tabs[i];
for (let j = 0; j < tourIds.length; ++j) {
await assertTourCompletedStyle(tourIds[j], j % 2 == 0, tab.linkedBrowser);
}
await BrowserTestUtils.removeTab(tab);
}
});

Просмотреть файл

@ -7,14 +7,23 @@ const ABOUT_HOME_URL = "about:home";
const ABOUT_NEWTAB_URL = "about:newtab";
const URLs = [ABOUT_HOME_URL, ABOUT_NEWTAB_URL];
const TOUR_IDs = [
"onboarding-tour-performance",
"onboarding-tour-private-browsing",
// TODO: should enable in bug 1371538
// "onboarding-tour-screenshots",
"onboarding-tour-addons",
"onboarding-tour-customize",
"onboarding-tour-search",
"onboarding-tour-default-browser",
];
const UPDATE_TOUR_IDs = [
"onboarding-tour-performance",
"onboarding-tour-library",
// TODO: should enable in bug 1371538
// "onboarding-tour-screenshots",
"onboarding-tour-singlesearch",
"onboarding-tour-customize",
"onboarding-tour-sync",
];
const UPDATE_TOUR_IDs = [];
registerCleanupFunction(resetOnboardingDefaultState);
@ -31,6 +40,7 @@ function resetOnboardingDefaultState() {
Preferences.reset("browser.onboarding.notification.prompt-count");
Preferences.reset("browser.onboarding.notification.tour-ids-queue");
TOUR_IDs.forEach(id => Preferences.reset(`browser.onboarding.tour.${id}.completed`));
UPDATE_TOUR_IDs.forEach(id => Preferences.reset(`browser.onboarding.tour.${id}.completed`));
}
function setTourCompletedState(tourId, state) {