Release Vulpes OS Preview 26 with Gecko 161.0 and Tundra 0.2.0
This commit is contained in:
parent
3a1fba4efe
commit
e241a42d2f
10 changed files with 1305 additions and 331 deletions
|
|
@ -50,6 +50,10 @@ with source as archive:
|
|||
actual = gaia.read("_vulpes/" + name)
|
||||
assert actual == expected, "Stale Android shared UI: " + name
|
||||
results[name] = hashlib.sha256(actual).hexdigest()
|
||||
settings_html = gaia.read("settings/index.html").decode()
|
||||
for link in ("system-privacy.php#reports", "system-privacy.php#telemetry",
|
||||
"browser-help.php#private", "browser-help.php#tracking", "browser-help.php#dnt"):
|
||||
assert "https://vulpes-os.org/" + link in settings_html, "Stale Settings help link: " + link
|
||||
wifi = translate((ROOT / "overrides/system.gaiamobile.org/js/wifi.js").read_text()).encode()
|
||||
assert gaia.read("system/js/wifi.js") == wifi, "Stale Android Gaia Wi-Fi timer"
|
||||
results["system/js/wifi.js"] = hashlib.sha256(wifi).hexdigest()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
"""Private ordinary-web-app store. No Gaia permissions are read from packages."""
|
||||
import base64
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
|
@ -19,9 +20,15 @@ class InstalledApps:
|
|||
token.chmod(0o600)
|
||||
self.items = {}
|
||||
for path in self.root.glob('user-*.json'):
|
||||
item = json.loads(path.read_text())
|
||||
if self.valid_id(item.get('id')):
|
||||
self.items[item['id']] = item
|
||||
try:
|
||||
item = json.loads(path.read_text())
|
||||
self.validate(item)
|
||||
if item['id'] != path.stem:
|
||||
raise ValueError('Package filename does not match its ID')
|
||||
except (ValueError, OSError) as error:
|
||||
logging.warning('Skipping unreadable installed app %s: %s', path.name, error)
|
||||
continue
|
||||
self.items[item['id']] = item
|
||||
|
||||
@staticmethod
|
||||
def valid_id(value):
|
||||
|
|
@ -37,13 +44,18 @@ class InstalledApps:
|
|||
return dict(id=item['id'], origin=origin, manifestURL=origin+'/manifest.webapp',
|
||||
manifest=manifest, removable=True, installed=True)
|
||||
|
||||
def save(self, item):
|
||||
if not self.valid_id(item.get('id')) or not isinstance(item.get('files'), dict):
|
||||
def validate(self, item):
|
||||
if (not isinstance(item, dict) or not self.valid_id(item.get('id'))
|
||||
or not isinstance(item.get('manifest'), dict) or not isinstance(item.get('files'), dict)):
|
||||
raise ValueError('INVALID_PACKAGE')
|
||||
# A second boundary check keeps the storage API independent of ZIP parsing.
|
||||
for name, content in item['files'].items():
|
||||
if not isinstance(name, str) or not isinstance(content, str):
|
||||
raise ValueError('INVALID_PACKAGE')
|
||||
base64.b64decode(content, validate=True)
|
||||
|
||||
def save(self, item):
|
||||
self.validate(item)
|
||||
with self.lock:
|
||||
target = self.root / (item['id']+'.json')
|
||||
stage = target.with_suffix('.tmp')
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ prefs = {
|
|||
"".join("user_pref(" + json.dumps(k) + "," + json.dumps(v) + ");\n" for k, v in prefs.items())
|
||||
)
|
||||
env = os.environ.copy()
|
||||
env["MOZ_REMOTE_ALLOW_SYSTEM_ACCESS"] = "1"
|
||||
for name in list(env):
|
||||
if name.startswith("MOZ_DISABLE_") or name == "B2G_HOMESCREEN":
|
||||
env.pop(name)
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ ROOT = Path(__file__).resolve().parents[1]
|
|||
SOURCE_OVERRIDES = {
|
||||
"system": ["js/launcher.js", "js/gaia_scheduler.js", "js/keyboard_manager.js",
|
||||
"js/core.js", "js/rocketbar.js", "js/wrapper_factory.js",
|
||||
"js/cover_screen.js", "js/lockscreen_window.js",
|
||||
"js/app_usage_metrics.js", "js/battery_overlay.js"],
|
||||
"js/cover_screen.js", "js/lockscreen_window.js", "lockscreen/js/lockscreen.js",
|
||||
"js/app_usage_metrics.js", "js/battery_overlay.js", "js/wifi_icon.js"],
|
||||
"camera": ["js/views/setting-options.js", "js/views/setting.js"],
|
||||
"communications": ["dialer/js/telephony_helper.js", "dialer/js/mmi.js"],
|
||||
"settings": ["js/modules/storage_helper.js", "js/modules/wifi_context.js", "js/startup.js"],
|
||||
|
|
|
|||
|
|
@ -70,11 +70,15 @@ def main():
|
|||
raise RuntimeError("Port Gaia 8765 déjà occupé. Fermer le précédent hôte/serveur Gaia.")
|
||||
finally:
|
||||
probe.close()
|
||||
profile_prefix = "host-" if args.test else "desktop-"
|
||||
if args.candidate and not args.test:
|
||||
# Leave the desktop-VERSION path available for migration on activation.
|
||||
profile_prefix = "candidate-"
|
||||
profile = (
|
||||
ROOT
|
||||
/ "profiles"
|
||||
/ (
|
||||
("host-" if args.test else "desktop-")
|
||||
profile_prefix
|
||||
+ ("legacy-" if args.legacy_apps else "")
|
||||
+ lock["version"]
|
||||
)
|
||||
|
|
@ -115,6 +119,7 @@ def main():
|
|||
"chrome://vulpes/content/shell.xhtml",
|
||||
]
|
||||
if args.test:
|
||||
env["MOZ_REMOTE_ALLOW_SYSTEM_ACCESS"] = "1"
|
||||
command += ["-marionette", "--remote-allow-system-access", "-new-window", "about:blank"]
|
||||
proc = None
|
||||
with (ROOT / "logs/gaia-server.log").open("w") as output:
|
||||
|
|
|
|||
|
|
@ -375,7 +375,14 @@ done(canvas.toDataURL());}).catch(e=>done({error:String(e)}));""",
|
|||
),
|
||||
)
|
||||
focus()
|
||||
subprocess.run(["xdotool", "mousemove", "240", "820", "mousedown", "1"], check=True)
|
||||
subprocess.run(["xdotool", "search", "--name", "^Vulpes", "windowraise", "windowfocus"], check=True)
|
||||
home_x, home_y = client.execute("""
|
||||
const w = Services.wm.getMostRecentWindow('vulpes:host');
|
||||
const r = w.document.getElementById('home').getBoundingClientRect();
|
||||
return [Math.round(w.mozInnerScreenX+r.x+r.width/2),
|
||||
Math.round(w.mozInnerScreenY+r.y+r.height/2)];
|
||||
""")
|
||||
subprocess.run(["xdotool", "mousemove", str(home_x), str(home_y), "mousedown", "1"], check=True)
|
||||
time.sleep(0.85)
|
||||
subprocess.run(["xdotool", "mouseup", "1"], check=True)
|
||||
check(
|
||||
|
|
|
|||
|
|
@ -11,15 +11,23 @@ spec=importlib.util.spec_from_file_location('probe',Path(__file__).with_name('pr
|
|||
probe=importlib.util.module_from_spec(spec);spec.loader.exec_module(probe)
|
||||
with Client(2857) as c:
|
||||
probe.register(c)
|
||||
probe.evaluate(c,'system',"ScreenManager.turnScreenOn(true);if(Service.query('locked'))await Service.request('unlock',{forcibly:true});return true;")
|
||||
hit_area=c.execute("const d=Services.wm.getMostRecentWindow('vulpes:host').document,b=d.getElementById('home'),r=b.getBoundingClientRect(),y=r.y+r.height/2;return [d.elementFromPoint(r.x+r.width/2,y)===b,d.elementFromPoint(2,y)===b,r.width];")
|
||||
assert hit_area == [True,False,44],hit_area
|
||||
def state():
|
||||
return c.execute("const w=Services.wm.getMostRecentWindow('vulpes:host'),d=w.document,b=d.getElementById('home');return {home:d.documentElement.hasAttribute('home-active'),bottom:d.documentElement.hasAttribute('home-at-bottom'),height:w.innerHeight,screen:d.getElementById('screen').clientHeight,bar:b.clientHeight,background:w.getComputedStyle(b).backgroundImage,color:w.getComputedStyle(b).backgroundColor};")
|
||||
def wait(home):
|
||||
return c.execute("const w=Services.wm.getMostRecentWindow('vulpes:host'),d=w.document,b=d.getElementById('home-bar');return {app:d.documentElement.dataset.navApp,home:d.documentElement.hasAttribute('home-active'),bottom:d.documentElement.hasAttribute('home-at-bottom'),height:w.innerHeight,screen:d.getElementById('screen').clientHeight,bar:b.clientHeight,background:w.getComputedStyle(b).backgroundImage,color:w.getComputedStyle(b).backgroundColor,ring:w.getComputedStyle(d.getElementById('home'),'::before').color};")
|
||||
def wait(home, app=None):
|
||||
for _ in range(100):
|
||||
s=state()
|
||||
if s['home']==home and s['screen']==s['height']-(0 if home else s['bar']):return s
|
||||
if s['home']==home and (app is None or s['app']==app) and s['screen']==s['height']-(0 if home else s['bar']):return s
|
||||
time.sleep(.15)
|
||||
raise AssertionError(s)
|
||||
c.execute("Services.wm.getMostRecentWindow('vulpes:host').document.getElementById('home').click();")
|
||||
wait(True)
|
||||
probe.evaluate(c,'homescreen',"document.querySelector('#apps-panel > .scrollable').scrollTop=0;return true;")
|
||||
for _ in range(50):
|
||||
if not state()['bottom']:break
|
||||
time.sleep(.05)
|
||||
home=wait(True);assert 'linear-gradient' in home['background'],home
|
||||
c.execute("const b=Services.wm.getMostRecentWindow('vulpes:host').document.getElementById('home');InspectorUtils.addPseudoClassLock(b,':active');")
|
||||
pressed=state();assert pressed['background']==home['background'] and pressed['color']==home['color'],pressed
|
||||
|
|
@ -30,14 +38,66 @@ with Client(2857) as c:
|
|||
if bottom['bottom']:break
|
||||
time.sleep(.1)
|
||||
assert bottom['background']=='none' and bottom['color']=='rgba(0, 0, 0, 0)',bottom
|
||||
for open_overlay,close_overlay in [
|
||||
("dispatchEvent(new CustomEvent('holdsleep'))", "document.querySelector('#sleep-menu button').click()"),
|
||||
("UtilityTray.show(true)", "UtilityTray.hide(true)"),
|
||||
]:
|
||||
probe.evaluate(c,'system',open_overlay+';return true;')
|
||||
if open_overlay.startswith('UtilityTray'):
|
||||
for _ in range(50):
|
||||
if c.execute("return Services.wm.getMostRecentWindow('vulpes:host').document.documentElement.hasAttribute('tray-over-home');"):break
|
||||
time.sleep(.05)
|
||||
tray=state()
|
||||
assert tray['home'] and tray['screen']==home['screen'] and tray['bar']==0,tray
|
||||
else:
|
||||
power = wait(False)
|
||||
footer = probe.evaluate(c,'system',"const b=document.querySelector('#sleep-menu button'),r=b.getBoundingClientRect();return [getComputedStyle(b.closest('gaia-buttons')).backgroundColor,r.bottom,document.elementFromPoint(r.x+r.width/2,r.y+r.height/2)===b];")['value']
|
||||
assert power['color']==footer[0] and power['ring']=='rgb(255, 255, 255)',power
|
||||
assert footer[1]<=power['screen'] and footer[2],footer
|
||||
probe.evaluate(c,'system',close_overlay+';return true;')
|
||||
wait(True)
|
||||
if open_overlay.startswith('UtilityTray'):
|
||||
for _ in range(50):
|
||||
restored=state()
|
||||
if restored['bar']:break
|
||||
time.sleep(.05)
|
||||
assert restored['bar']==home['bar'] and restored['screen']==home['screen'],restored
|
||||
result=probe.evaluate(c,'system','await VulpesCompat.call("apps.launch",{manifestURL:"http://settings.localhost:8765/manifest.webapp"});return true;')
|
||||
assert result.get('value'),result
|
||||
app=wait(False);assert app['background']=='none' and app['color']=='rgb(18, 35, 50)',app
|
||||
app=wait(False,'settings');assert app['background']=='none' and app['color']=='rgba(0, 0, 0, 0)',app
|
||||
assert app['ring']=='rgb(101, 112, 115)',app
|
||||
x,y=c.execute("const r=Services.wm.getMostRecentWindow('vulpes:host').document.getElementById('home').getBoundingClientRect();return [Math.floor(r.x+r.width/2),Math.floor(r.y+r.height/2)];")
|
||||
c.call("WebDriver:PerformActions",{"actions":[{"type":"pointer","id":"home-mouse",
|
||||
"parameters":{"pointerType":"mouse"},"actions":[{"type":"pointerMove","x":x,"y":y},
|
||||
{"type":"pointerDown","button":0},{"type":"pause","duration":950},{"type":"pointerUp","button":0}]}]})
|
||||
for _ in range(100):
|
||||
if c.execute("return Services.wm.getMostRecentWindow('vulpes:host').document.documentElement.hasAttribute('recents');"):
|
||||
break
|
||||
time.sleep(.1)
|
||||
else:
|
||||
raise AssertionError('Recent apps did not open')
|
||||
recent=state()
|
||||
assert recent['screen']==recent['height'] and recent['background']=='none' and recent['color']=='rgba(0, 0, 0, 0)',recent
|
||||
denied=probe.evaluate(c,'settings','try {await VulpesCompat.call("desktop.navigation",{home:true});return false;} catch(e) {return true;}')
|
||||
assert denied.get('value'),denied
|
||||
deniedScroll=probe.evaluate(c,'settings','try {await VulpesCompat.call("desktop.homeScroll",{bottom:true});return false;} catch(e) {return true;}')
|
||||
assert deniedScroll.get('value'),deniedScroll
|
||||
c.execute("Services.wm.getMostRecentWindow('vulpes:host').document.getElementById('home').click();")
|
||||
frames = c.call("WebDriver:ExecuteAsyncScript", {"script": """
|
||||
const done=arguments[arguments.length-1],w=Services.wm.getMostRecentWindow('vulpes:host');
|
||||
const d=w.document,root=d.documentElement,bar=d.getElementById('home-bar'),screen=d.getElementById('screen');
|
||||
let frames=0,settled=0;
|
||||
function paint(){
|
||||
const style=w.getComputedStyle(bar);
|
||||
if(screen.clientHeight!==w.innerHeight || style.backgroundColor!=='rgba(0, 0, 0, 0)')
|
||||
return done({error:'Exposed navigation strip',height:screen.clientHeight,background:style.backgroundColor});
|
||||
if(root.hasAttribute('home-active') && !root.hasAttribute('recents')) settled++;
|
||||
if(++frames>400 || settled>=3) return done({frames,settled});
|
||||
w.requestAnimationFrame(paint);
|
||||
}
|
||||
w.requestAnimationFrame(paint);
|
||||
d.getElementById('home').click();
|
||||
""","args":[],"sandbox":"system","newSandbox":True,"scriptTimeout":12000})['value']
|
||||
assert frames.get('settled',0)>=3,frames
|
||||
wait(True)
|
||||
probe.evaluate(c,'homescreen',"document.querySelector('#apps-panel > .scrollable').scrollTop=0;return true;")
|
||||
for _ in range(100):
|
||||
|
|
@ -63,6 +123,6 @@ try {
|
|||
} finally {box.remove();}
|
||||
''')
|
||||
assert iconRecovery.get('value',{}).get('initial')==0 and iconRecovery['value'].get('naturalWidth',0)>0,iconRecovery
|
||||
report={'passed':True,'home':home,'pressed':pressed,'bottom':bottom,'application':app,'returnHome':top,'nonSystemCallerDenied':True,'nonHomeScrollCallerDenied':True,'zeroWidthIconRecovery':iconRecovery['value']}
|
||||
report={'passed':True,'home':home,'pressed':pressed,'bottom':bottom,'application':app,'recents':recent,'returnFrames':frames,'returnHome':top,'nonSystemCallerDenied':True,'nonHomeScrollCallerDenied':True,'zeroWidthIconRecovery':iconRecovery['value']}
|
||||
(ROOT/'logs/home-surface-test.json').write_text(json.dumps(report,indent=2)+'\n')
|
||||
print(json.dumps(report,indent=2))
|
||||
|
|
|
|||
|
|
@ -231,25 +231,20 @@ bc.currentWindowGlobal.getActor('VulpesProbe').sendQuery('Evaluate', CODE)
|
|||
check=True,
|
||||
stdout=subprocess.DEVNULL,
|
||||
)
|
||||
subprocess.run(
|
||||
[
|
||||
"xdotool",
|
||||
"mousemove",
|
||||
"245",
|
||||
"630",
|
||||
"mousedown",
|
||||
"1",
|
||||
"mousemove",
|
||||
"245",
|
||||
"530",
|
||||
"mousemove",
|
||||
"245",
|
||||
"430",
|
||||
"mouseup",
|
||||
"1",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
drag = evaluate("homescreen", """
|
||||
const panel = document.querySelector('#apps-panel > .scrollable');
|
||||
const rect = panel.getBoundingClientRect();
|
||||
return {x:Math.round(mozInnerScreenX + rect.x + rect.width * .55),
|
||||
y:Math.round(mozInnerScreenY + rect.y + rect.height * .75),
|
||||
distance:Math.round(rect.height * .35)};
|
||||
""")
|
||||
for action in (["mousemove", str(drag["x"]), str(drag["y"])], ["mousedown", "1"]):
|
||||
subprocess.run(["xdotool", *action], check=True)
|
||||
for n in range(1, 13):
|
||||
time.sleep(.025)
|
||||
subprocess.run(["xdotool", "mousemove", str(drag["x"]),
|
||||
str(drag["y"] - drag["distance"] * n // 12)], check=True)
|
||||
subprocess.run(["xdotool", "mouseup", "1"], check=True)
|
||||
expect(
|
||||
"trusted-touch-drag",
|
||||
wait(
|
||||
|
|
|
|||
|
|
@ -129,18 +129,19 @@ if(!bc){done({missing:true});return;}bc.currentWindowGlobal.getActor('VulpesProb
|
|||
)
|
||||
time.sleep(0.5)
|
||||
|
||||
def state():
|
||||
return client.execute(
|
||||
"return Services.wm.getMostRecentWindow('vulpes:host').document.getElementById('ContentSelectDropdown')?.menupopup?.state;"
|
||||
)
|
||||
|
||||
def open_menu():
|
||||
tap("settings", "document.querySelector('select[name=\"language.current\"]')")
|
||||
for _ in range(30):
|
||||
if state() == "open":
|
||||
return
|
||||
time.sleep(0.1)
|
||||
raise AssertionError("Native select did not open")
|
||||
wait("settings", "return document.querySelector('#vulpes-value-selector')?.checkVisibility();")
|
||||
|
||||
def menu_tap(selector):
|
||||
tap("settings", "document.querySelector(" + json.dumps("#vulpes-value-selector " + selector) + ")")
|
||||
|
||||
def choose(language):
|
||||
selector = '[role="option"][data-value="' + language + '"]'
|
||||
ev("settings", "document.querySelector(" + json.dumps("#vulpes-value-selector " + selector) +
|
||||
").scrollIntoView({block:'center'});return true;")
|
||||
menu_tap(selector)
|
||||
menu_tap('[data-action="confirm"]')
|
||||
|
||||
if args.restart_check:
|
||||
check(
|
||||
|
|
@ -156,14 +157,9 @@ if(!bc){done({missing:true});return;}bc.currentWindowGlobal.getActor('VulpesProb
|
|||
"return document.querySelector('select[name=\"language.current\"]').value;",
|
||||
)
|
||||
open_menu()
|
||||
check(
|
||||
"native-language-menu-styled",
|
||||
client.execute(
|
||||
"const w=Services.wm.getMostRecentWindow('vulpes:host');const item=w.document.querySelector('#ContentSelectDropdownPopup menuitem');return w.getComputedStyle(item.querySelector('.menu-highlightable-text')).display==='none' && w.getComputedStyle(item.querySelector('.menu-text')).display!=='none';"
|
||||
),
|
||||
)
|
||||
shot("languages-native-menu")
|
||||
subprocess.run(["xdotool", "key", "Escape"], check=True)
|
||||
check("gaia-language-menu", ev("settings", "return !!document.querySelector('#vulpes-value-selector [role=option][aria-selected=true]');"))
|
||||
shot("languages-gaia-menu")
|
||||
menu_tap('[data-action="cancel"]')
|
||||
check(
|
||||
"language-cancel-preserves-value",
|
||||
ev(
|
||||
|
|
@ -174,8 +170,7 @@ if(!bc){done({missing:true});return;}bc.currentWindowGlobal.getActor('VulpesProb
|
|||
),
|
||||
)
|
||||
open_menu()
|
||||
# Native menu keyboard selection exercises Gecko's input/change route.
|
||||
subprocess.run(["xdotool", "key", "Home", *(["Down"] * 8), "Return"], check=True)
|
||||
choose("en-US")
|
||||
check(
|
||||
"language-english-applied",
|
||||
wait(
|
||||
|
|
@ -188,21 +183,7 @@ if(!bc){done({missing:true});return;}bc.currentWindowGlobal.getActor('VulpesProb
|
|||
wait("homescreen", "return document.documentElement.lang==='en-US';"),
|
||||
)
|
||||
open_menu()
|
||||
# Select French with a real pointer click on the native menu item.
|
||||
position = client.execute(
|
||||
"const w=Services.wm.getMostRecentWindow('vulpes:host');const e=[...w.document.querySelectorAll('#ContentSelectDropdownPopup menuitem')].find(e=>e.getAttribute('label').includes('Français'));e.scrollIntoView();const b=e.getBoundingClientRect();return {x:w.mozInnerScreenX+b.x+b.width/2,y:w.mozInnerScreenY+b.y+b.height/2};"
|
||||
)
|
||||
subprocess.run(
|
||||
[
|
||||
"xdotool",
|
||||
"mousemove",
|
||||
str(round(position["x"])),
|
||||
str(round(position["y"])),
|
||||
"click",
|
||||
"1",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
choose("fr")
|
||||
check(
|
||||
"language-french-applied",
|
||||
wait(
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ results = {}
|
|||
try:
|
||||
for phase in ["first", "restart"]:
|
||||
env = os.environ.copy()
|
||||
env["MOZ_REMOTE_ALLOW_SYSTEM_ACCESS"] = "1"
|
||||
for key in list(env):
|
||||
if key.startswith("MOZ_DISABLE_") or key == "B2G_HOMESCREEN":
|
||||
env.pop(key)
|
||||
|
|
|
|||
Loading…
Reference in a new issue