mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 03:49:42 +00:00
Bug 1727907 - Make Firefox Suggest an opt-in feature and update the onboarding dialog accordingly. r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D123852
This commit is contained in:
parent
8496ccf07d
commit
030b26fc0f
@ -363,7 +363,7 @@ pref("browser.urlbar.suggest.openpage", true);
|
||||
pref("browser.urlbar.suggest.searches", true);
|
||||
pref("browser.urlbar.suggest.topsites", true);
|
||||
pref("browser.urlbar.suggest.engines", true);
|
||||
pref("browser.urlbar.suggest.quicksuggest", true);
|
||||
pref("browser.urlbar.suggest.quicksuggest", false);
|
||||
pref("browser.urlbar.suggest.calculator", false);
|
||||
|
||||
// Whether the QuickSuggest experiment is enabled.
|
||||
@ -373,7 +373,7 @@ pref("browser.urlbar.quicksuggest.enabled", false);
|
||||
pref("browser.urlbar.quicksuggest.shouldShowOnboardingDialog", true);
|
||||
|
||||
// Show QuickSuggest onboarding dialog on the nth browser restarts.
|
||||
pref("browser.urlbar.quicksuggest.showOnboardingDialogAfterNRestarts", 2);
|
||||
pref("browser.urlbar.quicksuggest.showOnboardingDialogAfterNRestarts", 0);
|
||||
|
||||
// The indexes of the sponsored and non-sponsored quick suggest results within
|
||||
// the general results group.
|
||||
|
@ -182,7 +182,7 @@ const PREF_URLBAR_DEFAULTS = new Map([
|
||||
["suggest.calculator", false],
|
||||
|
||||
// Whether results will include QuickSuggest suggestions.
|
||||
["suggest.quicksuggest", true],
|
||||
["suggest.quicksuggest", false],
|
||||
|
||||
// Whether the user has seen the onboarding dialog.
|
||||
["quicksuggest.showedOnboardingDialog", false],
|
||||
|
@ -95,8 +95,6 @@ class ProviderQuickSuggest extends UrlbarProvider {
|
||||
!queryContext.searchMode &&
|
||||
!queryContext.isPrivate &&
|
||||
UrlbarPrefs.get("quickSuggestEnabled") &&
|
||||
(UrlbarPrefs.get("quicksuggest.showedOnboardingDialog") ||
|
||||
!UrlbarPrefs.get("quickSuggestShouldShowOnboardingDialog")) &&
|
||||
UrlbarPrefs.get(SUGGEST_PREF) &&
|
||||
UrlbarPrefs.get("suggest.searches") &&
|
||||
UrlbarPrefs.get("browser.search.suggest.enabled")
|
||||
|
@ -32,11 +32,10 @@ const RS_COLLECTION = "quicksuggest";
|
||||
|
||||
// Categories that should show "Firefox Suggest" instead of "Sponsored"
|
||||
const NONSPONSORED_IAB_CATEGORIES = new Set(["5 - Education"]);
|
||||
// Version in which the mr1 dialog is shown.
|
||||
const MR1_VERSION = 89;
|
||||
|
||||
const FEATURE_AVAILABLE = "quickSuggestEnabled";
|
||||
const OPTED_IN = "suggest.quicksuggest";
|
||||
const SEEN_DIALOG_PREF = "quicksuggest.showedOnboardingDialog";
|
||||
const VERSION_PREF = "browser.startup.upgradeDialog.version";
|
||||
const RESTARTS_PREF = "quicksuggest.seenRestarts";
|
||||
|
||||
/**
|
||||
@ -60,7 +59,7 @@ class Suggestions {
|
||||
return this._initPromise;
|
||||
}
|
||||
this._initPromise = Promise.resolve();
|
||||
if (UrlbarPrefs.get("quickSuggestEnabled")) {
|
||||
if (UrlbarPrefs.get(FEATURE_AVAILABLE)) {
|
||||
this._initPromise = new Promise(resolve => (this._initResolve = resolve));
|
||||
Services.tm.idleDispatchToMainThread(this.onEnabledUpdate.bind(this));
|
||||
} else {
|
||||
@ -158,15 +157,15 @@ class Suggestions {
|
||||
|
||||
/**
|
||||
* Called when a urlbar pref changes. The onboarding dialog will set the
|
||||
* `browser.urlbar.quicksuggest.user-seen-dialog` pref once the user has
|
||||
* seen the dialog at which point we can start showing results.
|
||||
* `browser.urlbar.suggest.quicksuggest` pref if the user has
|
||||
* opted in, at which point we can start showing results.
|
||||
*
|
||||
* @param {string} pref
|
||||
* The name of the pref relative to `browser.urlbar`.
|
||||
*/
|
||||
onPrefChanged(pref) {
|
||||
switch (pref) {
|
||||
case SEEN_DIALOG_PREF:
|
||||
case OPTED_IN:
|
||||
this.onEnabledUpdate();
|
||||
break;
|
||||
}
|
||||
@ -176,24 +175,16 @@ class Suggestions {
|
||||
* Called when an update that may change whether this feature is enabled
|
||||
* or not has occured.
|
||||
*
|
||||
* QuickSuggest is controlled by two perferences that can be remotely
|
||||
* configured through Nimbus.
|
||||
* QuickSuggest is controlled by two perferences.
|
||||
*
|
||||
* * `quickSuggestEnabled`: this enables the QuickSuggest feature, but the
|
||||
* suggestion might not be immediately available if we want the user to
|
||||
* see the onboarding dialog, which is controlled by
|
||||
* `quickSuggestShouldShowOnboardingDialog`
|
||||
* * `quickSuggestEnabled`: this can be configured remotely through Nimbus
|
||||
* and enables the QuickSuggest feature, but the suggestion won't be
|
||||
* shown until the user has opted in.
|
||||
*
|
||||
* * `quickSuggestShouldShowOnboardingDialog`: this determines whether the
|
||||
* QuickSuggest onboarding dialog should be shown before we show any
|
||||
* suggestions to the user once QuickSuggest is enabled
|
||||
* * `suggest.quicksuggest`: whether or not the user has opted in.
|
||||
*/
|
||||
onEnabledUpdate() {
|
||||
if (
|
||||
UrlbarPrefs.get("quickSuggestEnabled") &&
|
||||
(UrlbarPrefs.get(SEEN_DIALOG_PREF) ||
|
||||
!UrlbarPrefs.get("quickSuggestShouldShowOnboardingDialog"))
|
||||
) {
|
||||
if (UrlbarPrefs.get(FEATURE_AVAILABLE) && UrlbarPrefs.get(OPTED_IN)) {
|
||||
this._setupRemoteSettings();
|
||||
}
|
||||
}
|
||||
@ -204,23 +195,20 @@ class Suggestions {
|
||||
* by the pref `browser.urlbar.quicksuggest.shouldShowOnboardingDialog`
|
||||
* which can be remotely configured by Nimbus.
|
||||
*
|
||||
* Given that the release may overlap with MR1 which has an onboarding dialog
|
||||
* We will wait for a few restarts after the MR1 dialog will have been shown
|
||||
* before showing the QuickSuggest dialog. This could be remotely configured
|
||||
* by Nimbus through `quickSuggestShowOnboardingDialogAfterNRestarts`, the
|
||||
* default is 2.
|
||||
* Given that the release may overlap with another onboarding dialog, we may
|
||||
* wait for a few restarts before showing the QuickSuggest dialog. This can
|
||||
* be remotely configured by Nimbus through
|
||||
* `quickSuggestShowOnboardingDialogAfterNRestarts`, the default is 0.
|
||||
*/
|
||||
async maybeShowOnboardingDialog() {
|
||||
// If quicksuggest is not enabled, the user has already seen the
|
||||
// quicksuggest onboarding dialog, the onboarding dialog is configured to
|
||||
// be skipped, or the user is not yet on a version where they could have
|
||||
// seen the mr1 onboarding dialog then we won't show the quicksuggest
|
||||
// onboarding.
|
||||
// If quicksuggest is not available, the onboarding dialog is configured to
|
||||
// be skipped, the user has already seen the dialog, or has otherwise opted
|
||||
// in already, then we won't show the quicksuggest onboarding.
|
||||
if (
|
||||
!UrlbarPrefs.get("quickSuggestEnabled") ||
|
||||
!UrlbarPrefs.get(FEATURE_AVAILABLE) ||
|
||||
!UrlbarPrefs.get("quickSuggestShouldShowOnboardingDialog") ||
|
||||
UrlbarPrefs.get(SEEN_DIALOG_PREF) ||
|
||||
Services.prefs.getIntPref(VERSION_PREF, 0) < MR1_VERSION
|
||||
UrlbarPrefs.get(OPTED_IN)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@ -236,7 +224,7 @@ class Suggestions {
|
||||
return;
|
||||
}
|
||||
|
||||
let params = { disable: false, learnMore: false };
|
||||
let params = { accept: false, openSettings: false, learnMore: false };
|
||||
let win = BrowserWindowTracker.getTopWindow();
|
||||
await win.gDialogBox.open(
|
||||
"chrome://browser/content/urlbar/quicksuggestOnboarding.xhtml",
|
||||
@ -245,7 +233,9 @@ class Suggestions {
|
||||
|
||||
UrlbarPrefs.set(SEEN_DIALOG_PREF, true);
|
||||
|
||||
if (params.disable) {
|
||||
if (params.accept) {
|
||||
UrlbarPrefs.set(OPTED_IN, true);
|
||||
} else if (params.openSettings) {
|
||||
win.openPreferences("search-quickSuggest");
|
||||
} else if (params.learnMore) {
|
||||
win.openTrustedLinkIn(UrlbarProviderQuickSuggest.helpUrl, "tab", {
|
||||
|
@ -5,42 +5,37 @@
|
||||
#infoContainer {
|
||||
text-align: center;
|
||||
min-width: 500px;
|
||||
padding: 1em 0;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
#infoTitle {
|
||||
font-size: 24px;
|
||||
a {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#notNowLinkContainer {
|
||||
text-align: end;
|
||||
}
|
||||
|
||||
#infoIcon {
|
||||
width: 112px;
|
||||
height: 112px;
|
||||
margin: 1em auto;
|
||||
margin: 0 auto 1em;
|
||||
background-image: url("chrome://branding/content/about-logo.svg");
|
||||
background-size: 100%;
|
||||
}
|
||||
|
||||
/* Copied from https://searchfox.org/mozilla-central/source/browser/components/newtab/aboutwelcome/content/aboutwelcome.css#88 */
|
||||
/* We will want to check in to figure out if we want to share this code somehow */
|
||||
span.zap {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
white-space: nowrap;
|
||||
#infoTitle {
|
||||
font-size: 1.5em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.zap::after {
|
||||
display: block;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 100%;
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: calc(100% - 0.15em);
|
||||
width: 100%;
|
||||
height: 0.3em;
|
||||
left: 0;
|
||||
z-index: -1;
|
||||
#infoBody {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.zap.short::after {
|
||||
background-image: url('chrome://activity-stream/content/data/content/assets/short-zap.svg');
|
||||
#illustration {
|
||||
background: url("quicksuggestOnboarding_illustration.svg") no-repeat center;
|
||||
min-width: 455px;
|
||||
height: 219px;
|
||||
margin: 1em 0 2em;
|
||||
}
|
||||
|
@ -4,11 +4,17 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
document.addEventListener("dialogaccept", () => {
|
||||
window.arguments[0].accept = true;
|
||||
});
|
||||
document.addEventListener("dialogextra1", () => {
|
||||
window.arguments[0].disable = true;
|
||||
window.arguments[0].openSettings = true;
|
||||
window.close();
|
||||
});
|
||||
document.addEventListener("dialogextra2", () => {
|
||||
document.getElementById("onboardingNotNow").addEventListener("click", () => {
|
||||
window.close();
|
||||
});
|
||||
document.getElementById("onboardingLearnMore").addEventListener("click", () => {
|
||||
window.arguments[0].learnMore = true;
|
||||
window.close();
|
||||
});
|
||||
|
@ -15,7 +15,7 @@
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
aria-describedby="infoBody">
|
||||
<dialog id="quicksuggestOnboardingDialog"
|
||||
buttons="accept, extra1, extra2"
|
||||
buttons="accept, extra1"
|
||||
defaultButton="accept">
|
||||
|
||||
<linkset>
|
||||
@ -25,22 +25,16 @@
|
||||
<!-- The <div> was added in bug 1606617 to workaround bug 1614447 -->
|
||||
<div xmlns="http://www.w3.org/1999/xhtml">
|
||||
<div id="infoContainer">
|
||||
<div id="notNowLinkContainer"><a id="onboardingNotNow">Not now</a></div>
|
||||
<xul:image id="infoIcon"/>
|
||||
<h2 id="infoTitle">Firefox is getting <span class="zap short">smarter.</span></h2>
|
||||
<xul:description id="infoBody">
|
||||
We're rolling out experiences to help you find the right things faster.
|
||||
You'll start to see richer recommendations in the address bar.
|
||||
</xul:description>
|
||||
<h2 id="infoTitle">Say hello to smarter suggestions</h2>
|
||||
<xul:description id="infoBody">Firefox Suggest uses your city location and search keywords to make contextual suggestions from Firefox and partners, while keeping your privacy in mind. <a id="onboardingLearnMore">Learn more</a></xul:description>
|
||||
<div id="illustration"/>
|
||||
<div id="infoButtons">
|
||||
<xul:button id="onboardingAccept"
|
||||
dlgtype="accept"
|
||||
label="Okay, got it!"></xul:button>
|
||||
<xul:button id="onboardingDisable"
|
||||
dlgtype="extra1"
|
||||
label="Disable"></xul:button>
|
||||
<xul:button id="onboardingLearnMore"
|
||||
dlgtype="extra2"
|
||||
label="Learn more"></xul:button>
|
||||
<xul:button dlgtype="accept"
|
||||
label="Allow suggestions"/>
|
||||
<xul:button dlgtype="extra1"
|
||||
label="Customize in settings"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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/. -->
|
||||
<svg width="455" height="219" viewBox="0 0 455 219" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g filter="url(#filter0_d)">
|
||||
<rect x="43" y="4" width="367" height="207" rx="4" fill="white"/>
|
||||
<path d="M80.8651 19.1075C80.5056 18.0614 79.6993 17.3608 78.2227 17.3608C76.6489 17.3608 75.4832 18.2438 75.4832 19.4914C75.4832 20.5086 76.0952 21.19 77.4649 21.5067L78.7084 21.7946C79.4613 21.9674 79.8159 22.3225 79.8159 22.8311C79.8159 23.4645 79.1359 23.9827 78.0673 23.9827C77.1298 23.9827 76.542 23.5845 76.338 22.7927L75.25 23.0614C75.5172 24.3138 76.5615 24.9808 78.0867 24.9808C79.8207 24.9808 81.0011 24.0451 81.0011 22.7735C81.0011 21.7466 80.3502 21.0988 79.0193 20.7774L77.9118 20.5086C77.0278 20.2927 76.6295 20 76.6295 19.4338C76.6295 18.8004 77.3095 18.3397 78.2227 18.3397C79.2233 18.3397 79.6362 18.8868 79.8353 19.3954L80.8651 19.1075Z" fill="#15141A" fill-opacity="0.4"/>
|
||||
<path d="M86.1283 24.9808C87.6438 24.9808 88.7513 24.2322 89.101 23.119L87.9935 22.8119C87.7021 23.5797 87.0269 23.9635 86.1283 23.9635C84.7829 23.9635 83.8551 23.1046 83.8017 21.5259H89.2176V21.0461C89.2176 18.3013 87.5661 17.3608 86.0118 17.3608C83.9911 17.3608 82.6505 18.9347 82.6505 21.1996C82.6505 23.4645 83.9717 24.9808 86.1283 24.9808ZM83.8017 20.547C83.8794 19.4002 84.7003 18.3781 86.0118 18.3781C87.2552 18.3781 88.0518 19.2994 88.0518 20.547H83.8017Z" fill="#15141A" fill-opacity="0.4"/>
|
||||
<path d="M93.4305 25C94.7322 25 95.4122 24.309 95.6454 23.8292H95.7037V24.8273H96.85V19.9712C96.85 17.6296 95.0431 17.3608 94.091 17.3608C92.9641 17.3608 91.6818 17.7447 91.0989 19.0883L92.187 19.4722C92.4396 18.9347 93.037 18.3589 94.1299 18.3589C95.1839 18.3589 95.7037 18.9107 95.7037 19.856V19.8944C95.7037 20.4415 95.1402 20.3935 93.7802 20.5662C92.3958 20.7438 90.8852 21.0461 90.8852 22.7351C90.8852 24.1747 92.0121 25 93.4305 25ZM93.6053 23.9827C92.6921 23.9827 92.0315 23.5797 92.0315 22.7927C92.0315 21.929 92.8281 21.6603 93.7219 21.5451C94.2076 21.4875 95.5094 21.3532 95.7037 21.1228V22.1593C95.7037 23.0806 94.9654 23.9827 93.6053 23.9827Z" fill="#15141A" fill-opacity="0.4"/>
|
||||
<path d="M99.2159 24.8273H100.362V20.1631C100.362 19.1651 101.159 18.4357 102.247 18.4357C102.553 18.4357 102.869 18.4933 102.946 18.5125V17.3608C102.815 17.3512 102.514 17.3417 102.344 17.3417C101.45 17.3417 100.673 17.8407 100.401 18.5701H100.323V17.4568H99.2159V24.8273Z" fill="#15141A" fill-opacity="0.4"/>
|
||||
<path d="M107.383 24.9808C109.034 24.9808 110.122 23.9827 110.316 22.6775H109.17C108.956 23.4837 108.276 23.9635 107.383 23.9635C106.023 23.9635 105.148 22.8503 105.148 21.142C105.148 19.4722 106.042 18.3781 107.383 18.3781C108.393 18.3781 108.995 18.9923 109.17 19.6641H110.316C110.122 18.2821 108.937 17.3608 107.363 17.3608C105.343 17.3608 104.002 18.9347 104.002 21.1804C104.002 23.3877 105.284 24.9808 107.383 24.9808Z" fill="#15141A" fill-opacity="0.4"/>
|
||||
<path d="M113.412 20.3935C113.412 19.1075 114.243 18.3781 115.374 18.3781C116.453 18.3781 117.104 19.0499 117.104 20.2207V24.8273H118.25V20.144C118.25 18.2486 117.23 17.3608 115.705 17.3608C114.529 17.3608 113.859 17.8455 113.509 18.6084H113.412V15H112.266V24.8273H113.412V20.3935Z" fill="#15141A" fill-opacity="0.4"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M60.6111 21.2507L64.803 25.4425C65.0677 25.7167 65.0639 26.1524 64.7945 26.4219C64.525 26.6914 64.0892 26.6952 63.8151 26.4304L59.6233 22.2386C57.4228 23.919 54.2962 23.6056 52.473 21.5218C50.6499 19.438 50.7545 16.2976 52.7123 14.3398C54.6701 12.3819 57.8106 12.2773 59.8944 14.1005C61.9782 15.9237 62.2916 19.0502 60.6111 21.2507ZM52.6066 18.0768C52.6066 20.199 54.3269 21.9193 56.4491 21.9193C58.5703 21.917 60.2893 20.198 60.2916 18.0768C60.2916 15.9547 58.5712 14.2343 56.4491 14.2343C54.3269 14.2343 52.6066 15.9547 52.6066 18.0768Z" fill="#5B5B66"/>
|
||||
<path opacity="0.5" fill-rule="evenodd" clip-rule="evenodd" d="M394.794 16.5307C394.599 16.3355 394.282 16.3355 394.087 16.5307C393.892 16.726 393.892 17.0426 394.087 17.2378L396.166 19.3174H391.508C391.232 19.3174 391.008 19.5412 391.008 19.8174C391.008 20.0935 391.232 20.3174 391.508 20.3174H396.166L394.087 22.3968C393.892 22.5921 393.892 22.9087 394.087 23.1039C394.282 23.2992 394.599 23.2992 394.794 23.1039L397.715 20.183C397.813 20.0917 397.874 19.9617 397.874 19.8174C397.874 19.6734 397.813 19.5437 397.716 19.4525L394.794 16.5307Z" fill="#5B5B66"/>
|
||||
<rect x="46.7695" y="34.4829" width="350.708" height="0.628513" fill="#F0F0F4"/>
|
||||
<path opacity="0.15" fill-rule="evenodd" clip-rule="evenodd" d="M59.9196 123.146L62.9682 126.195C63.1608 126.394 63.158 126.711 62.962 126.907C62.766 127.103 62.4491 127.106 62.2498 126.914L59.2012 123.865C57.6008 125.087 55.3269 124.859 54.001 123.344C52.675 121.828 52.7511 119.544 54.175 118.12C55.5989 116.696 57.8829 116.62 59.3983 117.946C60.9138 119.272 61.1418 121.546 59.9196 123.146ZM54.098 120.838C54.098 122.382 55.3492 123.633 56.8926 123.633C58.4353 123.631 59.6855 122.381 59.6871 120.838C59.6871 119.295 58.436 118.044 56.8926 118.044C55.3492 118.044 54.098 119.295 54.098 120.838Z" fill="#5B5B66"/>
|
||||
<rect opacity="0.6" x="68.25" y="116" width="88" height="12" rx="2" fill="url(#paint0_linear)"/>
|
||||
<rect opacity="0.6" x="68.25" y="139" width="120" height="12" rx="2" fill="url(#paint1_linear)"/>
|
||||
<rect opacity="0.6" x="68.25" y="161" width="62" height="12" rx="2" fill="url(#paint2_linear)"/>
|
||||
<rect opacity="0.6" x="68.25" y="184" width="112" height="12" rx="2" fill="url(#paint3_linear)"/>
|
||||
<path opacity="0.15" fill-rule="evenodd" clip-rule="evenodd" d="M59.9196 145.773L62.9682 148.822C63.1608 149.021 63.158 149.338 62.962 149.534C62.766 149.73 62.4491 149.733 62.2498 149.54L59.2012 146.491C57.6008 147.714 55.3269 147.486 54.001 145.97C52.675 144.455 52.7511 142.171 54.175 140.747C55.5989 139.323 57.8829 139.247 59.3983 140.573C60.9138 141.899 61.1418 144.173 59.9196 145.773ZM54.098 143.465C54.098 145.008 55.3492 146.259 56.8926 146.259C58.4353 146.258 59.6855 145.007 59.6871 143.465C59.6871 141.921 58.436 140.67 56.8926 140.67C55.3492 140.67 54.098 141.921 54.098 143.465Z" fill="#5B5B66"/>
|
||||
<path opacity="0.15" fill-rule="evenodd" clip-rule="evenodd" d="M59.9196 168.399L62.9682 171.448C63.1608 171.647 63.158 171.964 62.962 172.16C62.766 172.356 62.4491 172.359 62.2498 172.166L59.2012 169.118C57.6008 170.34 55.3269 170.112 54.001 168.597C52.675 167.081 52.7511 164.797 54.175 163.373C55.5989 161.949 57.8829 161.873 59.3983 163.199C60.9138 164.525 61.1418 166.799 59.9196 168.399ZM54.098 166.091C54.098 167.635 55.3492 168.886 56.8926 168.886C58.4353 168.884 59.6855 167.634 59.6871 166.091C59.6871 164.548 58.436 163.297 56.8926 163.297C55.3492 163.297 54.098 164.548 54.098 166.091Z" fill="#5B5B66"/>
|
||||
<path opacity="0.15" fill-rule="evenodd" clip-rule="evenodd" d="M59.9196 191.025L62.9682 194.074C63.1608 194.273 63.158 194.59 62.962 194.786C62.766 194.982 62.4491 194.985 62.2498 194.792L59.2012 191.744C57.6008 192.966 55.3269 192.738 54.001 191.223C52.675 189.707 52.7511 187.423 54.175 185.999C55.5989 184.575 57.8829 184.499 59.3983 185.825C60.9138 187.151 61.1418 189.425 59.9196 191.025ZM54.098 188.717C54.098 190.261 55.3492 191.512 56.8926 191.512C58.4353 191.51 59.6855 190.26 59.6871 188.717C59.6871 187.174 58.436 185.923 56.8926 185.923C55.3492 185.923 54.098 187.174 54.098 188.717Z" fill="#5B5B66"/>
|
||||
</g>
|
||||
<g filter="url(#filter1_d)">
|
||||
<rect x="24" y="39.0596" width="406.5" height="71.0664" rx="4" fill="white"/>
|
||||
<path d="M35.25 56.0116H36.0659V53.016H38.9875V52.2965H36.0659V50.0334H39.2902V49.314H35.25V56.0116Z" fill="#15141A"/>
|
||||
<path d="M40.5823 56.0116H41.3588V50.9884H40.5823V56.0116ZM40.9771 50.1512C41.2798 50.1512 41.5298 49.9157 41.5298 49.6279C41.5298 49.3401 41.2798 49.1047 40.9771 49.1047C40.6744 49.1047 40.4244 49.3401 40.4244 49.6279C40.4244 49.9157 40.6744 50.1512 40.9771 50.1512Z" fill="#15141A"/>
|
||||
<path d="M42.7809 56.0116H43.5573V52.8328C43.5573 52.1526 44.0969 51.6555 44.8339 51.6555C45.0411 51.6555 45.255 51.6948 45.3076 51.7078V50.923C45.2188 50.9164 45.0148 50.9099 44.8997 50.9099C44.2943 50.9099 43.7679 51.25 43.5836 51.7471H43.531V50.9884H42.7809V56.0116Z" fill="#15141A"/>
|
||||
<path d="M48.193 56.1163C49.2195 56.1163 49.9696 55.6061 50.2065 54.8474L49.4563 54.6381C49.2589 55.1613 48.8016 55.423 48.193 55.423C47.2816 55.423 46.6532 54.8376 46.617 53.7616H50.2854V53.4346C50.2854 51.564 49.1668 50.923 48.114 50.923C46.7454 50.923 45.8373 51.9956 45.8373 53.5392C45.8373 55.0828 46.7322 56.1163 48.193 56.1163ZM46.617 53.0945C46.6697 52.3129 47.2257 51.6163 48.114 51.6163C48.9563 51.6163 49.4958 52.2442 49.4958 53.0945H46.617Z" fill="#15141A"/>
|
||||
<path d="M53.7169 50.9884H52.5852V50.4782C52.5852 49.9811 52.7957 49.7195 53.309 49.7195C53.5327 49.7195 53.6643 49.7718 53.7432 49.798L53.967 49.1308C53.8485 49.0785 53.6116 49 53.23 49C52.5062 49 51.8087 49.4317 51.8087 50.2951V50.9884H50.9928V51.6424H51.8087V56.0116H52.5852V51.6424H53.7169V50.9884Z" fill="#15141A"/>
|
||||
<path d="M56.65 56.1163C58.0186 56.1163 58.9398 55.0828 58.9398 53.5262C58.9398 51.9564 58.0186 50.923 56.65 50.923C55.2813 50.923 54.3601 51.9564 54.3601 53.5262C54.3601 55.0828 55.2813 56.1163 56.65 56.1163ZM56.65 55.423C55.6103 55.423 55.1366 54.5334 55.1366 53.5262C55.1366 52.5189 55.6103 51.6163 56.65 51.6163C57.6896 51.6163 58.1634 52.5189 58.1634 53.5262C58.1634 54.5334 57.6896 55.423 56.65 55.423Z" fill="#15141A"/>
|
||||
<path d="M60.496 50.9884H59.6011L61.2067 53.5L59.6011 56.0116H60.496L61.7068 54.0625L62.9175 56.0116H63.8124L62.1805 53.5L63.8124 50.9884H62.9175L61.7068 53.0422L60.496 50.9884Z" fill="#15141A"/>
|
||||
<path d="M71.3161 50.9884H72.1057C72.0695 49.9778 71.1319 49.2224 69.829 49.2224C68.5393 49.2224 67.526 49.968 67.526 51.093C67.526 51.9956 68.184 52.532 69.2368 52.8328L70.0659 53.0683C70.7765 53.2645 71.4082 53.5131 71.4082 54.1802C71.4082 54.9128 70.6976 55.3968 69.7632 55.3968C68.9605 55.3968 68.2498 55.0436 68.184 54.2849H67.3418C67.4207 55.3837 68.3156 56.1294 69.7632 56.1294C71.3161 56.1294 72.1978 55.2791 72.1978 54.1933C72.1978 52.9375 71.0003 52.532 70.3028 52.3488L69.6185 52.1657C69.1184 52.0349 68.3156 51.7733 68.3156 51.0538C68.3156 50.4128 68.9078 49.9419 69.8027 49.9419C70.6186 49.9419 71.2372 50.3278 71.3161 50.9884Z" fill="#15141A"/>
|
||||
<path d="M76.6188 53.9578C76.6188 54.8997 75.895 55.3314 75.316 55.3314C74.6711 55.3314 74.2105 54.8605 74.2105 54.1279V50.9884H73.4341V54.1802C73.4341 55.4622 74.1184 56.077 75.0659 56.077C75.8292 56.077 76.3293 55.6715 76.5662 55.1613H76.6188V56.0116H77.3953V50.9884H76.6188V53.9578Z" fill="#15141A"/>
|
||||
<path d="M80.8572 58C82.0679 58 83.0418 57.4506 83.0418 56.1555V50.9884H82.2916V51.7863H82.2127C82.0416 51.5247 81.7258 50.923 80.7388 50.923C79.4622 50.923 78.5805 51.9302 78.5805 53.4738C78.5805 55.0436 79.5017 55.9331 80.7256 55.9331C81.7126 55.9331 82.0284 55.3576 82.1995 55.0828H82.2653V56.1032C82.2653 56.9404 81.6731 57.3198 80.8572 57.3198C79.9393 57.3198 79.6169 56.839 79.4096 56.561L78.7911 56.9927C79.1069 57.5193 79.7287 58 80.8572 58ZM80.8309 55.2398C79.857 55.2398 79.3569 54.5073 79.3569 53.4608C79.3569 52.4404 79.8439 51.6163 80.8309 51.6163C81.7784 51.6163 82.2785 52.375 82.2785 53.4608C82.2785 54.5727 81.7652 55.2398 80.8309 55.2398Z" fill="#15141A"/>
|
||||
<path d="M86.5029 58C87.7136 58 88.6875 57.4506 88.6875 56.1555V50.9884H87.9373V51.7863H87.8584C87.6873 51.5247 87.3714 50.923 86.3844 50.923C85.1079 50.923 84.2262 51.9302 84.2262 53.4738C84.2262 55.0436 85.1474 55.9331 86.3713 55.9331C87.3583 55.9331 87.6741 55.3576 87.8452 55.0828H87.911V56.1032C87.911 56.9404 87.3188 57.3198 86.5029 57.3198C85.585 57.3198 85.2625 56.839 85.0553 56.561L84.4367 56.9927C84.7526 57.5193 85.3744 58 86.5029 58ZM86.4766 55.2398C85.5027 55.2398 85.0026 54.5073 85.0026 53.4608C85.0026 52.4404 85.4896 51.6163 86.4766 51.6163C87.4241 51.6163 87.9242 52.375 87.9242 53.4608C87.9242 54.5727 87.4109 55.2398 86.4766 55.2398Z" fill="#15141A"/>
|
||||
<path d="M92.2275 56.1163C93.254 56.1163 94.0041 55.6061 94.241 54.8474L93.4909 54.6381C93.2935 55.1613 92.8362 55.423 92.2275 55.423C91.3162 55.423 90.6878 54.8376 90.6516 53.7616H94.32V53.4346C94.32 51.564 93.2014 50.923 92.1486 50.923C90.7799 50.923 89.8719 51.9956 89.8719 53.5392C89.8719 55.0828 90.7668 56.1163 92.2275 56.1163ZM90.6516 53.0945C90.7042 52.3129 91.2603 51.6163 92.1486 51.6163C92.9908 51.6163 93.5304 52.2442 93.5304 53.0945H90.6516Z" fill="#15141A"/>
|
||||
<path d="M99.0807 52.1134C98.8372 51.4004 98.291 50.923 97.2909 50.923C96.2249 50.923 95.4353 51.5247 95.4353 52.375C95.4353 53.0683 95.8498 53.5327 96.7776 53.7485L97.6199 53.9448C98.1298 54.0625 98.37 54.3045 98.37 54.6512C98.37 55.0828 97.9094 55.436 97.1856 55.436C96.5506 55.436 96.1525 55.1646 96.0143 54.625L95.2774 54.8081C95.4583 55.6617 96.1657 56.1163 97.1988 56.1163C98.3733 56.1163 99.1728 55.4786 99.1728 54.6119C99.1728 53.9121 98.7319 53.4706 97.8304 53.2515L97.0803 53.0683C96.4815 52.9211 96.2117 52.7217 96.2117 52.3358C96.2117 51.9041 96.6723 51.5901 97.2909 51.5901C97.9686 51.5901 98.2483 51.9629 98.3832 52.3096L99.0807 52.1134Z" fill="#15141A"/>
|
||||
<path d="M102.539 50.9884H101.46V49.7849H100.684V50.9884H99.9204V51.6424H100.684V54.782C100.684 55.6584 101.394 56.077 102.052 56.077C102.342 56.077 102.526 56.0247 102.631 55.9855L102.473 55.2922C102.408 55.3052 102.302 55.3314 102.131 55.3314C101.789 55.3314 101.46 55.2267 101.46 54.5727V51.6424H102.539V50.9884Z" fill="#15141A"/>
|
||||
<rect x="35" y="68" width="32.4659" height="32.4875" rx="2" fill="#F0F0F4"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M53.1801 75C53.5688 75 53.8838 75.3171 53.8838 75.7083V76.4167C53.8838 76.8079 53.5688 77.125 53.1801 77.125C52.7914 77.125 52.4764 76.8079 52.4764 76.4167V75.7083C52.4764 75.3171 52.7914 75 53.1801 75ZM58.1561 77.0747C58.4309 77.3513 58.4309 77.7998 58.1561 78.0764L57.6585 78.5773C57.3837 78.8539 56.9381 78.8539 56.6633 78.5773C56.3885 78.3006 56.3885 77.8521 56.6633 77.5755L57.1609 77.0747C57.4357 76.798 57.8813 76.798 58.1561 77.0747ZM48.2042 77.0747C48.479 76.798 48.9245 76.798 49.1993 77.0747L49.6969 77.5755C49.9718 77.8521 49.9718 78.3006 49.6969 78.5773C49.4221 78.8539 48.9766 78.8539 48.7017 78.5773L48.2042 78.0764C47.9293 77.7998 47.9293 77.3513 48.2042 77.0747ZM53.1801 79.25C52.6044 79.25 52.0691 79.4239 51.6232 79.7225C51.1924 79.4503 50.7052 79.2298 50.1663 79.1068C50.9325 78.3209 51.9997 77.8333 53.1801 77.8333C55.512 77.8333 57.4023 79.7361 57.4023 82.0833C57.4023 82.9204 57.1619 83.7009 56.7468 84.3588C56.4926 83.9177 56.1788 83.4995 55.7946 83.135C55.9238 82.8098 55.9949 82.4549 55.9949 82.0833C55.9949 80.5185 54.7346 79.25 53.1801 79.25ZM58.106 82.0833C58.106 81.6921 58.4211 81.375 58.8097 81.375H59.5134C59.9021 81.375 60.2171 81.6921 60.2171 82.0833C60.2171 82.4745 59.9021 82.7917 59.5134 82.7917H58.8097C58.4211 82.7917 58.106 82.4745 58.106 82.0833ZM48.7396 79.9584C46.4077 79.9584 44.5174 81.8612 44.5174 84.2084C44.5174 84.306 44.5206 84.4029 44.5271 84.499C43.2794 85.0433 42.4062 86.2934 42.4062 87.75C42.4062 89.706 43.9815 91.2917 45.9248 91.2917H52.2581C54.59 91.2917 56.4803 89.3889 56.4803 87.0417C56.4803 84.8552 54.84 83.0544 52.7305 82.818C52.1582 81.1537 50.5882 79.9584 48.7396 79.9584ZM45.9248 84.2084C45.9248 82.6436 47.185 81.375 48.7396 81.375C50.1008 81.375 51.2377 82.3483 51.4982 83.6415C51.5657 83.9768 51.8618 84.2156 52.2017 84.2089C52.2205 84.2086 52.2392 84.2084 52.2581 84.2084C53.8127 84.2084 55.0729 85.4769 55.0729 87.0417C55.0729 88.6065 53.8127 89.875 52.2581 89.875H45.9248C44.7588 89.875 43.8137 88.9237 43.8137 87.75C43.8137 86.7378 44.5175 85.8894 45.46 85.6765C45.8391 85.591 46.0776 85.2123 45.9927 84.8306C45.9483 84.631 45.9248 84.4229 45.9248 84.2084Z" fill="url(#paint4_linear)"/>
|
||||
<rect x="76.25" y="72" width="215" height="12" rx="2" fill="url(#paint5_linear)"/>
|
||||
<rect x="76" y="88" width="62" height="6" rx="1" fill="url(#paint6_linear)"/>
|
||||
<rect x="357" y="76" width="45" height="6" rx="1" fill="#F0F0F4"/>
|
||||
<rect x="405" y="76" width="14" height="6" rx="1" fill="#F0F0F4"/>
|
||||
</g>
|
||||
<defs>
|
||||
<filter id="filter0_d" x="37" y="0" width="379" height="219" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dy="2"/>
|
||||
<feGaussianBlur stdDeviation="3"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0.227451 0 0 0 0 0.223529 0 0 0 0 0.266667 0 0 0 0.2 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
|
||||
</filter>
|
||||
<filter id="filter1_d" x="0" y="25.0596" width="454.5" height="119.066" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
||||
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
|
||||
<feOffset dy="10"/>
|
||||
<feGaussianBlur stdDeviation="12"/>
|
||||
<feColorMatrix type="matrix" values="0 0 0 0 0.227451 0 0 0 0 0.223529 0 0 0 0 0.266667 0 0 0 0.2 0"/>
|
||||
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
|
||||
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
|
||||
</filter>
|
||||
<linearGradient id="paint0_linear" x1="156.771" y1="128" x2="68.7707" y2="128" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#CFCFD8"/>
|
||||
<stop offset="0.479167" stop-color="#CFCFD8" stop-opacity="0.3"/>
|
||||
<stop offset="0.989583" stop-color="#CFCFD8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear" x1="188.25" y1="151" x2="68.25" y2="151" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#CFCFD8"/>
|
||||
<stop offset="0.525" stop-color="#CFCFD8" stop-opacity="0.3"/>
|
||||
<stop offset="1" stop-color="#CFCFD8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint2_linear" x1="130.25" y1="173" x2="68.25" y2="173" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#CFCFD8"/>
|
||||
<stop offset="0.516129" stop-color="#CFCFD8" stop-opacity="0.3"/>
|
||||
<stop offset="1" stop-color="#CFCFD8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint3_linear" x1="180.25" y1="196" x2="68.25" y2="196" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#CFCFD8"/>
|
||||
<stop offset="0.5" stop-color="#CFCFD8" stop-opacity="0.3"/>
|
||||
<stop offset="1" stop-color="#CFCFD8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint4_linear" x1="42.4062" y1="75" x2="60.2171" y2="75" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#9059FF"/>
|
||||
<stop offset="0.520833" stop-color="#FF4AA2"/>
|
||||
<stop offset="1" stop-color="#FFBD4F"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint5_linear" x1="292.394" y1="84" x2="77.3936" y2="84" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#CFCFD8"/>
|
||||
<stop offset="0.510638" stop-color="#CFCFD8" stop-opacity="0.3"/>
|
||||
<stop offset="1" stop-color="#CFCFD8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint6_linear" x1="138.25" y1="94" x2="76.25" y2="94" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#F0F0F4"/>
|
||||
<stop offset="0.532258" stop-color="#F0F0F4" stop-opacity="0.3"/>
|
||||
<stop offset="1" stop-color="#F0F0F4"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 19 KiB |
@ -7,3 +7,4 @@ browser.jar:
|
||||
content/browser/urlbar/quicksuggestOnboarding.xhtml (content/quicksuggestOnboarding.xhtml)
|
||||
content/browser/urlbar/quicksuggestOnboarding.js (content/quicksuggestOnboarding.js)
|
||||
content/browser/urlbar/quicksuggestOnboarding.css (content/quicksuggestOnboarding.css)
|
||||
content/browser/urlbar/quicksuggestOnboarding_illustration.svg (content/quicksuggestOnboarding_illustration.svg)
|
||||
|
@ -43,7 +43,7 @@ const DEFAULT_EXPERIMENT_FEATURE_VARIABLES = {
|
||||
quickSuggestEnabled: false,
|
||||
quickSuggestNonSponsoredIndex: -1,
|
||||
quickSuggestShouldShowOnboardingDialog: true,
|
||||
quickSuggestShowOnboardingDialogAfterNRestarts: 2,
|
||||
quickSuggestShowOnboardingDialogAfterNRestarts: 0,
|
||||
quickSuggestSponsoredIndex: -1,
|
||||
};
|
||||
|
||||
|
@ -148,10 +148,7 @@ add_task(async function init() {
|
||||
await PlacesUtils.history.clear();
|
||||
await UrlbarTestUtils.formHistory.clear();
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.urlbar.suggest.searches", true],
|
||||
["browser.startup.upgradeDialog.version", 89],
|
||||
],
|
||||
set: [["browser.urlbar.suggest.searches", true]],
|
||||
});
|
||||
|
||||
Services.prefs.clearUserPref(SEEN_DIALOG_PREF);
|
||||
|
@ -13,6 +13,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
|
||||
const SHOWED_ONBOARDING_DIALOG_PREF =
|
||||
"browser.urlbar.quicksuggest.showedOnboardingDialog";
|
||||
const OPT_IN_PREF = "browser.urlbar.suggest.quicksuggest";
|
||||
const SEEN_RESTART_PREF = "browser.urlbar.quicksuggest.seenRestarts";
|
||||
|
||||
add_task(async function init() {
|
||||
@ -21,8 +22,8 @@ add_task(async function init() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.urlbar.suggest.searches", true],
|
||||
["browser.startup.upgradeDialog.version", 89],
|
||||
// Reset those prefs in case they were set by other tests
|
||||
[OPT_IN_PREF, false],
|
||||
[SHOWED_ONBOARDING_DIALOG_PREF, false],
|
||||
[SEEN_RESTART_PREF, 0],
|
||||
],
|
||||
@ -45,15 +46,15 @@ add_task(async function init() {
|
||||
});
|
||||
});
|
||||
|
||||
// The default is to wait for 2 browser restarts to show the onboarding dialog
|
||||
// on the 3rd restart. This tests that we can override it by configuring the
|
||||
// The default is to wait for no browser restarts to show the onboarding dialog
|
||||
// on the first restart. This tests that we can override it by configuring the
|
||||
// `showOnboardingDialogOnNthRestart`
|
||||
add_task(async function test_override_wait_after_n_restarts() {
|
||||
let doExperimentCleanup = await UrlbarTestUtils.enrollExperiment({
|
||||
valueOverrides: {
|
||||
quickSuggestEnabled: true,
|
||||
quickSuggestShouldShowOnboardingDialog: true,
|
||||
// Just wait for 1 browser restart instead of the default 2
|
||||
// Wait for 1 browser restart
|
||||
quickSuggestShowOnboardingDialogAfterNRestarts: 1,
|
||||
},
|
||||
});
|
||||
@ -85,6 +86,7 @@ add_task(async function test_override_wait_after_n_restarts() {
|
||||
add_task(async function test_skip_onboarding_dialog() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[OPT_IN_PREF, false],
|
||||
[SHOWED_ONBOARDING_DIALOG_PREF, false],
|
||||
[SEEN_RESTART_PREF, 0],
|
||||
],
|
||||
|
@ -18,11 +18,10 @@ const LEARN_MORE_URL =
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL") +
|
||||
"firefox-suggest";
|
||||
|
||||
const MR1_VERSION = 89;
|
||||
|
||||
// When the accept button is clicked, no new pages should load.
|
||||
// When the accept button is clicked, no new pages should load, and the feature
|
||||
// should be enabled.
|
||||
add_task(async function accept() {
|
||||
await doDialogTest(async () => {
|
||||
await doDialogTest(true, async () => {
|
||||
let tabCount = gBrowser.tabs.length;
|
||||
let dialogPromise = openDialog("accept");
|
||||
|
||||
@ -41,9 +40,31 @@ add_task(async function accept() {
|
||||
});
|
||||
});
|
||||
|
||||
// When the Disable button is clicked, about:preferences#search should load.
|
||||
add_task(async function disable() {
|
||||
await doDialogTest(async () => {
|
||||
// When the Not Now link is clicked, no new pages should load, and the feature
|
||||
// should be enabled.
|
||||
add_task(async function notNow() {
|
||||
await doDialogTest(false, async () => {
|
||||
let tabCount = gBrowser.tabs.length;
|
||||
let dialogPromise = openDialog("onboardingNotNow");
|
||||
|
||||
info("Calling maybeShowOnboardingDialog");
|
||||
await UrlbarQuickSuggest.maybeShowOnboardingDialog();
|
||||
|
||||
info("Waiting for dialog");
|
||||
await dialogPromise;
|
||||
|
||||
Assert.equal(
|
||||
gBrowser.currentURI.spec,
|
||||
"about:blank",
|
||||
"Nothing loaded in the current tab"
|
||||
);
|
||||
Assert.equal(gBrowser.tabs.length, tabCount, "No news tabs were opened");
|
||||
});
|
||||
});
|
||||
|
||||
// When the Customize button is clicked, about:preferences#search should load.
|
||||
add_task(async function customize() {
|
||||
await doDialogTest(false, async () => {
|
||||
let dialogPromise = openDialog("extra1");
|
||||
|
||||
// about:preferences#search will load in the current tab since it's
|
||||
@ -72,8 +93,8 @@ add_task(async function disable() {
|
||||
// When the Learn More button is clicked, the support URL should open in a new
|
||||
// tab.
|
||||
add_task(async function learnMore() {
|
||||
await doDialogTest(async () => {
|
||||
let dialogPromise = openDialog("extra2");
|
||||
await doDialogTest(false, async () => {
|
||||
let dialogPromise = openDialog("onboardingLearnMore");
|
||||
let loadPromise = BrowserTestUtils.waitForNewTab(
|
||||
gBrowser,
|
||||
LEARN_MORE_URL
|
||||
@ -101,19 +122,26 @@ add_task(async function learnMore() {
|
||||
});
|
||||
});
|
||||
|
||||
async function doDialogTest(callback) {
|
||||
async function doDialogTest(expectOptIn, callback) {
|
||||
await BrowserTestUtils.withNewTab("about:blank", async () => {
|
||||
// Set all the required prefs for showing the onboarding dialog.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.urlbar.suggest.quicksuggest", false],
|
||||
["browser.urlbar.quicksuggest.enabled", true],
|
||||
["browser.urlbar.quicksuggest.shouldShowOnboardingDialog", true],
|
||||
["browser.urlbar.quicksuggest.showedOnboardingDialog", false],
|
||||
["browser.urlbar.quicksuggest.showOnboardingDialogAfterNRestarts", 0],
|
||||
["browser.startup.upgradeDialog.version", MR1_VERSION],
|
||||
],
|
||||
});
|
||||
await callback();
|
||||
|
||||
Assert.equal(
|
||||
UrlbarPrefs.get("suggest.quicksuggest"),
|
||||
expectOptIn,
|
||||
"The feature has been enabled"
|
||||
);
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ add_task(async function init() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[EXPERIMENT_PREF, true],
|
||||
["browser.urlbar." + SUGGEST_PREF, true],
|
||||
["browser.urlbar.suggest.searches", true],
|
||||
["browser.urlbar.quicksuggest.showedOnboardingDialog", true],
|
||||
],
|
||||
});
|
||||
|
||||
@ -321,7 +321,7 @@ add_task(async function enableToggled() {
|
||||
TelemetryTestUtils.assertEvents([], { category: TELEMETRY_EVENT_CATEGORY });
|
||||
await SpecialPowers.popPrefEnv();
|
||||
|
||||
UrlbarPrefs.clear(SUGGEST_PREF);
|
||||
UrlbarPrefs.set(SUGGEST_PREF, true);
|
||||
});
|
||||
|
||||
// Tests the Nimbus "exposure" event gets recorded when the user is enrolled in
|
||||
|
@ -2339,8 +2339,9 @@ var BrowserTestUtils = {
|
||||
/**
|
||||
* Waits for the dialog to open, and clicks the specified button.
|
||||
*
|
||||
* @param {string} buttonAction
|
||||
* The ID of the button to click ("accept", "cancel", etc).
|
||||
* @param {string} buttonNameOrElementID
|
||||
* The name of the button ("accept", "cancel", etc) or element ID to
|
||||
* click.
|
||||
* @param {string} uri
|
||||
* The URI of the dialog to wait for. Defaults to the common dialog.
|
||||
* @return {Promise}
|
||||
@ -2349,7 +2350,7 @@ var BrowserTestUtils = {
|
||||
* specified button is clicked.
|
||||
*/
|
||||
async promiseAlertDialogOpen(
|
||||
buttonAction,
|
||||
buttonNameOrElementID,
|
||||
uri = "chrome://global/content/commonDialog.xhtml",
|
||||
options = { callback: null, isSubDialog: false }
|
||||
) {
|
||||
@ -2372,9 +2373,12 @@ var BrowserTestUtils = {
|
||||
return win;
|
||||
}
|
||||
|
||||
if (buttonAction) {
|
||||
if (buttonNameOrElementID) {
|
||||
let dialog = win.document.querySelector("dialog");
|
||||
dialog.getButton(buttonAction).click();
|
||||
let element =
|
||||
dialog.getButton(buttonNameOrElementID) ||
|
||||
win.document.getElementById(buttonNameOrElementID);
|
||||
element.click();
|
||||
}
|
||||
|
||||
return win;
|
||||
@ -2384,8 +2388,9 @@ var BrowserTestUtils = {
|
||||
* Waits for the dialog to open, and clicks the specified button, and waits
|
||||
* for the dialog to close.
|
||||
*
|
||||
* @param {string} buttonAction
|
||||
* The ID of the button to click ("accept", "cancel", etc).
|
||||
* @param {string} buttonNameOrElementID
|
||||
* The name of the button ("accept", "cancel", etc) or element ID to
|
||||
* click.
|
||||
* @param {string} uri
|
||||
* The URI of the dialog to wait for. Defaults to the common dialog.
|
||||
* @return {Promise}
|
||||
@ -2394,11 +2399,15 @@ var BrowserTestUtils = {
|
||||
* specified button is clicked, and the dialog has been fully closed.
|
||||
*/
|
||||
async promiseAlertDialog(
|
||||
buttonAction,
|
||||
buttonNameOrElementID,
|
||||
uri = "chrome://global/content/commonDialog.xhtml",
|
||||
options = { callback: null, isSubDialog: false }
|
||||
) {
|
||||
let win = await this.promiseAlertDialogOpen(buttonAction, uri, options);
|
||||
let win = await this.promiseAlertDialogOpen(
|
||||
buttonNameOrElementID,
|
||||
uri,
|
||||
options
|
||||
);
|
||||
if (!win.docShell.browsingContext.embedderElement) {
|
||||
return this.windowClosed(win);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user