local-operator-ui 0.47.8 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/main/index.js +488 -170
- package/out/renderer/assets/{_basePickBy-ojkoQ439.js → _basePickBy-Dv9-f1zg.js} +1 -1
- package/out/renderer/assets/{_baseUniq-Cgz7Hj_a.js → _baseUniq-DhaZAHoq.js} +1 -1
- package/out/renderer/assets/{agent-details-page-B5287Wxd.js → agent-details-page-CR3LqA6j.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-D3p-cWKe.js → agent-hub-page-CUrnlAxA.js} +1 -1
- package/out/renderer/assets/{agents-page-Dfj750IG.js → agents-page-C7yY-2qp.js} +3 -3
- package/out/renderer/assets/{arc-QdUtBTFo.js → arc-LL7ee6-c.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-B6bGif-A.js → architectureDiagram-IEHRJDOE-Bdpg_P_k.js} +1 -1
- package/out/renderer/assets/{avatar-cropper-C0NbIvss.js → avatar-cropper-DIvwbJ-E.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-DNZk1EMc.js → blockDiagram-JOT3LUYC-DOdFevdL.js} +1 -1
- package/out/renderer/assets/{book-open-DAO2iRnF.js → book-open-13BlWsMx.js} +1 -1
- package/out/renderer/assets/browser-page-Ducxyk3P.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-6rWrqh9J.js → browser-webauthn-prompt-DiRIL08d.js} +1 -1
- package/out/renderer/assets/{building-2-DpO451z6.js → building-2-9N44CmaA.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-l_7VtVOD.js → c4Diagram-VJAJSXHY-CjyVs5O2.js} +1 -1
- package/out/renderer/assets/channel-DnjDWcac.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-BZPnQwiD.js → chunk-4BMEZGHF-tE6rpM2C.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-CrfIH5iq.js → chunk-A2AXSNBT-DV0Fb7U9.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-CaPCVkD8.js → chunk-AEK57VVT-BLSpH8f8.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-bEDpLmbt.js → chunk-D6G4REZN-rSj-_6yc.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-CsrG7rfM.js → chunk-RZ5BOZE2-jPXnSJCa.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-F1EtkaMn.js → chunk-XZIHB7SX-MRXkZaZL.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-QToYz1ed.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-QToYz1ed.js +1 -0
- package/out/renderer/assets/clone-DhcIbbVE.js +1 -0
- package/out/renderer/assets/{console-mirror-CY6eZKQD.js → console-mirror-Du1Dfi6G.js} +1 -1
- package/out/renderer/assets/{consoleCapture-Cj71UOvJ.js → consoleCapture-B8I_oIj6.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-CT1X3xzg.js → conversation-input-sync-CZrU8Pug.js} +5 -5
- package/out/renderer/assets/{dagre-OKDRZEBW-KbsJOd-j.js → dagre-OKDRZEBW-Cm4oWZdS.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-P_0af2wd.js → diagram-SSKATNLV-B-SuT3th.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-CkyDCyPd.js → diagram-VNBRO52H-C_87XaDb.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-BaiH25Qu.js → erDiagram-Q7BY3M3F-CNUTHNRl.js} +1 -1
- package/out/renderer/assets/{error-boundary-CD9E-FB_.js → error-boundary-CwJn067i.js} +22 -22
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-DB1HkaCE.js → flowDiagram-4HSFHLVR-CNWPnM24.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-DnoZ-mEJ.js → ganttDiagram-APWFNJXF-DsY3XLIc.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-DcrBUoZ8.js → gitGraphDiagram-7IBYFJ6S-BC2rtoKr.js} +1 -1
- package/out/renderer/assets/{graph-Da9ZlHpw.js → graph-8FfBtXyF.js} +1 -1
- package/out/renderer/assets/{hash-BGVcZhsd.js → hash-CYo8ILV1.js} +1 -1
- package/out/renderer/assets/{heart-CC5rFmGg.js → heart-BNMX-lJj.js} +1 -1
- package/out/renderer/assets/{image-plus-Dc4Ph61z.js → image-plus-CJJBBm-x.js} +1 -1
- package/out/renderer/assets/{index-BiI-eK_K.js → index-Bw2_HcHz.js} +1 -1
- package/out/renderer/assets/{index-DSl-Zp-F.js → index-CAHaHqgX.js} +3 -3
- package/out/renderer/assets/{index-G0fTK0HE.js → index-Cbu_OqUM.js} +1 -1
- package/out/renderer/assets/{index-xeR22aZz.css → index-DY_OTUQR.css} +1 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5--dcCt49k.js +2 -0
- package/out/renderer/assets/{installer-M2B_gKRK.js → installer-8KDPYD7n.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-DTmBGW6Q.js → journeyDiagram-U35MCT3I-BDNGeVqH.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-C8WI_dOp.js → kanban-definition-NDS4AKOZ-S6WyCw-t.js} +1 -1
- package/out/renderer/assets/{layout-C3jbvT4l.js → layout-C8dSdqMl.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-BX1ObLve.js → legacy-agents-page-DlgZ5b8m.js} +1 -1
- package/out/renderer/assets/{library-page-qOfmNVcg.js → library-page-Cp4PnUA5.js} +3 -3
- package/out/renderer/assets/{mermaid.core-CdQ7E5mL.js → mermaid.core-ChUVqMVr.js} +5 -5
- package/out/renderer/assets/{mesh-page-DMkT_9A-.js → mesh-page-DZZfCNa2.js} +1 -1
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-DU0mo9p2.js → mindmap-definition-ALO5MXBD-BDgMRP17.js} +1 -1
- package/out/renderer/assets/{mini-aAsnKaGz.js → mini-BiSL5p9w.js} +1 -1
- package/out/renderer/assets/{notebook-pen-BP6ceuCH.js → notebook-pen-CDTqffOy.js} +1 -1
- package/out/renderer/assets/{notifications-page-DRMToDYt.js → notifications-page-Cmp-Mcnx.js} +1 -1
- package/out/renderer/assets/{org-access-Bs8eFlSp.js → org-access-CQLGDE7O.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-Cxo-hbUN.js → org-surface-gate-BRW-oc5F.js} +1 -1
- package/out/renderer/assets/{page-header-D5i9aRdF.js → page-header-51hz6cfp.js} +1 -1
- package/out/renderer/assets/{path-utils-CS-ZbmNv.js → path-utils-hqT2xf5k.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-Jdvz8VWw.js → pieDiagram-IB7DONF6-_o4TQRD4.js} +1 -1
- package/out/renderer/assets/{project-markdown-6v_v8CTi.js → project-markdown-DCyUXZT4.js} +1 -1
- package/out/renderer/assets/{projects-page-ClDZIyym.js → projects-page-DpKBnfKx.js} +1 -1
- package/out/renderer/assets/{publication-validation-fhBwU4Ct.js → publication-validation-DAtEW_km.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-DDWwjPpi.js → quadrantDiagram-7GDLP6J5-iGSUnWGg.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-Bph4zewY.js → radar-MK3ICKWK-WyU70_8J.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-DzozdIYt.js → radient-auth-buttons-CfQ8zffH.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-dCfjbetB.js → requirementDiagram-KVF5MWMF-D8UCvhk2.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-HVn73-Eh.js → sankeyDiagram-QLVOVGJD-Cu2Jst1E.js} +1 -1
- package/out/renderer/assets/{schedules-page-D7cUalTn.js → schedules-page-CBOwjsR3.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-DLk99tON.js → sequenceDiagram-X6HHIX6F-Cf1qv7nv.js} +1 -1
- package/out/renderer/assets/{settings-page-A_PbN5kj.js → settings-page-ri8T0hR6.js} +1 -1
- package/out/renderer/assets/{smartart-BXJB_IpV.js → smartart-BD3VY3T_.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-D4lTws7V.js → stateDiagram-DGXRK772-DygQ8odd.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-JmiS-OvQ.js +1 -0
- package/out/renderer/assets/team-bridge-page-CnL7zo0z.js +39 -0
- package/out/renderer/assets/{team-bridge-scope-preference-B_3LiR3U.js → team-bridge-scope-preference-amThPee8.js} +1 -1
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-_5CvFmhx.js → timeline-definition-BDJGKUSR-WnOC2syY.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-uNfQtsZW.js → use-download-agent-mutation-Boh-EKE8.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-Dd2mlTTk.js → use-session-snapshot-DPrglgqS.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-FE7vAowE.js → xychartDiagram-VJFVF3MP-BwdKR-i5.js} +1 -1
- package/out/renderer/console-capture.html +5 -5
- package/out/renderer/index.html +7 -7
- package/out/renderer/installer.html +4 -4
- package/out/renderer/mini.html +7 -7
- package/package.json +2 -2
- package/out/renderer/assets/browser-page-PqDhz6JH.js +0 -1
- package/out/renderer/assets/channel-Bayx-C4D.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-DIGzvb4h.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-DIGzvb4h.js +0 -1
- package/out/renderer/assets/clone-DSth8cxq.js +0 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-CEGFxaq5.js +0 -2
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CLGdAi2z.js +0 -1
- package/out/renderer/assets/team-bridge-page-DOAIc8WR.js +0 -38
- /package/out/renderer/assets/{index-Cs4iHH2g.js → index-yTWbf43d.js} +0 -0
package/out/main/index.js
CHANGED
|
@@ -82010,7 +82010,15 @@ const METHODS$1 = [
|
|
|
82010
82010
|
// `protocol.py`'s METHODS tuple carries them, so the hand-kept mirror stays
|
|
82011
82011
|
// comparable by eye (D8).
|
|
82012
82012
|
"record_start",
|
|
82013
|
-
"record_stop"
|
|
82013
|
+
"record_stop",
|
|
82014
|
+
// Pointer-move without a press (hover-revealed menus, row actions, tooltips).
|
|
82015
|
+
// APPENDED here so no existing method's index moves on this host. The Python
|
|
82016
|
+
// mirror (`protocol.py`, local-operator#3326) places it right after `press`
|
|
82017
|
+
// instead: the lists are NOT byte-comparable at this entry, and the wire is by
|
|
82018
|
+
// NAME, so `isMethod` admits it either way. Hosts advertise it in
|
|
82019
|
+
// HOST_CAPABILITIES (beside `press`), which is what lets the harness refuse it
|
|
82020
|
+
// on an app that predates it instead of sending an unknown method.
|
|
82021
|
+
"hover"
|
|
82014
82022
|
];
|
|
82015
82023
|
const METHOD_SET = new Set(METHODS$1);
|
|
82016
82024
|
function isMethod(value) {
|
|
@@ -82044,6 +82052,7 @@ const ERROR_CODES = [
|
|
|
82044
82052
|
// policy refusal travels as an `ok: true` result here.
|
|
82045
82053
|
"capability_unsupported",
|
|
82046
82054
|
// Paired with the core press follow-up before callers use this new method.
|
|
82055
|
+
// Also the refusal for a `press` chord outside the grammar (press-chord.ts).
|
|
82047
82056
|
"unsupported_key",
|
|
82048
82057
|
"internal",
|
|
82049
82058
|
// The console namespace's own additions (design 10.6). Spread rather than copied
|
|
@@ -82064,6 +82073,12 @@ const HOST_CAPABILITIES = [
|
|
|
82064
82073
|
// Desktop-only trusted keys. Core must capability-gate extension/cmux and
|
|
82065
82074
|
// older desktop hosts instead of sending them an unknown method.
|
|
82066
82075
|
"press",
|
|
82076
|
+
// The extended-press flag (see `HostCapabilityToken`). Advertised with the same
|
|
82077
|
+
// change that implements the grammar in `actions/press-chord.ts`, never ahead of it.
|
|
82078
|
+
"press_chord",
|
|
82079
|
+
// `hover` rides the same list as `press` for the same reason: desktop-only, and
|
|
82080
|
+
// the extension/cmux hosts and older desktop apps must be refused by capability.
|
|
82081
|
+
"hover",
|
|
82067
82082
|
// Session-scoped network capture. DESKTOP-ONLY: the extension's debugger is
|
|
82068
82083
|
// attached only for the duration of an action, so it holds no standing session
|
|
82069
82084
|
// to keep a `Network` subscription on. The backend therefore gates these four
|
|
@@ -90456,7 +90471,7 @@ function truncateToInt(value, min, max) {
|
|
|
90456
90471
|
if (!Number.isFinite(value)) return min;
|
|
90457
90472
|
return Math.min(Math.max(Math.trunc(value), min), max);
|
|
90458
90473
|
}
|
|
90459
|
-
const NAMED_KEYS$
|
|
90474
|
+
const NAMED_KEYS$2 = [
|
|
90460
90475
|
"enter",
|
|
90461
90476
|
"return",
|
|
90462
90477
|
"tab",
|
|
@@ -91592,8 +91607,8 @@ class ConsoleHost {
|
|
|
91592
91607
|
if (unknown !== void 0) {
|
|
91593
91608
|
throw new ConsoleError(
|
|
91594
91609
|
"unknown_key",
|
|
91595
|
-
`unknown key ${JSON.stringify(unknown)}; accepted: ${NAMED_KEYS$
|
|
91596
|
-
{ accepted: [...NAMED_KEYS$
|
|
91610
|
+
`unknown key ${JSON.stringify(unknown)}; accepted: ${NAMED_KEYS$2.join(", ")}`,
|
|
91611
|
+
{ accepted: [...NAMED_KEYS$2], key: unknown }
|
|
91597
91612
|
);
|
|
91598
91613
|
}
|
|
91599
91614
|
this.markActor(entry, actor);
|
|
@@ -100462,6 +100477,10 @@ async function editableInFrame(ctx, contents, scope, target2) {
|
|
|
100462
100477
|
);
|
|
100463
100478
|
return { nodeId: requested?.nodeId ?? 0, objectId };
|
|
100464
100479
|
}
|
|
100480
|
+
const READ_STYLES_SOURCE = '(selector, properties) => {\n const DEFAULTS = [\n "display",\n "position",\n "visibility",\n "opacity",\n "z-index",\n "transform",\n "transform-origin",\n "top",\n "right",\n "bottom",\n "left",\n "width",\n "height",\n "contain",\n "filter",\n "will-change",\n "overflow",\n "overflow-x",\n "overflow-y",\n "pointer-events"\n ];\n const MAX_MATCHES = 5;\n const MAX_STYLES = 30;\n const MAX_INLINE = 30;\n const MAX_IDENTITY = 120;\n const MAX_VALUE = 200;\n const all = document.querySelectorAll(selector);\n if (!all || all.length === 0) return null;\n const names = DEFAULTS.slice();\n if (Array.isArray(properties)) {\n for (let i = 0; i < properties.length && names.length < MAX_STYLES; i++) {\n const name = String(properties[i] ?? "").trim();\n if (name && names.indexOf(name) === -1) names.push(name);\n }\n }\n const round2 = (value) => {\n const rounded = Math.round(value * 100) / 100;\n return rounded === 0 ? 0 : rounded;\n };\n const clip = (value, limit) => value.length > limit ? value.slice(0, limit - 1) + "\\u2026" : value;\n const rectOf = (el) => {\n const r = el.getBoundingClientRect();\n return {\n x: round2(r.x),\n y: round2(r.y),\n top: round2(r.top),\n right: round2(r.right),\n bottom: round2(r.bottom),\n width: round2(r.width),\n height: round2(r.height)\n };\n };\n const attrOf = (el, name) => clip(el.getAttribute(name) || "", MAX_IDENTITY);\n const matches = [];\n const first = Array.from(all).slice(0, MAX_MATCHES);\n for (const el of first) {\n const computed = getComputedStyle(el);\n const styles = {};\n for (const name of names) {\n styles[name] = clip(String(computed.getPropertyValue(name) || "").trim(), MAX_VALUE);\n }\n const inline = {};\n const declaration = el.style;\n let inlineCount = 0;\n for (let j = 0; j < declaration.length && inlineCount < MAX_INLINE; j++) {\n const name = declaration.item(j);\n if (name && name.indexOf("--") === 0) {\n const key = clip(name, MAX_IDENTITY);\n if (!(key in inline)) {\n inline[key] = clip(\n String(declaration.getPropertyValue(name) || "").trim(),\n MAX_VALUE\n );\n inlineCount += 1;\n }\n }\n }\n matches.push({\n tag: clip(el.tagName.toLowerCase(), MAX_IDENTITY),\n id: attrOf(el, "id"),\n role: attrOf(el, "role"),\n className: attrOf(el, "class"),\n rect: rectOf(el),\n styles,\n inline\n });\n }\n return { count: matches.length, matches, truncated: all.length > matches.length };\n}';
|
|
100481
|
+
const HIT_TEST_SOURCE = '(x, y) => {\n const PROPS = ["display", "position", "visibility", "opacity", "z-index", "pointer-events"];\n const MAX_ELEMENTS = 8;\n const MAX_IDENTITY = 120;\n const MAX_VALUE = 200;\n const px = Number(x);\n const py = Number(y);\n if (!Number.isFinite(px) || !Number.isFinite(py)) return null;\n const stack = document.elementsFromPoint(px, py);\n if (!stack || stack.length === 0) return null;\n const round2 = (value) => {\n const rounded = Math.round(value * 100) / 100;\n return rounded === 0 ? 0 : rounded;\n };\n const clip = (value, limit) => value.length > limit ? value.slice(0, limit - 1) + "\\u2026" : value;\n const attrOf = (el, name) => clip(el.getAttribute(name) || "", MAX_IDENTITY);\n const elements = [];\n for (const el of stack.slice(0, MAX_ELEMENTS)) {\n const computed = getComputedStyle(el);\n const styles = {};\n for (const name of PROPS) {\n styles[name] = clip(String(computed.getPropertyValue(name) || "").trim(), MAX_VALUE);\n }\n const r = el.getBoundingClientRect();\n elements.push({\n tag: clip(el.tagName.toLowerCase(), MAX_IDENTITY),\n id: attrOf(el, "id"),\n role: attrOf(el, "role"),\n className: attrOf(el, "class"),\n rect: {\n x: round2(r.x),\n y: round2(r.y),\n top: round2(r.top),\n right: round2(r.right),\n bottom: round2(r.bottom),\n width: round2(r.width),\n height: round2(r.height)\n },\n styles\n });\n }\n return { count: elements.length, elements };\n}';
|
|
100482
|
+
const ANCESTORS_SOURCE = '(selector, depth) => {\n const PROPS = [\n "display",\n "position",\n "visibility",\n "overflow",\n "overflow-x",\n "overflow-y",\n "transform",\n "transform-origin",\n "contain",\n "filter",\n "will-change",\n "z-index",\n "isolation",\n "top",\n "left"\n ];\n const DEFAULT_DEPTH = 12;\n const MAX_DEPTH = 16;\n const MAX_IDENTITY = 120;\n const MAX_VALUE = 200;\n const el = document.querySelector(selector);\n if (!el) return null;\n const wanted = typeof depth === "number" && Number.isFinite(depth) ? Math.floor(depth) : DEFAULT_DEPTH;\n const bound = Math.max(1, Math.min(MAX_DEPTH, wanted));\n const round2 = (value) => {\n const rounded = Math.round(value * 100) / 100;\n return rounded === 0 ? 0 : rounded;\n };\n const clip = (value, limit) => value.length > limit ? value.slice(0, limit - 1) + "\\u2026" : value;\n const attrOf = (el2, name) => clip(el2.getAttribute(name) || "", MAX_IDENTITY);\n const chain = [];\n let node = el;\n while (node && chain.length < bound) {\n const computed = getComputedStyle(node);\n const styles = {};\n for (const name of PROPS) {\n styles[name] = clip(String(computed.getPropertyValue(name) || "").trim(), MAX_VALUE);\n }\n const r = node.getBoundingClientRect();\n chain.push({\n tag: clip(node.tagName.toLowerCase(), MAX_IDENTITY),\n id: attrOf(node, "id"),\n role: attrOf(node, "role"),\n className: attrOf(node, "class"),\n rect: {\n x: round2(r.x),\n y: round2(r.y),\n top: round2(r.top),\n right: round2(r.right),\n bottom: round2(r.bottom),\n width: round2(r.width),\n height: round2(r.height)\n },\n styles\n });\n if (node === document.documentElement) break;\n node = node.parentElement;\n }\n return { count: chain.length, chain };\n}';
|
|
100483
|
+
const QUERY_SOURCE = '(selector, limit) => {\n const MAX_ELEMENTS = 50;\n const MAX_IDENTITY = 120;\n const MAX_TEXT = 120;\n const MAX_VALUE = 120;\n if (typeof selector !== "string" || !selector.trim()) return null;\n const wanted = typeof limit === "number" && Number.isFinite(limit) ? Math.floor(limit) : 20;\n const bound = Math.max(1, Math.min(MAX_ELEMENTS, wanted));\n const round2 = (value) => {\n const rounded = Math.round(value * 100) / 100;\n return rounded === 0 ? 0 : rounded;\n };\n const clip = (value, cap) => value.length > cap ? `${value.slice(0, cap - 1)}\\u2026` : value;\n const attrOf = (el, name) => clip(String(el.getAttribute(name) || ""), MAX_IDENTITY);\n const visibleOf = (el, rect) => {\n if (rect.width <= 0 || rect.height <= 0) return false;\n const computed = getComputedStyle(el);\n if (computed.display === "none" || computed.visibility === "hidden") return false;\n return computed.contentVisibility !== "hidden";\n };\n let nodes;\n try {\n nodes = Array.from(document.querySelectorAll(selector));\n } catch {\n return { count: 0, truncated: false, matches: [], error: "invalid_selector" };\n }\n const viewport = {\n width: document.documentElement.clientWidth || window.innerWidth || 0,\n height: document.documentElement.clientHeight || window.innerHeight || 0\n };\n const matches = [];\n for (const el of nodes.slice(0, bound)) {\n const rect = el.getBoundingClientRect();\n const tag = clip(String(el.tagName || "").toLowerCase(), MAX_IDENTITY);\n const type = attrOf(el, "type").toLowerCase();\n const isPassword = tag === "input" && type === "password";\n const rawValue = el.value;\n const checkable = tag === "input" && (type === "checkbox" || type === "radio");\n const checked = checkable ? Boolean(el.checked) : null;\n matches.push({\n tag,\n id: attrOf(el, "id"),\n name: attrOf(el, "name"),\n role: attrOf(el, "role"),\n ariaLabel: attrOf(el, "aria-label"),\n // `innerText` is the RENDERED text (a hidden node reports ""), which is\n // what an agent reading a page means by "the text"; `textContent` would\n // report text nobody can see, including inside a collapsed section.\n text: clip(String(el.innerText || "").replace(/\\s+/g, " ").trim(), MAX_TEXT),\n type,\n visible: visibleOf(el, rect),\n inView: rect.top < viewport.height && rect.bottom > 0 && rect.left < viewport.width && rect.right > 0,\n disabled: el.hasAttribute("disabled") || el.disabled === true,\n checked,\n value: isPassword || rawValue === void 0 || rawValue === null ? "" : clip(String(rawValue), MAX_VALUE),\n rect: {\n x: round2(rect.x),\n y: round2(rect.y),\n width: round2(rect.width),\n height: round2(rect.height)\n }\n });\n }\n return { count: nodes.length, truncated: nodes.length > matches.length, matches };\n}';
|
|
100465
100484
|
const LANDMARKS = /* @__PURE__ */ new Set(["banner", "main", "navigation", "complementary", "contentinfo", "form", "region"]);
|
|
100466
100485
|
const INTERACTIVE = /* @__PURE__ */ new Set(["button", "link", "textbox", "checkbox", "radio", "combobox", "menuitem", "tab", "switch", "slider", "spinbutton"]);
|
|
100467
100486
|
function stateSuffix(node) {
|
|
@@ -100984,6 +101003,304 @@ async function backendNodeIdForSelector(ctx, view, selector) {
|
|
|
100984
101003
|
}
|
|
100985
101004
|
return backendNodeId;
|
|
100986
101005
|
}
|
|
101006
|
+
const MAX_REQUESTED_PROPERTIES = 20;
|
|
101007
|
+
const DEFAULT_DEPTH = 12;
|
|
101008
|
+
const MAX_DEPTH = 16;
|
|
101009
|
+
async function runFixed(record, source, args, label) {
|
|
101010
|
+
const code = `(${source})(${args.map((arg) => JSON.stringify(arg)).join(", ")})`;
|
|
101011
|
+
return await deadline(
|
|
101012
|
+
record.view.webContents.executeJavaScriptInIsolatedWorld(
|
|
101013
|
+
ISOLATED_WORLD_ID,
|
|
101014
|
+
[{ code }]
|
|
101015
|
+
),
|
|
101016
|
+
SCRIPTING_DEADLINE_MS,
|
|
101017
|
+
label
|
|
101018
|
+
);
|
|
101019
|
+
}
|
|
101020
|
+
function selectorError(selector, error) {
|
|
101021
|
+
if (error instanceof Error && INVALID_SELECTOR.test(error.message)) {
|
|
101022
|
+
return new BridgeCommandError(
|
|
101023
|
+
"element_not_found",
|
|
101024
|
+
`selector ${selector} is not valid`
|
|
101025
|
+
);
|
|
101026
|
+
}
|
|
101027
|
+
return error;
|
|
101028
|
+
}
|
|
101029
|
+
function structuredResult(name, result) {
|
|
101030
|
+
if (typeof result !== "object" || result === null) {
|
|
101031
|
+
throw new BridgeCommandError(
|
|
101032
|
+
"internal",
|
|
101033
|
+
`the page returned no structured ${name} result`
|
|
101034
|
+
);
|
|
101035
|
+
}
|
|
101036
|
+
return result;
|
|
101037
|
+
}
|
|
101038
|
+
function requiredSelector(params) {
|
|
101039
|
+
const selector = stringParam(params, "selector");
|
|
101040
|
+
if (!selector) {
|
|
101041
|
+
throw new BridgeCommandError("element_not_found", "selector is required");
|
|
101042
|
+
}
|
|
101043
|
+
return selector;
|
|
101044
|
+
}
|
|
101045
|
+
function requestedProperties(params) {
|
|
101046
|
+
if (!Array.isArray(params.properties)) return [];
|
|
101047
|
+
return params.properties.filter((entry) => typeof entry === "string").slice(0, MAX_REQUESTED_PROPERTIES);
|
|
101048
|
+
}
|
|
101049
|
+
async function styles(ctx, params) {
|
|
101050
|
+
const record = ctx.registry.requireSurface(params.tab);
|
|
101051
|
+
const selector = requiredSelector(params);
|
|
101052
|
+
const properties = requestedProperties(params);
|
|
101053
|
+
let result;
|
|
101054
|
+
try {
|
|
101055
|
+
result = await runFixed(
|
|
101056
|
+
record,
|
|
101057
|
+
READ_STYLES_SOURCE,
|
|
101058
|
+
[selector, properties],
|
|
101059
|
+
`styles(${selector})`
|
|
101060
|
+
);
|
|
101061
|
+
} catch (error) {
|
|
101062
|
+
throw selectorError(selector, error);
|
|
101063
|
+
}
|
|
101064
|
+
if (result === null || result === void 0) {
|
|
101065
|
+
throw new BridgeCommandError(
|
|
101066
|
+
"element_not_found",
|
|
101067
|
+
`selector ${selector} matched nothing`
|
|
101068
|
+
);
|
|
101069
|
+
}
|
|
101070
|
+
ctx.registry.touch(record);
|
|
101071
|
+
return { ...structuredResult("styles", result), ...pageOf(record.view) };
|
|
101072
|
+
}
|
|
101073
|
+
async function hitAt(record, x, y) {
|
|
101074
|
+
return await runFixed(
|
|
101075
|
+
record,
|
|
101076
|
+
HIT_TEST_SOURCE,
|
|
101077
|
+
[x, y],
|
|
101078
|
+
`hit_test(${x}, ${y})`
|
|
101079
|
+
);
|
|
101080
|
+
}
|
|
101081
|
+
async function hitTest(ctx, params) {
|
|
101082
|
+
const record = ctx.registry.requireSurface(params.tab);
|
|
101083
|
+
const x = numberParam(params, "x");
|
|
101084
|
+
const y = numberParam(params, "y");
|
|
101085
|
+
if (x === void 0 || y === void 0) {
|
|
101086
|
+
throw new BridgeCommandError(
|
|
101087
|
+
"internal",
|
|
101088
|
+
"'hit_test' needs numeric x and y (viewport coordinates)"
|
|
101089
|
+
);
|
|
101090
|
+
}
|
|
101091
|
+
const result = await hitAt(record, x, y);
|
|
101092
|
+
if (result === null || result === void 0) {
|
|
101093
|
+
throw new BridgeCommandError(
|
|
101094
|
+
"element_not_found",
|
|
101095
|
+
`no element at point (${x}, ${y})`
|
|
101096
|
+
);
|
|
101097
|
+
}
|
|
101098
|
+
ctx.registry.touch(record);
|
|
101099
|
+
return {
|
|
101100
|
+
...structuredResult("hit_test", result),
|
|
101101
|
+
...pageOf(record.view)
|
|
101102
|
+
};
|
|
101103
|
+
}
|
|
101104
|
+
async function ancestors(ctx, params) {
|
|
101105
|
+
const record = ctx.registry.requireSurface(params.tab);
|
|
101106
|
+
const selector = requiredSelector(params);
|
|
101107
|
+
const raw = numberParam(params, "depth");
|
|
101108
|
+
const depth = Math.max(
|
|
101109
|
+
1,
|
|
101110
|
+
Math.min(MAX_DEPTH, raw === void 0 ? DEFAULT_DEPTH : Math.floor(raw))
|
|
101111
|
+
);
|
|
101112
|
+
let result;
|
|
101113
|
+
try {
|
|
101114
|
+
result = await runFixed(
|
|
101115
|
+
record,
|
|
101116
|
+
ANCESTORS_SOURCE,
|
|
101117
|
+
[selector, depth],
|
|
101118
|
+
`ancestors(${selector})`
|
|
101119
|
+
);
|
|
101120
|
+
} catch (error) {
|
|
101121
|
+
throw selectorError(selector, error);
|
|
101122
|
+
}
|
|
101123
|
+
if (result === null || result === void 0) {
|
|
101124
|
+
throw new BridgeCommandError(
|
|
101125
|
+
"element_not_found",
|
|
101126
|
+
`selector ${selector} matched nothing`
|
|
101127
|
+
);
|
|
101128
|
+
}
|
|
101129
|
+
ctx.registry.touch(record);
|
|
101130
|
+
return {
|
|
101131
|
+
...structuredResult("ancestors", result),
|
|
101132
|
+
...pageOf(record.view)
|
|
101133
|
+
};
|
|
101134
|
+
}
|
|
101135
|
+
const MOD_ALT = 1;
|
|
101136
|
+
const MOD_CONTROL = 2;
|
|
101137
|
+
const MOD_META = 4;
|
|
101138
|
+
const MOD_SHIFT = 8;
|
|
101139
|
+
const MODIFIER_ORDER$1 = [
|
|
101140
|
+
["Control", MOD_CONTROL],
|
|
101141
|
+
["Alt", MOD_ALT],
|
|
101142
|
+
["Shift", MOD_SHIFT],
|
|
101143
|
+
["Meta", MOD_META]
|
|
101144
|
+
];
|
|
101145
|
+
const MODIFIER_NAMES = /* @__PURE__ */ new Map([
|
|
101146
|
+
["shift", "Shift"],
|
|
101147
|
+
["control", "Control"],
|
|
101148
|
+
["ctrl", "Control"],
|
|
101149
|
+
["alt", "Alt"],
|
|
101150
|
+
["meta", "Meta"],
|
|
101151
|
+
["cmd", "Meta"]
|
|
101152
|
+
]);
|
|
101153
|
+
const NAMED_KEYS$1 = new Map([
|
|
101154
|
+
[
|
|
101155
|
+
"Backspace",
|
|
101156
|
+
{ key: "Backspace", code: "Backspace", windowsVirtualKeyCode: 8 }
|
|
101157
|
+
],
|
|
101158
|
+
["Tab", { key: "Tab", code: "Tab", windowsVirtualKeyCode: 9 }],
|
|
101159
|
+
[
|
|
101160
|
+
"Enter",
|
|
101161
|
+
{
|
|
101162
|
+
key: "Enter",
|
|
101163
|
+
code: "Enter",
|
|
101164
|
+
windowsVirtualKeyCode: 13,
|
|
101165
|
+
text: "\r",
|
|
101166
|
+
unmodifiedText: "\r"
|
|
101167
|
+
}
|
|
101168
|
+
],
|
|
101169
|
+
["Escape", { key: "Escape", code: "Escape", windowsVirtualKeyCode: 27 }],
|
|
101170
|
+
[
|
|
101171
|
+
"Space",
|
|
101172
|
+
{
|
|
101173
|
+
key: " ",
|
|
101174
|
+
code: "Space",
|
|
101175
|
+
windowsVirtualKeyCode: 32,
|
|
101176
|
+
text: " ",
|
|
101177
|
+
unmodifiedText: " "
|
|
101178
|
+
}
|
|
101179
|
+
],
|
|
101180
|
+
["PageUp", { key: "PageUp", code: "PageUp", windowsVirtualKeyCode: 33 }],
|
|
101181
|
+
[
|
|
101182
|
+
"PageDown",
|
|
101183
|
+
{ key: "PageDown", code: "PageDown", windowsVirtualKeyCode: 34 }
|
|
101184
|
+
],
|
|
101185
|
+
["End", { key: "End", code: "End", windowsVirtualKeyCode: 35 }],
|
|
101186
|
+
["Home", { key: "Home", code: "Home", windowsVirtualKeyCode: 36 }],
|
|
101187
|
+
[
|
|
101188
|
+
"ArrowLeft",
|
|
101189
|
+
{ key: "ArrowLeft", code: "ArrowLeft", windowsVirtualKeyCode: 37 }
|
|
101190
|
+
],
|
|
101191
|
+
["ArrowUp", { key: "ArrowUp", code: "ArrowUp", windowsVirtualKeyCode: 38 }],
|
|
101192
|
+
[
|
|
101193
|
+
"ArrowRight",
|
|
101194
|
+
{ key: "ArrowRight", code: "ArrowRight", windowsVirtualKeyCode: 39 }
|
|
101195
|
+
],
|
|
101196
|
+
[
|
|
101197
|
+
"ArrowDown",
|
|
101198
|
+
{ key: "ArrowDown", code: "ArrowDown", windowsVirtualKeyCode: 40 }
|
|
101199
|
+
],
|
|
101200
|
+
["Delete", { key: "Delete", code: "Delete", windowsVirtualKeyCode: 46 }],
|
|
101201
|
+
...Array.from({ length: 12 }, (_, index) => {
|
|
101202
|
+
const name = `F${index + 1}`;
|
|
101203
|
+
return [
|
|
101204
|
+
name,
|
|
101205
|
+
{ key: name, code: name, windowsVirtualKeyCode: 112 + index }
|
|
101206
|
+
];
|
|
101207
|
+
})
|
|
101208
|
+
]);
|
|
101209
|
+
const PUNCTUATION = [
|
|
101210
|
+
["-_", "Minus", 189],
|
|
101211
|
+
["=+", "Equal", 187],
|
|
101212
|
+
["[{", "BracketLeft", 219],
|
|
101213
|
+
["]}", "BracketRight", 221],
|
|
101214
|
+
["\\|", "Backslash", 220],
|
|
101215
|
+
[";:", "Semicolon", 186],
|
|
101216
|
+
[`'"`, "Quote", 222],
|
|
101217
|
+
[",<", "Comma", 188],
|
|
101218
|
+
[".>", "Period", 190],
|
|
101219
|
+
["/?", "Slash", 191],
|
|
101220
|
+
["`~", "Backquote", 192]
|
|
101221
|
+
];
|
|
101222
|
+
const SHIFTED_DIGITS = ")!@#$%^&*(";
|
|
101223
|
+
const PRINTABLE_KEYS = (() => {
|
|
101224
|
+
const table = /* @__PURE__ */ new Map();
|
|
101225
|
+
const add = (char, code, windowsVirtualKeyCode, unmodifiedText = char) => {
|
|
101226
|
+
table.set(char, {
|
|
101227
|
+
key: char,
|
|
101228
|
+
code,
|
|
101229
|
+
windowsVirtualKeyCode,
|
|
101230
|
+
text: char,
|
|
101231
|
+
unmodifiedText
|
|
101232
|
+
});
|
|
101233
|
+
};
|
|
101234
|
+
for (let index = 0; index < 26; index += 1) {
|
|
101235
|
+
const lower = String.fromCharCode(97 + index);
|
|
101236
|
+
const code = `Key${lower.toUpperCase()}`;
|
|
101237
|
+
add(lower, code, 65 + index);
|
|
101238
|
+
add(lower.toUpperCase(), code, 65 + index, lower);
|
|
101239
|
+
}
|
|
101240
|
+
for (let digit = 0; digit <= 9; digit += 1) {
|
|
101241
|
+
add(String(digit), `Digit${digit}`, 48 + digit);
|
|
101242
|
+
add(SHIFTED_DIGITS[digit], `Digit${digit}`, 48 + digit, String(digit));
|
|
101243
|
+
}
|
|
101244
|
+
for (const [chars, code, virtualKey] of PUNCTUATION) {
|
|
101245
|
+
for (const char of chars) add(char, code, virtualKey, chars[0]);
|
|
101246
|
+
}
|
|
101247
|
+
return table;
|
|
101248
|
+
})();
|
|
101249
|
+
const LETTER = /^[A-Za-z]$/;
|
|
101250
|
+
const MAX_CHORD_LENGTH = 40;
|
|
101251
|
+
const MAX_ECHO = 24;
|
|
101252
|
+
function describeRefusedKey(key) {
|
|
101253
|
+
const text2 = String(key);
|
|
101254
|
+
return text2.length > MAX_ECHO ? `${text2.slice(0, MAX_ECHO)}...` : text2;
|
|
101255
|
+
}
|
|
101256
|
+
function parsePressChord(input) {
|
|
101257
|
+
if (typeof input !== "string" || input.length === 0) return null;
|
|
101258
|
+
if (input.length > MAX_CHORD_LENGTH) return null;
|
|
101259
|
+
let base;
|
|
101260
|
+
let modifierPart;
|
|
101261
|
+
if (input === "+") {
|
|
101262
|
+
base = "+";
|
|
101263
|
+
modifierPart = "";
|
|
101264
|
+
} else if (input.endsWith("++")) {
|
|
101265
|
+
base = "+";
|
|
101266
|
+
modifierPart = input.slice(0, -2);
|
|
101267
|
+
if (modifierPart === "") return null;
|
|
101268
|
+
} else {
|
|
101269
|
+
const cut = input.lastIndexOf("+");
|
|
101270
|
+
base = cut === -1 ? input : input.slice(cut + 1);
|
|
101271
|
+
modifierPart = cut === -1 ? "" : input.slice(0, cut);
|
|
101272
|
+
if (cut !== -1 && modifierPart === "") return null;
|
|
101273
|
+
}
|
|
101274
|
+
let modifiers = 0;
|
|
101275
|
+
const seen = /* @__PURE__ */ new Set();
|
|
101276
|
+
if (modifierPart !== "") {
|
|
101277
|
+
for (const raw of modifierPart.split("+")) {
|
|
101278
|
+
const name = MODIFIER_NAMES.get(raw.toLowerCase());
|
|
101279
|
+
if (!name || seen.has(name)) return null;
|
|
101280
|
+
seen.add(name);
|
|
101281
|
+
modifiers |= MODIFIER_ORDER$1.find(([n]) => n === name)?.[1] ?? 0;
|
|
101282
|
+
}
|
|
101283
|
+
}
|
|
101284
|
+
const shortcut = (modifiers & (MOD_CONTROL | MOD_META | MOD_ALT)) !== 0;
|
|
101285
|
+
const looked = LETTER.test(base) && (modifiers & MOD_SHIFT) !== 0 ? base.toUpperCase() : LETTER.test(base) && shortcut ? base.toLowerCase() : base;
|
|
101286
|
+
const descriptor = NAMED_KEYS$1.get(base) ?? PRINTABLE_KEYS.get(looked);
|
|
101287
|
+
if (!descriptor) return null;
|
|
101288
|
+
const canonicalModifiers = MODIFIER_ORDER$1.filter(
|
|
101289
|
+
([name]) => seen.has(name)
|
|
101290
|
+
).map(([name]) => name);
|
|
101291
|
+
const characterless = shortcut;
|
|
101292
|
+
return {
|
|
101293
|
+
canonical: [...canonicalModifiers, base].join("+"),
|
|
101294
|
+
key: descriptor.key,
|
|
101295
|
+
code: descriptor.code,
|
|
101296
|
+
windowsVirtualKeyCode: descriptor.windowsVirtualKeyCode,
|
|
101297
|
+
modifiers,
|
|
101298
|
+
...descriptor.text !== void 0 && !characterless ? {
|
|
101299
|
+
text: descriptor.text,
|
|
101300
|
+
unmodifiedText: descriptor.unmodifiedText ?? descriptor.text
|
|
101301
|
+
} : {}
|
|
101302
|
+
};
|
|
101303
|
+
}
|
|
100987
101304
|
const CLICK_FUNCTION = `function () {
|
|
100988
101305
|
const r = this.getBoundingClientRect();
|
|
100989
101306
|
const cx = r.left + r.width / 2, cy = r.top + r.height / 2;
|
|
@@ -101362,49 +101679,29 @@ async function click(ctx, params) {
|
|
|
101362
101679
|
...after
|
|
101363
101680
|
};
|
|
101364
101681
|
}
|
|
101365
|
-
const
|
|
101366
|
-
|
|
101367
|
-
|
|
101368
|
-
|
|
101369
|
-
|
|
101370
|
-
"Escape",
|
|
101371
|
-
{ key: "Escape", code: "Escape", virtualKeyCode: 27, modifiers: 0 }
|
|
101372
|
-
],
|
|
101373
|
-
[
|
|
101374
|
-
"ArrowUp",
|
|
101375
|
-
{ key: "ArrowUp", code: "ArrowUp", virtualKeyCode: 38, modifiers: 0 }
|
|
101376
|
-
],
|
|
101377
|
-
[
|
|
101378
|
-
"ArrowDown",
|
|
101379
|
-
{ key: "ArrowDown", code: "ArrowDown", virtualKeyCode: 40, modifiers: 0 }
|
|
101380
|
-
],
|
|
101381
|
-
[
|
|
101382
|
-
"ArrowLeft",
|
|
101383
|
-
{ key: "ArrowLeft", code: "ArrowLeft", virtualKeyCode: 37, modifiers: 0 }
|
|
101384
|
-
],
|
|
101385
|
-
[
|
|
101386
|
-
"ArrowRight",
|
|
101387
|
-
{ key: "ArrowRight", code: "ArrowRight", virtualKeyCode: 39, modifiers: 0 }
|
|
101388
|
-
]
|
|
101389
|
-
]);
|
|
101682
|
+
const FOCUS_FUNCTION = `function () {
|
|
101683
|
+
const focusFn = this.focus;
|
|
101684
|
+
if (typeof focusFn === 'function') focusFn.call(this, { preventScroll: true });
|
|
101685
|
+
return this.getRootNode().activeElement === this;
|
|
101686
|
+
}`;
|
|
101390
101687
|
async function press(ctx, params) {
|
|
101391
|
-
const
|
|
101392
|
-
if (!
|
|
101688
|
+
const chord = parsePressChord(params.key);
|
|
101689
|
+
if (!chord) {
|
|
101393
101690
|
throw new BridgeCommandError(
|
|
101394
101691
|
"unsupported_key",
|
|
101395
|
-
`unsupported key: ${
|
|
101692
|
+
`unsupported key: ${describeRefusedKey(params.key)}`,
|
|
101396
101693
|
{
|
|
101397
|
-
key: params.key ?? null
|
|
101694
|
+
key: typeof params.key === "string" ? describeRefusedKey(params.key) : params.key ?? null
|
|
101398
101695
|
}
|
|
101399
101696
|
);
|
|
101400
101697
|
}
|
|
101401
101698
|
const record = ctx.registry.requireSurface(params.tab);
|
|
101402
101699
|
const contents = record.view.webContents;
|
|
101403
101700
|
const event = {
|
|
101404
|
-
key:
|
|
101405
|
-
code:
|
|
101406
|
-
windowsVirtualKeyCode:
|
|
101407
|
-
modifiers:
|
|
101701
|
+
key: chord.key,
|
|
101702
|
+
code: chord.code,
|
|
101703
|
+
windowsVirtualKeyCode: chord.windowsVirtualKeyCode,
|
|
101704
|
+
modifiers: chord.modifiers
|
|
101408
101705
|
};
|
|
101409
101706
|
const before = pageOf(record.view).url;
|
|
101410
101707
|
let navigationSeen = false;
|
|
@@ -101413,12 +101710,43 @@ async function press(ctx, params) {
|
|
|
101413
101710
|
};
|
|
101414
101711
|
contents.on("did-start-navigation", onStart);
|
|
101415
101712
|
try {
|
|
101713
|
+
const target2 = stringParam(params, "ref") || stringParam(params, "selector");
|
|
101714
|
+
let node = null;
|
|
101715
|
+
if (target2) {
|
|
101716
|
+
node = await resolveNode(ctx, record, target2);
|
|
101717
|
+
if (node.sessionId) {
|
|
101718
|
+
throw new BridgeCommandError(
|
|
101719
|
+
"element_not_found",
|
|
101720
|
+
`${target2} is inside a cross-origin frame, which press cannot focus; click it, then press without a selector`
|
|
101721
|
+
);
|
|
101722
|
+
}
|
|
101723
|
+
const focus = await sendIn(
|
|
101724
|
+
ctx,
|
|
101725
|
+
contents,
|
|
101726
|
+
node.sessionId,
|
|
101727
|
+
"Runtime.callFunctionOn",
|
|
101728
|
+
{
|
|
101729
|
+
objectId: node.objectId,
|
|
101730
|
+
functionDeclaration: FOCUS_FUNCTION,
|
|
101731
|
+
returnByValue: true
|
|
101732
|
+
}
|
|
101733
|
+
);
|
|
101734
|
+
if (focus?.result?.value !== true) {
|
|
101735
|
+
throw new BridgeCommandError(
|
|
101736
|
+
"element_not_found",
|
|
101737
|
+
`${target2} cannot take focus (it is not focusable, e.g. a non-interactive element with no tabindex), so nothing was pressed`
|
|
101738
|
+
);
|
|
101739
|
+
}
|
|
101740
|
+
}
|
|
101416
101741
|
let keyDownFailed = true;
|
|
101417
101742
|
try {
|
|
101418
101743
|
await ctx.cdp.send(contents, "Input.dispatchKeyEvent", {
|
|
101419
101744
|
...event,
|
|
101420
101745
|
type: "keyDown",
|
|
101421
|
-
|
|
101746
|
+
// Only a character press with no Control/Meta/Alt held carries text (the
|
|
101747
|
+
// chord parser decides); a shortcut with `text` would also fire
|
|
101748
|
+
// `keypress` and type into an editable.
|
|
101749
|
+
...chord.text !== void 0 ? { text: chord.text, unmodifiedText: chord.unmodifiedText } : {}
|
|
101422
101750
|
});
|
|
101423
101751
|
keyDownFailed = false;
|
|
101424
101752
|
} finally {
|
|
@@ -101435,14 +101763,113 @@ async function press(ctx, params) {
|
|
|
101435
101763
|
ctx.registry.touch(record);
|
|
101436
101764
|
const after = pageOf(record.view);
|
|
101437
101765
|
return {
|
|
101438
|
-
key:
|
|
101766
|
+
key: chord.canonical,
|
|
101439
101767
|
navigated: navigationSeen || after.url !== before,
|
|
101768
|
+
...node ? { ...frameFields(node), ...resolvedFields(node) } : {},
|
|
101440
101769
|
...after
|
|
101441
101770
|
};
|
|
101442
101771
|
} finally {
|
|
101443
101772
|
contents.removeListener("did-start-navigation", onStart);
|
|
101444
101773
|
}
|
|
101445
101774
|
}
|
|
101775
|
+
const CENTER_FUNCTION = `function () {
|
|
101776
|
+
const r = this.getBoundingClientRect();
|
|
101777
|
+
if (!(r.width > 0 && r.height > 0)) return null;
|
|
101778
|
+
return { x: r.left + r.width / 2, y: r.top + r.height / 2 };
|
|
101779
|
+
}`;
|
|
101780
|
+
function hoveredAt(x, y) {
|
|
101781
|
+
return `(() => { const el = document.elementFromPoint(${x}, ${y}); return !!el && el.matches(':hover'); })()`;
|
|
101782
|
+
}
|
|
101783
|
+
const HOVER_SETTLE_MS = 150;
|
|
101784
|
+
async function hover(ctx, params) {
|
|
101785
|
+
const target2 = stringParam(params, "ref") || stringParam(params, "selector");
|
|
101786
|
+
const px = numberParam(params, "x");
|
|
101787
|
+
const py = numberParam(params, "y");
|
|
101788
|
+
const refuse = (message, param) => {
|
|
101789
|
+
throw new BridgeCommandError("internal", message, {
|
|
101790
|
+
reason: "invalid_arguments",
|
|
101791
|
+
param
|
|
101792
|
+
});
|
|
101793
|
+
};
|
|
101794
|
+
if (target2 && (params.x !== void 0 || params.y !== void 0)) {
|
|
101795
|
+
refuse(
|
|
101796
|
+
"hover takes a selector OR x and y, not both; nothing was moved",
|
|
101797
|
+
"selector"
|
|
101798
|
+
);
|
|
101799
|
+
}
|
|
101800
|
+
if (!target2 && (px === void 0 || py === void 0)) {
|
|
101801
|
+
refuse(
|
|
101802
|
+
"hover needs a selector, or both numeric x and y (viewport pixels); nothing was moved",
|
|
101803
|
+
params.x === void 0 && params.y === void 0 ? "selector" : "x,y"
|
|
101804
|
+
);
|
|
101805
|
+
}
|
|
101806
|
+
const record = ctx.registry.requireSurface(params.tab);
|
|
101807
|
+
const contents = record.view.webContents;
|
|
101808
|
+
let x = px;
|
|
101809
|
+
let y = py;
|
|
101810
|
+
let node = null;
|
|
101811
|
+
if (target2) {
|
|
101812
|
+
node = await resolveNode(ctx, record, target2);
|
|
101813
|
+
if (node.frame) {
|
|
101814
|
+
throw new BridgeCommandError(
|
|
101815
|
+
"element_not_found",
|
|
101816
|
+
`${target2} is inside a frame; hover it by position with x and y (take them from hit_test)`
|
|
101817
|
+
);
|
|
101818
|
+
}
|
|
101819
|
+
const centre = await sendIn(
|
|
101820
|
+
ctx,
|
|
101821
|
+
contents,
|
|
101822
|
+
node.sessionId,
|
|
101823
|
+
"Runtime.callFunctionOn",
|
|
101824
|
+
{
|
|
101825
|
+
objectId: node.objectId,
|
|
101826
|
+
functionDeclaration: CENTER_FUNCTION,
|
|
101827
|
+
returnByValue: true
|
|
101828
|
+
}
|
|
101829
|
+
);
|
|
101830
|
+
const point = centre?.result?.value;
|
|
101831
|
+
if (!point || typeof point.x !== "number" || typeof point.y !== "number") {
|
|
101832
|
+
throw new BridgeCommandError(
|
|
101833
|
+
"element_not_found",
|
|
101834
|
+
`${target2} has no box to point at (display:none, detached or zero-sized), so the pointer was not moved`
|
|
101835
|
+
);
|
|
101836
|
+
}
|
|
101837
|
+
x = Math.round(point.x * 100) / 100;
|
|
101838
|
+
y = Math.round(point.y * 100) / 100;
|
|
101839
|
+
}
|
|
101840
|
+
await ctx.cdp.send(contents, "Input.dispatchMouseEvent", {
|
|
101841
|
+
type: "mouseMoved",
|
|
101842
|
+
x,
|
|
101843
|
+
y,
|
|
101844
|
+
button: "none",
|
|
101845
|
+
buttons: 0,
|
|
101846
|
+
pointerType: "mouse"
|
|
101847
|
+
});
|
|
101848
|
+
await sleep(HOVER_SETTLE_MS);
|
|
101849
|
+
const stack = await hitAt(record, x, y);
|
|
101850
|
+
if (stack === null || stack === void 0) {
|
|
101851
|
+
throw new BridgeCommandError(
|
|
101852
|
+
"element_not_found",
|
|
101853
|
+
`no element at point (${x}, ${y}); the pointer was moved there but nothing is under it`
|
|
101854
|
+
);
|
|
101855
|
+
}
|
|
101856
|
+
const hovered = await sendIn(
|
|
101857
|
+
ctx,
|
|
101858
|
+
contents,
|
|
101859
|
+
void 0,
|
|
101860
|
+
"Runtime.evaluate",
|
|
101861
|
+
{ expression: hoveredAt(x, y), returnByValue: true }
|
|
101862
|
+
);
|
|
101863
|
+
ctx.registry.touch(record);
|
|
101864
|
+
return {
|
|
101865
|
+
x,
|
|
101866
|
+
y,
|
|
101867
|
+
hit: stack,
|
|
101868
|
+
hovered: hovered?.result?.value === true,
|
|
101869
|
+
...node ? { ...frameFields(node), ...resolvedFields(node) } : {},
|
|
101870
|
+
...pageOf(record.view)
|
|
101871
|
+
};
|
|
101872
|
+
}
|
|
101446
101873
|
async function type(ctx, params) {
|
|
101447
101874
|
const record = ctx.registry.requireSurface(params.tab);
|
|
101448
101875
|
const contents = record.view.webContents;
|
|
@@ -101615,136 +102042,6 @@ function clampTimeout(requested) {
|
|
|
101615
102042
|
if (!Number.isFinite(wanted) || wanted <= 0) return CAPS.downloadTimeoutS;
|
|
101616
102043
|
return Math.min(wanted, CAPS.downloadTimeoutMaxS);
|
|
101617
102044
|
}
|
|
101618
|
-
const READ_STYLES_SOURCE = '(selector, properties) => {\n const DEFAULTS = [\n "display",\n "position",\n "visibility",\n "opacity",\n "z-index",\n "transform",\n "transform-origin",\n "top",\n "right",\n "bottom",\n "left",\n "width",\n "height",\n "contain",\n "filter",\n "will-change",\n "overflow",\n "overflow-x",\n "overflow-y",\n "pointer-events"\n ];\n const MAX_MATCHES = 5;\n const MAX_STYLES = 30;\n const MAX_INLINE = 30;\n const MAX_IDENTITY = 120;\n const MAX_VALUE = 200;\n const all = document.querySelectorAll(selector);\n if (!all || all.length === 0) return null;\n const names = DEFAULTS.slice();\n if (Array.isArray(properties)) {\n for (let i = 0; i < properties.length && names.length < MAX_STYLES; i++) {\n const name = String(properties[i] ?? "").trim();\n if (name && names.indexOf(name) === -1) names.push(name);\n }\n }\n const round2 = (value) => {\n const rounded = Math.round(value * 100) / 100;\n return rounded === 0 ? 0 : rounded;\n };\n const clip = (value, limit) => value.length > limit ? value.slice(0, limit - 1) + "\\u2026" : value;\n const rectOf = (el) => {\n const r = el.getBoundingClientRect();\n return {\n x: round2(r.x),\n y: round2(r.y),\n top: round2(r.top),\n right: round2(r.right),\n bottom: round2(r.bottom),\n width: round2(r.width),\n height: round2(r.height)\n };\n };\n const attrOf = (el, name) => clip(el.getAttribute(name) || "", MAX_IDENTITY);\n const matches = [];\n const first = Array.from(all).slice(0, MAX_MATCHES);\n for (const el of first) {\n const computed = getComputedStyle(el);\n const styles = {};\n for (const name of names) {\n styles[name] = clip(String(computed.getPropertyValue(name) || "").trim(), MAX_VALUE);\n }\n const inline = {};\n const declaration = el.style;\n let inlineCount = 0;\n for (let j = 0; j < declaration.length && inlineCount < MAX_INLINE; j++) {\n const name = declaration.item(j);\n if (name && name.indexOf("--") === 0) {\n const key = clip(name, MAX_IDENTITY);\n if (!(key in inline)) {\n inline[key] = clip(\n String(declaration.getPropertyValue(name) || "").trim(),\n MAX_VALUE\n );\n inlineCount += 1;\n }\n }\n }\n matches.push({\n tag: clip(el.tagName.toLowerCase(), MAX_IDENTITY),\n id: attrOf(el, "id"),\n role: attrOf(el, "role"),\n className: attrOf(el, "class"),\n rect: rectOf(el),\n styles,\n inline\n });\n }\n return { count: matches.length, matches, truncated: all.length > matches.length };\n}';
|
|
101619
|
-
const HIT_TEST_SOURCE = '(x, y) => {\n const PROPS = ["display", "position", "visibility", "opacity", "z-index", "pointer-events"];\n const MAX_ELEMENTS = 8;\n const MAX_IDENTITY = 120;\n const MAX_VALUE = 200;\n const px = Number(x);\n const py = Number(y);\n if (!Number.isFinite(px) || !Number.isFinite(py)) return null;\n const stack = document.elementsFromPoint(px, py);\n if (!stack || stack.length === 0) return null;\n const round2 = (value) => {\n const rounded = Math.round(value * 100) / 100;\n return rounded === 0 ? 0 : rounded;\n };\n const clip = (value, limit) => value.length > limit ? value.slice(0, limit - 1) + "\\u2026" : value;\n const attrOf = (el, name) => clip(el.getAttribute(name) || "", MAX_IDENTITY);\n const elements = [];\n for (const el of stack.slice(0, MAX_ELEMENTS)) {\n const computed = getComputedStyle(el);\n const styles = {};\n for (const name of PROPS) {\n styles[name] = clip(String(computed.getPropertyValue(name) || "").trim(), MAX_VALUE);\n }\n const r = el.getBoundingClientRect();\n elements.push({\n tag: clip(el.tagName.toLowerCase(), MAX_IDENTITY),\n id: attrOf(el, "id"),\n role: attrOf(el, "role"),\n className: attrOf(el, "class"),\n rect: {\n x: round2(r.x),\n y: round2(r.y),\n top: round2(r.top),\n right: round2(r.right),\n bottom: round2(r.bottom),\n width: round2(r.width),\n height: round2(r.height)\n },\n styles\n });\n }\n return { count: elements.length, elements };\n}';
|
|
101620
|
-
const ANCESTORS_SOURCE = '(selector, depth) => {\n const PROPS = [\n "display",\n "position",\n "visibility",\n "overflow",\n "overflow-x",\n "overflow-y",\n "transform",\n "transform-origin",\n "contain",\n "filter",\n "will-change",\n "z-index",\n "isolation",\n "top",\n "left"\n ];\n const DEFAULT_DEPTH = 12;\n const MAX_DEPTH = 16;\n const MAX_IDENTITY = 120;\n const MAX_VALUE = 200;\n const el = document.querySelector(selector);\n if (!el) return null;\n const wanted = typeof depth === "number" && Number.isFinite(depth) ? Math.floor(depth) : DEFAULT_DEPTH;\n const bound = Math.max(1, Math.min(MAX_DEPTH, wanted));\n const round2 = (value) => {\n const rounded = Math.round(value * 100) / 100;\n return rounded === 0 ? 0 : rounded;\n };\n const clip = (value, limit) => value.length > limit ? value.slice(0, limit - 1) + "\\u2026" : value;\n const attrOf = (el2, name) => clip(el2.getAttribute(name) || "", MAX_IDENTITY);\n const chain = [];\n let node = el;\n while (node && chain.length < bound) {\n const computed = getComputedStyle(node);\n const styles = {};\n for (const name of PROPS) {\n styles[name] = clip(String(computed.getPropertyValue(name) || "").trim(), MAX_VALUE);\n }\n const r = node.getBoundingClientRect();\n chain.push({\n tag: clip(node.tagName.toLowerCase(), MAX_IDENTITY),\n id: attrOf(node, "id"),\n role: attrOf(node, "role"),\n className: attrOf(node, "class"),\n rect: {\n x: round2(r.x),\n y: round2(r.y),\n top: round2(r.top),\n right: round2(r.right),\n bottom: round2(r.bottom),\n width: round2(r.width),\n height: round2(r.height)\n },\n styles\n });\n if (node === document.documentElement) break;\n node = node.parentElement;\n }\n return { count: chain.length, chain };\n}';
|
|
101621
|
-
const QUERY_SOURCE = '(selector, limit) => {\n const MAX_ELEMENTS = 50;\n const MAX_IDENTITY = 120;\n const MAX_TEXT = 120;\n const MAX_VALUE = 120;\n if (typeof selector !== "string" || !selector.trim()) return null;\n const wanted = typeof limit === "number" && Number.isFinite(limit) ? Math.floor(limit) : 20;\n const bound = Math.max(1, Math.min(MAX_ELEMENTS, wanted));\n const round2 = (value) => {\n const rounded = Math.round(value * 100) / 100;\n return rounded === 0 ? 0 : rounded;\n };\n const clip = (value, cap) => value.length > cap ? `${value.slice(0, cap - 1)}\\u2026` : value;\n const attrOf = (el, name) => clip(String(el.getAttribute(name) || ""), MAX_IDENTITY);\n const visibleOf = (el, rect) => {\n if (rect.width <= 0 || rect.height <= 0) return false;\n const computed = getComputedStyle(el);\n if (computed.display === "none" || computed.visibility === "hidden") return false;\n return computed.contentVisibility !== "hidden";\n };\n let nodes;\n try {\n nodes = Array.from(document.querySelectorAll(selector));\n } catch {\n return { count: 0, truncated: false, matches: [], error: "invalid_selector" };\n }\n const viewport = {\n width: document.documentElement.clientWidth || window.innerWidth || 0,\n height: document.documentElement.clientHeight || window.innerHeight || 0\n };\n const matches = [];\n for (const el of nodes.slice(0, bound)) {\n const rect = el.getBoundingClientRect();\n const tag = clip(String(el.tagName || "").toLowerCase(), MAX_IDENTITY);\n const type = attrOf(el, "type").toLowerCase();\n const isPassword = tag === "input" && type === "password";\n const rawValue = el.value;\n const checkable = tag === "input" && (type === "checkbox" || type === "radio");\n const checked = checkable ? Boolean(el.checked) : null;\n matches.push({\n tag,\n id: attrOf(el, "id"),\n name: attrOf(el, "name"),\n role: attrOf(el, "role"),\n ariaLabel: attrOf(el, "aria-label"),\n // `innerText` is the RENDERED text (a hidden node reports ""), which is\n // what an agent reading a page means by "the text"; `textContent` would\n // report text nobody can see, including inside a collapsed section.\n text: clip(String(el.innerText || "").replace(/\\s+/g, " ").trim(), MAX_TEXT),\n type,\n visible: visibleOf(el, rect),\n inView: rect.top < viewport.height && rect.bottom > 0 && rect.left < viewport.width && rect.right > 0,\n disabled: el.hasAttribute("disabled") || el.disabled === true,\n checked,\n value: isPassword || rawValue === void 0 || rawValue === null ? "" : clip(String(rawValue), MAX_VALUE),\n rect: {\n x: round2(rect.x),\n y: round2(rect.y),\n width: round2(rect.width),\n height: round2(rect.height)\n }\n });\n }\n return { count: nodes.length, truncated: nodes.length > matches.length, matches };\n}';
|
|
101622
|
-
const MAX_REQUESTED_PROPERTIES = 20;
|
|
101623
|
-
const DEFAULT_DEPTH = 12;
|
|
101624
|
-
const MAX_DEPTH = 16;
|
|
101625
|
-
async function runFixed(record, source, args, label) {
|
|
101626
|
-
const code = `(${source})(${args.map((arg) => JSON.stringify(arg)).join(", ")})`;
|
|
101627
|
-
return await deadline(
|
|
101628
|
-
record.view.webContents.executeJavaScriptInIsolatedWorld(
|
|
101629
|
-
ISOLATED_WORLD_ID,
|
|
101630
|
-
[{ code }]
|
|
101631
|
-
),
|
|
101632
|
-
SCRIPTING_DEADLINE_MS,
|
|
101633
|
-
label
|
|
101634
|
-
);
|
|
101635
|
-
}
|
|
101636
|
-
function selectorError(selector, error) {
|
|
101637
|
-
if (error instanceof Error && INVALID_SELECTOR.test(error.message)) {
|
|
101638
|
-
return new BridgeCommandError(
|
|
101639
|
-
"element_not_found",
|
|
101640
|
-
`selector ${selector} is not valid`
|
|
101641
|
-
);
|
|
101642
|
-
}
|
|
101643
|
-
return error;
|
|
101644
|
-
}
|
|
101645
|
-
function structuredResult(name, result) {
|
|
101646
|
-
if (typeof result !== "object" || result === null) {
|
|
101647
|
-
throw new BridgeCommandError(
|
|
101648
|
-
"internal",
|
|
101649
|
-
`the page returned no structured ${name} result`
|
|
101650
|
-
);
|
|
101651
|
-
}
|
|
101652
|
-
return result;
|
|
101653
|
-
}
|
|
101654
|
-
function requiredSelector(params) {
|
|
101655
|
-
const selector = stringParam(params, "selector");
|
|
101656
|
-
if (!selector) {
|
|
101657
|
-
throw new BridgeCommandError("element_not_found", "selector is required");
|
|
101658
|
-
}
|
|
101659
|
-
return selector;
|
|
101660
|
-
}
|
|
101661
|
-
function requestedProperties(params) {
|
|
101662
|
-
if (!Array.isArray(params.properties)) return [];
|
|
101663
|
-
return params.properties.filter((entry) => typeof entry === "string").slice(0, MAX_REQUESTED_PROPERTIES);
|
|
101664
|
-
}
|
|
101665
|
-
async function styles(ctx, params) {
|
|
101666
|
-
const record = ctx.registry.requireSurface(params.tab);
|
|
101667
|
-
const selector = requiredSelector(params);
|
|
101668
|
-
const properties = requestedProperties(params);
|
|
101669
|
-
let result;
|
|
101670
|
-
try {
|
|
101671
|
-
result = await runFixed(
|
|
101672
|
-
record,
|
|
101673
|
-
READ_STYLES_SOURCE,
|
|
101674
|
-
[selector, properties],
|
|
101675
|
-
`styles(${selector})`
|
|
101676
|
-
);
|
|
101677
|
-
} catch (error) {
|
|
101678
|
-
throw selectorError(selector, error);
|
|
101679
|
-
}
|
|
101680
|
-
if (result === null || result === void 0) {
|
|
101681
|
-
throw new BridgeCommandError(
|
|
101682
|
-
"element_not_found",
|
|
101683
|
-
`selector ${selector} matched nothing`
|
|
101684
|
-
);
|
|
101685
|
-
}
|
|
101686
|
-
ctx.registry.touch(record);
|
|
101687
|
-
return { ...structuredResult("styles", result), ...pageOf(record.view) };
|
|
101688
|
-
}
|
|
101689
|
-
async function hitTest(ctx, params) {
|
|
101690
|
-
const record = ctx.registry.requireSurface(params.tab);
|
|
101691
|
-
const x = numberParam(params, "x");
|
|
101692
|
-
const y = numberParam(params, "y");
|
|
101693
|
-
if (x === void 0 || y === void 0) {
|
|
101694
|
-
throw new BridgeCommandError(
|
|
101695
|
-
"internal",
|
|
101696
|
-
"'hit_test' needs numeric x and y (viewport coordinates)"
|
|
101697
|
-
);
|
|
101698
|
-
}
|
|
101699
|
-
const result = await runFixed(
|
|
101700
|
-
record,
|
|
101701
|
-
HIT_TEST_SOURCE,
|
|
101702
|
-
[x, y],
|
|
101703
|
-
`hit_test(${x}, ${y})`
|
|
101704
|
-
);
|
|
101705
|
-
if (result === null || result === void 0) {
|
|
101706
|
-
throw new BridgeCommandError(
|
|
101707
|
-
"element_not_found",
|
|
101708
|
-
`no element at point (${x}, ${y})`
|
|
101709
|
-
);
|
|
101710
|
-
}
|
|
101711
|
-
ctx.registry.touch(record);
|
|
101712
|
-
return {
|
|
101713
|
-
...structuredResult("hit_test", result),
|
|
101714
|
-
...pageOf(record.view)
|
|
101715
|
-
};
|
|
101716
|
-
}
|
|
101717
|
-
async function ancestors(ctx, params) {
|
|
101718
|
-
const record = ctx.registry.requireSurface(params.tab);
|
|
101719
|
-
const selector = requiredSelector(params);
|
|
101720
|
-
const raw = numberParam(params, "depth");
|
|
101721
|
-
const depth = Math.max(
|
|
101722
|
-
1,
|
|
101723
|
-
Math.min(MAX_DEPTH, raw === void 0 ? DEFAULT_DEPTH : Math.floor(raw))
|
|
101724
|
-
);
|
|
101725
|
-
let result;
|
|
101726
|
-
try {
|
|
101727
|
-
result = await runFixed(
|
|
101728
|
-
record,
|
|
101729
|
-
ANCESTORS_SOURCE,
|
|
101730
|
-
[selector, depth],
|
|
101731
|
-
`ancestors(${selector})`
|
|
101732
|
-
);
|
|
101733
|
-
} catch (error) {
|
|
101734
|
-
throw selectorError(selector, error);
|
|
101735
|
-
}
|
|
101736
|
-
if (result === null || result === void 0) {
|
|
101737
|
-
throw new BridgeCommandError(
|
|
101738
|
-
"element_not_found",
|
|
101739
|
-
`selector ${selector} matched nothing`
|
|
101740
|
-
);
|
|
101741
|
-
}
|
|
101742
|
-
ctx.registry.touch(record);
|
|
101743
|
-
return {
|
|
101744
|
-
...structuredResult("ancestors", result),
|
|
101745
|
-
...pageOf(record.view)
|
|
101746
|
-
};
|
|
101747
|
-
}
|
|
101748
102045
|
const DEFAULT_LIMIT = 20;
|
|
101749
102046
|
const MAX_LIMIT = 50;
|
|
101750
102047
|
async function query(ctx, params) {
|
|
@@ -103645,6 +103942,9 @@ const DOCUMENT_SCOPED = /* @__PURE__ */ new Set([
|
|
|
103645
103942
|
"click",
|
|
103646
103943
|
"type",
|
|
103647
103944
|
"press",
|
|
103945
|
+
// `hover` dispatches page events at the CURRENT document and reports its hit
|
|
103946
|
+
// stack, so it is authorized on entry and on the result exactly like `click`.
|
|
103947
|
+
"hover",
|
|
103648
103948
|
"scroll",
|
|
103649
103949
|
"logs",
|
|
103650
103950
|
// `download` names a control on the CURRENT document (the link or button that
|
|
@@ -103669,6 +103969,15 @@ const NAVIGATING_ACTIONS = /* @__PURE__ */ new Set([
|
|
|
103669
103969
|
"click",
|
|
103670
103970
|
"type",
|
|
103671
103971
|
"press",
|
|
103972
|
+
// `hover` cannot navigate by ITSELF, but the page's own `mouseenter`/`mouseover`
|
|
103973
|
+
// handler can (menus and router links do exactly that), and measured against the
|
|
103974
|
+
// built app (scripts/browser-hover-press-proof.mjs, `/navhover`) a hover whose
|
|
103975
|
+
// handler sent the tab to an unapproved origin was refused with `origin_not_allowed`
|
|
103976
|
+
// while the tab STAYED on the unapproved page. Membership here is what restores it
|
|
103977
|
+
// to the entry document (and adopts an approved landing instead of reporting
|
|
103978
|
+
// `changed`). It is deliberately NOT in NAVIGATION_ACTIONS: no per-hop `Fetch`
|
|
103979
|
+
// gate, for the reason that set's comment gives.
|
|
103980
|
+
"hover",
|
|
103672
103981
|
"download",
|
|
103673
103982
|
"upload"
|
|
103674
103983
|
]);
|
|
@@ -103689,6 +103998,7 @@ const TAB_SCOPED = /* @__PURE__ */ new Set([
|
|
|
103689
103998
|
"click",
|
|
103690
103999
|
"type",
|
|
103691
104000
|
"press",
|
|
104001
|
+
"hover",
|
|
103692
104002
|
"scroll",
|
|
103693
104003
|
"logs",
|
|
103694
104004
|
"close",
|
|
@@ -103877,7 +104187,13 @@ class BrowserHost {
|
|
|
103877
104187
|
assertDocument();
|
|
103878
104188
|
const operation = async () => {
|
|
103879
104189
|
assertDocument();
|
|
103880
|
-
|
|
104190
|
+
let result;
|
|
104191
|
+
try {
|
|
104192
|
+
result = await this.perform(method, params, requestId2);
|
|
104193
|
+
} catch (error) {
|
|
104194
|
+
if (NAVIGATING_ACTIONS.has(method)) assertDocument();
|
|
104195
|
+
throw error;
|
|
104196
|
+
}
|
|
103881
104197
|
try {
|
|
103882
104198
|
assertDocument();
|
|
103883
104199
|
} catch (error) {
|
|
@@ -103959,6 +104275,8 @@ class BrowserHost {
|
|
|
103959
104275
|
return type(this, params);
|
|
103960
104276
|
case "press":
|
|
103961
104277
|
return press(this, params);
|
|
104278
|
+
case "hover":
|
|
104279
|
+
return hover(this, params);
|
|
103962
104280
|
case "download":
|
|
103963
104281
|
return download(this, params);
|
|
103964
104282
|
case "upload":
|