Release Vulpes OS Preview 26 with Gecko 161.0 and Tundra 0.2.0
This commit is contained in:
parent
3a1fba4efe
commit
e241a42d2f
1 changed files with 1305 additions and 331 deletions
|
|
@ -31,7 +31,7 @@ export class WebInputChild extends JSWindowActorChild {
|
|||
const editable = element?.isContentEditable || element?.localName === 'textarea' ||
|
||||
(element?.localName === 'input' && ['text','search','email','url','tel','password','number'].includes(element.type));
|
||||
if (!editable || element.disabled || element.readOnly) {
|
||||
if (event.type === 'click') this.sendAsyncMessage('Vulpes:InputFocus', null);
|
||||
if (event.type === 'click' && event.isTrusted) this.sendAsyncMessage('Vulpes:WebDismissInput', null);
|
||||
return;
|
||||
}
|
||||
this.editor ||= new InputEditor(this.contentWindow);
|
||||
|
|
@ -39,6 +39,25 @@ export class WebInputChild extends JSWindowActorChild {
|
|||
this.sendAsyncMessage('Vulpes:InputFocus', this.editor.state());
|
||||
}
|
||||
receiveMessage(message) {
|
||||
if (message.name === 'Vulpes:PageIcon') {
|
||||
const doc = this.document;
|
||||
const origin = doc.location.origin;
|
||||
const candidates = [...doc.querySelectorAll('link[rel~="icon" i][href]')]
|
||||
.map(link => ({href:link.href, sizes:link.getAttribute('sizes') || ''}));
|
||||
candidates.push({href:origin + '/favicon.ico', sizes:''});
|
||||
return (async () => {
|
||||
for (const candidate of candidates.slice(0, 12)) {
|
||||
let url;
|
||||
try { url = new URL(candidate.href); } catch { continue; }
|
||||
if (url.origin !== origin || !['https:', 'http:'].includes(url.protocol)) continue;
|
||||
const image = doc.createElement('img');
|
||||
image.src = url.href;
|
||||
try { await image.decode(); } catch { continue; }
|
||||
if (image.naturalWidth) return {href:url.href, sizes:candidate.sizes};
|
||||
}
|
||||
return null;
|
||||
})();
|
||||
}
|
||||
if (message.name !== 'Vulpes:Edit' || !this.editor) throw Error('INPUT_CONTEXT_EXPIRED');
|
||||
return this.editor.edit(message.data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue