зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1395460 p1 - Remove usages of about:accounts. r=tcsc
MozReview-Commit-ID: APdGc9avJDw --HG-- extra : rebase_source : 9da1cea9fb6494c057bc6587a7bcbdb4ac127448
This commit is contained in:
Родитель
2a4555d99b
Коммит
58876ecbe9
|
@ -254,27 +254,14 @@ var gSync = {
|
||||||
PanelUI.hide();
|
PanelUI.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
openAccountsPage(action, urlParams = {}) {
|
async openSignInAgainPage(entryPoint) {
|
||||||
let params = new URLSearchParams();
|
const url = await fxAccounts.promiseAccountsForceSigninURI(entryPoint);
|
||||||
if (action) {
|
|
||||||
params.set("action", action);
|
|
||||||
}
|
|
||||||
for (let name in urlParams) {
|
|
||||||
if (urlParams[name] !== undefined) {
|
|
||||||
params.set(name, urlParams[name]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let url = "about:accounts?" + params;
|
|
||||||
switchToTabHavingURI(url, true, {
|
switchToTabHavingURI(url, true, {
|
||||||
replaceQueryString: true,
|
replaceQueryString: true,
|
||||||
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal(),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
openSignInAgainPage(entryPoint) {
|
|
||||||
this.openAccountsPage("reauth", { entrypoint: entryPoint });
|
|
||||||
},
|
|
||||||
|
|
||||||
async openDevicesManagementPage(entryPoint) {
|
async openDevicesManagementPage(entryPoint) {
|
||||||
let url = await fxAccounts.promiseAccountsManageDevicesURI(entryPoint);
|
let url = await fxAccounts.promiseAccountsManageDevicesURI(entryPoint);
|
||||||
switchToTabHavingURI(url, true, {
|
switchToTabHavingURI(url, true, {
|
||||||
|
|
|
@ -59,7 +59,7 @@ add_task(async function setup() {
|
||||||
// The test expects the about:preferences#sync page to open in the current tab
|
// The test expects the about:preferences#sync page to open in the current tab
|
||||||
async function openPrefsFromMenuPanel(expectedPanelId, entryPoint) {
|
async function openPrefsFromMenuPanel(expectedPanelId, entryPoint) {
|
||||||
info("Check Sync button functionality");
|
info("Check Sync button functionality");
|
||||||
Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", "http://example.com/");
|
Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", "https://example.com/");
|
||||||
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_FIXED_OVERFLOW_PANEL);
|
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_FIXED_OVERFLOW_PANEL);
|
||||||
|
|
||||||
await waitForOverflowButtonShown();
|
await waitForOverflowButtonShown();
|
||||||
|
|
|
@ -559,23 +559,23 @@ var gMainPane = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onGetStarted(aEvent) {
|
async onGetStarted(aEvent) {
|
||||||
if (AppConstants.MOZ_DEV_EDITION) {
|
if (!AppConstants.MOZ_DEV_EDITION) {
|
||||||
const Cc = Components.classes, Ci = Components.interfaces;
|
return;
|
||||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
}
|
||||||
|
const win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||||
fxAccounts.getSignedInUser().then(data => {
|
if (!win) {
|
||||||
if (win) {
|
return;
|
||||||
if (data) {
|
}
|
||||||
|
const user = await fxAccounts.getSignedInUser();
|
||||||
|
if (user) {
|
||||||
// We have a user, open Sync preferences in the same tab
|
// We have a user, open Sync preferences in the same tab
|
||||||
win.openUILinkIn("about:preferences#sync", "current");
|
win.openUILinkIn("about:preferences#sync", "current");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let accountsTab = win.gBrowser.addTab("about:accounts?action=signin&entrypoint=dev-edition-setup");
|
let url = await fxAccounts.promiseAccountsSignInURI("dev-edition-setup");
|
||||||
|
let accountsTab = win.gBrowser.addTab(url);
|
||||||
win.gBrowser.selectedTab = accountsTab;
|
win.gBrowser.selectedTab = accountsTab;
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// HOME PAGE
|
// HOME PAGE
|
||||||
|
|
|
@ -153,6 +153,10 @@ var gSyncPane = {
|
||||||
document.getElementById("verifiedManage").setAttribute("href", accountsManageURI);
|
document.getElementById("verifiedManage").setAttribute("href", accountsManageURI);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fxAccounts.promiseAccountsSignUpURI(this._getEntryPoint()).then(signUpURI => {
|
||||||
|
document.getElementById("noFxaSignUp").setAttribute("href", signUpURI);
|
||||||
|
});
|
||||||
|
|
||||||
this.updateWeavePrefs();
|
this.updateWeavePrefs();
|
||||||
|
|
||||||
// Notify observers that the UI is now ready
|
// Notify observers that the UI is now ready
|
||||||
|
@ -355,17 +359,6 @@ var gSyncPane = {
|
||||||
return params.get("entrypoint") || "preferences";
|
return params.get("entrypoint") || "preferences";
|
||||||
},
|
},
|
||||||
|
|
||||||
_openAboutAccounts(action) {
|
|
||||||
let entryPoint = this._getEntryPoint();
|
|
||||||
let params = new URLSearchParams();
|
|
||||||
if (action) {
|
|
||||||
params.set("action", action);
|
|
||||||
}
|
|
||||||
params.set("entrypoint", entryPoint);
|
|
||||||
|
|
||||||
this.replaceTabWithUrl("about:accounts?" + params);
|
|
||||||
},
|
|
||||||
|
|
||||||
openContentInBrowser(url, options) {
|
openContentInBrowser(url, options) {
|
||||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||||
if (!win) {
|
if (!win) {
|
||||||
|
@ -386,16 +379,14 @@ var gSyncPane = {
|
||||||
browser.loadURI(url);
|
browser.loadURI(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
signUp() {
|
async signIn() {
|
||||||
this._openAboutAccounts("signup");
|
const url = await fxAccounts.promiseAccountsSignInURI(this._getEntryPoint());
|
||||||
|
this.replaceTabWithUrl(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
signIn() {
|
async reSignIn() {
|
||||||
this._openAboutAccounts("signin");
|
const url = await fxAccounts.promiseAccountsForceSigninURI(this._getEntryPoint());
|
||||||
},
|
this.replaceTabWithUrl(url);
|
||||||
|
|
||||||
reSignIn() {
|
|
||||||
this._openAboutAccounts("reauth");
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,7 @@
|
||||||
<hbox align="center" flex="1">
|
<hbox align="center" flex="1">
|
||||||
<html:a id="noFxaSignUp"
|
<html:a id="noFxaSignUp"
|
||||||
class="openLink"
|
class="openLink"
|
||||||
accesskey="&signedOut.accountBox.create2.accesskey;"
|
accesskey="&signedOut.accountBox.create2.accesskey;">&signedOut.accountBox.create2;</html:a>
|
||||||
onclick="gSyncPane.signUp();"
|
|
||||||
onkeypress="gSyncPane.signUp();">&signedOut.accountBox.create2;</html:a>
|
|
||||||
</hbox>
|
</hbox>
|
||||||
</vbox>
|
</vbox>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
|
|
@ -573,18 +573,18 @@ if (typeof Mozilla == "undefined") {
|
||||||
* for the URL opened by the browser.
|
* for the URL opened by the browser.
|
||||||
* @since 31, 47 for `extraURLCampaignParams`
|
* @since 31, 47 for `extraURLCampaignParams`
|
||||||
* @example
|
* @example
|
||||||
* // Will open about:accounts?action=signup&entrypoint=uitour
|
* // Will open https://accounts.firefox.com/signup?entrypoint=uitour
|
||||||
* Mozilla.UITour.showFirefoxAccounts();
|
* Mozilla.UITour.showFirefoxAccounts();
|
||||||
* @example
|
* @example
|
||||||
* // Will open:
|
* // Will open:
|
||||||
* // about:accounts?action=signup&entrypoint=uitour&utm_foo=bar&utm_bar=baz
|
* // https://accounts.firefox.com/signup?entrypoint=uitour&utm_foo=bar&utm_bar=baz
|
||||||
* Mozilla.UITour.showFirefoxAccounts({
|
* Mozilla.UITour.showFirefoxAccounts({
|
||||||
* 'utm_foo': 'bar',
|
* 'utm_foo': 'bar',
|
||||||
* 'utm_bar': 'baz'
|
* 'utm_bar': 'baz'
|
||||||
* });
|
* });
|
||||||
* @example
|
* @example
|
||||||
* // Will open:
|
* // Will open:
|
||||||
* // about:accounts?action=signup&entrypoint=uitour&email=foo%40bar.com
|
* // https://accounts.firefox.com/?action=email&email=foo%40bar.com&entrypoint=uitour
|
||||||
* Mozilla.UITour.showFirefoxAccounts(null, "foo@bar.com");
|
* Mozilla.UITour.showFirefoxAccounts(null, "foo@bar.com");
|
||||||
*/
|
*/
|
||||||
Mozilla.UITour.showFirefoxAccounts = function(extraURLCampaignParams, email) {
|
Mozilla.UITour.showFirefoxAccounts = function(extraURLCampaignParams, email) {
|
||||||
|
|
|
@ -34,6 +34,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "ReaderParent",
|
||||||
"resource:///modules/ReaderParent.jsm");
|
"resource:///modules/ReaderParent.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "PageActions",
|
XPCOMUtils.defineLazyModuleGetter(this, "PageActions",
|
||||||
"resource:///modules/PageActions.jsm");
|
"resource:///modules/PageActions.jsm");
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
|
||||||
|
"resource://gre/modules/FxAccounts.jsm");
|
||||||
|
|
||||||
// See LOG_LEVELS in Console.jsm. Common examples: "All", "Info", "Warn", & "Error".
|
// See LOG_LEVELS in Console.jsm. Common examples: "All", "Info", "Warn", & "Error".
|
||||||
const PREF_LOG_LEVEL = "browser.uitour.loglevel";
|
const PREF_LOG_LEVEL = "browser.uitour.loglevel";
|
||||||
|
@ -548,25 +550,20 @@ this.UITour = {
|
||||||
}
|
}
|
||||||
|
|
||||||
case "showFirefoxAccounts": {
|
case "showFirefoxAccounts": {
|
||||||
let p;
|
Promise.resolve().then(() => {
|
||||||
if (data.email) {
|
return data.email ? fxAccounts.promiseAccountsEmailURI(data.email, "uitour") :
|
||||||
// With email parameter added, we need to use 'email' action to help FxA determine
|
fxAccounts.promiseAccountsSignUpURI("uitour");
|
||||||
// whether the email is registered or not and direct the user down the correct flow
|
}).then(uri => {
|
||||||
p = new URLSearchParams("action=email&entrypoint=uitour");
|
const url = new URL(uri);
|
||||||
p.append("email", data.email);
|
|
||||||
} else {
|
|
||||||
// 'signup' is the default action that makes sense currently, so we don't
|
|
||||||
// accept arbitrary actions just to be safe...
|
|
||||||
p = new URLSearchParams("action=signup&entrypoint=uitour");
|
|
||||||
}
|
|
||||||
// Call our helper to validate extraURLCampaignParams and populate URLSearchParams
|
// Call our helper to validate extraURLCampaignParams and populate URLSearchParams
|
||||||
if (!this._populateCampaignParams(p, data.extraURLCampaignParams)) {
|
if (!this._populateCampaignParams(url, data.extraURLCampaignParams)) {
|
||||||
log.warn("showFirefoxAccounts: invalid campaign args specified");
|
log.warn("showFirefoxAccounts: invalid campaign args specified");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to replace the current tab.
|
// We want to replace the current tab.
|
||||||
browser.loadURI("about:accounts?" + p.toString());
|
browser.loadURI(url.href);
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,9 +758,9 @@ this.UITour = {
|
||||||
|
|
||||||
// Given a string that is a JSONified represenation of an object with
|
// Given a string that is a JSONified represenation of an object with
|
||||||
// additional utm_* URL params that should be appended, validate and append
|
// additional utm_* URL params that should be appended, validate and append
|
||||||
// them to the passed URLSearchParams object. Returns true if the params
|
// them to the passed URL object. Returns true if the params
|
||||||
// were validated and appended, and false if the request should be ignored.
|
// were validated and appended, and false if the request should be ignored.
|
||||||
_populateCampaignParams(urlSearchParams, extraURLCampaignParams) {
|
_populateCampaignParams(url, extraURLCampaignParams) {
|
||||||
// We are extra paranoid about what params we allow to be appended.
|
// We are extra paranoid about what params we allow to be appended.
|
||||||
if (typeof extraURLCampaignParams == "undefined") {
|
if (typeof extraURLCampaignParams == "undefined") {
|
||||||
// no params, so it's all good.
|
// no params, so it's all good.
|
||||||
|
@ -799,7 +796,7 @@ this.UITour = {
|
||||||
log.warn("_populateCampaignParams: invalid campaign param specified");
|
log.warn("_populateCampaignParams: invalid campaign param specified");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
urlSearchParams.append(name, value);
|
url.searchParams.append(name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -5,11 +5,20 @@ var gContentAPI;
|
||||||
var gContentWindow;
|
var gContentWindow;
|
||||||
|
|
||||||
registerCleanupFunction(function() {
|
registerCleanupFunction(function() {
|
||||||
|
Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri");
|
||||||
|
Services.prefs.clearUserPref("identity.fxaccounts.remote.email.uri");
|
||||||
Services.prefs.clearUserPref("services.sync.username");
|
Services.prefs.clearUserPref("services.sync.username");
|
||||||
});
|
});
|
||||||
|
|
||||||
add_task(setup_UITourTest);
|
add_task(setup_UITourTest);
|
||||||
|
|
||||||
|
add_task(async function setup() {
|
||||||
|
Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri",
|
||||||
|
"https://example.com/signup");
|
||||||
|
Services.prefs.setCharPref("identity.fxaccounts.remote.email.uri",
|
||||||
|
"https://example.com/?action=email");
|
||||||
|
})
|
||||||
|
|
||||||
add_UITour_task(async function test_checkSyncSetup_disabled() {
|
add_UITour_task(async function test_checkSyncSetup_disabled() {
|
||||||
let result = await getConfigurationPromise("sync");
|
let result = await getConfigurationPromise("sync");
|
||||||
is(result.setup, false, "Sync shouldn't be setup by default");
|
is(result.setup, false, "Sync shouldn't be setup by default");
|
||||||
|
@ -51,25 +60,25 @@ add_UITour_task(async function test_checkSyncCounts() {
|
||||||
|
|
||||||
// The showFirefoxAccounts API is sync related, so we test that here too...
|
// The showFirefoxAccounts API is sync related, so we test that here too...
|
||||||
add_UITour_task(async function test_firefoxAccountsNoParams() {
|
add_UITour_task(async function test_firefoxAccountsNoParams() {
|
||||||
info("Load about:accounts containing an iframe to https://accounts.firefox.com");
|
info("Load https://accounts.firefox.com");
|
||||||
await gContentAPI.showFirefoxAccounts();
|
await gContentAPI.showFirefoxAccounts();
|
||||||
await BrowserTestUtils.browserLoaded(gTestTab.linkedBrowser, false,
|
await BrowserTestUtils.browserLoaded(gTestTab.linkedBrowser, false,
|
||||||
"about:accounts?action=signup&entrypoint=uitour");
|
"https://example.com/signup?entrypoint=uitour");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
add_UITour_task(async function test_firefoxAccountsValidParams() {
|
add_UITour_task(async function test_firefoxAccountsValidParams() {
|
||||||
info("Load about:accounts containing an iframe to https://accounts.firefox.com");
|
info("Load https://accounts.firefox.com");
|
||||||
await gContentAPI.showFirefoxAccounts({ utm_foo: "foo", utm_bar: "bar" });
|
await gContentAPI.showFirefoxAccounts({ utm_foo: "foo", utm_bar: "bar" });
|
||||||
await BrowserTestUtils.browserLoaded(gTestTab.linkedBrowser, false,
|
await BrowserTestUtils.browserLoaded(gTestTab.linkedBrowser, false,
|
||||||
"about:accounts?action=signup&entrypoint=uitour&utm_foo=foo&utm_bar=bar");
|
"https://example.com/signup?entrypoint=uitour&utm_foo=foo&utm_bar=bar");
|
||||||
});
|
});
|
||||||
|
|
||||||
add_UITour_task(async function test_firefoxAccountsWithEmail() {
|
add_UITour_task(async function test_firefoxAccountsWithEmail() {
|
||||||
info("Load about:accounts containing an iframe to https://accounts.firefox.com");
|
info("Load https://accounts.firefox.com");
|
||||||
await gContentAPI.showFirefoxAccounts(null, "foo@bar.com");
|
await gContentAPI.showFirefoxAccounts(null, "foo@bar.com");
|
||||||
await BrowserTestUtils.browserLoaded(gTestTab.linkedBrowser, false,
|
await BrowserTestUtils.browserLoaded(gTestTab.linkedBrowser, false,
|
||||||
"about:accounts?action=email&entrypoint=uitour&email=foo%40bar.com");
|
"https://example.com/?action=email&email=foo%40bar.com&entrypoint=uitour");
|
||||||
});
|
});
|
||||||
|
|
||||||
add_UITour_task(async function test_firefoxAccountsNonAlphaValue() {
|
add_UITour_task(async function test_firefoxAccountsNonAlphaValue() {
|
||||||
|
@ -79,38 +88,38 @@ add_UITour_task(async function test_firefoxAccountsNonAlphaValue() {
|
||||||
let value = "foo& /=?:\\\xa9";
|
let value = "foo& /=?:\\\xa9";
|
||||||
// encodeURIComponent encodes spaces to %20 but we want "+"
|
// encodeURIComponent encodes spaces to %20 but we want "+"
|
||||||
let expected = encodeURIComponent(value).replace(/%20/g, "+");
|
let expected = encodeURIComponent(value).replace(/%20/g, "+");
|
||||||
info("Load about:accounts containing an iframe to https://accounts.firefox.com");
|
info("Load https://accounts.firefox.com");
|
||||||
await gContentAPI.showFirefoxAccounts({ utm_foo: value });
|
await gContentAPI.showFirefoxAccounts({ utm_foo: value });
|
||||||
await BrowserTestUtils.browserLoaded(gTestTab.linkedBrowser, false,
|
await BrowserTestUtils.browserLoaded(gTestTab.linkedBrowser, false,
|
||||||
"about:accounts?action=signup&entrypoint=uitour&utm_foo=" + expected);
|
"https://example.com/signup?entrypoint=uitour&utm_foo=" + expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
// A helper to check the request was ignored due to invalid params.
|
// A helper to check the request was ignored due to invalid params.
|
||||||
async function checkAboutAccountsNotLoaded() {
|
async function checkFxANotLoaded() {
|
||||||
try {
|
try {
|
||||||
await waitForConditionPromise(() => {
|
await waitForConditionPromise(() => {
|
||||||
return gBrowser.selectedBrowser.currentURI.spec.startsWith("about:accounts");
|
return gBrowser.selectedBrowser.currentURI.spec.startsWith("https://example.com");
|
||||||
}, "Check if about:accounts opened");
|
}, "Check if FxA opened");
|
||||||
ok(false, "No about:accounts tab should have opened");
|
ok(false, "No FxA tab should have opened");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
ok(true, "No about:accounts tab opened");
|
ok(true, "No FxA tab opened");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_UITour_task(async function test_firefoxAccountsNonObject() {
|
add_UITour_task(async function test_firefoxAccountsNonObject() {
|
||||||
// non-string should be rejected.
|
// non-string should be rejected.
|
||||||
await gContentAPI.showFirefoxAccounts(99);
|
await gContentAPI.showFirefoxAccounts(99);
|
||||||
await checkAboutAccountsNotLoaded();
|
await checkFxANotLoaded();
|
||||||
});
|
});
|
||||||
|
|
||||||
add_UITour_task(async function test_firefoxAccountsNonUtmPrefix() {
|
add_UITour_task(async function test_firefoxAccountsNonUtmPrefix() {
|
||||||
// Any non "utm_" name should should be rejected.
|
// Any non "utm_" name should should be rejected.
|
||||||
await gContentAPI.showFirefoxAccounts({ utm_foo: "foo", bar: "bar" });
|
await gContentAPI.showFirefoxAccounts({ utm_foo: "foo", bar: "bar" });
|
||||||
await checkAboutAccountsNotLoaded();
|
await checkFxANotLoaded();
|
||||||
});
|
});
|
||||||
|
|
||||||
add_UITour_task(async function test_firefoxAccountsNonAlphaName() {
|
add_UITour_task(async function test_firefoxAccountsNonAlphaName() {
|
||||||
// Any "utm_" name which includes non-alpha chars should be rejected.
|
// Any "utm_" name which includes non-alpha chars should be rejected.
|
||||||
await gContentAPI.showFirefoxAccounts({ utm_foo: "foo", "utm_bar=": "bar" });
|
await gContentAPI.showFirefoxAccounts({ utm_foo: "foo", "utm_bar=": "bar" });
|
||||||
await checkAboutAccountsNotLoaded();
|
await checkFxANotLoaded();
|
||||||
});
|
});
|
||||||
|
|
|
@ -13,6 +13,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "ShellService",
|
||||||
"resource:///modules/ShellService.jsm");
|
"resource:///modules/ShellService.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "ProfileAge",
|
XPCOMUtils.defineLazyModuleGetter(this, "ProfileAge",
|
||||||
"resource://gre/modules/ProfileAge.jsm");
|
"resource://gre/modules/ProfileAge.jsm");
|
||||||
|
XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
|
||||||
|
"resource://gre/modules/FxAccounts.jsm");
|
||||||
|
|
||||||
// Url to fetch snippets, in the urlFormatter service format.
|
// Url to fetch snippets, in the urlFormatter service format.
|
||||||
const SNIPPETS_URL_PREF = "browser.aboutHomeSnippets.updateUrl";
|
const SNIPPETS_URL_PREF = "browser.aboutHomeSnippets.updateUrl";
|
||||||
|
@ -124,9 +126,10 @@ this.SnippetsFeed = class SnippetsFeed {
|
||||||
this.store.dispatch(ac.BroadcastToContent({type: at.SNIPPETS_RESET}));
|
this.store.dispatch(ac.BroadcastToContent({type: at.SNIPPETS_RESET}));
|
||||||
}
|
}
|
||||||
|
|
||||||
showFirefoxAccounts(browser) {
|
async showFirefoxAccounts(browser) {
|
||||||
|
const url = await fxAccounts.promiseAccountsSignUpURI("snippets");
|
||||||
// We want to replace the current tab.
|
// We want to replace the current tab.
|
||||||
browser.loadURI("about:accounts?action=signup&entrypoint=snippets");
|
browser.loadURI(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
onAction(action) {
|
onAction(action) {
|
||||||
|
|
|
@ -77,15 +77,11 @@ onboarding.tour-sync.logged-in.title=You’re signed in to Sync!
|
||||||
onboarding.tour-sync.logged-in.description=Sync works when you’re signed in to %1$S on more than one device. Have a mobile device? Install the %1$S app and sign in to get your bookmarks, history, and passwords on the go.
|
onboarding.tour-sync.logged-in.description=Sync works when you’re signed in to %1$S on more than one device. Have a mobile device? Install the %1$S app and sign in to get your bookmarks, history, and passwords on the go.
|
||||||
# LOCALIZATION NOTE(onboarding.tour-sync.form.title): This string is displayed
|
# LOCALIZATION NOTE(onboarding.tour-sync.form.title): This string is displayed
|
||||||
# as a title and followed by onboarding.tour-sync.form.description.
|
# as a title and followed by onboarding.tour-sync.form.description.
|
||||||
# Your translation should be consistent with the form displayed in
|
|
||||||
# about:accounts when signing up to Firefox Account.
|
|
||||||
onboarding.tour-sync.form.title=Create a Firefox Account
|
onboarding.tour-sync.form.title=Create a Firefox Account
|
||||||
# LOCALIZATION NOTE(onboarding.tour-sync.form.description): The description
|
# LOCALIZATION NOTE(onboarding.tour-sync.form.description): The description
|
||||||
# continues after onboarding.tour-sync.form.title to create a complete sentence.
|
# continues after onboarding.tour-sync.form.title to create a complete sentence.
|
||||||
# If it's not possible for your locale, you can translate this string as
|
# If it's not possible for your locale, you can translate this string as
|
||||||
# "Continue to Firefox Sync" instead.
|
# "Continue to Firefox Sync" instead.
|
||||||
# Your translation should be consistent with the form displayed in
|
|
||||||
# about:accounts when signing up to Firefox Account.
|
|
||||||
onboarding.tour-sync.form.description=to continue to Firefox Sync
|
onboarding.tour-sync.form.description=to continue to Firefox Sync
|
||||||
onboarding.tour-sync.button=Next
|
onboarding.tour-sync.button=Next
|
||||||
onboarding.tour-sync.email-input.placeholder=Email
|
onboarding.tour-sync.email-input.placeholder=Email
|
||||||
|
|
|
@ -13,9 +13,9 @@ add_task(async function runTests() {
|
||||||
|
|
||||||
let browser = tab.linkedBrowser;
|
let browser = tab.linkedBrowser;
|
||||||
|
|
||||||
browser.loadURI("about:accounts");
|
browser.loadURI("about:healthreport");
|
||||||
let href = await BrowserTestUtils.browserLoaded(browser);
|
let href = await BrowserTestUtils.browserLoaded(browser);
|
||||||
is(href, "about:accounts", "Check about:accounts loaded");
|
is(href, "about:healthreport", "Check about:healthreport loaded");
|
||||||
|
|
||||||
// Using a dummy onunload listener to disable the bfcache as that can prevent
|
// Using a dummy onunload listener to disable the bfcache as that can prevent
|
||||||
// the test browser load detection mechanism from working.
|
// the test browser load detection mechanism from working.
|
||||||
|
@ -26,7 +26,7 @@ add_task(async function runTests() {
|
||||||
|
|
||||||
browser.goBack();
|
browser.goBack();
|
||||||
href = await BrowserTestUtils.browserLoaded(browser);
|
href = await BrowserTestUtils.browserLoaded(browser);
|
||||||
is(href, "about:accounts", "Check we've gone back to about:accounts");
|
is(href, "about:healthreport", "Check we've gone back to about:healthreport");
|
||||||
|
|
||||||
browser.goForward();
|
browser.goForward();
|
||||||
href = await BrowserTestUtils.browserLoaded(browser);
|
href = await BrowserTestUtils.browserLoaded(browser);
|
||||||
|
|
|
@ -1297,16 +1297,29 @@ FxAccountsInternal.prototype = {
|
||||||
return allowHttp !== true;
|
return allowHttp !== true;
|
||||||
},
|
},
|
||||||
|
|
||||||
promiseAccountsSignUpURI() {
|
async promiseAccountsSignUpURI(entrypoint) {
|
||||||
return FxAccountsConfig.promiseAccountsSignUpURI();
|
const url = new URL((await FxAccountsConfig.promiseAccountsSignUpURI()));
|
||||||
|
if (entrypoint) {
|
||||||
|
url.searchParams.append("entrypoint", entrypoint);
|
||||||
|
}
|
||||||
|
return url.href;
|
||||||
},
|
},
|
||||||
|
|
||||||
promiseAccountsSignInURI() {
|
async promiseAccountsSignInURI(entrypoint) {
|
||||||
return FxAccountsConfig.promiseAccountsSignInURI();
|
const url = new URL((await FxAccountsConfig.promiseAccountsSignInURI()));
|
||||||
|
if (entrypoint) {
|
||||||
|
url.searchParams.append("entrypoint", entrypoint);
|
||||||
|
}
|
||||||
|
return url.href;
|
||||||
},
|
},
|
||||||
|
|
||||||
promiseAccountsEmailURI() {
|
async promiseAccountsEmailURI(email, entrypoint) {
|
||||||
return FxAccountsConfig.promiseAccountsEmailURI();
|
const url = new URL((await FxAccountsConfig.promiseAccountsEmailURI()));
|
||||||
|
url.searchParams.append("email", email);
|
||||||
|
if (entrypoint) {
|
||||||
|
url.searchParams.append("entrypoint", entrypoint);
|
||||||
|
}
|
||||||
|
return url.href;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1342,9 +1355,9 @@ FxAccountsInternal.prototype = {
|
||||||
|
|
||||||
// Returns a promise that resolves with the URL to use to force a re-signin
|
// Returns a promise that resolves with the URL to use to force a re-signin
|
||||||
// of the current account.
|
// of the current account.
|
||||||
async promiseAccountsForceSigninURI() {
|
async promiseAccountsForceSigninURI(entrypoint) {
|
||||||
await FxAccountsConfig.ensureConfigured();
|
await FxAccountsConfig.ensureConfigured();
|
||||||
return this._formatPrefURL("identity.fxaccounts.remote.force_auth.uri");
|
return this._formatPrefURL("identity.fxaccounts.remote.force_auth.uri", entrypoint);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns a promise that resolves with the URL to use to change
|
// Returns a promise that resolves with the URL to use to change
|
||||||
|
|
|
@ -33,10 +33,9 @@ const CONFIG_PREFS = [
|
||||||
|
|
||||||
this.FxAccountsConfig = {
|
this.FxAccountsConfig = {
|
||||||
|
|
||||||
// Returns a promise that resolves with the URI of the remote UI flows.
|
async _getPrefURL(prefName) {
|
||||||
async promiseAccountsSignUpURI() {
|
|
||||||
await this.ensureConfigured();
|
await this.ensureConfigured();
|
||||||
let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.signup.uri");
|
let url = Services.urlFormatter.formatURLPref(prefName);
|
||||||
if (fxAccounts.requiresHttps() && !/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
|
if (fxAccounts.requiresHttps() && !/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
|
||||||
throw new Error("Firefox Accounts server must use HTTPS");
|
throw new Error("Firefox Accounts server must use HTTPS");
|
||||||
}
|
}
|
||||||
|
@ -44,23 +43,17 @@ this.FxAccountsConfig = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns a promise that resolves with the URI of the remote UI flows.
|
// Returns a promise that resolves with the URI of the remote UI flows.
|
||||||
async promiseAccountsSignInURI() {
|
promiseAccountsSignUpURI() {
|
||||||
await this.ensureConfigured();
|
return this._getPrefURL("identity.fxaccounts.remote.signup.uri");
|
||||||
let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.signin.uri");
|
|
||||||
if (fxAccounts.requiresHttps() && !/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
|
|
||||||
throw new Error("Firefox Accounts server must use HTTPS");
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Returns a promise that resolves with the URI of the remote UI flows.
|
// Returns a promise that resolves with the URI of the remote UI flows.
|
||||||
async promiseAccountsEmailURI() {
|
promiseAccountsSignInURI() {
|
||||||
await this.ensureConfigured();
|
return this._getPrefURL("identity.fxaccounts.remote.signin.uri");
|
||||||
let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.email.uri");
|
},
|
||||||
if (fxAccounts.requiresHttps() && !/^https:/.test(url)) { // Comment to un-break emacs js-mode highlighting
|
|
||||||
throw new Error("Firefox Accounts server must use HTTPS");
|
promiseAccountsEmailURI() {
|
||||||
}
|
return this._getPrefURL("identity.fxaccounts.remote.email.uri");
|
||||||
return url;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
resetConfigURLs() {
|
resetConfigURLs() {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче