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,120 @@
/* global Buffer, process */
'use strict';
/**
* Everything.me server for fixtures. Serves stubbed Everything.me responses.
*/
var http = require('http');
var fs = require('fs');
var fsPath = require('path');
var EventEmitter = require('events').EventEmitter;
function writeJSON(res, object) {
object = object || {};
var json = JSON.stringify(object);
res.writeHead(200, {
'Content-Length': Buffer.byteLength(json),
'Content-Type': 'application/json'
});
res.end(json);
}
/**
* @param {String} root directory where content is.@
* @param {Object} routes for the server.
* @constructor
*/
function EmeServer(root, routes) {
EventEmitter.call(this);
// ensure we always have the slash suffix
if (root[root.length - 1] !== '/') {
root += '/';
}
this.root = root;
this.routes = routes;
this._settings = {};
this.fail = false;
}
EmeServer.prototype = {
__proto__: EventEmitter.prototype,
requestHandler: function() {
var routes = this.routes;
return function(req, res) {
// Fail requests
if (req.url.indexOf('/settings') !== 0 && this.fail) {
process.nextTick(function() {
req.socket.destroy();
});
return;
}
var handler = routes[req.url] || routes['*'];
// routes are always invoked with the context of the server.
return handler.call(this, req, res);
}.bind(this);
},
};
var emeServer = new EmeServer(process.argv[2], {
'/Categories/list': function(req, res) {
var json = JSON.parse(fs.readFileSync(this.root + 'categories_list.json'));
writeJSON(res, json);
},
'/Apps/nativeInfo': function(req, res) {
var json = JSON.parse(fs.readFileSync(this.root + 'apps_nativeinfo.json'));
writeJSON(res, json);
},
'/Apps/search': function(req, res) {
var json = JSON.parse(fs.readFileSync(this.root + 'apps_search.json'));
writeJSON(res, json);
},
'/Search/bgimage': function(req, res) {
var json = JSON.parse(fs.readFileSync(this.root + 'search_bgimage.json'));
writeJSON(res, json);
},
'/Search/suggestions': function(req, res) {
var file = fs.readFileSync(this.root + 'search_suggestions.json');
var json = JSON.parse(file);
writeJSON(res, json);
},
'/settings/failAll': function(req, res) {
this.fail = true;
writeJSON(res);
},
'/settings/unfailAll': function(req, res) {
this.fail = false;
writeJSON(res);
},
/**
* Catch all handler which serves up static assets.
*/
'*': function(req, res) {
var url = req.url;
var filePath = fsPath.join(this.root, url);
console.log('Uncaught request: ', url, filePath);
res.writeHead(404);
res.end();
return;
}
});
var server = http.createServer(emeServer.requestHandler());
server.listen(0, function() {
process.send({ type: 'started', port: server.address().port });
});

View file

@ -0,0 +1,6 @@
{
"errorCode": 1,
"processingTime": 0,
"response": {
}
}

View file

@ -0,0 +1,113 @@
{
"errorCode": 1,
"processingTime": 1,
"response": {
"spellingCorrection": [],
"ads": null,
"disambiguation": [],
"adultContent": false,
"apps": [
{
"appUrl": "http://mozilla1.org",
"favUrl": "@",
"icon": "",
"adult": false,
"type": "app",
"id": 1,
"name": "Mozilla"
},
{
"appUrl": "http://mozilla2.org/firefox",
"favUrl": "@",
"icon": "",
"adult": false,
"type": "app",
"id": 2,
"name": "Firefox"
},
{
"appUrl": "http://mozilla3.org/Thunderbird",
"favUrl": "@",
"icon": "",
"adult": false,
"type": "app",
"id": 3,
"name": "Thunderbird"
},
{
"appUrl": "http://mozilla4.org/Persona",
"favUrl": "@",
"icon": "",
"adult": false,
"type": "app",
"id": 4,
"name": "Persona"
},
{
"appUrl": "http://mozilla5.org/FxOS",
"favUrl": "@",
"icon": "",
"adult": false,
"type": "app",
"id": 5,
"name": "FxOS"
},
{
"appUrl": "http://mozilla6.org/Servo",
"favUrl": "@",
"icon": "",
"adult": false,
"type": "app",
"id": 6,
"name": "Servo"
},
{
"appUrl": "http://mozilla7.org/rust",
"favUrl": "@",
"icon": "",
"adult": false,
"type": "app",
"id": 7,
"name": "Rust"
},
{
"appUrl": "http://mozilla8.org/Javascript",
"favUrl": "@",
"icon": "",
"adult": false,
"type": "app",
"id": 8,
"name": "Javascript"
},
{
"appUrl": "http://mozilla9.org/HTML",
"favUrl": "@",
"icon": "",
"adult": false,
"type": "app",
"id": 9,
"name": "HTML"
},
{
"appUrl": "http://mozilla10.org/CSS",
"favUrl": "@",
"icon": "",
"adult": false,
"type": "app",
"id": 10,
"name": "CSS"
}
],
"paging": {
"max": 20,
"limit": 10,
"first": 0
},
"experiences": [
"music"
],
"query": "music"
},
"errorString": "OK",
"requestId": null
}

