Publish Vulpes Preview 15 sources for desktop, Android and Tundra

Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
OverSu 2026-09-30 23:13:03 +02:00
commit b38dea0597
25901 changed files with 9982925 additions and 369 deletions

View file

@ -0,0 +1,89 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
/**
* This module allow the user to select her age from a date picker and checks
* that she is old enough to create a Firefox account. Otherwise, it shows an
* error.
*/
/* global FxaModuleUI, FxaModule, FxaModuleStates, FxaModuleNavigation */
/* exported FxaModuleCoppa */
var FxaModuleCoppa = (function() {
var MINIMUM_AGE = 13;
function _populateSelect(select) {
var currentYear = new Date().getFullYear();
var start = currentYear - MINIMUM_AGE;
for (var year = start; year <= currentYear; year++) {
var option = document.createElement('option');
option.value= year;
if (year == start) {
option.setAttribute('data-l10n-id', 'fxa-age-earlier');
option.setAttribute('data-l10n-args', '{ "year": "' + year + '" }');
} else {
option.textContent = year;
}
select.appendChild(option);
}
}
function _enableNext(age) {
if (age === '0') {
FxaModuleUI.disableNextButton();
return;
}
FxaModuleUI.enableNextButton();
}
var Module = Object.create(FxaModule);
Module.init = function init(options) {
this.importElements('fxa-age-select');
this.isFTU = !!(options && options.isftu);
// Initially we only have one value ("Year of birth") in the age
// selection element.
if (this.fxaAgeSelect.length == 1) {
_populateSelect(this.fxaAgeSelect);
}
_enableNext(this.fxaAgeSelect.value);
// If COPPA is part of the sign up flow, then we need to add a step to the
// progress bar. Don't increment if the user is moving backwards, though.
if (!FxaModuleNavigation.backAnim) {
FxaModuleUI.increaseMaxStepsBy(1);
}
if (this.initialized) {
return;
}
this.fxaAgeSelect.addEventListener('change', () => {
_enableNext(this.fxaAgeSelect.value);
});
this.initialized = true;
};
Module.onNext = function onNext(gotoNextStepCallback) {
if (new Date().getFullYear() - this.fxaAgeSelect.value < MINIMUM_AGE) {
this.showErrorResponse({
error: this.isFTU ? 'COPPA_FTU_ERROR' : 'COPPA_ERROR'
});
return;
}
gotoNextStepCallback(FxaModuleStates.SET_PASSWORD);
};
Module.onBack = function onBack() {
FxaModuleUI.decreaseMaxStepsBy(1);
};
return Module;
})();

View file

