Repository Public License
1// ORIX Navigator — user activation reporter.2// World: orix.bridge (isolated). Frames: all. Injection: document start.3// Tells the native side that a *trusted* input event just happened, so that a window.open arriving right after4// can be treated as user-initiated. Page script cannot forge `isTrusted`, and cannot reach this world's handler.5(function () {6 "use strict";7 if (window.__orixActivation) return;8 window.__orixActivation = true;9 var handler = window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.orixBridge;10 if (!handler) return;11 var last = 0;12 function report(event) {13 if (!event.isTrusted) return;14 var now = Date.now();15 if (now - last < 80) return;16 last = now;17 try { handler.postMessage({ v: 1, kind: "activation", payload: { type: String(event.type) } }); } catch (e) {}18 }19 ["pointerdown", "mousedown", "keydown", "touchend", "click"].forEach(function (type) {20 window.addEventListener(type, report, { capture: true, passive: true });21 });22})();23