Release Vulpes OS 2.7 Preview 25 for Desktop, Android and Pixel 3a

This commit is contained in:
OverSu 2026-11-28 12:20:19 +01:00
commit 3a1fba4efe
5 changed files with 1301 additions and 196 deletions

View file

@ -13,7 +13,7 @@ async function fixture(reducedMotion) {
getTiming:()=>({iterations,duration}),updateTiming:value=>writes.push(value)}});
const finite=animation(1,300),busy=animation(Infinity,1000);
vm.runInNewContext(source,{
document:{documentElement:{dataset},getAnimations:()=>[finite,busy],
document:{documentElement:{dataset,toggleAttribute(){}},getAnimations:()=>[finite,busy],
addEventListener:(name,fn)=>listeners[name]=fn},
window:{},location:{hostname:'system.localhost'},
addEventListener(){},requestAnimationFrame:fn=>fn(),console,

View file

@ -4,17 +4,18 @@ import vm from 'node:vm';
import {readFileSync} from 'node:fs';
const source=readFileSync(new URL('../gaia/apps/marketplace/marketplace.js',import.meta.url),'utf8');
function element(){return Object.assign(new EventTarget(),{style:{},hidden:false,textContent:''});}
async function setup() {
async function setup(online=true) {
const network=new EventTarget(),navigator={language:"en",onLine:online};
const nodes=Object.fromEntries(['catalogue','message','confirm','open','browse','install','cancel','status','title','question','permissions'].map(id=>[id,element()]));
let poll,download=null,finish;
const context={document:{getElementById:id=>nodes[id]},navigator:{language:'en'},console,
addEventListener(){},setInterval:fn=>poll=fn,VulpesCompat:{call:async method=>{
const context={document:{getElementById:id=>nodes[id]},navigator,console,
addEventListener:network.addEventListener.bind(network),setInterval:fn=>poll=fn,VulpesCompat:{call:async method=>{
if(method==='locale.current')return 'en';
if(method==='marketplace.poll'){const url=download;download=null;return url;}
if(method==='marketplace.prepare')return new Promise(resolve=>finish=resolve);
}}};
await vm.runInNewContext(source,context);
return {nodes,poll,setDownload:()=>download='https://vulpes-os.org/marketplace/index.php?download=1',finish:()=>finish({name:'Test',bytes:1024,token:'test'})};
return {nodes,poll,setLanguage(value){navigator.language=value;network.dispatchEvent(new Event("languagechange"));},setOnline(value){navigator.onLine=value;network.dispatchEvent(new Event(value?"online":"offline"));},setDownload:()=>download='https://vulpes-os.org/marketplace/index.php?download=1',finish:()=>finish({name:'Test',bytes:1024,token:'test'})};
}
test('closing the Android web view exposes a way back to the catalogue, not a blank frame',async()=>{
const {nodes:n}=await setup();
@ -32,3 +33,45 @@ test('a close notification cannot erase an installation confirmation',async()=>{
assert.match(f.nodes.status.textContent,/Checking/);
f.finish();await pending;assert.equal(f.nodes.confirm.hidden,false);
});
test('offline catalogue hides its action and reconnects when the network returns',async()=>{
const f=await setup(false), n=f.nodes;
assert.equal(n.browse.hidden,true);
assert.equal(n.catalogue.src,undefined);
f.setOnline(true);
assert.equal(n.browse.hidden,false);
assert.equal(n.catalogue.style.visibility,'visible');
f.setOnline(false);
assert.equal(n.browse.hidden,true);
assert.equal(n.message.hidden,false);
});
test('reopening a closed catalogue navigates the frame again',async()=>{
const {nodes:n}=await setup();
n.catalogue.dispatchEvent(new Event('mozbrowserclose'));
n.catalogue.src='about:blank';
n.browse.onclick();
assert.match(n.catalogue.src,/mode=app&lang=en/);
});
test('losing connectivity while confirming and cancelling dismisses the dialog',async()=>{
const f=await setup();f.setDownload();const pending=f.poll();
await new Promise(resolve=>setImmediate(resolve));f.finish();await pending;
f.setOnline(false);
f.nodes.cancel.onclick();
assert.equal(f.nodes.confirm.hidden,true);
assert.equal(f.nodes.message.hidden,false);
});
test('the English download confirmation uses MiB',async()=>{
const f=await setup();f.setDownload();const pending=f.poll();
await new Promise(resolve=>setImmediate(resolve));f.finish();await pending;
assert.match(f.nodes.question.textContent,/MiB/);
});
test('changing language before installation completes does not leave the catalogue in the old language',async()=>{
const f=await setup();f.setDownload();const pending=f.poll();
await new Promise(resolve=>setImmediate(resolve));f.setLanguage('fr');f.finish();await pending;
f.nodes.cancel.onclick();
assert.match(f.nodes.catalogue.src,/lang=fr/);
});

View file

@ -48,3 +48,18 @@ test('Gaia notification sound and vibration respect per-notification flags',()=>
show({novibrate:true});assert.equal(events.sound,1);assert.equal(events.vibration,1);
show({});assert.equal(events.sound,2);assert.equal(events.vibration,2);
});
test('a scalable icon entry does not discard available numbered notification icons',()=>{
const store=new Notifications();
const mixed={...app,manifest:{icons:{any:'/vector.svg',128:'/small.png',256:'/large.png'}}};
assert.equal(store.show(mixed,{}).icon,app.origin+'/large.png');
assert.equal(store.show({...app,manifest:{icons:{any:'/vector.svg'}}},{}).icon,app.origin+'/vector.svg');
});
test('invalid optional icon cannot discard a notification',()=>{
const store=new Notifications();
const row=store.show(app,{title:'Message',icon:'http://['});
assert.equal(row.title,'Message');
assert.equal(row.icon,app.origin+'/sms.png');
assert.equal(store.list().length,1);
});

View file

@ -0,0 +1,50 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {readVCards} from '../host/VCard.sys.mjs';
import {Contacts} from '../host/Contacts.sys.mjs';
const wrap = lines => ['BEGIN:VCARD','VERSION:3.0',...lines,'END:VCARD'].join('\r\n');
test('reads structured names without FN and keeps escaped separators', () => {
const [c]=readVCards(wrap(['N:Martin\\;Durand;Ana;;;']));
assert.deepEqual(c.name,['Ana Martin;Durand']);
assert.deepEqual(c.familyName,['Martin;Durand']);
});
test('grouped properties and URI schemes retain numbers, email and their labels', () => {
const [c]=readVCards(wrap(['FN:Ana','item1.TEL;TYPE=CELL:TEL:+33123','item2.EMAIL;TYPE=WORK:mailto:ana@example.org']));
assert.deepEqual(c.tel,[{value:'+33123',type:['mobile']}]);
assert.deepEqual(c.email,[{value:'ana@example.org',type:['work']}]);
});
test('legacy CR lines, UTF-8 BOM and folded names',()=>{
const [c]=readVCards('\uFEFF'+wrap(['FN:Fran',' çois']).replaceAll('\r\n','\r'));
assert.deepEqual(c.name,['François']);
});
test('literal backslash followed by n is not a newline',()=>{
const [c]=readVCards(wrap([String.raw`FN:Ana\\north`]));
assert.deepEqual(c.name,[String.raw`Ana\north`]);
});
test('truncated and nested cards are rejected before importing any contacts',()=>{
assert.throws(()=>readVCards(wrap(['FN:Valid'])+'\nBEGIN:VCARD\nFN:Truncated'),/INVALID_VCARD/);
assert.throws(()=>readVCards('BEGIN:VCARD\nFN:Truncated'),/INVALID_VCARD/);
});
test('batch import writes once, preserves simultaneous saves and can recover from a failed write',async()=>{
let count=0,fail=true,seq=0;
globalThis.Services={uuid:{generateUUID:()=>String(++seq)}};
const events=[];
const book=new Contacts({async run(_,op){
if(op==='get')return {};
if(fail)throw Error('storage full');
count++;
}},e=>events.push(e));
await book.init();
const app={manifest:{permissions:{contacts:{access:'readwrite'}}}};
const cards=readVCards([wrap(['FN:One']),wrap(['FN:Two'])].join('\n'));
await assert.rejects(book.importCards(app,cards),/storage full/);
assert.equal(book.data.contacts.length,0);
assert.equal(events.length,0);
fail=false;
const [result]=await Promise.all([book.importCards(app,cards),book.request(app,{operation:'save',contact:{name:['Three']}})]);
assert.deepEqual(result,{count:2});assert.equal(count,2);
assert.deepEqual(book.data.contacts.map(c=>c.name[0]),['One','Two','Three']);
assert.equal(events.length,3);
});

View file

@ -194,3 +194,71 @@ test('saved networks outside the scan have zero signal and retain security type'
assert.equal(network.security[0],'WPA-EAP');
assert.equal(network.savedId,'4');
});
test('association remains visible during a scan and clears after a rejected password', async () => {
const {readFile} = await import('node:fs/promises');
const vm = await import('node:vm');
const navigator = {};
let rejectConnect;
const call = async (_, params) => {
if (params.operation === 'connect') return new Promise((_, reject) => { rejectConnect = reject; });
return {enabled:true, state:'disconnected', networks:[]};
};
const ctx = vm.createContext({navigator, console, Event, EventTarget,
window:{VulpesNativeWifi:true}, location:{hostname:'settings.localhost'},
addEventListener(){}, VulpesCompat:{call, request:value=>value}});
vm.runInContext(await readFile(new URL('../host/gaia-wifi.js',import.meta.url),'utf8'),ctx);
const manager = navigator.mozWifiManager;
const result = manager.associate({ssid:'Lab', security:['WPA-PSK'], psk:'test'});
await manager.getNetworks();
assert.equal(manager.connection.status,'connecting');
assert.equal(manager.connection.network.ssid,'Lab');
assert.equal(manager.connection.network.psk,undefined);
assert.equal(manager.connectionInformation,null);
rejectConnect(Error('WIFI_CONNECT_FAILED'));
await assert.rejects(result,/WIFI_CONNECT_FAILED/);
assert.equal(manager.connection.status,'disconnected');
});
test('a late Wi-Fi broker initializes Gaia after the first status read fails', async () => {
const {readFile} = await import('node:fs/promises');
const vm = await import('node:vm');
let retry, attempts = 0, observers = 0;
const events = {};
const navigator = {mozSettings:{addObserver(){ observers++; }}};
const call = async (_, params) => {
if (params.operation === 'status' && ++attempts === 1) throw Error('BROKER_READ_FAILED');
return {enabled:true, state:'disconnected', networks:[]};
};
vm.runInNewContext(await readFile(new URL('../host/gaia-wifi.js',import.meta.url),'utf8'), {
navigator, console, Event, EventTarget, window:{VulpesNativeWifi:true},
location:{hostname:'settings.localhost'}, VulpesCompat:{call, request:value=>value},
addEventListener:(key,cb)=>{events[key]=cb;}, setTimeout:cb=>{retry=cb;}, setInterval(){}
});
await events.DOMContentLoaded();
assert.equal(observers,0);
await retry();
assert.equal(navigator.mozWifiManager.enabled,true);
assert.equal(observers,1);
});
test('two APs with the same name keep the active AP identifier; a saved network uses its profile ID',async()=>{
const {readFile}=await import('node:fs/promises');
const vm=await import('node:vm');
const inactive={id:'ap-a',ssid:'Campus',security:'open',signal:75};
const active={id:'ap-b',ssid:'Campus',security:'wpa-psk',signal:40,connected:true,savedId:'profile-b'};
const state={enabled:true,state:'connected',networks:[inactive,active],network:active};
const navigator={};let target;
const call=async(_,p)=>{
if(p.operation==='known')return {networks:[{id:'profile-b',ssid:'Campus',security:'wpa-psk'}]};
if(p.operation==='connect')target=p.id;
return state;
};
vm.runInNewContext(await readFile(new URL('../host/gaia-wifi.js',import.meta.url),'utf8'),{
navigator,window:{VulpesNativeWifi:true},location:{hostname:'system.localhost'},Event,EventTarget,
VulpesCompat:{call,request:p=>p},addEventListener(){}});
const wifi=navigator.mozWifiManager;
await wifi.getNetworks();
assert.equal(wifi.connection.network.vulpesId,'ap-b');
const [known]=await wifi.getKnownNetworks();await wifi.associate(known);assert.equal(target,'profile-b');
});