@ -0,0 +1,193 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* global FxaModuleStates, FxaModuleUI, FxaModule, FxaModuleNavigation,
FxModuleServerRequest, FxaModuleOverlay, FxaModuleManager, EntrySheet,
BrowserFrame */
/* exported FxaModuleEnterEmail */
'use strict';
/**
* This module checks the validity of an email address, and if valid,
* determines which screen to go next.
*/
var FxaModuleEnterEmail = (function() {
function _isEmailValid(emailEl) {
return emailEl && emailEl.value && emailEl.validity.valid;
}
function _loadSignIn(done) {
done(FxaModuleStates.ENTER_PASSWORD);
}
function _loadSignUp(done) {
done(FxaModuleStates.SET_PASSWORD);
}
function _loadCoppa(done) {
done(FxaModuleStates.COPPA);
}
function _enableNext(emailEl) {
if (_isEmailValid(emailEl)) {
FxaModuleUI.enableNextButton();
} else {
FxaModuleUI.disableNextButton();
}
}
var Module = Object.create(FxaModule);
Module.init = function init(options) {
// Cache static HTML elements
this.importElements(
'fxa-email-input',
'fxa-logo',
'fxa-notice'
);
// Blocks the navigation until check the condition
_enableNext(this.fxaEmailInput);
if (this.initialized) {
return;
}
this.fxaPrivacy = document.getElementById('fxa-privacy');
this.fxaPrivacy.setAttribute('data-l10n-id', 'fxa-pn');
this.fxaTerms = document.getElementById('fxa-terms');
this.fxaTerms.setAttribute('data-l10n-id', 'fxa-tos');
this.isFTU = !!(options && options.isftu);
// Add listeners
this.fxaEmailInput.addEventListener(
'input',
function onInput(event) {
_enableNext(event.target);
}
);
this.fxaEmailInput.addEventListener(
'focus',
function onFocus() {
this.fxaLogo.setAttribute('hidden', true);
}.bind(this)
);
this.fxaEmailInput.addEventListener(
'blur',
function onBlur() {
this.fxaLogo.removeAttribute('hidden');
}.bind(this)
);
this.fxaTerms.addEventListener('click', onExternalLinkClick.bind(this));
this.fxaPrivacy.addEventListener('click', onExternalLinkClick.bind(this));
function onExternalLinkClick(e) {
/*jshint validthis:true */
e.stopPropagation();
e.preventDefault();
if (!navigator.onLine) {
return this.showErrorResponse({error: 'OFFLINE'});
}
var url = e.target.href;
if (this.entrySheet) {
this.entrySheet.close();
this.entrySheet = null;
}
this.entrySheet = new EntrySheet(
window.top.document.getElementById('screen'),
// Prefix url with LRM character
// This ensures truncation occurs correctly in an RTL document
// We can remove this when bug 1154438 is fixed.
'\u200E' + url,
new BrowserFrame({
url: url,
oop: true
})
);
this.entrySheet.open();
}
document.addEventListener(
'visibilitychange',
onVisibilityChange.bind(this)
);
function onVisibilityChange() {
/*jshint validthis:true */
if (document.hidden) {
document.removeEventListener('visibilitychange', onVisibilityChange);
if (this.entrySheet) {
this.entrySheet.close();
this.entrySheet = null;
}
}
}
window.addEventListener('holdhome', hideEntrySheet.bind(this));
window.addEventListener('home', hideEntrySheet.bind(this));
window.addEventListener('activityrequesting', hideEntrySheet.bind(this));
function hideEntrySheet() {
/*jshint validthis:true */
if (this.entrySheet) {
this.entrySheet.close();
this.entrySheet = null;
}
window.removeEventListener('holdhome', hideEntrySheet);
window.removeEventListener('home', hideEntrySheet);
window.removeEventListener('activityrequesting', hideEntrySheet);
}
// Ensure that pressing 'ENTER' (keycode 13) we send the form
// as expected
this.fxaEmailInput.addEventListener(
'keypress',
function onKeypress(event) {
if (_isEmailValid(this.fxaEmailInput) && event.keyCode === 13) {
document.activeElement.blur();
FxaModuleNavigation.next();
}
}.bind(this)
);
// Avoid to add listener twice
this.initialized = true;
};
Module.onNext = function onNext(gotoNextStepCallback) {
FxaModuleOverlay.show('fxa-connecting');
var email = this.fxaEmailInput.value;
FxModuleServerRequest.checkEmail(
email,
function onSuccess(response) {
FxaModuleOverlay.hide();
FxaModuleManager.setParam('email', email);
if (response && response.registered) {
_loadSignIn(gotoNextStepCallback);
} else if (this.isFTU) {
// XXX Skip COPPA verification during FTU: if a child has a mobile
// device, we assume a parent/guardian has given it to them, which
// implies parental consent. So, we skip to the next step in the
// signup flow, the set-password screen. See also bug 1010598.
_loadSignUp(gotoNextStepCallback);
} else {
_loadCoppa(gotoNextStepCallback);
}
}.bind(this),
this.showErrorResponse);
};
Module.onBack = function onBack() {
FxaModuleUI.enableNextButton();
};
return Module;
}());

View file

