forked from Floorp-Projects/Floorp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1737873 - Add More From Mozilla in about:preferences r=preference…
…s-reviewers,Gijs,fluent-reviewers Differential Revision: https://phabricator.services.mozilla.com/D128289
- Loading branch information
1 parent
c0794d7
commit 4789f87
Showing
16 changed files
with
282 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
browser/components/preferences/content/moreFromMozilla.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# 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/. | ||
|
||
### These strings are related to moreFromMozilla section added | ||
### in about:preferences for en-US only Fx95 experiment | ||
|
||
## These strings are used in the about:preferences moreFromMozilla page | ||
|
||
pane-more-from-mozilla-title = More From { -vendor-short-name } | ||
category-more-from-mozilla = | ||
.tooltiptext = More From { -vendor-short-name } | ||
pane-more-from-mozilla-subtitle = Check out other Mozilla products that work to support a healthy internet. | ||
firefox-mobile-title = { -brand-product-name } Mobile | ||
firefox-mobile-description = Get the mobile browser that puts your privacy first. | ||
mozilla-vpn-title = { -mozilla-vpn-brand-name } | ||
mozilla-vpn-description = Discover an added layer of anonymous browsing and protection. | ||
mozilla-rally-title = { -vendor-short-name } Rally | ||
mozilla-rally-description = Put your data to work for a better Internet for everyone. | ||
button-firefox-mobile = | ||
.label = Get { -brand-product-name } Mobile | ||
button-mozilla-vpn = | ||
.label = Get VPN | ||
button-mozilla-rally = | ||
.label = Join Rally |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# 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/. | ||
|
||
<!-- More From Mozilla panel --> | ||
|
||
<script src="chrome://browser/content/preferences/moreFromMozilla.js"/> | ||
<html:template id="template-paneMoreFromMozilla"> | ||
<vbox id="moreFromMozillaCategory" | ||
class="subcategory" | ||
data-hidden-from-search="true" | ||
data-category="paneMoreFromMozilla"> | ||
<html:h1 class="title" data-l10n-id="pane-more-from-mozilla-title" /> | ||
<html:p class="subtitle" data-l10n-id="pane-more-from-mozilla-subtitle" /> | ||
<!-- Mozilla Products --> | ||
<vbox class="list-item"> | ||
<label> | ||
<html:h2 id="firefox-mobile" class="product-title" data-l10n-id="firefox-mobile-title" /> | ||
</label> | ||
<html:p class="description" data-l10n-id="firefox-mobile-description" /> | ||
<hbox> | ||
<button id="fxMobile" class="primary small-button" data-l10n-id="button-firefox-mobile" /> | ||
</hbox> | ||
</vbox> | ||
<vbox class="list-item"> | ||
<label> | ||
<html:h2 id="mozilla-vpn" class="product-title" data-l10n-id="mozilla-vpn-title" /> | ||
</label> | ||
<html:p class="description" data-l10n-id="mozilla-vpn-description" /> | ||
<hbox> | ||
<button id="mozillaVPN" class="primary small-button" data-l10n-id="button-mozilla-vpn" /> | ||
</hbox> | ||
</vbox> | ||
<vbox class="list-item"> | ||
<label> | ||
<html:h2 id="mozilla-rally" class="product-title" data-l10n-id="mozilla-rally-title" /> | ||
</label> | ||
<html:p class="description" data-l10n-id="mozilla-rally-description" /> | ||
<hbox> | ||
<button id="mozillaRally" class="primary small-button" data-l10n-id="button-mozilla-rally" /> | ||
</hbox> | ||
</vbox> | ||
</vbox> | ||
</html:template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* 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/. */ | ||
|
||
/* import-globals-from preferences.js */ | ||
|
||
var gMoreFromMozillaPane = { | ||
initialized: false, | ||
|
||
openURL(url) { | ||
const URL_PARAMS = { | ||
utm_source: "about-preferences", | ||
utm_campaign: "morefrommozilla-na", | ||
utm_medium: "firefox-release-browser", | ||
entrypoint_experiment: "morefrommozilla", | ||
entrypoint_variation: "a", | ||
}; | ||
|
||
let pageUrl = new URL(url); | ||
for (let [key, val] of Object.entries(URL_PARAMS)) { | ||
pageUrl.searchParams.append(key, val); | ||
} | ||
|
||
let mainWindow = window.windowRoot.ownerGlobal; | ||
mainWindow.openTrustedLinkIn(pageUrl.toString(), "tab"); | ||
}, | ||
|
||
async init() { | ||
if (this.initialized) { | ||
return; | ||
} | ||
this.initialized = true; | ||
document | ||
.getElementById("moreFromMozillaCategory") | ||
.removeAttribute("data-hidden-from-search"); | ||
|
||
document.getElementById("mozillaVPN").addEventListener("click", function() { | ||
gMoreFromMozillaPane.openURL("https://www.mozilla.org/products/vpn/"); | ||
}); | ||
|
||
document.getElementById("fxMobile").addEventListener("click", function() { | ||
gMoreFromMozillaPane.openURL( | ||
"https://www.mozilla.org/en-US/firefox/browsers/mobile/" | ||
); | ||
}); | ||
|
||
document | ||
.getElementById("mozillaRally") | ||
.addEventListener("click", function() { | ||
gMoreFromMozillaPane.openURL("https://rally.mozilla.org/"); | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
browser/components/preferences/tests/browser_moreFromMozilla.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* Any copyright is dedicated to the Public Domain. | ||
* http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
||
"use strict"; | ||
|
||
/** | ||
* Test that we don't show moreFromMozilla pane when it's disabled. | ||
*/ | ||
add_task(async function testwhenPrefDisabled() { | ||
await SpecialPowers.pushPrefEnv({ | ||
set: [["browser.preferences.moreFromMozilla", false]], | ||
}); | ||
|
||
await openPreferencesViaOpenPreferencesAPI("paneGeneral", { | ||
leaveOpen: true, | ||
}); | ||
let doc = gBrowser.contentDocument; | ||
|
||
let moreFromMozillaCategory = doc.getElementById( | ||
"category-more-from-mozilla" | ||
); | ||
ok(moreFromMozillaCategory, "The category exists"); | ||
ok(moreFromMozillaCategory.hidden, "The category is hidden"); | ||
|
||
BrowserTestUtils.removeTab(gBrowser.selectedTab); | ||
}); | ||
|
||
add_task(async function testwhenPrefEnabled() { | ||
await SpecialPowers.pushPrefEnv({ | ||
set: [["browser.preferences.moreFromMozilla", true]], | ||
}); | ||
|
||
await openPreferencesViaOpenPreferencesAPI("paneGeneral", { | ||
leaveOpen: true, | ||
}); | ||
let doc = gBrowser.contentDocument; | ||
|
||
let moreFromMozillaCategory = doc.getElementById( | ||
"category-more-from-mozilla" | ||
); | ||
ok(moreFromMozillaCategory, "The category exists"); | ||
ok(!moreFromMozillaCategory.hidden, "The category is not hidden"); | ||
|
||
BrowserTestUtils.removeTab(gBrowser.selectedTab); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
preview/protections.ftl (../components/protections/content/protections.ftl) | ||
preview/interventions.ftl (../components/urlbar/content/interventions.ftl) | ||
preview/firefoxSuggest.ftl (../components/urlbar/content/firefoxSuggest.ftl) | ||
preview/moreFromMozilla.ftl (../components/preferences/content/moreFromMozilla.ftl) | ||
browser (%browser/**/*.ftl) | ||
|
||
@[email protected]: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters