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:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
3
gaia/distros/raptor/apps.list
Executable file
3
gaia/distros/raptor/apps.list
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
apps/*
|
||||
distros/raptor/apps/*
|
||||
distros/raptor/outoftree_apps/*
|
||||
23
gaia/distros/raptor/apps/test-startup-limit/index.html
Executable file
23
gaia/distros/raptor/apps/test-startup-limit/index.html
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
|
||||
<meta charset="utf-8">
|
||||
<title>Test Startup Limit</title>
|
||||
<link rel="stylesheet" href="style/style.css">
|
||||
<script defer src="js/app.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="toggle">Switch to Binary</div>
|
||||
<div class="count">
|
||||
<div class="decimal">0</div>
|
||||
<div class="binary">0</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<div class="plus">+</div>
|
||||
<div class="minus">-</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
156
gaia/distros/raptor/apps/test-startup-limit/js/app.js
Executable file
156
gaia/distros/raptor/apps/test-startup-limit/js/app.js
Executable file
|
|
@ -0,0 +1,156 @@
|
|||
var counter = {};
|
||||
|
||||
counter.component = (() => {
|
||||
'use strict';
|
||||
|
||||
var exports = {};
|
||||
|
||||
/**
|
||||
* Component state
|
||||
*/
|
||||
exports.base = 'decimal';
|
||||
exports.count = 0;
|
||||
exports.binary = '0';
|
||||
exports.decimal = '0';
|
||||
|
||||
exports.render = function() {
|
||||
console.log('Will render ui');
|
||||
var toggleElement = document.getElementsByClassName('toggle')[0];
|
||||
var decimalElement = document.getElementsByClassName('decimal')[0];
|
||||
var binaryElement = document.getElementsByClassName('binary')[0];
|
||||
|
||||
decimalElement.innerHTML = this.decimal;
|
||||
binaryElement.innerHTML = this.binary;
|
||||
|
||||
if (this.base === 'decimal') {
|
||||
toggleElement.innerHTML = 'Switch to binary';
|
||||
binaryElement.style.display = 'none';
|
||||
decimalElement.style.display = 'block';
|
||||
} else if (this.base === 'binary') {
|
||||
toggleElement.innerHTML = 'Switch to decimal';
|
||||
decimalElement.style.display = 'none';
|
||||
binaryElement.style.display = 'block';
|
||||
}
|
||||
};
|
||||
|
||||
return exports;
|
||||
|
||||
})();
|
||||
|
||||
counter.string = (() => {
|
||||
'use strict';
|
||||
|
||||
var exports = {};
|
||||
|
||||
exports.convertToBinary = function(value) {
|
||||
// Fake async operation.
|
||||
return Promise.resolve().then(() => {
|
||||
if (value === 0) {
|
||||
return '0';
|
||||
}
|
||||
|
||||
var remainders = '';
|
||||
for (var quotient = value; quotient > 0; quotient = Math.floor(quotient / 2)) {
|
||||
remainders += (quotient % 2);
|
||||
}
|
||||
|
||||
return reverse('', remainders);
|
||||
});
|
||||
};
|
||||
|
||||
function reverse(str, backwards) {
|
||||
if (!backwards.length) {
|
||||
return str;
|
||||
}
|
||||
|
||||
var chr = backwards[backwards.length - 1];
|
||||
return reverse(str + chr, backwards.slice(0, -1));
|
||||
};
|
||||
|
||||
return exports;
|
||||
|
||||
})();
|
||||
|
||||
counter.app = (() => {
|
||||
'use strict';
|
||||
|
||||
var component = counter.component;
|
||||
var perf = window.performance;
|
||||
var string = counter.string;
|
||||
|
||||
var initialized = false;
|
||||
var worker;
|
||||
|
||||
var exports = {};
|
||||
|
||||
exports.main = function() {
|
||||
// Since our entire UI is in index.html, we can emit navigationLoaded.
|
||||
perf.mark('navigationLoaded');
|
||||
|
||||
console.log('Binding event handlers');
|
||||
var toggle = document.getElementsByClassName('toggle')[0];
|
||||
toggle.addEventListener('click', ontoggle);
|
||||
var plus = document.getElementsByClassName('plus')[0];
|
||||
plus.addEventListener('click', onplus);
|
||||
var minus = document.getElementsByClassName('minus')[0];
|
||||
minus.addEventListener('click', onminus);
|
||||
|
||||
component.render();
|
||||
|
||||
// Now that people can switch between bases, we can mark navigationInteractive.
|
||||
perf.mark('navigationInteractive');
|
||||
|
||||
// Start our worker and ask for the current counter count.
|
||||
console.log('Starting worker');
|
||||
worker = new Worker('/js/worker.js');
|
||||
worker.postMessage({ method: 'getCount' });
|
||||
worker.onmessage = event => {
|
||||
// We got the current counter value from the worker.
|
||||
var count = event.data;
|
||||
console.log(`Read count = ${count} from worker`);
|
||||
component.count = count;
|
||||
component.decimal = count.toString();
|
||||
initialized = true;
|
||||
component.render();
|
||||
perf.mark('visuallyLoaded');
|
||||
perf.mark('contentInteractive');
|
||||
|
||||
// Now in the background we're going to update the binary value.
|
||||
string.convertToBinary(count).then(binaryCount => {
|
||||
component.binary = binaryCount;
|
||||
perf.mark('fullyLoaded');
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
function ontoggle() {
|
||||
component.base = component.base === 'decimal' ? 'binary' : 'decimal';
|
||||
component.render();
|
||||
}
|
||||
|
||||
function add(diff) {
|
||||
if (!initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
var count = component.count;
|
||||
count = Math.max(0, count + diff);
|
||||
return string.convertToBinary(count).then(binaryCount => {
|
||||
component.count = count;
|
||||
component.decimal = count.toString();
|
||||
component.binary = binaryCount;
|
||||
component.render();
|
||||
worker.postMessage({ method: 'setCount', params: [count] });
|
||||
});
|
||||
}
|
||||
|
||||
var onplus = add.bind(null, 1);
|
||||
var onminus = add.bind(null, -1);
|
||||
|
||||
return exports;
|
||||
|
||||
})();
|
||||
|
||||
// main
|
||||
var app = counter.app;
|
||||
app.main();
|
||||
40
gaia/distros/raptor/apps/test-startup-limit/js/worker.js
Executable file
40
gaia/distros/raptor/apps/test-startup-limit/js/worker.js
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
var db;
|
||||
|
||||
var getCount = new Promise(resolve => {
|
||||
console.log('Will open indexedDB');
|
||||
var request = indexedDB.open('counter');
|
||||
|
||||
request.onupgradeneeded = event => {
|
||||
console.log('Populating indexedDB');
|
||||
db = event.target.result;
|
||||
var store = db.createObjectStore('count');
|
||||
store.add(0, 'count');
|
||||
};
|
||||
|
||||
request.onsuccess = () => {
|
||||
console.log('Reading count from indexedDB');
|
||||
db = request.result;
|
||||
var transaction = db.transaction(['count'], 'readonly');
|
||||
var store = transaction.objectStore('count');
|
||||
var get = store.get('count');
|
||||
get.onsuccess = () => resolve(get.result);
|
||||
};
|
||||
});
|
||||
|
||||
function setCount(count) {
|
||||
var transaction = db.transaction(['count'], 'readwrite');
|
||||
var store = transaction.objectStore('count');
|
||||
store.put(count, 'count');
|
||||
}
|
||||
|
||||
self.onmessage = event => {
|
||||
console.log(`Will call ${event.data.method}`);
|
||||
switch (event.data.method) {
|
||||
case 'getCount':
|
||||
getCount.then(postMessage);
|
||||
break;
|
||||
case 'setCount':
|
||||
setCount(event.data.params[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
23
gaia/distros/raptor/apps/test-startup-limit/manifest.webapp
Executable file
23
gaia/distros/raptor/apps/test-startup-limit/manifest.webapp
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "Test Startup Limit",
|
||||
"description": "Counter application that does the theoretical least amount of work on startup",
|
||||
"launch_path": "/index.html",
|
||||
"developer": {
|
||||
"name": "The Gaia Team",
|
||||
"url": "https://github.com/mozilla-b2g/gaia"
|
||||
},
|
||||
"locales": {
|
||||
"en-US": {
|
||||
"name": "Test Startup Limit",
|
||||
"description": "Counter application that does the theoretical least amount of work on startup"
|
||||
}
|
||||
},
|
||||
"default_locale": "en-US",
|
||||
"icons": {
|
||||
"84": "/style/icons/default_84.png",
|
||||
"126": "/style/icons/default_126.png",
|
||||
"142": "/style/icons/default_142.png",
|
||||
"189": "/style/icons/default_189.png",
|
||||
"284": "/style/icons/default_284.png"
|
||||
}
|
||||
}
|
||||
BIN
gaia/distros/raptor/apps/test-startup-limit/style/icons/default_126.png
Executable file
BIN
gaia/distros/raptor/apps/test-startup-limit/style/icons/default_126.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
gaia/distros/raptor/apps/test-startup-limit/style/icons/default_142.png
Executable file
BIN
gaia/distros/raptor/apps/test-startup-limit/style/icons/default_142.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
BIN
gaia/distros/raptor/apps/test-startup-limit/style/icons/default_189.png
Executable file
BIN
gaia/distros/raptor/apps/test-startup-limit/style/icons/default_189.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
BIN
gaia/distros/raptor/apps/test-startup-limit/style/icons/default_284.png
Executable file
BIN
gaia/distros/raptor/apps/test-startup-limit/style/icons/default_284.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
BIN
gaia/distros/raptor/apps/test-startup-limit/style/icons/default_84.png
Executable file
BIN
gaia/distros/raptor/apps/test-startup-limit/style/icons/default_84.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
74
gaia/distros/raptor/apps/test-startup-limit/style/style.css
Executable file
74
gaia/distros/raptor/apps/test-startup-limit/style/style.css
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
.container {
|
||||
background-color: black;
|
||||
bottom: 0;
|
||||
color: white;
|
||||
font-size: 64px;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.container * {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.toggle {
|
||||
background-color: white;
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
font-size: 32px;
|
||||
float: right;
|
||||
text-align: center;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.toggle:hover {
|
||||
background-color: yellow;
|
||||
}
|
||||
|
||||
.count {
|
||||
bottom: 50%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.count * {
|
||||
height: 100%;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.count .binary {
|
||||
/* binary is initially hidden */
|
||||
display: none;
|
||||
}
|
||||
|
||||
.controls {
|
||||
bottom: 0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.controls * {
|
||||
cursor: pointer;
|
||||
float: left;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.controls *:hover {
|
||||
background-color: yellow;
|
||||
}
|
||||
|
||||
.controls *:active {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.controls .plus {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.controls .minus {
|
||||
color: red;
|
||||
}
|
||||
87
gaia/distros/raptor/apps/test-startup-limit/test/marionette/counter_test.js
Executable file
87
gaia/distros/raptor/apps/test-startup-limit/test/marionette/counter_test.js
Executable file
|
|
@ -0,0 +1,87 @@
|
|||
var expect = require('chai').expect;
|
||||
|
||||
const APP_ORIGIN = 'app://test-startup-limit.gaiamobile.org';
|
||||
|
||||
function Counter(client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
Counter.prototype = {
|
||||
launch: function() {
|
||||
this.client.apps.launch(APP_ORIGIN);
|
||||
this.client.apps.switchToApp(APP_ORIGIN);
|
||||
},
|
||||
|
||||
getCurrentBase: function() {
|
||||
return this.client
|
||||
.findElement('.toggle')
|
||||
.text()
|
||||
.indexOf('binary') !== -1 ? 'decimal' : 'binary';
|
||||
},
|
||||
|
||||
getCount: function() {
|
||||
return this.client
|
||||
.findElement('.count')
|
||||
.text();
|
||||
},
|
||||
|
||||
toggleView: function() {
|
||||
var base = this.getCurrentBase();
|
||||
this.client
|
||||
.findElement('.toggle')
|
||||
.click();
|
||||
this.client.waitFor(function() {
|
||||
return this.getCurrentBase() !== base;
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
plus: function() {
|
||||
this.client
|
||||
.findElement('.plus')
|
||||
.click();
|
||||
},
|
||||
|
||||
minus: function() {
|
||||
this.client
|
||||
.findElement('.minus')
|
||||
.click();
|
||||
}
|
||||
};
|
||||
|
||||
marionette('counter', function() {
|
||||
var client = marionette.client({
|
||||
desiredCapabilities: { raisesAccessibilityExceptions: false }
|
||||
});
|
||||
var counter = new Counter(client);
|
||||
|
||||
setup(function() {
|
||||
counter.launch();
|
||||
});
|
||||
|
||||
test('should initially show decimal', function() {
|
||||
expect(counter.getCurrentBase()).to.equal('decimal');
|
||||
});
|
||||
|
||||
test('toggling view should show binary', function() {
|
||||
counter.toggleView();
|
||||
expect(counter.getCurrentBase()).to.equal('binary');
|
||||
counter.plus();
|
||||
counter.plus();
|
||||
expect(counter.getCount()).to.equal('10');
|
||||
});
|
||||
|
||||
test('+ should increment count', function() {
|
||||
expect(counter.getCount()).to.equal('0');
|
||||
counter.plus();
|
||||
counter.plus();
|
||||
expect(counter.getCount()).to.equal('2');
|
||||
});
|
||||
|
||||
test('- should decrement count', function() {
|
||||
expect(counter.getCount()).to.equal('0');
|
||||
counter.plus();
|
||||
counter.plus();
|
||||
counter.minus();
|
||||
expect(counter.getCount()).to.equal('1');
|
||||
});
|
||||
});
|
||||
3
gaia/distros/raptor/distro.mk
Executable file
3
gaia/distros/raptor/distro.mk
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
RAPTOR=1
|
||||
PERF_LOGGING=1
|
||||
GAIA_OPTIMIZE=1
|
||||
5
gaia/distros/raptor/partner-prefs.js
Executable file
5
gaia/distros/raptor/partner-prefs.js
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
/*global user_pref*/
|
||||
user_pref('b2g.adb.timeout', 0);
|
||||
user_pref('dom.serviceWorkers.enabled', true);
|
||||
// Remove this pref once bug 1125916 and bug 1125961 are fixed.
|
||||
user_pref('network.disable.ipc.security', true);
|
||||
1
gaia/distros/raptor/remote.list
Executable file
1
gaia/distros/raptor/remote.list
Executable file
|
|
@ -0,0 +1 @@
|
|||
fxos-performance,https://fxos-performance.github.io/package.webapp
|
||||
6
gaia/distros/raptor/settings.json
Executable file
6
gaia/distros/raptor/settings.json
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"screen.timeout": 0,
|
||||
"ftu.manifestURL": null,
|
||||
"lockscreen.enabled": false,
|
||||
"dom.serviceWorkers.interception.enabled": true
|
||||
}
|
||||
Loading…
Reference in a new issue