Release Vulpes OS Preview 26 with Gecko 161.0 and Tundra 0.2.0

This commit is contained in:
OverSu 2026-12-01 22:22:00 +01:00
commit e241a42d2f
7 changed files with 1305 additions and 331 deletions

View file

@ -140,3 +140,15 @@ assert.throws(()=>sharing.route({name:'share',data:{type:'image/jpeg',blobs:Arra
assert.throws(()=>sharing.start({app:{id:'untrusted'}},{name:'share',data:{type:'image/jpeg'}}),/PERMISSION_DENIED/);
assert.equal(isGaiaActivity({name:'share'}),true);
console.log('Gallery share chooser, MIME matching, provider limits and cancellation: OK');
const camera = {id:'camera',origin:'http://camera.localhost',manifest:{
launch_path:'/index.html',activities:{record:{filters:{type:['photos','videos']},disposition:'window'}}
}};
apps.push(camera);
const recording = {name:'record',data:{type:'videos'}};
assert.ok(isGaiaActivity(recording));
const openedCamera = broker.start({app:{id:'video'}},recording);
assert.equal(new URL(launches.at(-1)[1]).hash,'#record');
broker.subscribe({app:camera});
await openedCamera;
assert.deepEqual(events.at(-1)[2].source,recording);

View file

@ -1,3 +1,4 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { Alarms } from '../host/Alarms.sys.mjs';
@ -60,3 +61,81 @@ assert.equal(saved.pending.length, 0);
console.log(
'PASS: shared alarms persist, enforce permissions and deliver queued events after restart.',
);
const isolated = async () => {
let fail = false;
let stored;
const a = new Alarms(() => app, () => {}, {
load: async () => null,
save: async state => {
if (fail) throw Error('disk full');
stored = structuredClone(state);
},
}, () => {});
await a.init();
return {a, fail: value => { fail=value; }, stored: () => stored};
};
test('failed add cannot create a ringing alarm',async()=>{
const {a,fail}=await isolated();fail(true);
await assert.rejects(a.request(actor,app,request),/disk full/);
assert.equal(a.state.records.length,0);
});
test('failed deletion retains a scheduled alarm',async()=>{
const {a,fail}=await isolated();
const id=await a.request(actor,app,request);fail(true);
await assert.rejects(a.request(actor,app,{operation:'remove',id}),/disk full/);
assert.equal(a.state.records[0].id,id);
});
test('failed transition to pending keeps alarm scheduled for retry',async()=>{
const {a,fail,stored}=await isolated();
await a.request(actor,app,{...request,date:Date.now()-100});fail(true);
await assert.rejects(a.tick(),/disk full/);
assert.equal(a.state.records.length,1);
fail(false);await a.tick();assert.equal(stored().pending.length,1);
});
test('cancel queued alarm before delivery',async()=>{
const {a,stored}=await isolated();
const id=await a.request(actor,app,{...request,date:Date.now()-100});
await a.tick();await a.request(actor,app,{operation:'remove',id});
assert.equal(stored().pending.length,0);
});
test('reject dates outside the supported calendar range',async()=>{
const {a}=await isolated();
await assert.rejects(a.request(actor,app,{...request,date:Number.MAX_VALUE}),/InvalidStateError/);
await assert.rejects(a.request(actor,app,{...request,respectTimezone:'ignoreTimezone',local:[1e12,1,1,0,0,0,0]}),/InvalidStateError/);
});
test('retry failed delivery acknowledgement without ringing twice',async()=>{
const {a, fail, stored}=await isolated();
await a.request(actor,app,{...request,date:Date.now()-100});
await a.tick();
a.listeners.set(actor,app.id);
fail(true);
await assert.rejects(a.tick(),/disk full/);
fail(false);
const deliveries=events.length;
await a.tick();
assert.equal(stored().pending.length,0,'retry acknowledgement after storage recovers');
assert.equal(events.length,deliveries);
});
test('retry launch after clock is set back',async()=>{
const launches=[];
const {a}=await isolated();
a.launch=id=>launches.push(id);
await a.request(actor,app,{...request,date:Date.now()-100});
a.lastLaunch.set(app.id,Date.now()+3600000);
await a.tick();
assert.deepEqual(launches,[app.id],'a backwards clock adjustment does not suppress delivery');
});
test('stop idle alarm timer until a new alarm is scheduled',async()=>{
let active=0;
const a=new Alarms(()=>app,()=>{}, {load:async()=>null,save:async()=>{}},
()=>{active++;return 7;}, id=>{assert.equal(id,7);active--;});
await a.init();
assert.equal(active,0,'no periodic wakeup with an empty alarm store');
const id=await a.request(actor,app,request);
assert.equal(active,1);
await a.request(actor,app,{operation:'remove',id});
assert.equal(active,0);
await a.request(actor,app,request);
assert.equal(active,1,'scheduler restarts when needed');
});

View file

@ -25,4 +25,30 @@ class StoreTests(unittest.TestCase):
restored.remove(item['id'])
self.assertEqual(InstalledApps(folder,8765).records(),[])
def test_bad_app_does_not_hide_other_apps_or_break_boot(self):
with tempfile.TemporaryDirectory() as folder:
store = InstalledApps(folder, 8765)
good = dict(id='user-'+'1'*24, manifest={'name':'Working'}, files={})
store.save(good)
bad = Path(folder)/('user-'+'2'*24+'.json')
for payload in ('{', '[]', json.dumps({**good,'files':None}),
json.dumps({**good,'manifest':None}),
json.dumps({**good,'files':{'icon.png':'??'}}),
json.dumps({**good,'manifest':{'name':'Wrong app'}})):
with self.subTest(payload=payload):
bad.write_text(payload)
restarted = InstalledApps(folder, 8765)
self.assertEqual([r['manifest']['name'] for r in restarted.records()], ['Working'])
self.assertTrue(bad.exists())
def test_failed_package_update_preserves_installed_copy(self):
with tempfile.TemporaryDirectory() as folder:
store = InstalledApps(folder, 8765)
item = dict(id='user-'+'1'*24, manifest={'name':'Working'}, files={'index.html':'T0s='})
store.save(item)
for patch in ({'manifest':None}, {'files':{'index.html':'??'}}):
with self.assertRaises(ValueError):
store.save({**item,**patch})
self.assertEqual(store.read(item['id'],'index.html'), b'OK')
if __name__=='__main__':unittest.main()

View file

@ -17,6 +17,11 @@ rejects(gallery, 'wifi', { operation: 'connect' });
rejects(settings, 'wifi', { password: 'x'.repeat(4097) });
authorizePlatform(gallery, 'pick', { type: 'pictures' });
authorizePlatform(camera, 'capture');
authorizePlatform(app('system'), 'carrierName');
rejects(gallery, 'carrierName');
authorizePlatform(camera, 'cameraPreview', {action:'focusMode',mode:'continuous-picture'});
rejects(gallery, 'cameraPreview', {action:'focusMode',mode:'continuous-picture'});
assert.throws(() => authorizePlatform(camera, 'cameraPreview', {action:'focusMode',mode:'unknown'}), /INVALID_VALUE/);
authorizePlatform(camera, 'cameraPreview', {action:'start',camera:'back'});
authorizePlatform(camera, 'cameraPreview', {action:'frame'});
authorizePlatform(camera, 'cameraPreview', {action:'stop'});

View file

@ -24,7 +24,10 @@ test('Tundra rejects missing/stale status and preserves the real battery value',
test('native capabilities report the camera adapter and gate modem/Wi-Fi services', () => {
globalThis.Services = { appinfo: { platformVersion: '156.0.1' } };
const caps = tundraCapabilities({ version: '2.7-preview.7', gaia: '2.7.0' });
const caps = tundraCapabilities({ version: '2.7-preview.26', gaia: '2.7.0',
tundra: '0.2.0', adapters: { sargo: '0.1.0-dev' } });
assert.equal(caps.tundra, '0.2.0');
assert.deepEqual(caps.adapter, { device: 'sargo', version: '0.1.0-dev' });
assert.equal(caps.platform, 'tundra');
assert.equal(caps.gecko, '156.0.1');
assert.equal(caps.camera, true);

View file

@ -48,3 +48,23 @@ test('batch import writes once, preserves simultaneous saves and can recover fro
assert.deepEqual(book.data.contacts.map(c=>c.name[0]),['One','Two','Three']);
assert.equal(events.length,3);
});
for (const [label, lines, field, expected] of [
['additional names and titles', ['N:Diaz;Ana;Maria;Dr.;Jr.'], 'name', ['Dr. Ana Maria Diaz Jr.']],
['multiple given names and escaped commas', [String.raw`N:Diaz;Ana,Mary\,Jane;;;`], 'givenName', ['Ana','Mary,Jane']],
['postal addresses', [String.raw`ADR;TYPE=HOME:;;1 Rue\; Est;Lyon;;69000;France`], 'adr',
[{streetAddress:'1 Rue; Est',locality:'Lyon',region:'',postalCode:'69000',countryName:'France',type:['home']}]],
['web addresses', ['URL;TYPE=WORK:https://example.org'], 'url', [{value:'https://example.org',type:['work']}]],
['organisation', ['ORG:Clinic;Research'], 'org', ['Clinic / Research']],
['job title', ['TITLE:Surgeon'], 'jobTitle', ['Surgeon']],
['notes', [String.raw`NOTE:Main\nOffice`], 'note', ['Main\nOffice']],
['nicknames', [String.raw`NICKNAME:Ana,A\,B`], 'nickname', ['Ana','A,B']],
['contact groups', ['CATEGORIES:Family,Friends'], 'category', ['Family','Friends']],
['preferred phone', ['TEL;TYPE=CELL,PREF:123'], 'tel', [{value:'123',type:['mobile'],pref:true}]],
['preferred email', ['EMAIL;PREF=1:a@example.org'], 'email', [{value:'a@example.org',type:['other'],pref:true}]],
]) {
test('vCard import retains '+label, () => {
const [card]=readVCards(wrap(['FN:Ana', ...lines].filter(l=>field!=='name'||!l.startsWith('FN:'))));
assert.deepEqual(card[field],expected);
});
}

View file

@ -262,3 +262,74 @@ test('two APs with the same name keep the active AP identifier; a saved network
assert.equal(wifi.connection.network.vulpesId,'ap-b');
const [known]=await wifi.getKnownNetworks();await wifi.associate(known);assert.equal(target,'profile-b');
});
test('live Wi-Fi updates distinguish roaming, unknown targets and unchanged polling',async()=>{
const {readFile}=await import('node:fs/promises');
const vm=await import('node:vm');
const events={}, navigator={mozSettings:{addObserver(){}}};
let state={enabled:true, state:'disconnected', networks:[]}, refresh;
vm.runInNewContext(await readFile(new URL('../host/gaia-wifi.js',import.meta.url),'utf8'),{
navigator,document:{},window:{VulpesNativeWifi:true},location:{hostname:'system.localhost'},
Event,EventTarget,console,VulpesCompat:{call:async()=>state,request:p=>p},
addEventListener:(k,cb)=>{events[k]=cb;},setInterval:cb=>{refresh=cb;},clearInterval(){}});
await events.DOMContentLoaded();
const wifi=navigator.mozWifiManager;
let signals=0, changes=0;
wifi.onconnectioninfoupdate=()=>signals++;
wifi.onstatuschange=()=>changes++;
state={enabled:true,state:'connected',network:{id:'ap1',ssid:'Lab',signal:10,security:'open'}};
await refresh();
assert.equal(wifi.connection.network.vulpesId,'ap1');
await refresh();
assert.equal(signals,1);
state.network.id='ap2';
await refresh();
assert.equal(changes,2);
state={enabled:true,state:'connecting'};
await refresh();
assert.equal(wifi.connection.status,'connecting');
assert.equal(wifi.connectionInformation,null);
});
test('a scan started before disabling Wi-Fi cannot overwrite a newer scan cache', async () => {
const {tundraWifi: wifi} = await import('../host/Tundra.sys.mjs?scan-generation');
const responses=[];
globalThis.Services={env:{get:key => key==='VULPES_TUNDRA_WIFI'?'1':''}};
globalThis.ChromeUtils={importESModule:()=>({Subprocess:{call:async ()=>{
let read=false;
const result=new Promise(resolve=>responses.push(resolve));
return {stdin:{write:async()=>{},close:async()=>{}},stdout:{readString:async()=>{
if(read)return null;read=true;return JSON.stringify({result:await result});
}},wait:async()=>({exitCode:0})};
}}})};
const stale=wifi({operation:'scan'});
const off=wifi({operation:'setEnabled',enabled:false});
responses[1]({enabled:false});await off;
const fresh=wifi({operation:'scan'});
assert.equal(responses.length,3);
responses[2]({enabled:false,networks:[]});await fresh;
responses[0]({enabled:true,networks:[{ssid:'Old'}]});await stale;
assert.equal((await wifi({operation:'scan'})).enabled,false);
});
test('status icon resets stale bars and the connecting spinner when telemetry disappears', async () => {
const {readFile}=await import('node:fs/promises');
const vm=await import('node:vm');
const window={};
vm.runInNewContext(await readFile(new URL('../gaia/apps/system/js/wifi_icon.js',import.meta.url),'utf8'),{
window,BaseIcon:function(){},navigator:{mozL10n:{setAttributes(){}}}
});
const icon=new window.WifiIcon();
const wifi={connection:{status:'connected'},connectionInformation:null};
Object.assign(icon,{manager:{wifiManager:wifi},element:{dataset:{level:'4',connecting:'true'}},
enabled:()=>true,show(){},publish(){}});
icon.update();
assert.equal(icon.element.dataset.level,0);
assert.equal(icon.element.dataset.connecting,undefined);
for (const [signal,level] of [[-1,0],[NaN,0],[21,1],[99,4]]) {
wifi.connectionInformation={relSignalStrength:signal};
icon.update();
assert.equal(icon.element.dataset.level,level);
}
});