@ -0,0 +1,166 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* global FxaModuleStates, FxaModuleUI, FxaModule, FxaModuleNavigation,
FxModuleServerRequest, FxaModuleOverlay, FxaModuleManager */
/* exported FxaModuleEnterPassword */
'use strict';
/**
* This module checks the validity of password given email address, and if
* valid, determine which screen to go next.
*/
var FxaModuleEnterPassword = (function() {
function _isPasswordValid(passwordEl) {
var passwordValue = passwordEl.value;
return passwordValue && passwordEl.validity.valid;
}
function _enableNext(passwordEl) {
if (_isPasswordValid(passwordEl)) {
FxaModuleUI.enableNextButton();
} else {
FxaModuleUI.disableNextButton();
}
}
function _cleanForm(passwordEl, passwordCheck) {
passwordEl.value = '';
passwordCheck.checked = false;
passwordEl.setAttribute('type', 'password');
}
function _loadSigninSuccess(done) {
done(FxaModuleStates.SIGNIN_SUCCESS);
}
function _notVerifiedUser(done) {
done(FxaModuleStates.SIGNUP_SUCCESS);
}
function _togglePasswordVisibility() {
/*jshint validthis:true*/
var passwordFieldType = !!this.fxaShowPw.checked ? 'text' : 'password';
this.fxaPwInput.setAttribute('type', passwordFieldType);
}
function _forgotPassword() {
/*jshint validthis:true*/
var self = this;
if (this.isFTU) {
return this.showErrorResponse({
error: 'RESET_PASSWORD_ERROR'
});
}
// Note: we don't need to pass a success callback, but we do need an errback
FxModuleServerRequest.requestPasswordReset(
this.email,
null,
function on_reset_error() {
self.showErrorResponse({
error: 'UNKNOWN_ERROR'
});
}
);
}
var Module = Object.create(FxaModule);
Module.init = function init(options) {
if (!this.initialized) {
// Cache DOM elements
this.importElements(
'fxa-hello-known-user',
'fxa-pw-input',
'fxa-show-pw',
'fxa-forgot-password'
);
// Add listeners
this.fxaPwInput.addEventListener(
'input',
function onInput(event) {
_enableNext(event.target);
}
);
// Ensure that pressing 'ENTER' (keycode 13) we send the form
// as expected
this.fxaPwInput.addEventListener(
'keypress',
function onKeypress(event) {
if (_isPasswordValid(this.fxaPwInput) && event.keyCode === 13) {
document.activeElement.blur();
FxaModuleNavigation.next();
}
}.bind(this)
);
this.fxaShowPw.addEventListener(
'change',
_togglePasswordVisibility.bind(this),
false
);
this.fxaForgotPassword.addEventListener(
'click',
_forgotPassword.bind(this),
false
);
// Avoid repeated initialization
this.initialized = true;
}
if (!options || !options.email) {
console.error('Options are not sent properly. Email not available');
return;
}
this.isFTU = !!(options && options.isftu);
this.email = options.email;
navigator.mozL10n.setAttributes(this.fxaHelloKnownUser, 'fxa-hello-user2', {
email: this.email
});
_cleanForm(
this.fxaPwInput,
this.fxaShowPw
);
_enableNext(this.fxaPwInput);
};
Module.onNext = function onNext(gotoNextStepCallback) {
FxaModuleOverlay.show('fxa-connecting');
FxaModuleManager.setParam('success', true);
FxModuleServerRequest.signIn(
this.email,
this.fxaPwInput.value,
function onServerResponse(response) {
FxaModuleOverlay.hide();
if (!response.authenticated) {
_notVerifiedUser(gotoNextStepCallback);
return;
}
_loadSigninSuccess(gotoNextStepCallback);
}.bind(this),
function onError(response) {
_cleanForm(
this.fxaPwInput,
this.fxaShowPw
);
this.showErrorResponse(response);
}.bind(this)
);
};
return Module;
}());

View file

@ -0,0 +1,121 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* global FxaModuleStates, FxaModuleUI, FxaModule, FxModuleServerRequest,
FxaModuleOverlay */
/* exported FxaModuleRefreshAuth */
/* jshint unused:false */
'use strict';
var FxaModuleRefreshAuth = (function() {
function _isPasswordValid(passwordEl) {
var passwordValue = passwordEl.value;
return passwordValue && passwordEl.validity.valid;
}
function _enableDone(passwordEl) {
if (_isPasswordValid(passwordEl)) {
FxaModuleUI.enableDoneButton();
} else {
FxaModuleUI.disableDoneButton();
}
}
function _cleanForm(passwordEl, passwordCheck) {
passwordEl.value = '';
passwordCheck.checked = false;
passwordEl.setAttribute('type', 'password');
FxaModuleUI.disableDoneButton();
}
function _requestPasswordReset(email, done) {
/*jshint validthis:true */
FxModuleServerRequest.requestPasswordReset(
email,
function onSuccess(response) {
done();
},
function onError(response) {
this._showCouldNotResetPassword();
}.bind(this)
);
}
function _showCouldNotResetPassword() {
/*jshint validthis:true */
this.showErrorResponse({
error: 'RESET_PASSWORD_ERROR'
});
}
function _forgotPassword() {
/*jshint validthis:true */
FxaModuleOverlay.show('fxa-requesting-password-reset');
_requestPasswordReset.call(
this,
this.email,
function() {
FxaModuleOverlay.hide();
FxaModuleStates.setState(FxaModuleStates.PASSWORD_RESET_SUCCESS);
}
);
}
var Module = Object.create(FxaModule);
Module.init = function init(options) {
if (!this.initialized) {
// Cache DOM elements.
this.importElements(
'fxa-pw-input-refresh',
'fxa-show-pw-refresh',
'fxa-forgot-password-refresh'
);
this.fxaPwInputRefresh.addEventListener('input', (function(event) {
_enableDone(event.target);
}).bind(this));
this.fxaShowPwRefresh.addEventListener('change', (function() {
var passwordFieldType = !!this.fxaShowPwRefresh.checked ? 'text' :
'password';
}).bind(this), false);
this.fxaForgotPasswordRefresh.addEventListener('click',
_forgotPassword.bind(this),
false);
this.initialized = true;
}
if (!options || !options.email) {
console.error('Options are not sent properly. Email not available');
return;
}
this.email = options.email;
_cleanForm(this.fxaPwInputRefresh, this.fxaShowPwRefresh);
_enableDone(this.fxaPwInputRefresh);
};
Module.onDone = function onDone(callback) {
FxaModuleOverlay.show('fxa-connecting');
FxModuleServerRequest.signIn(
this.email,
this.fxaPwInputRefresh.value,
function onServerResponse(response) {
FxaModuleOverlay.hide();
callback();
}, function onError(response) {
_cleanForm(this.fxaPwInputRefresh,
this.fxaShowPwRefresh);
this.showErrorResponse(response);
}.bind(this)
);
};
return Module;
})();

