Backed out changeset f4ab27bcac2e (bug 1715504) for causing browser-chrome failures in browser_all_files_referenced. CLOSED TREE

This commit is contained in:
Sandor Molnar 2021-06-18 13:38:10 +03:00
parent 5e63926089
commit 917badff50
10 changed files with 16 additions and 399 deletions

View File

@ -47,7 +47,7 @@ class AboutPrivateBrowsingChild extends RemotePageChild {
}
PrivateBrowsingFeatureConfig() {
const config = NimbusFeatures.privatebrowsing.getAllVariables({
const config = NimbusFeatures.privatebrowsing.getValue({
sendExposureEvent: true,
});

View File

@ -528,8 +528,6 @@ pref("browser.privatebrowsing.promoEnabled", true);
pref("browser.privatebrowsing.promoTitle", "");
pref("browser.privatebrowsing.promoLinkText", "");
pref("browser.privatebrowsing.promoLinkUrl", "");
pref("browser.privatebrowsing.infoTitleEnabled", true);
pref("browser.privatebrowsing.promoTitleEnabled", true);
pref("browser.sessionhistory.max_entries", 50);

View File

@ -12,7 +12,7 @@
<link rel="stylesheet" href="chrome://browser/content/aboutPrivateBrowsing.css" media="all"/>
<link rel="stylesheet" href="chrome://browser/skin/privatebrowsing/aboutPrivateBrowsing.css" media="all"/>
<link rel="localization" href="branding/brand.ftl"/>
<link rel="localization" href="browser/branding/brandings.ftl"/>
<link rel="localization" href="browser/branding/brandings.ftl">
<link rel="localization" href="browser/aboutPrivateBrowsing.ftl"/>
<script src="chrome://browser/content/aboutPrivateBrowsing.js"></script>
<script src="chrome://browser/content/contentSearchHandoffUI.js"></script>
@ -59,19 +59,8 @@
</div>
<div class="promo">
<div class="promo-image-large">
<img src="" alt="" />
</div>
<div class="promo-content">
<h1 id="promo-header"></h1>
<p id="private-browsing-vpn-text" class="vpn-promo" data-l10n-id="about-private-browsing-need-more-privacy"></p>
<div class="promo-cta">
<a id="private-browsing-vpn-link" class="vpn-promo" data-l10n-id="about-private-browsing-turn-on-vpn"></a>
<div class="promo-image-small">
<img src="" alt="" />
</div>
</div>
</div>
<p id="private-browsing-vpn-text" class="vpn-promo" data-l10n-id="about-private-browsing-need-more-privacy"></p>
<a id="private-browsing-vpn-link" class="vpn-promo" data-l10n-id="about-private-browsing-turn-on-vpn"></a>
</div>
</body>
</html>

View File

@ -33,7 +33,6 @@ async function translateElements(container, items) {
async function renderInfo({
infoEnabled,
infoTitle,
infoTitleEnabled,
infoBody,
infoLinkText,
infoLinkUrl,
@ -53,10 +52,6 @@ async function renderInfo({
container.style.backgroundImage = `url(${infoIcon})`;
}
if (!infoTitleEnabled) {
titleEl.remove();
}
await translateElements(container, [
[titleEl, infoTitle],
[bodyEl, infoBody],
@ -77,14 +72,8 @@ async function renderInfo({
async function renderPromo({
promoEnabled,
promoTitle,
promoTitleEnabled,
promoLinkText,
promoLinkUrl,
promoLinkType,
promoSectionStyle,
promoHeader,
promoImageLarge,
promoImageSmall,
}) {
const container = document.querySelector(".promo");
if (promoEnabled === false) {
@ -100,65 +89,24 @@ async function renderPromo({
});
const titleEl = document.getElementById("private-browsing-vpn-text");
let linkEl = document.getElementById("private-browsing-vpn-link");
const promoHeaderEl = document.getElementById("promo-header");
const infoContainerEl = document.querySelector(".info");
const promoImageLargeEl = document.querySelector(".promo-image-large img");
const promoImageSmallEl = document.querySelector(".promo-image-small img");
const linkEl = document.getElementById("private-browsing-vpn-link");
// Setup the private browsing VPN link.
const vpnPromoUrl =
promoLinkUrl || RPMGetFormatURLPref("browser.privatebrowsing.vpnpromourl");
if (promoLinkType === "button") {
linkEl.classList.add("button");
}
linkEl.addEventListener("click", () => {
window.PrivateBrowsingRecordClick("promo_link");
});
if (vpnPromoUrl) {
linkEl.setAttribute("href", vpnPromoUrl);
linkEl.addEventListener("click", () => {
window.PrivateBrowsingRecordClick("promo_link");
});
} else {
// If the link is undefined, remove the promo completely
container.remove();
return;
}
if (promoSectionStyle) {
container.classList.add(promoSectionStyle);
switch (promoSectionStyle) {
case "below-search":
container.remove();
infoContainerEl.insertAdjacentElement("beforebegin", container);
break;
case "top":
container.remove();
document.body.insertAdjacentElement("afterbegin", container);
}
}
if (promoHeader) {
promoHeaderEl.innerText = promoHeader;
}
if (promoImageLarge) {
promoImageLargeEl.src = promoImageLarge;
} else {
promoImageLargeEl.parentNode.remove();
}
if (promoImageSmall) {
promoImageSmallEl.src = promoImageSmall;
} else {
promoImageSmallEl.parentNode.remove();
}
if (!promoTitleEnabled) {
titleEl.remove();
}
await translateElements(container, [
[titleEl, promoTitle],
[linkEl, promoLinkText],

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 18 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -6,4 +6,3 @@ browser.jar:
content/browser/aboutPrivateBrowsing.css (content/aboutPrivateBrowsing.css)
content/browser/aboutPrivateBrowsing.html (content/aboutPrivateBrowsing.html)
content/browser/aboutPrivateBrowsing.js (content/aboutPrivateBrowsing.js)
content/browser/assets/ (content/assets/*)

View File

@ -46,6 +46,7 @@ function waitForTelemetryEvent(category) {
}
add_task(async function test_experiment_plain_text() {
await ExperimentAPI.ready();
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "privatebrowsing",
enabled: true,
@ -93,6 +94,7 @@ add_task(async function test_experiment_plain_text() {
});
add_task(async function test_experiment_fluent() {
await ExperimentAPI.ready();
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "privatebrowsing",
enabled: true,
@ -128,6 +130,7 @@ add_task(async function test_experiment_fluent() {
});
add_task(async function test_experiment_info_disabled() {
await ExperimentAPI.ready();
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "privatebrowsing",
enabled: true,
@ -151,6 +154,7 @@ add_task(async function test_experiment_info_disabled() {
});
add_task(async function test_experiment_promo_disabled() {
await ExperimentAPI.ready();
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "privatebrowsing",
enabled: true,
@ -174,6 +178,7 @@ add_task(async function test_experiment_promo_disabled() {
});
add_task(async function test_experiment_format_urls() {
await ExperimentAPI.ready();
const LOCALE = Services.locale.appLocaleAsBCP47;
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "privatebrowsing",
@ -204,6 +209,7 @@ add_task(async function test_experiment_format_urls() {
});
add_task(async function test_experiment_click_info_telemetry() {
await ExperimentAPI.ready();
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "privatebrowsing",
enabled: true,
@ -233,6 +239,7 @@ add_task(async function test_experiment_click_info_telemetry() {
});
add_task(async function test_experiment_click_promo_telemetry() {
await ExperimentAPI.ready();
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "privatebrowsing",
enabled: true,
@ -260,166 +267,3 @@ add_task(async function test_experiment_click_promo_telemetry() {
await BrowserTestUtils.closeWindow(win);
await doExperimentCleanup();
});
add_task(async function test_experiment_bottom_promo() {
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "privatebrowsing",
value: {
enabled: true,
promoLinkType: "button",
promoSectionStyle: "bottom",
promoHeader: "Need more privacy?",
promoTitleEnabled: false,
promoImageLarge: "",
promoImageSmall: "chrome://browser/content/assets/vpn-logo.svg",
},
});
let { win, tab } = await openTabAndWaitForRender();
await SpecialPowers.spawn(tab, [], async function() {
is(
content.document
.querySelector(".promo-cta .button")
.classList.contains("button"),
true,
"Should have a button CTA"
);
is(
content.document.querySelector(".promo-image-small img").src,
"chrome://browser/content/assets/vpn-logo.svg",
"Should have logo image"
);
ok(
content.document.querySelector(".promo.bottom"),
"Should have .bottom for the promo section"
);
ok(
content.document.querySelector("#info-title"),
"Should render info title if infoTitleEnabled is true"
);
ok(
!content.document.querySelector("#private-browsing-vpn-text"),
"Should not render promo title if promoTitleEnabled is true"
);
ok(
content.document.querySelector("#info-title"),
"Should render info title if infoTitleEnabled is true"
);
ok(
!content.document.querySelector("#private-browsing-vpn-text"),
"Should not render promo title if promoTitleEnabled is false"
);
});
await BrowserTestUtils.closeWindow(win);
await doExperimentCleanup();
});
add_task(async function test_experiment_below_search_promo() {
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "privatebrowsing",
value: {
enabled: true,
promoLinkType: "button",
promoSectionStyle: "below-search",
promoHeader: "Need more privacy?",
promoTitle:
"Mozilla VPN. Security, reliability and speed — on every device, anywhere you go.",
promoImageLarge: "chrome://browser/content/assets/moz-vpn.svg",
promoImageSmall: "chrome://browser/content/assets/vpn-logo.svg",
infoTitleEnabled: false,
},
});
let { win, tab } = await openTabAndWaitForRender();
await SpecialPowers.spawn(tab, [], async function() {
is(
content.document
.querySelector(".promo-cta .button")
.classList.contains("button"),
true,
"Should have a button CTA"
);
is(
content.document.querySelector(".promo-image-small img").src,
"chrome://browser/content/assets/vpn-logo.svg",
"Should have logo image"
);
is(
content.document.querySelector(".promo-image-large img").src,
"chrome://browser/content/assets/moz-vpn.svg",
"Should have a product image"
);
ok(
content.document.querySelector(".promo.below-search"),
"Should have .below-search for the promo section"
);
ok(
!content.document.querySelector("#info-title"),
"Should not render info title if infoTitleEnabled is false"
);
ok(
content.document.querySelector("#private-browsing-vpn-text"),
"Should render promo title if promoTitleEnabled is true"
);
});
await BrowserTestUtils.closeWindow(win);
await doExperimentCleanup();
});
add_task(async function test_experiment_top_promo() {
let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
featureId: "privatebrowsing",
value: {
enabled: true,
promoLinkType: "button",
promoSectionStyle: "top",
promoHeader: "Need more privacy?",
promoTitle:
"Mozilla VPN. Security, reliability and speed — on every device,anywhere you go.",
promoImageLarge: "chrome://browser/content/assets/moz-vpn.svg",
promoImageSmall: "chrome://browser/content/assets/vpn-logo.svg",
infoTitleEnabled: false,
},
});
let { win, tab } = await openTabAndWaitForRender();
await SpecialPowers.spawn(tab, [], async function() {
ok(
!content.document.querySelector("#info-title"),
"Should remove the infoTitle element"
);
is(
content.document.querySelector(".promo-image-small img").src,
"chrome://browser/content/assets/vpn-logo.svg",
"Should have logo image"
);
is(
content.document.querySelector(".promo-image-large img").src,
"chrome://browser/content/assets/moz-vpn.svg",
"Should have a product image"
);
ok(
content.document.querySelector(".promo.top"),
"Should have .below-search for the promo section"
);
ok(
!content.document.querySelector("#info-title"),
"Should not render info title if infoTitleEnabled is false"
);
ok(
content.document.querySelector("#private-browsing-vpn-text"),
"Should render promo title if promoTitleEnabled is true"
);
});
await BrowserTestUtils.closeWindow(win);
await doExperimentCleanup();
});

View File

@ -86,66 +86,10 @@ p {
min-width: 70vw;
}
.promo-image-large {
margin-inline-end: 6px;
min-width: 160px;
}
.promo-image-small {
display: none;
}
.promo.top {
background: rgba(255, 255, 255, .2);
position: absolute;
top: 0;
left: 0;
right: 0;
border-bottom: 1px solid rgba(255, 255, 255, .3);
}
.promo.top .promo-image-large {
min-width: 100px;
margin-inline: 6px;
}
.promo.top ~ .container {
margin-top: 120px;
}
@media (min-width: 764px) {
.search-inner-wrapper {
min-width: 680px;
}
.promo-image-large {
margin-inline-end: 36px;
min-width: 200px;
}
.promo-image-small {
display: block;
}
.promo.top {
padding: 10px 22%;
}
.promo.top .promo-image-large {
min-width: 120px;
}
.promo.top .vpn-promo {
margin: 10px 0;
}
}
@media (max-height: 780px) {
/* On screens with not enough height we need to push down the content
* to make room for the banner */
.promo.top ~ .container {
margin-top: 140px;
}
}
.search-handoff-button,
@ -285,23 +229,17 @@ p {
background-position-x: right 32px;
}
.info h1,
.promo h1 {
.info h1 {
font-size: 18px;
font-weight: bold;
line-height: 28px;
}
.info p {
margin-top: 0;
font-size: 15px;
line-height: 25px;
}
.info #info-title + p {
margin-top: 15px;
}
.search-banner-close-button {
float: inline-end;
/* min-width and min-height override values set on button elements. */
@ -325,75 +263,9 @@ p {
.promo {
text-align: center;
display: flex;
align-items: center;
}
.promo-content {
width: 100%;
}
.promo-image-large img {
width: 100%;
}
.promo-cta {
display: flex;
justify-content: space-between;
align-items: center;
}
.promo-cta .button {
text-decoration: none;
padding: 11px 15px;
margin: 8px 0;
appearance: button;
background-color: var(--in-content-primary-button-background);
color: var(--in-content-primary-button-text-color);
border-radius: var(--in-content-button-border-radius);
font-weight: 600;
}
.promo.bottom .promo-cta {
display: unset;
}
.promo.bottom h1 {
margin-bottom: 1em;
}
.promo a {
color: inherit;
text-decoration: underline;
flex: 1;
}
.promo.top a,
.promo.below-search a {
flex: unset;
}
.promo.top,
.promo.below-search {
text-align: start;
}
.promo.below-search {
padding: 50px 22px 0;
}
.promo.bottom {
margin-top: 30px;
}
.promo.bottom .promo-image-small {
margin-top: 40px;
}
.promo.bottom .promo-image-small img {
height: 40px;
}
.promo.top > .promo-content {
padding: 10px 6px;
}

View File

@ -149,10 +149,6 @@ const FeatureManifest = {
type: "string",
fallbackPref: "browser.privatebrowsing.infoTitle",
},
infoTitleEnabled: {
type: "boolean",
fallbackPref: "browser.privatebrowsing.infoTitleEnabled",
},
infoBody: {
type: "string",
fallbackPref: "browser.privatebrowsing.infoBody",
@ -169,37 +165,18 @@ const FeatureManifest = {
type: "boolean",
fallbackPref: "browser.privatebrowsing.promoEnabled",
},
promoSectionStyle: {
type: "string",
},
promoTitle: {
type: "string",
fallbackPref: "browser.privatebrowsing.promoTitle",
},
promoTitleEnabled: {
type: "boolean",
fallbackPref: "browser.privatebrowsing.promoTitleEnabled",
},
promoLinkText: {
type: "string",
fallbackPref: "browser.privatebrowsing.promoLinkText",
},
promoHeader: {
type: "string",
},
promoLinkUrl: {
type: "string",
fallbackPref: "browser.privatebrowsing.promoLinkUrl",
},
promoLinkType: {
type: "string",
},
promoImageLarge: {
type: "string",
},
promoImageSmall: {
type: "string",
},
},
},
};