Release Vulpes OS 2.7 Preview 25 for Desktop, Android and Pixel 3a
This commit is contained in:
parent
6a44daeaaa
commit
3a1fba4efe
1 changed files with 1301 additions and 196 deletions
|
|
@ -3,9 +3,25 @@ import {InputEditor} from 'resource://vulpes/services/input-editor.mjs';
|
|||
// Web pages may edit their focused field, but receive no Gaia service bridge.
|
||||
export class WebInputChild extends JSWindowActorChild {
|
||||
handleEvent(event) {
|
||||
if (!Services.cpmm.sharedData.get('vulpes:native-input') || this.editor?.editing) return;
|
||||
if (this.editor?.editing) return;
|
||||
const contexts = Services.cpmm.sharedData.get('vulpes:host-contexts') || [];
|
||||
if (!contexts.includes(this.browsingContext.top.id)) return;
|
||||
// The standalone host has no Firefox tab strip for target=_blank. Use
|
||||
// the current web view so Gecko retains its normal link security checks.
|
||||
if (event.type === 'click' && event.isTrusted && this.browsingContext === this.browsingContext.top) {
|
||||
const link = event.composedPath().find(node => node.localName === 'a' && node.href);
|
||||
const target = link?.getAttribute('target') ?? this.document.querySelector('base[target]')?.target;
|
||||
if (link && target?.toLowerCase() === '_blank' && /^https?:/.test(link.href) && !link.hasAttribute('download')) {
|
||||
const original = link.getAttribute('target');
|
||||
link.target = '_self';
|
||||
this.contentWindow.setTimeout(() => {
|
||||
if (link.target !== '_self') return;
|
||||
if (original === null) link.removeAttribute('target');
|
||||
else link.target = original;
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
if (!Services.cpmm.sharedData.get('vulpes:native-input')) return;
|
||||
// Standalone web views have no Firefox tabbrowser to focus their embedder.
|
||||
// Keep Gecko's picker focus checks intact by activating only a touched view.
|
||||
if (event.isTrusted && ['pointerdown','mousedown','click'].includes(event.type))
|
||||
|
|
|
|||
Loading…
Reference in a new issue