View file

@ -0,0 +1,123 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* global FxaModuleUI, FxaModuleOverlay, FxaModule, FxModuleServerRequest,
FxaModuleManager, FxaModuleStates */
/* exported FxaModuleSetPassword */
'use strict';
/**
* Takes care of a new user's set password screen. If password is valid,
* attempt to stage the user.
*/
var FxaModuleSetPassword = (function() {
function _isPasswordValid(passwordEl) {
var passwordValue = passwordEl.value;
return passwordValue && passwordEl.validity.valid;
}
function _enableNext(passwordEl) {
if (_isPasswordValid(passwordEl)) {
FxaModuleUI.enableNextButton();
} else {
FxaModuleUI.disableNextButton();
}
}
function _cleanForm(passwordEl, passwordCheck) {
passwordEl.value = '';
passwordCheck.checked = false;
passwordEl.setAttribute('type', 'password');
}
function _showRegistering() {
FxaModuleOverlay.show('fxa-connecting');
}
function _hideRegistering() {
FxaModuleOverlay.hide();
}
function _showUserNotCreated() {
/*jshint validthis:true */
this.showErrorResponse({
error: 'CANNOT_CREATE_ACCOUNT'
});
}
function _togglePasswordVisibility() {
/*jshint validthis:true */
var passwordFieldType = !!this.fxaShowPwSet.checked ? 'text' : 'password';
this.fxaPwSetInput.setAttribute('type', passwordFieldType);
}
var Module = Object.create(FxaModule);
Module.init = function init(options) {
if (!this.initialized) {
// Cache DOM elements
this.importElements(
'fxa-pw-set-input',
'fxa-show-pw-set',
'fxa-hello-user'
);
// Add Listeners
this.fxaPwSetInput.addEventListener(
'input',
function onInput(event) {
_enableNext(event.target);
}
);
this.fxaShowPwSet.addEventListener(
'change',
_togglePasswordVisibility.bind(this),
false
);
}
options = options || {};
this.email = options.email;
navigator.mozL10n.setAttributes(this.fxaHelloUser, 'fxa-hello-user2', {
email: this.email
});
_cleanForm(
this.fxaPwSetInput,
this.fxaShowPwSet
);
_enableNext(this.fxaPwSetInput);
};
Module.onNext = function onNext(gotoNextStepCallback) {
_showRegistering();
FxModuleServerRequest.signUp(
this.email,
this.fxaPwSetInput.value,
function(response) {
_hideRegistering();
FxaModuleManager.setParam('success', true);
var isAccountCreated = response.accountCreated;
if (!isAccountCreated) {
_showUserNotCreated.call(this);
return;
}
gotoNextStepCallback(FxaModuleStates.SIGNUP_SUCCESS);
}.bind(this),
this.showErrorResponse
);
};
return Module;
}());

View file

@ -0,0 +1,23 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* global FxaModule, FxaModuleStates */
/* exported FxaModuleSigninSuccess */
'use strict';
/**
* Display the signup success message to the user.
*/
var FxaModuleSigninSuccess = (function() {
var Module = Object.create(FxaModule);
Module.onNext = function onNext(done) {
done(FxaModuleStates.DONE);
};
return Module;
}());

View file

@ -0,0 +1,34 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* global FxaModule, FxaModuleStates */
/* exported FxaModuleSignupSuccess */
'use strict';
/**
* Display the signup success message to the user.
*/
var FxaModuleSignupSuccess = (function() {
var Module = Object.create(FxaModule);
Module.init = function init(options) {
options = options || {};
this.importElements(
'fxa-will-send-email'
);
navigator.mozL10n.setAttributes(this.fxaWillSendEmail,
'fxa-will-send-email2', {
email: options.email
});
};
Module.onNext = function onNext(done) {
done(FxaModuleStates.DONE);
};
return Module;
}());