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,98 @@
'use strict';
var mozAlarmsId = 0;
function MockOSAlarm(date, respectTimezone, data, callback) {
this.date = date || new Date();
this.data = data || {};
this.callback = callback;
this.id = mozAlarmsId++;
this.respectTimezone = respectTimezone;
this.timeout = setTimeout(function() {
if ((typeof this.callback) === 'function') {
this.callback({
id: this.id,
respectTimezone: this.respectTimezone,
date: this.date,
data: this.data
});
}
}.bind(this), this.date.getTime() - Date.now());
}
function MockMozAlarmRequest(config) {
this.init(config || {});
}
MockMozAlarmRequest.prototype = {
init: function mar_init(config) {
setTimeout(function() {
this.fire(config.error, config.result);
}.bind(this), 0);
},
fire: function mar_call(error, result) {
if (!error) {
this.onsuccess && this.onsuccess({
target: {
result: result
}
});
} else {
this.onerror && this.onerror({
target: {
error: result
}
});
}
}
};
var messageHandlers = [];
navigator.mozSetMessageHandler = function(type, callback) {
if (type === 'alarm') {
messageHandlers.push(callback);
}
};
navigator.mozAlarms = {
alarms: [],
getAll: function() {
return new MockMozAlarmRequest({
result: this.alarms
});
},
add: function(date, timezone, data) {
if (!(timezone === 'ignoreTimezone' ||
timezone === 'honorTimezone')) {
throw new Error('invalid timezone argument');
}
var alarm = new MockOSAlarm(date, timezone, data, function(x) {
messageHandlers.forEach(function(callback) {
callback(x);
});
this.remove(x.id);
}.bind(this));
this.alarms.push(alarm);
return new MockMozAlarmRequest({
result: alarm.id
});
},
remove: function(id) {
for (var i = 0; i < this.alarms.length; i++) {
var alarm = this.alarms[i];
if (alarm && (alarm.id === id)) {
clearTimeout(alarm.timeout);
this.alarms.splice(i, 1);
return true;
}
}
return false;
}
};

View file

@ -0,0 +1,52 @@
define(function() {
'use strict';
function DateTimeFormat() {
this.mInitialized = true;
}
DateTimeFormat.prototype = {
localeFormat: function mockLocaleFormat(time, strFormat) {
return '' + time;
}
};
var testDefaults = {'en-US': {}};
var currentLanguage = 'en-US';
// callbacks to be fired onready
var onreadycbs = [];
return {
get: function get(key, params) {
var res = testDefaults[currentLanguage];
if (key in res) {
return res[key];
}
if (params) {
return key + JSON.stringify(params);
}
return key;
},
ready: function(cb) {
setTimeout(cb);
onreadycbs.push(cb);
},
setAttributes: function() {},
DateTimeFormat: DateTimeFormat,
// for unit tests
setResources: function(lang, res) {
testDefaults[lang] = res;
},
language: {
set code(lang) {
currentLanguage = lang;
for (var cb of onreadycbs) {
cb();
}
}
},
};
});

View file

@ -0,0 +1,45 @@
/* global define */
define(function() {
'use strict';
var allSettings = {};
var settingsObservers = {};
return {
createLock: function() {
return {
get: function(key) {
var ret = { onsuccess: null, result: {} };
setTimeout(function() {
ret.result[key] = allSettings[key];
ret.onsuccess && ret.onsuccess();
});
return ret;
},
set: function(settings) {
var ret = { onsuccess: null };
/* jshint loopfunc:true */
for (var key in settings) {
allSettings[key] = settings[key];
var listeners = settingsObservers[key];
if (listeners) {
listeners.forEach(function(cb) {
cb({ settingValue: settings[key] });
});
}
}
setTimeout(function() {
ret.onsuccess && ret.onsuccess();
});
return ret;
}
};
},
addObserver: function(key, cb) {
var listeners = settingsObservers[key] || [];
listeners.push(cb);
settingsObservers[key] = listeners;
},
};
});

View file

@ -0,0 +1,45 @@
define(function() {
'use strict';
function MockLock(type) {
this.type = type;
this.locked = true;
this.unlocks = 0;
}
MockLock.prototype = {
unlock: function() {
this.locked = false;
this.unlocks++;
}
};
function MockRequestWakeLock() {
this.issued = new Map();
}
MockRequestWakeLock.prototype = {
requestWakeLock: function mock_requestWakeLock(type) {
var lock = new MockLock(type);
this.issued.set(lock, true);
return lock;
},
getissued: function mock_getissued() {
var ret = [];
for (var el of this.issued) {
ret.push(el[0]);
}
return ret;
},
reset: function() {
this.issued.clear();
}
};
return MockRequestWakeLock;
});

View file

@ -0,0 +1,6 @@
'use strict';
define(function() {
return {
setAriaSelected: function() {}
};
});