brave-real-playwright-core 1.56.1 → 1.57.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/README.md +5 -5
- package/advanced-stealth.js +1 -1
- 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/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,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
|
-
});
|
|
@@ -1,237 +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 wkAccessibility_exports = {};
|
|
20
|
-
__export(wkAccessibility_exports, {
|
|
21
|
-
getAccessibilityTree: () => getAccessibilityTree
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(wkAccessibility_exports);
|
|
24
|
-
async function getAccessibilityTree(session, needle) {
|
|
25
|
-
const objectId = needle ? needle._objectId : void 0;
|
|
26
|
-
const { axNode } = await session.send("Page.accessibilitySnapshot", { objectId });
|
|
27
|
-
const tree = new WKAXNode(axNode);
|
|
28
|
-
return {
|
|
29
|
-
tree,
|
|
30
|
-
needle: needle ? tree._findNeedle() : null
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const WKRoleToARIARole = new Map(Object.entries({
|
|
34
|
-
"TextField": "textbox"
|
|
35
|
-
}));
|
|
36
|
-
const WKUnhelpfulRoleDescriptions = new Map(Object.entries({
|
|
37
|
-
"WebArea": "HTML content",
|
|
38
|
-
"Summary": "summary",
|
|
39
|
-
"DescriptionList": "description list",
|
|
40
|
-
"ImageMap": "image map",
|
|
41
|
-
"ListMarker": "list marker",
|
|
42
|
-
"Video": "video playback",
|
|
43
|
-
"Mark": "highlighted",
|
|
44
|
-
"contentinfo": "content information",
|
|
45
|
-
"Details": "details",
|
|
46
|
-
"DescriptionListDetail": "description",
|
|
47
|
-
"DescriptionListTerm": "term",
|
|
48
|
-
"alertdialog": "web alert dialog",
|
|
49
|
-
"dialog": "web dialog",
|
|
50
|
-
"status": "application status",
|
|
51
|
-
"tabpanel": "tab panel",
|
|
52
|
-
"application": "web application"
|
|
53
|
-
}));
|
|
54
|
-
class WKAXNode {
|
|
55
|
-
constructor(payload) {
|
|
56
|
-
this._payload = payload;
|
|
57
|
-
this._children = [];
|
|
58
|
-
for (const payload2 of this._payload.children || [])
|
|
59
|
-
this._children.push(new WKAXNode(payload2));
|
|
60
|
-
}
|
|
61
|
-
children() {
|
|
62
|
-
return this._children;
|
|
63
|
-
}
|
|
64
|
-
_findNeedle() {
|
|
65
|
-
if (this._payload.found)
|
|
66
|
-
return this;
|
|
67
|
-
for (const child of this._children) {
|
|
68
|
-
const found = child._findNeedle();
|
|
69
|
-
if (found)
|
|
70
|
-
return found;
|
|
71
|
-
}
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
isControl() {
|
|
75
|
-
switch (this._payload.role) {
|
|
76
|
-
case "button":
|
|
77
|
-
case "checkbox":
|
|
78
|
-
case "ColorWell":
|
|
79
|
-
case "combobox":
|
|
80
|
-
case "DisclosureTriangle":
|
|
81
|
-
case "listbox":
|
|
82
|
-
case "menu":
|
|
83
|
-
case "menubar":
|
|
84
|
-
case "menuitem":
|
|
85
|
-
case "menuitemcheckbox":
|
|
86
|
-
case "menuitemradio":
|
|
87
|
-
case "radio":
|
|
88
|
-
case "scrollbar":
|
|
89
|
-
case "searchbox":
|
|
90
|
-
case "slider":
|
|
91
|
-
case "spinbutton":
|
|
92
|
-
case "switch":
|
|
93
|
-
case "tab":
|
|
94
|
-
case "textbox":
|
|
95
|
-
case "TextField":
|
|
96
|
-
case "tree":
|
|
97
|
-
return true;
|
|
98
|
-
default:
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
_isTextControl() {
|
|
103
|
-
switch (this._payload.role) {
|
|
104
|
-
case "combobox":
|
|
105
|
-
case "searchfield":
|
|
106
|
-
case "textbox":
|
|
107
|
-
case "TextField":
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
_name() {
|
|
113
|
-
if (this._payload.role === "text")
|
|
114
|
-
return this._payload.value || "";
|
|
115
|
-
return this._payload.name || "";
|
|
116
|
-
}
|
|
117
|
-
isInteresting(insideControl) {
|
|
118
|
-
const { role, focusable } = this._payload;
|
|
119
|
-
const name = this._name();
|
|
120
|
-
if (role === "ScrollArea")
|
|
121
|
-
return false;
|
|
122
|
-
if (role === "WebArea")
|
|
123
|
-
return true;
|
|
124
|
-
if (focusable || role === "MenuListOption")
|
|
125
|
-
return true;
|
|
126
|
-
if (this.isControl())
|
|
127
|
-
return true;
|
|
128
|
-
if (insideControl)
|
|
129
|
-
return false;
|
|
130
|
-
return this.isLeafNode() && !!name;
|
|
131
|
-
}
|
|
132
|
-
_hasRedundantTextChild() {
|
|
133
|
-
if (this._children.length !== 1)
|
|
134
|
-
return false;
|
|
135
|
-
const child = this._children[0];
|
|
136
|
-
return child._payload.role === "text" && this._payload.name === child._payload.value;
|
|
137
|
-
}
|
|
138
|
-
isLeafNode() {
|
|
139
|
-
if (!this._children.length)
|
|
140
|
-
return true;
|
|
141
|
-
if (this._isTextControl())
|
|
142
|
-
return true;
|
|
143
|
-
if (this._hasRedundantTextChild())
|
|
144
|
-
return true;
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
serialize() {
|
|
148
|
-
const node = {
|
|
149
|
-
role: WKRoleToARIARole.get(this._payload.role) || this._payload.role,
|
|
150
|
-
name: this._name()
|
|
151
|
-
};
|
|
152
|
-
if ("description" in this._payload && this._payload.description !== node.name)
|
|
153
|
-
node.description = this._payload.description;
|
|
154
|
-
if ("roledescription" in this._payload) {
|
|
155
|
-
const roledescription = this._payload.roledescription;
|
|
156
|
-
if (roledescription !== this._payload.role && WKUnhelpfulRoleDescriptions.get(this._payload.role) !== roledescription)
|
|
157
|
-
node.roledescription = roledescription;
|
|
158
|
-
}
|
|
159
|
-
if ("value" in this._payload && this._payload.role !== "text") {
|
|
160
|
-
if (typeof this._payload.value === "string")
|
|
161
|
-
node.valueString = this._payload.value;
|
|
162
|
-
else if (typeof this._payload.value === "number")
|
|
163
|
-
node.valueNumber = this._payload.value;
|
|
164
|
-
}
|
|
165
|
-
if ("checked" in this._payload)
|
|
166
|
-
node.checked = this._payload.checked === "true" ? "checked" : this._payload.checked === "false" ? "unchecked" : "mixed";
|
|
167
|
-
if ("pressed" in this._payload)
|
|
168
|
-
node.pressed = this._payload.pressed === "true" ? "pressed" : this._payload.pressed === "false" ? "released" : "mixed";
|
|
169
|
-
const userStringProperties = [
|
|
170
|
-
"keyshortcuts",
|
|
171
|
-
"valuetext"
|
|
172
|
-
];
|
|
173
|
-
for (const userStringProperty of userStringProperties) {
|
|
174
|
-
if (!(userStringProperty in this._payload))
|
|
175
|
-
continue;
|
|
176
|
-
node[userStringProperty] = this._payload[userStringProperty];
|
|
177
|
-
}
|
|
178
|
-
const booleanProperties = [
|
|
179
|
-
"disabled",
|
|
180
|
-
"expanded",
|
|
181
|
-
"focused",
|
|
182
|
-
"modal",
|
|
183
|
-
"multiselectable",
|
|
184
|
-
"readonly",
|
|
185
|
-
"required",
|
|
186
|
-
"selected"
|
|
187
|
-
];
|
|
188
|
-
for (const booleanProperty of booleanProperties) {
|
|
189
|
-
if (booleanProperty === "focused" && (this._payload.role === "WebArea" || this._payload.role === "ScrollArea"))
|
|
190
|
-
continue;
|
|
191
|
-
const value = this._payload[booleanProperty];
|
|
192
|
-
if (!value)
|
|
193
|
-
continue;
|
|
194
|
-
node[booleanProperty] = value;
|
|
195
|
-
}
|
|
196
|
-
const numericalProperties = [
|
|
197
|
-
"level",
|
|
198
|
-
"valuemax",
|
|
199
|
-
"valuemin"
|
|
200
|
-
];
|
|
201
|
-
for (const numericalProperty of numericalProperties) {
|
|
202
|
-
if (!(numericalProperty in this._payload))
|
|
203
|
-
continue;
|
|
204
|
-
node[numericalProperty] = this._payload[numericalProperty];
|
|
205
|
-
}
|
|
206
|
-
const tokenProperties = [
|
|
207
|
-
"autocomplete",
|
|
208
|
-
"haspopup",
|
|
209
|
-
"invalid"
|
|
210
|
-
];
|
|
211
|
-
for (const tokenProperty of tokenProperties) {
|
|
212
|
-
const value = this._payload[tokenProperty];
|
|
213
|
-
if (!value || value === "false")
|
|
214
|
-
continue;
|
|
215
|
-
node[tokenProperty] = value;
|
|
216
|
-
}
|
|
217
|
-
const orientationIsApplicable = /* @__PURE__ */ new Set([
|
|
218
|
-
"ScrollArea",
|
|
219
|
-
"scrollbar",
|
|
220
|
-
"listbox",
|
|
221
|
-
"combobox",
|
|
222
|
-
"menu",
|
|
223
|
-
"tree",
|
|
224
|
-
"separator",
|
|
225
|
-
"slider",
|
|
226
|
-
"tablist",
|
|
227
|
-
"toolbar"
|
|
228
|
-
]);
|
|
229
|
-
if (this._payload.orientation && orientationIsApplicable.has(this._payload.role))
|
|
230
|
-
node.orientation = this._payload.orientation;
|
|
231
|
-
return node;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
235
|
-
0 && (module.exports = {
|
|
236
|
-
getAccessibilityTree
|
|
237
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var import_net = __toESM(require("net"));
|
|
25
|
-
var import_fs = __toESM(require("fs"));
|
|
26
|
-
var import_child_process = require("child_process");
|
|
27
|
-
(async () => {
|
|
28
|
-
const { PW_WSL_BRIDGE_PORT: socketPort, ...childEnv } = process.env;
|
|
29
|
-
if (!socketPort)
|
|
30
|
-
throw new Error("PW_WSL_BRIDGE_PORT env var is not set");
|
|
31
|
-
const [executable, ...args] = process.argv.slice(2);
|
|
32
|
-
if (!(await import_fs.default.promises.stat(executable)).isFile())
|
|
33
|
-
throw new Error(`Executable does not exist. Did you update Playwright recently? Make sure to run npx playwright install webkit-wsl`);
|
|
34
|
-
const address = (() => {
|
|
35
|
-
const res = (0, import_child_process.spawnSync)("/usr/bin/wslinfo", ["--networking-mode"], { encoding: "utf8" });
|
|
36
|
-
if (res.error || res.status !== 0)
|
|
37
|
-
throw new Error(`Failed to run /usr/bin/wslinfo --networking-mode: ${res.error?.message || res.stderr || res.status}`);
|
|
38
|
-
if (res.stdout.trim() === "nat") {
|
|
39
|
-
const ipRes = (0, import_child_process.spawnSync)("/usr/sbin/ip", ["route", "show"], { encoding: "utf8" });
|
|
40
|
-
if (ipRes.error || ipRes.status !== 0)
|
|
41
|
-
throw new Error(`Failed to run ip route show: ${ipRes.error?.message || ipRes.stderr || ipRes.status}`);
|
|
42
|
-
const ip = ipRes.stdout.trim().split("\n").find((line) => line.includes("default"))?.split(" ")[2];
|
|
43
|
-
if (!ip)
|
|
44
|
-
throw new Error("Could not determine WSL IP address (NAT mode).");
|
|
45
|
-
return ip;
|
|
46
|
-
}
|
|
47
|
-
return "127.0.0.1";
|
|
48
|
-
})();
|
|
49
|
-
const socket = import_net.default.createConnection(parseInt(socketPort, 10), address);
|
|
50
|
-
socket.setNoDelay(true);
|
|
51
|
-
await new Promise((resolve, reject) => {
|
|
52
|
-
socket.on("connect", resolve);
|
|
53
|
-
socket.on("error", reject);
|
|
54
|
-
});
|
|
55
|
-
const child = (0, import_child_process.spawn)(executable, args, {
|
|
56
|
-
stdio: ["inherit", "inherit", "inherit", "pipe", "pipe"],
|
|
57
|
-
env: childEnv
|
|
58
|
-
});
|
|
59
|
-
const [childOutput, childInput] = [child.stdio[3], child.stdio[4]];
|
|
60
|
-
socket.pipe(childOutput);
|
|
61
|
-
childInput.pipe(socket);
|
|
62
|
-
socket.on("end", () => child.kill());
|
|
63
|
-
child.on("exit", (exitCode) => {
|
|
64
|
-
socket.end();
|
|
65
|
-
process.exit(exitCode || 0);
|
|
66
|
-
});
|
|
67
|
-
await new Promise((resolve, reject) => {
|
|
68
|
-
child.on("exit", resolve);
|
|
69
|
-
child.on("error", reject);
|
|
70
|
-
});
|
|
71
|
-
})().catch((error) => {
|
|
72
|
-
console.error("Error occurred:", error);
|
|
73
|
-
process.exit(1);
|
|
74
|
-
});
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
var import_net = __toESM(require("net"));
|
|
25
|
-
var import_path = __toESM(require("path"));
|
|
26
|
-
var import_child_process = require("child_process");
|
|
27
|
-
(async () => {
|
|
28
|
-
const argv = process.argv.slice(2);
|
|
29
|
-
if (!argv.length) {
|
|
30
|
-
console.error(`Usage: node ${import_path.default.basename(__filename)} <executable> [args...]`);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
const parentIn = new import_net.default.Socket({ fd: 3, readable: true, writable: false });
|
|
34
|
-
const parentOut = new import_net.default.Socket({ fd: 4, readable: false, writable: true });
|
|
35
|
-
const server = import_net.default.createServer();
|
|
36
|
-
let socket = null;
|
|
37
|
-
server.on("connection", (s) => {
|
|
38
|
-
if (socket) {
|
|
39
|
-
log("Extra connection received, destroying.");
|
|
40
|
-
socket.destroy();
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
socket = s;
|
|
44
|
-
socket.setNoDelay(true);
|
|
45
|
-
log("Client connected, wiring pipes.");
|
|
46
|
-
socket.pipe(parentOut);
|
|
47
|
-
parentIn.pipe(socket);
|
|
48
|
-
socket.on("close", () => {
|
|
49
|
-
log("Socket closed");
|
|
50
|
-
socket = null;
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
await new Promise((resolve, reject) => {
|
|
54
|
-
server.once("error", reject);
|
|
55
|
-
server.listen(0, () => resolve(null));
|
|
56
|
-
});
|
|
57
|
-
const address = server.address();
|
|
58
|
-
if (!address || typeof address === "string") {
|
|
59
|
-
console.error("Failed to obtain listening address");
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
const port = address.port;
|
|
63
|
-
log("Server listening on", port);
|
|
64
|
-
const env = {
|
|
65
|
-
...process.env,
|
|
66
|
-
// WSLENV is a colon-delimited list of environment variables that should be included when launching WSL processes from Win32 or Win32 processes from WSL
|
|
67
|
-
WSLENV: "PW_WSL_BRIDGE_PORT",
|
|
68
|
-
PW_WSL_BRIDGE_PORT: String(port)
|
|
69
|
-
};
|
|
70
|
-
let shuttingDown = false;
|
|
71
|
-
const child = (0, import_child_process.spawn)("wsl.exe", [
|
|
72
|
-
"-d",
|
|
73
|
-
"playwright",
|
|
74
|
-
"--cd",
|
|
75
|
-
"/home/pwuser",
|
|
76
|
-
"/home/pwuser/node/bin/node",
|
|
77
|
-
"/home/pwuser/webkit-wsl-transport-client.js",
|
|
78
|
-
process.env.WEBKIT_EXECUTABLE || "",
|
|
79
|
-
...argv
|
|
80
|
-
], {
|
|
81
|
-
env,
|
|
82
|
-
stdio: ["inherit", "inherit", "inherit"]
|
|
83
|
-
// no fd3/fd4 here; they stay only in this wrapper
|
|
84
|
-
});
|
|
85
|
-
log("Spawned child pid", child.pid);
|
|
86
|
-
child.on("close", (code, signal) => {
|
|
87
|
-
log("Child exit", { code, signal });
|
|
88
|
-
const exitCode = code ?? (signal ? 128 : 0);
|
|
89
|
-
shutdown(exitCode);
|
|
90
|
-
});
|
|
91
|
-
child.on("error", (err) => {
|
|
92
|
-
console.error("Child process failed to start:", err);
|
|
93
|
-
shutdown(1);
|
|
94
|
-
});
|
|
95
|
-
await new Promise((resolve) => child.once("close", resolve));
|
|
96
|
-
async function shutdown(code = 0) {
|
|
97
|
-
if (shuttingDown)
|
|
98
|
-
return;
|
|
99
|
-
shuttingDown = true;
|
|
100
|
-
server.close();
|
|
101
|
-
parentIn.destroy();
|
|
102
|
-
parentOut.destroy();
|
|
103
|
-
socket?.destroy();
|
|
104
|
-
await new Promise((resolve) => server.once("close", resolve));
|
|
105
|
-
process.exit(code);
|
|
106
|
-
}
|
|
107
|
-
function log(...args) {
|
|
108
|
-
console.error(/* @__PURE__ */ new Date(), `[${import_path.default.basename(__filename)}]`, ...args);
|
|
109
|
-
}
|
|
110
|
-
})().catch((error) => {
|
|
111
|
-
console.error("Error occurred:", error);
|
|
112
|
-
process.exit(1);
|
|
113
|
-
});
|