View file

@ -0,0 +1,60 @@
{
"errorCode": 1,
"processingTime": 0,
"response": {
"locale": "en_US",
"categories": [
{
"appIds": [
1,
2,
3
],
"locale": "en_US",
"canonicalName": "around me",
"query": "Around Me",
"categoryId": 1
},
{
"appIds": [
1,
2,
3
],
"locale": "en_US",
"canonicalName": "astrology",
"query": "Astrology",
"categoryId": 2
},
{
"appIds": [
1,
2,
3
],
"locale": "en_US",
"canonicalName": "autos",
"query": "Autos",
"categoryId": 3
},
{
"appIds": [
1,
2,
3
],
"locale": "en_US",
"canonicalName": "entertainment",
"query": "Entertainment",
"categoryId": 376
}
],
"icons": {
"1": "/blank.png",
"2": "/blank.png",
"3": "/blank.png"
}
},
"errorString": "OK",
"requestId": "0"
}

View file

@ -0,0 +1,14 @@
{
"processingTime": 1,
"errorString": "OK",
"checksum": "1",
"errorCode": 1,
"requestId": "1",
"response": {
"source": "",
"image": {
"MIMEType": "image/gif",
"data": "R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs="
}
}
}

View file

@ -0,0 +1,12 @@
{
"errorCode":1,
"processingTime":14.3,
"response": [
"[ab]out.com",
"ab",
"[ab]ercrombie & fitch",
"[ab]ner louima"
],
"errorString":"OK",
"requestId":"8WxZsKjO_VU"
}

View file

@ -0,0 +1,89 @@
'use strict';
/* global module, __dirname */
var fork = require('child_process').fork;
/**
* Issue a POST request via marionette.
*/
function post(client, url, json) {
json = json || {};
// must run in chrome so we can do cross domain xhr
client = client.scope({ context: 'chrome' });
return client.executeAsyncScript(function(url, json) {
var xhr = new XMLHttpRequest();
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onload = function() {
marionetteScriptFinished(xhr.response);
};
xhr.send(json);
}, [url, JSON.stringify(json)]);
}
function EmeServer(root, marionette, port, proc) {
this.root = root;
this.marionette = marionette;
this.url = 'http://localhost:' + port;
this.process = proc;
}
EmeServer.prototype = {
close: function(callback) {
this.process.kill();
this.process.once('exit', callback.bind(this, null));
},
/**
* Indicate to the server that all requests should be given a response with
* headers but then the socket should be closed shortly after that time.
*/
failAll: function() {
return post(this.marionette, this.url + '/settings/failAll');
},
/**
* Allow requests to to proceed without failure after calling `.failAll`.
*/
unfailAll: function() {
return post(this.marionette, this.url + '/settings/unfailAll');
},
};
/**
* Create an everything.me server for use in marionette tests.
*
* @param {Marionette.Client} client for marionette.
* @param {Function} callback [Error]
*/
module.exports = function create(client, callback) {
var stubRoot = __dirname + '/fixtures';
var proc = fork(__dirname + '/child.js', [stubRoot]);
proc.once('error', callback);
proc.on('message', function(msg) {
if (msg.type !== 'started') {
return;
}
proc.removeListener('error', callback);
callback(null, new EmeServer(stubRoot, client, msg.port, proc));
});
};
module.exports.EmeServer;
/**
* Updates the everything.me API setting.
* @param {Object} client The marionette client.
* @param {Object} server An everything.me server instance.
*/
module.exports.setServerURL = function(client, server) {
var chrome = client.scope({ context: 'chrome' });
chrome.executeAsyncScript(function(url) {
var request = navigator.mozSettings.createLock().set({
'appsearch.url': url
});
request.onsuccess = function() {
marionetteScriptFinished();
};
}, [server.url + '/{resource}']);
};