brave-real-playwright-core 1.56.1 → 1.57.0-patch.2
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/README.md +5 -5
- package/advanced-stealth.js +46 -59
- package/lib/cli/program.js +14 -57
- package/lib/client/api.js +0 -3
- package/lib/client/browserContext.js +22 -4
- package/lib/client/consoleMessage.js +5 -1
- package/lib/client/electron.js +1 -1
- package/lib/client/events.js +2 -1
- package/lib/client/locator.js +4 -1
- package/lib/client/page.js +2 -5
- package/lib/client/playwright.js +1 -5
- package/lib/client/tracing.js +6 -4
- package/lib/client/worker.js +22 -0
- package/lib/generated/clockSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +1 -1
- package/lib/inProcessFactory.js +0 -2
- package/lib/protocol/validator.js +24 -46
- package/lib/server/android/android.js +1 -1
- package/lib/server/bidi/bidiBrowser.js +26 -11
- package/lib/server/bidi/bidiChromium.js +1 -1
- package/lib/server/bidi/bidiFirefox.js +1 -1
- package/lib/server/bidi/bidiPage.js +25 -5
- package/lib/server/browserContext.js +9 -10
- package/lib/server/chromium/chromium.js +12 -1
- package/lib/server/chromium/chromiumSwitches.js +11 -2
- package/lib/server/chromium/crBrowser.js +8 -0
- package/lib/server/chromium/crPage.js +7 -7
- package/lib/server/chromium/crServiceWorker.js +16 -5
- package/lib/server/chromium/videoRecorder.js +14 -12
- package/lib/server/console.js +5 -1
- package/lib/server/deviceDescriptorsSource.json +56 -56
- package/lib/server/dispatchers/browserContextDispatcher.js +23 -6
- package/lib/server/dispatchers/pageDispatcher.js +10 -22
- package/lib/server/dispatchers/playwrightDispatcher.js +0 -4
- package/lib/server/electron/electron.js +1 -1
- package/lib/server/firefox/ffPage.js +3 -6
- package/lib/server/firefox/firefox.js +12 -1
- package/lib/server/frameSelectors.js +2 -4
- package/lib/server/frames.js +10 -3
- package/lib/server/input.js +7 -3
- package/lib/server/localUtils.js +4 -8
- package/lib/server/page.js +54 -40
- package/lib/server/playwright.js +2 -4
- package/lib/server/recorder/recorderApp.js +1 -1
- package/lib/server/recorder.js +3 -2
- package/lib/server/registry/index.js +113 -47
- package/lib/server/registry/oopDownloadBrowserMain.js +6 -2
- package/lib/server/socksClientCertificatesInterceptor.js +1 -1
- package/lib/server/trace/recorder/tracing.js +2 -0
- package/lib/server/trace/viewer/traceViewer.js +37 -36
- package/lib/server/utils/comparators.js +3 -25
- package/lib/server/utils/hostPlatform.js +15 -3
- package/lib/server/utils/imageUtils.js +141 -0
- package/lib/server/utils/network.js +22 -16
- package/lib/server/webkit/webkit.js +1 -10
- package/lib/server/webkit/wkPage.js +1 -5
- package/lib/server/webkit/wkWorkers.js +2 -1
- package/lib/utils/isomorphic/ariaSnapshot.js +5 -0
- package/lib/utils/isomorphic/locatorGenerators.js +24 -8
- package/lib/utils/isomorphic/mimeType.js +1 -1
- package/lib/utils/isomorphic/protocolFormatter.js +3 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +2 -1
- package/lib/utils/isomorphic/urlMatch.js +19 -5
- package/lib/utils.js +2 -0
- package/lib/utilsBundle.js +6 -3
- package/lib/utilsBundleImpl/index.js +171 -171
- package/lib/vite/htmlReport/index.html +18 -18
- package/lib/vite/recorder/assets/codeMirrorModule-BoWUGj0J.js +25 -0
- package/lib/vite/recorder/assets/{index-Y-X2TGJv.js → index-DJqDAOZp.js} +32 -32
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-Bucv2d7q.js +25 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-BEpdCv1S.js +266 -0
- package/lib/vite/traceViewer/defaultSettingsView.ConWv5KN.css +1 -0
- package/lib/vite/traceViewer/index.BxQ34UMZ.js +2 -0
- package/lib/vite/traceViewer/index.C4Y3Aw8n.css +1 -0
- package/lib/vite/traceViewer/index.html +6 -6
- package/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/lib/vite/traceViewer/snapshot.html +3 -3
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/{uiMode.DRQ310U5.js → uiMode.BWTwXl41.js} +3 -3
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/package.json +9 -9
- package/stealth-injection.js +45 -58
- package/lib/client/accessibility.js +0 -49
- package/lib/server/accessibility.js +0 -69
- package/lib/server/chromium/crAccessibility.js +0 -263
- package/lib/server/firefox/ffAccessibility.js +0 -238
- package/lib/server/webkit/wkAccessibility.js +0 -237
- package/lib/server/webkit/wsl/webkit-wsl-transport-client.js +0 -74
- package/lib/server/webkit/wsl/webkit-wsl-transport-server.js +0 -113
- package/lib/vite/recorder/assets/codeMirrorModule-RJCXzfmE.js +0 -24
- package/lib/vite/traceViewer/assets/codeMirrorModule-eyVcHN77.js +0 -24
- package/lib/vite/traceViewer/assets/defaultSettingsView-w0zYjHsW.js +0 -265
- package/lib/vite/traceViewer/defaultSettingsView.TQ8_7ybu.css +0 -1
- package/lib/vite/traceViewer/index.Bx16ehp1.js +0 -2
- package/lib/vite/traceViewer/index.I8N9v4jT.css +0 -1
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var crAccessibility_exports = {};
|
|
20
|
-
__export(crAccessibility_exports, {
|
|
21
|
-
getAccessibilityTree: () => getAccessibilityTree
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(crAccessibility_exports);
|
|
24
|
-
async function getAccessibilityTree(client, needle) {
|
|
25
|
-
const { nodes } = await client.send("Accessibility.getFullAXTree");
|
|
26
|
-
const tree = CRAXNode.createTree(client, nodes);
|
|
27
|
-
return {
|
|
28
|
-
tree,
|
|
29
|
-
needle: needle ? await tree._findElement(needle) : null
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
class CRAXNode {
|
|
33
|
-
constructor(client, payload) {
|
|
34
|
-
this._children = [];
|
|
35
|
-
this._richlyEditable = false;
|
|
36
|
-
this._editable = false;
|
|
37
|
-
this._focusable = false;
|
|
38
|
-
this._expanded = false;
|
|
39
|
-
this._hidden = false;
|
|
40
|
-
this._client = client;
|
|
41
|
-
this._payload = payload;
|
|
42
|
-
this._name = this._payload.name ? this._payload.name.value : "";
|
|
43
|
-
this._role = this._payload.role ? this._payload.role.value : "Unknown";
|
|
44
|
-
for (const property of this._payload.properties || []) {
|
|
45
|
-
if (property.name === "editable") {
|
|
46
|
-
this._richlyEditable = property.value.value === "richtext";
|
|
47
|
-
this._editable = true;
|
|
48
|
-
}
|
|
49
|
-
if (property.name === "focusable")
|
|
50
|
-
this._focusable = property.value.value;
|
|
51
|
-
if (property.name === "expanded")
|
|
52
|
-
this._expanded = property.value.value;
|
|
53
|
-
if (property.name === "hidden")
|
|
54
|
-
this._hidden = property.value.value;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
_isPlainTextField() {
|
|
58
|
-
if (this._richlyEditable)
|
|
59
|
-
return false;
|
|
60
|
-
if (this._editable)
|
|
61
|
-
return true;
|
|
62
|
-
return this._role === "textbox" || this._role === "ComboBox" || this._role === "searchbox";
|
|
63
|
-
}
|
|
64
|
-
_isTextOnlyObject() {
|
|
65
|
-
const role = this._role;
|
|
66
|
-
return role === "LineBreak" || role === "text" || role === "InlineTextBox" || role === "StaticText";
|
|
67
|
-
}
|
|
68
|
-
_hasFocusableChild() {
|
|
69
|
-
if (this._cachedHasFocusableChild === void 0) {
|
|
70
|
-
this._cachedHasFocusableChild = false;
|
|
71
|
-
for (const child of this._children) {
|
|
72
|
-
if (child._focusable || child._hasFocusableChild()) {
|
|
73
|
-
this._cachedHasFocusableChild = true;
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return this._cachedHasFocusableChild;
|
|
79
|
-
}
|
|
80
|
-
children() {
|
|
81
|
-
return this._children;
|
|
82
|
-
}
|
|
83
|
-
async _findElement(element) {
|
|
84
|
-
const objectId = element._objectId;
|
|
85
|
-
const { node: { backendNodeId } } = await this._client.send("DOM.describeNode", { objectId });
|
|
86
|
-
const needle = this.find((node) => node._payload.backendDOMNodeId === backendNodeId);
|
|
87
|
-
return needle || null;
|
|
88
|
-
}
|
|
89
|
-
find(predicate) {
|
|
90
|
-
if (predicate(this))
|
|
91
|
-
return this;
|
|
92
|
-
for (const child of this._children) {
|
|
93
|
-
const result = child.find(predicate);
|
|
94
|
-
if (result)
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
isLeafNode() {
|
|
100
|
-
if (!this._children.length)
|
|
101
|
-
return true;
|
|
102
|
-
if (this._isPlainTextField() || this._isTextOnlyObject())
|
|
103
|
-
return true;
|
|
104
|
-
switch (this._role) {
|
|
105
|
-
case "doc-cover":
|
|
106
|
-
case "graphics-symbol":
|
|
107
|
-
case "img":
|
|
108
|
-
case "Meter":
|
|
109
|
-
case "scrollbar":
|
|
110
|
-
case "slider":
|
|
111
|
-
case "separator":
|
|
112
|
-
case "progressbar":
|
|
113
|
-
return true;
|
|
114
|
-
default:
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
if (this._hasFocusableChild())
|
|
118
|
-
return false;
|
|
119
|
-
if (this._focusable && this._role !== "WebArea" && this._role !== "RootWebArea" && this._name)
|
|
120
|
-
return true;
|
|
121
|
-
if (this._role === "heading" && this._name)
|
|
122
|
-
return true;
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
isControl() {
|
|
126
|
-
switch (this._role) {
|
|
127
|
-
case "button":
|
|
128
|
-
case "checkbox":
|
|
129
|
-
case "ColorWell":
|
|
130
|
-
case "combobox":
|
|
131
|
-
case "DisclosureTriangle":
|
|
132
|
-
case "listbox":
|
|
133
|
-
case "menu":
|
|
134
|
-
case "menubar":
|
|
135
|
-
case "menuitem":
|
|
136
|
-
case "menuitemcheckbox":
|
|
137
|
-
case "menuitemradio":
|
|
138
|
-
case "radio":
|
|
139
|
-
case "scrollbar":
|
|
140
|
-
case "searchbox":
|
|
141
|
-
case "slider":
|
|
142
|
-
case "spinbutton":
|
|
143
|
-
case "switch":
|
|
144
|
-
case "tab":
|
|
145
|
-
case "textbox":
|
|
146
|
-
case "tree":
|
|
147
|
-
return true;
|
|
148
|
-
default:
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
isInteresting(insideControl) {
|
|
153
|
-
const role = this._role;
|
|
154
|
-
if (role === "Ignored" || this._hidden)
|
|
155
|
-
return false;
|
|
156
|
-
if (this._focusable || this._richlyEditable)
|
|
157
|
-
return true;
|
|
158
|
-
if (this.isControl())
|
|
159
|
-
return true;
|
|
160
|
-
if (insideControl)
|
|
161
|
-
return false;
|
|
162
|
-
return this.isLeafNode() && !!this._name;
|
|
163
|
-
}
|
|
164
|
-
normalizedRole() {
|
|
165
|
-
switch (this._role) {
|
|
166
|
-
case "RootWebArea":
|
|
167
|
-
return "WebArea";
|
|
168
|
-
case "StaticText":
|
|
169
|
-
return "text";
|
|
170
|
-
default:
|
|
171
|
-
return this._role;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
serialize() {
|
|
175
|
-
const properties = /* @__PURE__ */ new Map();
|
|
176
|
-
for (const property of this._payload.properties || [])
|
|
177
|
-
properties.set(property.name.toLowerCase(), property.value.value);
|
|
178
|
-
if (this._payload.description)
|
|
179
|
-
properties.set("description", this._payload.description.value);
|
|
180
|
-
const node = {
|
|
181
|
-
role: this.normalizedRole(),
|
|
182
|
-
name: this._payload.name ? this._payload.name.value || "" : ""
|
|
183
|
-
};
|
|
184
|
-
const userStringProperties = [
|
|
185
|
-
"description",
|
|
186
|
-
"keyshortcuts",
|
|
187
|
-
"roledescription",
|
|
188
|
-
"valuetext"
|
|
189
|
-
];
|
|
190
|
-
for (const userStringProperty of userStringProperties) {
|
|
191
|
-
if (!properties.has(userStringProperty))
|
|
192
|
-
continue;
|
|
193
|
-
node[userStringProperty] = properties.get(userStringProperty);
|
|
194
|
-
}
|
|
195
|
-
const booleanProperties = [
|
|
196
|
-
"disabled",
|
|
197
|
-
"expanded",
|
|
198
|
-
"focused",
|
|
199
|
-
"modal",
|
|
200
|
-
"multiline",
|
|
201
|
-
"multiselectable",
|
|
202
|
-
"readonly",
|
|
203
|
-
"required",
|
|
204
|
-
"selected"
|
|
205
|
-
];
|
|
206
|
-
for (const booleanProperty of booleanProperties) {
|
|
207
|
-
if (booleanProperty === "focused" && (this._role === "WebArea" || this._role === "RootWebArea"))
|
|
208
|
-
continue;
|
|
209
|
-
const value = properties.get(booleanProperty);
|
|
210
|
-
if (!value)
|
|
211
|
-
continue;
|
|
212
|
-
node[booleanProperty] = value;
|
|
213
|
-
}
|
|
214
|
-
const numericalProperties = [
|
|
215
|
-
"level",
|
|
216
|
-
"valuemax",
|
|
217
|
-
"valuemin"
|
|
218
|
-
];
|
|
219
|
-
for (const numericalProperty of numericalProperties) {
|
|
220
|
-
if (!properties.has(numericalProperty))
|
|
221
|
-
continue;
|
|
222
|
-
node[numericalProperty] = properties.get(numericalProperty);
|
|
223
|
-
}
|
|
224
|
-
const tokenProperties = [
|
|
225
|
-
"autocomplete",
|
|
226
|
-
"haspopup",
|
|
227
|
-
"invalid",
|
|
228
|
-
"orientation"
|
|
229
|
-
];
|
|
230
|
-
for (const tokenProperty of tokenProperties) {
|
|
231
|
-
const value = properties.get(tokenProperty);
|
|
232
|
-
if (!value || value === "false")
|
|
233
|
-
continue;
|
|
234
|
-
node[tokenProperty] = value;
|
|
235
|
-
}
|
|
236
|
-
const axNode = node;
|
|
237
|
-
if (this._payload.value) {
|
|
238
|
-
if (typeof this._payload.value.value === "string")
|
|
239
|
-
axNode.valueString = this._payload.value.value;
|
|
240
|
-
if (typeof this._payload.value.value === "number")
|
|
241
|
-
axNode.valueNumber = this._payload.value.value;
|
|
242
|
-
}
|
|
243
|
-
if (properties.has("checked"))
|
|
244
|
-
axNode.checked = properties.get("checked") === "true" ? "checked" : properties.get("checked") === "false" ? "unchecked" : "mixed";
|
|
245
|
-
if (properties.has("pressed"))
|
|
246
|
-
axNode.pressed = properties.get("pressed") === "true" ? "pressed" : properties.get("pressed") === "false" ? "released" : "mixed";
|
|
247
|
-
return axNode;
|
|
248
|
-
}
|
|
249
|
-
static createTree(client, payloads) {
|
|
250
|
-
const nodeById = /* @__PURE__ */ new Map();
|
|
251
|
-
for (const payload of payloads)
|
|
252
|
-
nodeById.set(payload.nodeId, new CRAXNode(client, payload));
|
|
253
|
-
for (const node of nodeById.values()) {
|
|
254
|
-
for (const childId of node._payload.childIds || [])
|
|
255
|
-
node._children.push(nodeById.get(childId));
|
|
256
|
-
}
|
|
257
|
-
return nodeById.values().next().value;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
261
|
-
0 && (module.exports = {
|
|
262
|
-
getAccessibilityTree
|
|
263
|
-
});
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var ffAccessibility_exports = {};
|
|
20
|
-
__export(ffAccessibility_exports, {
|
|
21
|
-
getAccessibilityTree: () => getAccessibilityTree
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(ffAccessibility_exports);
|
|
24
|
-
async function getAccessibilityTree(session, needle) {
|
|
25
|
-
const objectId = needle ? needle._objectId : void 0;
|
|
26
|
-
const { tree } = await session.send("Accessibility.getFullAXTree", { objectId });
|
|
27
|
-
const axNode = new FFAXNode(tree);
|
|
28
|
-
return {
|
|
29
|
-
tree: axNode,
|
|
30
|
-
needle: needle ? axNode._findNeedle() : null
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const FFRoleToARIARole = new Map(Object.entries({
|
|
34
|
-
"pushbutton": "button",
|
|
35
|
-
"checkbutton": "checkbox",
|
|
36
|
-
"editcombobox": "combobox",
|
|
37
|
-
"content deletion": "deletion",
|
|
38
|
-
"footnote": "doc-footnote",
|
|
39
|
-
"non-native document": "document",
|
|
40
|
-
"grouping": "group",
|
|
41
|
-
"graphic": "img",
|
|
42
|
-
"content insertion": "insertion",
|
|
43
|
-
"animation": "marquee",
|
|
44
|
-
"flat equation": "math",
|
|
45
|
-
"menupopup": "menu",
|
|
46
|
-
"check menu item": "menuitemcheckbox",
|
|
47
|
-
"radio menu item": "menuitemradio",
|
|
48
|
-
"listbox option": "option",
|
|
49
|
-
"radiobutton": "radio",
|
|
50
|
-
"statusbar": "status",
|
|
51
|
-
"pagetab": "tab",
|
|
52
|
-
"pagetablist": "tablist",
|
|
53
|
-
"propertypage": "tabpanel",
|
|
54
|
-
"entry": "textbox",
|
|
55
|
-
"outline": "tree",
|
|
56
|
-
"tree table": "treegrid",
|
|
57
|
-
"outlineitem": "treeitem"
|
|
58
|
-
}));
|
|
59
|
-
class FFAXNode {
|
|
60
|
-
constructor(payload) {
|
|
61
|
-
this._payload = payload;
|
|
62
|
-
this._children = (payload.children || []).map((x) => new FFAXNode(x));
|
|
63
|
-
this._editable = !!payload.editable;
|
|
64
|
-
this._richlyEditable = this._editable && (payload.tag !== "textarea" && payload.tag !== "input");
|
|
65
|
-
this._focusable = !!payload.focusable;
|
|
66
|
-
this._expanded = !!payload.expanded;
|
|
67
|
-
this._name = this._payload.name;
|
|
68
|
-
this._role = this._payload.role;
|
|
69
|
-
}
|
|
70
|
-
_isPlainTextField() {
|
|
71
|
-
if (this._richlyEditable)
|
|
72
|
-
return false;
|
|
73
|
-
if (this._editable)
|
|
74
|
-
return true;
|
|
75
|
-
return this._role === "entry";
|
|
76
|
-
}
|
|
77
|
-
_isTextOnlyObject() {
|
|
78
|
-
const role = this._role;
|
|
79
|
-
return role === "text leaf" || role === "text" || role === "statictext";
|
|
80
|
-
}
|
|
81
|
-
_hasFocusableChild() {
|
|
82
|
-
if (this._cachedHasFocusableChild === void 0) {
|
|
83
|
-
this._cachedHasFocusableChild = false;
|
|
84
|
-
for (const child of this._children) {
|
|
85
|
-
if (child._focusable || child._hasFocusableChild()) {
|
|
86
|
-
this._cachedHasFocusableChild = true;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return this._cachedHasFocusableChild;
|
|
92
|
-
}
|
|
93
|
-
children() {
|
|
94
|
-
return this._children;
|
|
95
|
-
}
|
|
96
|
-
_findNeedle() {
|
|
97
|
-
if (this._payload.foundObject)
|
|
98
|
-
return this;
|
|
99
|
-
for (const child of this._children) {
|
|
100
|
-
const found = child._findNeedle();
|
|
101
|
-
if (found)
|
|
102
|
-
return found;
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
isLeafNode() {
|
|
107
|
-
if (!this._children.length)
|
|
108
|
-
return true;
|
|
109
|
-
if (this._isPlainTextField() || this._isTextOnlyObject())
|
|
110
|
-
return true;
|
|
111
|
-
switch (this._role) {
|
|
112
|
-
case "graphic":
|
|
113
|
-
case "scrollbar":
|
|
114
|
-
case "slider":
|
|
115
|
-
case "separator":
|
|
116
|
-
case "progressbar":
|
|
117
|
-
return true;
|
|
118
|
-
default:
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
if (this._hasFocusableChild())
|
|
122
|
-
return false;
|
|
123
|
-
if (this._focusable && this._role !== "document" && this._name)
|
|
124
|
-
return true;
|
|
125
|
-
if (this._role === "heading" && this._name)
|
|
126
|
-
return true;
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
isControl() {
|
|
130
|
-
switch (this._role) {
|
|
131
|
-
case "checkbutton":
|
|
132
|
-
case "check menu item":
|
|
133
|
-
case "check rich option":
|
|
134
|
-
case "combobox":
|
|
135
|
-
case "combobox option":
|
|
136
|
-
case "color chooser":
|
|
137
|
-
case "listbox":
|
|
138
|
-
case "listbox option":
|
|
139
|
-
case "listbox rich option":
|
|
140
|
-
case "popup menu":
|
|
141
|
-
case "menupopup":
|
|
142
|
-
case "menuitem":
|
|
143
|
-
case "menubar":
|
|
144
|
-
case "button":
|
|
145
|
-
case "pushbutton":
|
|
146
|
-
case "radiobutton":
|
|
147
|
-
case "radio menuitem":
|
|
148
|
-
case "scrollbar":
|
|
149
|
-
case "slider":
|
|
150
|
-
case "spinbutton":
|
|
151
|
-
case "switch":
|
|
152
|
-
case "pagetab":
|
|
153
|
-
case "entry":
|
|
154
|
-
case "tree table":
|
|
155
|
-
return true;
|
|
156
|
-
default:
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
isInteresting(insideControl) {
|
|
161
|
-
if (this._focusable || this._richlyEditable)
|
|
162
|
-
return true;
|
|
163
|
-
if (this.isControl())
|
|
164
|
-
return true;
|
|
165
|
-
if (insideControl)
|
|
166
|
-
return false;
|
|
167
|
-
return this.isLeafNode() && !!this._name.trim();
|
|
168
|
-
}
|
|
169
|
-
serialize() {
|
|
170
|
-
const node = {
|
|
171
|
-
role: FFRoleToARIARole.get(this._role) || this._role,
|
|
172
|
-
name: this._name || ""
|
|
173
|
-
};
|
|
174
|
-
const userStringProperties = [
|
|
175
|
-
"name",
|
|
176
|
-
"description",
|
|
177
|
-
"roledescription",
|
|
178
|
-
"valuetext",
|
|
179
|
-
"keyshortcuts"
|
|
180
|
-
];
|
|
181
|
-
for (const userStringProperty of userStringProperties) {
|
|
182
|
-
if (!(userStringProperty in this._payload))
|
|
183
|
-
continue;
|
|
184
|
-
node[userStringProperty] = this._payload[userStringProperty];
|
|
185
|
-
}
|
|
186
|
-
const booleanProperties = [
|
|
187
|
-
"disabled",
|
|
188
|
-
"expanded",
|
|
189
|
-
"focused",
|
|
190
|
-
"modal",
|
|
191
|
-
"multiline",
|
|
192
|
-
"multiselectable",
|
|
193
|
-
"readonly",
|
|
194
|
-
"required",
|
|
195
|
-
"selected"
|
|
196
|
-
];
|
|
197
|
-
for (const booleanProperty of booleanProperties) {
|
|
198
|
-
if (this._role === "document" && booleanProperty === "focused")
|
|
199
|
-
continue;
|
|
200
|
-
const value = this._payload[booleanProperty];
|
|
201
|
-
if (!value)
|
|
202
|
-
continue;
|
|
203
|
-
node[booleanProperty] = value;
|
|
204
|
-
}
|
|
205
|
-
const numericalProperties = [
|
|
206
|
-
"level"
|
|
207
|
-
];
|
|
208
|
-
for (const numericalProperty of numericalProperties) {
|
|
209
|
-
if (!(numericalProperty in this._payload))
|
|
210
|
-
continue;
|
|
211
|
-
node[numericalProperty] = this._payload[numericalProperty];
|
|
212
|
-
}
|
|
213
|
-
const tokenProperties = [
|
|
214
|
-
"autocomplete",
|
|
215
|
-
"haspopup",
|
|
216
|
-
"orientation"
|
|
217
|
-
];
|
|
218
|
-
for (const tokenProperty of tokenProperties) {
|
|
219
|
-
const value = this._payload[tokenProperty];
|
|
220
|
-
if (!value || value === "false")
|
|
221
|
-
continue;
|
|
222
|
-
node[tokenProperty] = value;
|
|
223
|
-
}
|
|
224
|
-
const axNode = node;
|
|
225
|
-
axNode.valueString = this._payload.value;
|
|
226
|
-
if ("checked" in this._payload)
|
|
227
|
-
axNode.checked = this._payload.checked === true ? "checked" : this._payload.checked === "mixed" ? "mixed" : "unchecked";
|
|
228
|
-
if ("pressed" in this._payload)
|
|
229
|
-
axNode.pressed = this._payload.pressed === true ? "pressed" : "released";
|
|
230
|
-
if ("invalid" in this._payload)
|
|
231
|
-
axNode.invalid = this._payload.invalid === true ? "true" : "false";
|
|
232
|
-
return axNode;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
236
|
-
0 && (module.exports = {
|
|
237
|
-
getAccessibilityTree
|
|
238
|
-
});
|