First Commit
This commit is contained in:
238
node_modules/playwright-core/lib/server/firefox/ffAccessibility.js
generated
vendored
Normal file
238
node_modules/playwright-core/lib/server/firefox/ffAccessibility.js
generated
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var ffAccessibility_exports = {};
|
||||
__export(ffAccessibility_exports, {
|
||||
getAccessibilityTree: () => getAccessibilityTree
|
||||
});
|
||||
module.exports = __toCommonJS(ffAccessibility_exports);
|
||||
async function getAccessibilityTree(session, needle) {
|
||||
const objectId = needle ? needle._objectId : void 0;
|
||||
const { tree } = await session.send("Accessibility.getFullAXTree", { objectId });
|
||||
const axNode = new FFAXNode(tree);
|
||||
return {
|
||||
tree: axNode,
|
||||
needle: needle ? axNode._findNeedle() : null
|
||||
};
|
||||
}
|
||||
const FFRoleToARIARole = new Map(Object.entries({
|
||||
"pushbutton": "button",
|
||||
"checkbutton": "checkbox",
|
||||
"editcombobox": "combobox",
|
||||
"content deletion": "deletion",
|
||||
"footnote": "doc-footnote",
|
||||
"non-native document": "document",
|
||||
"grouping": "group",
|
||||
"graphic": "img",
|
||||
"content insertion": "insertion",
|
||||
"animation": "marquee",
|
||||
"flat equation": "math",
|
||||
"menupopup": "menu",
|
||||
"check menu item": "menuitemcheckbox",
|
||||
"radio menu item": "menuitemradio",
|
||||
"listbox option": "option",
|
||||
"radiobutton": "radio",
|
||||
"statusbar": "status",
|
||||
"pagetab": "tab",
|
||||
"pagetablist": "tablist",
|
||||
"propertypage": "tabpanel",
|
||||
"entry": "textbox",
|
||||
"outline": "tree",
|
||||
"tree table": "treegrid",
|
||||
"outlineitem": "treeitem"
|
||||
}));
|
||||
class FFAXNode {
|
||||
constructor(payload) {
|
||||
this._payload = payload;
|
||||
this._children = (payload.children || []).map((x) => new FFAXNode(x));
|
||||
this._editable = !!payload.editable;
|
||||
this._richlyEditable = this._editable && (payload.tag !== "textarea" && payload.tag !== "input");
|
||||
this._focusable = !!payload.focusable;
|
||||
this._expanded = !!payload.expanded;
|
||||
this._name = this._payload.name;
|
||||
this._role = this._payload.role;
|
||||
}
|
||||
_isPlainTextField() {
|
||||
if (this._richlyEditable)
|
||||
return false;
|
||||
if (this._editable)
|
||||
return true;
|
||||
return this._role === "entry";
|
||||
}
|
||||
_isTextOnlyObject() {
|
||||
const role = this._role;
|
||||
return role === "text leaf" || role === "text" || role === "statictext";
|
||||
}
|
||||
_hasFocusableChild() {
|
||||
if (this._cachedHasFocusableChild === void 0) {
|
||||
this._cachedHasFocusableChild = false;
|
||||
for (const child of this._children) {
|
||||
if (child._focusable || child._hasFocusableChild()) {
|
||||
this._cachedHasFocusableChild = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return this._cachedHasFocusableChild;
|
||||
}
|
||||
children() {
|
||||
return this._children;
|
||||
}
|
||||
_findNeedle() {
|
||||
if (this._payload.foundObject)
|
||||
return this;
|
||||
for (const child of this._children) {
|
||||
const found = child._findNeedle();
|
||||
if (found)
|
||||
return found;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
isLeafNode() {
|
||||
if (!this._children.length)
|
||||
return true;
|
||||
if (this._isPlainTextField() || this._isTextOnlyObject())
|
||||
return true;
|
||||
switch (this._role) {
|
||||
case "graphic":
|
||||
case "scrollbar":
|
||||
case "slider":
|
||||
case "separator":
|
||||
case "progressbar":
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (this._hasFocusableChild())
|
||||
return false;
|
||||
if (this._focusable && this._role !== "document" && this._name)
|
||||
return true;
|
||||
if (this._role === "heading" && this._name)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
isControl() {
|
||||
switch (this._role) {
|
||||
case "checkbutton":
|
||||
case "check menu item":
|
||||
case "check rich option":
|
||||
case "combobox":
|
||||
case "combobox option":
|
||||
case "color chooser":
|
||||
case "listbox":
|
||||
case "listbox option":
|
||||
case "listbox rich option":
|
||||
case "popup menu":
|
||||
case "menupopup":
|
||||
case "menuitem":
|
||||
case "menubar":
|
||||
case "button":
|
||||
case "pushbutton":
|
||||
case "radiobutton":
|
||||
case "radio menuitem":
|
||||
case "scrollbar":
|
||||
case "slider":
|
||||
case "spinbutton":
|
||||
case "switch":
|
||||
case "pagetab":
|
||||
case "entry":
|
||||
case "tree table":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
isInteresting(insideControl) {
|
||||
if (this._focusable || this._richlyEditable)
|
||||
return true;
|
||||
if (this.isControl())
|
||||
return true;
|
||||
if (insideControl)
|
||||
return false;
|
||||
return this.isLeafNode() && !!this._name.trim();
|
||||
}
|
||||
serialize() {
|
||||
const node = {
|
||||
role: FFRoleToARIARole.get(this._role) || this._role,
|
||||
name: this._name || ""
|
||||
};
|
||||
const userStringProperties = [
|
||||
"name",
|
||||
"description",
|
||||
"roledescription",
|
||||
"valuetext",
|
||||
"keyshortcuts"
|
||||
];
|
||||
for (const userStringProperty of userStringProperties) {
|
||||
if (!(userStringProperty in this._payload))
|
||||
continue;
|
||||
node[userStringProperty] = this._payload[userStringProperty];
|
||||
}
|
||||
const booleanProperties = [
|
||||
"disabled",
|
||||
"expanded",
|
||||
"focused",
|
||||
"modal",
|
||||
"multiline",
|
||||
"multiselectable",
|
||||
"readonly",
|
||||
"required",
|
||||
"selected"
|
||||
];
|
||||
for (const booleanProperty of booleanProperties) {
|
||||
if (this._role === "document" && booleanProperty === "focused")
|
||||
continue;
|
||||
const value = this._payload[booleanProperty];
|
||||
if (!value)
|
||||
continue;
|
||||
node[booleanProperty] = value;
|
||||
}
|
||||
const numericalProperties = [
|
||||
"level"
|
||||
];
|
||||
for (const numericalProperty of numericalProperties) {
|
||||
if (!(numericalProperty in this._payload))
|
||||
continue;
|
||||
node[numericalProperty] = this._payload[numericalProperty];
|
||||
}
|
||||
const tokenProperties = [
|
||||
"autocomplete",
|
||||
"haspopup",
|
||||
"orientation"
|
||||
];
|
||||
for (const tokenProperty of tokenProperties) {
|
||||
const value = this._payload[tokenProperty];
|
||||
if (!value || value === "false")
|
||||
continue;
|
||||
node[tokenProperty] = value;
|
||||
}
|
||||
const axNode = node;
|
||||
axNode.valueString = this._payload.value;
|
||||
if ("checked" in this._payload)
|
||||
axNode.checked = this._payload.checked === true ? "checked" : this._payload.checked === "mixed" ? "mixed" : "unchecked";
|
||||
if ("pressed" in this._payload)
|
||||
axNode.pressed = this._payload.pressed === true ? "pressed" : "released";
|
||||
if ("invalid" in this._payload)
|
||||
axNode.invalid = this._payload.invalid === true ? "true" : "false";
|
||||
return axNode;
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
getAccessibilityTree
|
||||
});
|
428
node_modules/playwright-core/lib/server/firefox/ffBrowser.js
generated
vendored
Normal file
428
node_modules/playwright-core/lib/server/firefox/ffBrowser.js
generated
vendored
Normal file
@@ -0,0 +1,428 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var ffBrowser_exports = {};
|
||||
__export(ffBrowser_exports, {
|
||||
FFBrowser: () => FFBrowser,
|
||||
FFBrowserContext: () => FFBrowserContext
|
||||
});
|
||||
module.exports = __toCommonJS(ffBrowser_exports);
|
||||
var import_utils = require("../../utils");
|
||||
var import_browser = require("../browser");
|
||||
var import_browserContext = require("../browserContext");
|
||||
var import_errors = require("../errors");
|
||||
var network = __toESM(require("../network"));
|
||||
var import_ffConnection = require("./ffConnection");
|
||||
var import_ffPage = require("./ffPage");
|
||||
var import_page = require("../page");
|
||||
class FFBrowser extends import_browser.Browser {
|
||||
constructor(parent, connection, options) {
|
||||
super(parent, options);
|
||||
this._version = "";
|
||||
this._userAgent = "";
|
||||
this._connection = connection;
|
||||
this.session = connection.rootSession;
|
||||
this._ffPages = /* @__PURE__ */ new Map();
|
||||
this._contexts = /* @__PURE__ */ new Map();
|
||||
this._connection.on(import_ffConnection.ConnectionEvents.Disconnected, () => this._onDisconnect());
|
||||
this.session.on("Browser.attachedToTarget", this._onAttachedToTarget.bind(this));
|
||||
this.session.on("Browser.detachedFromTarget", this._onDetachedFromTarget.bind(this));
|
||||
this.session.on("Browser.downloadCreated", this._onDownloadCreated.bind(this));
|
||||
this.session.on("Browser.downloadFinished", this._onDownloadFinished.bind(this));
|
||||
this.session.on("Browser.videoRecordingFinished", this._onVideoRecordingFinished.bind(this));
|
||||
}
|
||||
static async connect(parent, transport, options) {
|
||||
const connection = new import_ffConnection.FFConnection(transport, options.protocolLogger, options.browserLogsCollector);
|
||||
const browser = new FFBrowser(parent, connection, options);
|
||||
if (options.__testHookOnConnectToBrowser)
|
||||
await options.__testHookOnConnectToBrowser();
|
||||
let firefoxUserPrefs = options.originalLaunchOptions.firefoxUserPrefs ?? {};
|
||||
if (Object.keys(kBandaidFirefoxUserPrefs).length)
|
||||
firefoxUserPrefs = { ...kBandaidFirefoxUserPrefs, ...firefoxUserPrefs };
|
||||
const promises = [
|
||||
browser.session.send("Browser.enable", {
|
||||
attachToDefaultContext: !!options.persistent,
|
||||
userPrefs: Object.entries(firefoxUserPrefs).map(([name, value]) => ({ name, value }))
|
||||
}),
|
||||
browser._initVersion()
|
||||
];
|
||||
if (options.persistent) {
|
||||
browser._defaultContext = new FFBrowserContext(browser, void 0, options.persistent);
|
||||
promises.push(browser._defaultContext._initialize());
|
||||
}
|
||||
const proxy = options.originalLaunchOptions.proxyOverride || options.proxy;
|
||||
if (proxy)
|
||||
promises.push(browser.session.send("Browser.setBrowserProxy", toJugglerProxyOptions(proxy)));
|
||||
await Promise.all(promises);
|
||||
return browser;
|
||||
}
|
||||
async _initVersion() {
|
||||
const result = await this.session.send("Browser.getInfo");
|
||||
this._version = result.version.substring(result.version.indexOf("/") + 1);
|
||||
this._userAgent = result.userAgent;
|
||||
}
|
||||
isConnected() {
|
||||
return !this._connection._closed;
|
||||
}
|
||||
async doCreateNewContext(options) {
|
||||
if (options.isMobile)
|
||||
throw new Error("options.isMobile is not supported in Firefox");
|
||||
const { browserContextId } = await this.session.send("Browser.createBrowserContext", { removeOnDetach: true });
|
||||
const context = new FFBrowserContext(this, browserContextId, options);
|
||||
await context._initialize();
|
||||
this._contexts.set(browserContextId, context);
|
||||
return context;
|
||||
}
|
||||
contexts() {
|
||||
return Array.from(this._contexts.values());
|
||||
}
|
||||
version() {
|
||||
return this._version;
|
||||
}
|
||||
userAgent() {
|
||||
return this._userAgent;
|
||||
}
|
||||
_onDetachedFromTarget(payload) {
|
||||
const ffPage = this._ffPages.get(payload.targetId);
|
||||
this._ffPages.delete(payload.targetId);
|
||||
ffPage.didClose();
|
||||
}
|
||||
_onAttachedToTarget(payload) {
|
||||
const { targetId, browserContextId, openerId, type } = payload.targetInfo;
|
||||
(0, import_utils.assert)(type === "page");
|
||||
const context = browserContextId ? this._contexts.get(browserContextId) : this._defaultContext;
|
||||
(0, import_utils.assert)(context, `Unknown context id:${browserContextId}, _defaultContext: ${this._defaultContext}`);
|
||||
const session = this._connection.createSession(payload.sessionId);
|
||||
const opener = openerId ? this._ffPages.get(openerId) : null;
|
||||
const ffPage = new import_ffPage.FFPage(session, context, opener);
|
||||
this._ffPages.set(targetId, ffPage);
|
||||
}
|
||||
_onDownloadCreated(payload) {
|
||||
const ffPage = this._ffPages.get(payload.pageTargetId);
|
||||
if (!ffPage)
|
||||
return;
|
||||
ffPage._page.frameManager.frameAbortedNavigation(payload.frameId, "Download is starting");
|
||||
let originPage = ffPage._page.initializedOrUndefined();
|
||||
if (!originPage) {
|
||||
ffPage._markAsError(new Error("Starting new page download"));
|
||||
if (ffPage._opener)
|
||||
originPage = ffPage._opener._page.initializedOrUndefined();
|
||||
}
|
||||
if (!originPage)
|
||||
return;
|
||||
this._downloadCreated(originPage, payload.uuid, payload.url, payload.suggestedFileName);
|
||||
}
|
||||
_onDownloadFinished(payload) {
|
||||
const error = payload.canceled ? "canceled" : payload.error;
|
||||
this._downloadFinished(payload.uuid, error);
|
||||
}
|
||||
_onVideoRecordingFinished(payload) {
|
||||
this._takeVideo(payload.screencastId)?.reportFinished();
|
||||
}
|
||||
_onDisconnect() {
|
||||
for (const video of this._idToVideo.values())
|
||||
video.artifact.reportFinished(new import_errors.TargetClosedError());
|
||||
this._idToVideo.clear();
|
||||
for (const ffPage of this._ffPages.values())
|
||||
ffPage.didClose();
|
||||
this._ffPages.clear();
|
||||
this._didClose();
|
||||
}
|
||||
}
|
||||
class FFBrowserContext extends import_browserContext.BrowserContext {
|
||||
constructor(browser, browserContextId, options) {
|
||||
super(browser, options, browserContextId);
|
||||
}
|
||||
async _initialize() {
|
||||
(0, import_utils.assert)(!this._ffPages().length);
|
||||
const browserContextId = this._browserContextId;
|
||||
const promises = [
|
||||
super._initialize(),
|
||||
this._updateInitScripts()
|
||||
];
|
||||
if (this._options.acceptDownloads !== "internal-browser-default") {
|
||||
promises.push(this._browser.session.send("Browser.setDownloadOptions", {
|
||||
browserContextId,
|
||||
downloadOptions: {
|
||||
behavior: this._options.acceptDownloads === "accept" ? "saveToDisk" : "cancel",
|
||||
downloadsDir: this._browser.options.downloadsPath
|
||||
}
|
||||
}));
|
||||
}
|
||||
promises.push(this.doUpdateDefaultViewport());
|
||||
if (this._options.hasTouch)
|
||||
promises.push(this._browser.session.send("Browser.setTouchOverride", { browserContextId, hasTouch: true }));
|
||||
if (this._options.userAgent)
|
||||
promises.push(this._browser.session.send("Browser.setUserAgentOverride", { browserContextId, userAgent: this._options.userAgent }));
|
||||
if (this._options.bypassCSP)
|
||||
promises.push(this._browser.session.send("Browser.setBypassCSP", { browserContextId, bypassCSP: true }));
|
||||
if (this._options.ignoreHTTPSErrors || this._options.internalIgnoreHTTPSErrors)
|
||||
promises.push(this._browser.session.send("Browser.setIgnoreHTTPSErrors", { browserContextId, ignoreHTTPSErrors: true }));
|
||||
if (this._options.javaScriptEnabled === false)
|
||||
promises.push(this._browser.session.send("Browser.setJavaScriptDisabled", { browserContextId, javaScriptDisabled: true }));
|
||||
if (this._options.locale)
|
||||
promises.push(this._browser.session.send("Browser.setLocaleOverride", { browserContextId, locale: this._options.locale }));
|
||||
if (this._options.timezoneId)
|
||||
promises.push(this._browser.session.send("Browser.setTimezoneOverride", { browserContextId, timezoneId: this._options.timezoneId }));
|
||||
if (this._options.extraHTTPHeaders || this._options.locale)
|
||||
promises.push(this.doUpdateExtraHTTPHeaders());
|
||||
if (this._options.httpCredentials)
|
||||
promises.push(this.setHTTPCredentials(this._options.httpCredentials));
|
||||
if (this._options.geolocation)
|
||||
promises.push(this.setGeolocation(this._options.geolocation));
|
||||
if (this._options.offline)
|
||||
promises.push(this.doUpdateOffline());
|
||||
promises.push(this.doUpdateDefaultEmulatedMedia());
|
||||
if (this._options.recordVideo) {
|
||||
promises.push(this._ensureVideosPath().then(() => {
|
||||
return this._browser.session.send("Browser.setVideoRecordingOptions", {
|
||||
// validateBrowserContextOptions ensures correct video size.
|
||||
options: {
|
||||
...this._options.recordVideo.size,
|
||||
dir: this._options.recordVideo.dir
|
||||
},
|
||||
browserContextId: this._browserContextId
|
||||
});
|
||||
}));
|
||||
}
|
||||
const proxy = this._options.proxyOverride || this._options.proxy;
|
||||
if (proxy) {
|
||||
promises.push(this._browser.session.send("Browser.setContextProxy", {
|
||||
browserContextId: this._browserContextId,
|
||||
...toJugglerProxyOptions(proxy)
|
||||
}));
|
||||
}
|
||||
await Promise.all(promises);
|
||||
}
|
||||
_ffPages() {
|
||||
return Array.from(this._browser._ffPages.values()).filter((ffPage) => ffPage._browserContext === this);
|
||||
}
|
||||
possiblyUninitializedPages() {
|
||||
return this._ffPages().map((ffPage) => ffPage._page);
|
||||
}
|
||||
async doCreateNewPage() {
|
||||
const { targetId } = await this._browser.session.send("Browser.newPage", {
|
||||
browserContextId: this._browserContextId
|
||||
}).catch((e) => {
|
||||
if (e.message.includes("Failed to override timezone"))
|
||||
throw new Error(`Invalid timezone ID: ${this._options.timezoneId}`);
|
||||
throw e;
|
||||
});
|
||||
return this._browser._ffPages.get(targetId)._page;
|
||||
}
|
||||
async doGetCookies(urls) {
|
||||
const { cookies } = await this._browser.session.send("Browser.getCookies", { browserContextId: this._browserContextId });
|
||||
return network.filterCookies(cookies.map((c) => {
|
||||
const { name, value, domain, path, expires, httpOnly, secure, sameSite } = c;
|
||||
return {
|
||||
name,
|
||||
value,
|
||||
domain,
|
||||
path,
|
||||
expires,
|
||||
httpOnly,
|
||||
secure,
|
||||
sameSite
|
||||
};
|
||||
}), urls);
|
||||
}
|
||||
async addCookies(cookies) {
|
||||
const cc = network.rewriteCookies(cookies).map((c) => {
|
||||
const { name, value, url, domain, path, expires, httpOnly, secure, sameSite } = c;
|
||||
return {
|
||||
name,
|
||||
value,
|
||||
url,
|
||||
domain,
|
||||
path,
|
||||
expires: expires === -1 ? void 0 : expires,
|
||||
httpOnly,
|
||||
secure,
|
||||
sameSite
|
||||
};
|
||||
});
|
||||
await this._browser.session.send("Browser.setCookies", { browserContextId: this._browserContextId, cookies: cc });
|
||||
}
|
||||
async doClearCookies() {
|
||||
await this._browser.session.send("Browser.clearCookies", { browserContextId: this._browserContextId });
|
||||
}
|
||||
async doGrantPermissions(origin, permissions) {
|
||||
const webPermissionToProtocol = /* @__PURE__ */ new Map([
|
||||
["geolocation", "geo"],
|
||||
["persistent-storage", "persistent-storage"],
|
||||
["push", "push"],
|
||||
["notifications", "desktop-notification"]
|
||||
]);
|
||||
const filtered = permissions.map((permission) => {
|
||||
const protocolPermission = webPermissionToProtocol.get(permission);
|
||||
if (!protocolPermission)
|
||||
throw new Error("Unknown permission: " + permission);
|
||||
return protocolPermission;
|
||||
});
|
||||
await this._browser.session.send("Browser.grantPermissions", { origin, browserContextId: this._browserContextId, permissions: filtered });
|
||||
}
|
||||
async doClearPermissions() {
|
||||
await this._browser.session.send("Browser.resetPermissions", { browserContextId: this._browserContextId });
|
||||
}
|
||||
async setGeolocation(geolocation) {
|
||||
(0, import_browserContext.verifyGeolocation)(geolocation);
|
||||
this._options.geolocation = geolocation;
|
||||
await this._browser.session.send("Browser.setGeolocationOverride", { browserContextId: this._browserContextId, geolocation: geolocation || null });
|
||||
}
|
||||
async doUpdateExtraHTTPHeaders() {
|
||||
let allHeaders = this._options.extraHTTPHeaders || [];
|
||||
if (this._options.locale)
|
||||
allHeaders = network.mergeHeaders([allHeaders, network.singleHeader("Accept-Language", this._options.locale)]);
|
||||
await this._browser.session.send("Browser.setExtraHTTPHeaders", { browserContextId: this._browserContextId, headers: allHeaders });
|
||||
}
|
||||
async setUserAgent(userAgent) {
|
||||
await this._browser.session.send("Browser.setUserAgentOverride", { browserContextId: this._browserContextId, userAgent: userAgent || null });
|
||||
}
|
||||
async doUpdateOffline() {
|
||||
await this._browser.session.send("Browser.setOnlineOverride", { browserContextId: this._browserContextId, override: this._options.offline ? "offline" : "online" });
|
||||
}
|
||||
async doSetHTTPCredentials(httpCredentials) {
|
||||
this._options.httpCredentials = httpCredentials;
|
||||
let credentials = null;
|
||||
if (httpCredentials) {
|
||||
const { username, password, origin } = httpCredentials;
|
||||
credentials = { username, password, origin };
|
||||
}
|
||||
await this._browser.session.send("Browser.setHTTPCredentials", { browserContextId: this._browserContextId, credentials });
|
||||
}
|
||||
async doAddInitScript(initScript) {
|
||||
await this._updateInitScripts();
|
||||
}
|
||||
async doRemoveInitScripts(initScripts) {
|
||||
await this._updateInitScripts();
|
||||
}
|
||||
async _updateInitScripts() {
|
||||
const bindingScripts = [...this._pageBindings.values()].map((binding) => binding.initScript.source);
|
||||
if (this.bindingsInitScript)
|
||||
bindingScripts.unshift(this.bindingsInitScript.source);
|
||||
const initScripts = this.initScripts.map((script) => script.source);
|
||||
await this._browser.session.send("Browser.setInitScripts", { browserContextId: this._browserContextId, scripts: [...bindingScripts, ...initScripts].map((script) => ({ script })) });
|
||||
}
|
||||
async doUpdateRequestInterception() {
|
||||
await Promise.all([
|
||||
this._browser.session.send("Browser.setRequestInterception", { browserContextId: this._browserContextId, enabled: this.requestInterceptors.length > 0 }),
|
||||
this._browser.session.send("Browser.setCacheDisabled", { browserContextId: this._browserContextId, cacheDisabled: this.requestInterceptors.length > 0 })
|
||||
]);
|
||||
}
|
||||
async doUpdateDefaultViewport() {
|
||||
if (!this._options.viewport)
|
||||
return;
|
||||
const viewport = {
|
||||
viewportSize: { width: this._options.viewport.width, height: this._options.viewport.height },
|
||||
deviceScaleFactor: this._options.deviceScaleFactor || 1
|
||||
};
|
||||
await this._browser.session.send("Browser.setDefaultViewport", { browserContextId: this._browserContextId, viewport });
|
||||
}
|
||||
async doUpdateDefaultEmulatedMedia() {
|
||||
if (this._options.colorScheme !== "no-override") {
|
||||
await this._browser.session.send("Browser.setColorScheme", {
|
||||
browserContextId: this._browserContextId,
|
||||
colorScheme: this._options.colorScheme !== void 0 ? this._options.colorScheme : "light"
|
||||
});
|
||||
}
|
||||
if (this._options.reducedMotion !== "no-override") {
|
||||
await this._browser.session.send("Browser.setReducedMotion", {
|
||||
browserContextId: this._browserContextId,
|
||||
reducedMotion: this._options.reducedMotion !== void 0 ? this._options.reducedMotion : "no-preference"
|
||||
});
|
||||
}
|
||||
if (this._options.forcedColors !== "no-override") {
|
||||
await this._browser.session.send("Browser.setForcedColors", {
|
||||
browserContextId: this._browserContextId,
|
||||
forcedColors: this._options.forcedColors !== void 0 ? this._options.forcedColors : "none"
|
||||
});
|
||||
}
|
||||
if (this._options.contrast !== "no-override") {
|
||||
await this._browser.session.send("Browser.setContrast", {
|
||||
browserContextId: this._browserContextId,
|
||||
contrast: this._options.contrast !== void 0 ? this._options.contrast : "no-preference"
|
||||
});
|
||||
}
|
||||
}
|
||||
async doExposePlaywrightBinding() {
|
||||
this._browser.session.send("Browser.addBinding", { browserContextId: this._browserContextId, name: import_page.PageBinding.kBindingName, script: "" });
|
||||
}
|
||||
onClosePersistent() {
|
||||
}
|
||||
async clearCache() {
|
||||
await this._browser.session.send("Browser.clearCache");
|
||||
}
|
||||
async doClose(reason) {
|
||||
if (!this._browserContextId) {
|
||||
if (this._options.recordVideo) {
|
||||
await this._browser.session.send("Browser.setVideoRecordingOptions", {
|
||||
options: void 0,
|
||||
browserContextId: this._browserContextId
|
||||
});
|
||||
}
|
||||
await this._browser.close({ reason });
|
||||
} else {
|
||||
await this._browser.session.send("Browser.removeBrowserContext", { browserContextId: this._browserContextId });
|
||||
this._browser._contexts.delete(this._browserContextId);
|
||||
}
|
||||
}
|
||||
async cancelDownload(uuid) {
|
||||
await this._browser.session.send("Browser.cancelDownload", { uuid });
|
||||
}
|
||||
}
|
||||
function toJugglerProxyOptions(proxy) {
|
||||
const proxyServer = new URL(proxy.server);
|
||||
let port = parseInt(proxyServer.port, 10);
|
||||
let type = "http";
|
||||
if (proxyServer.protocol === "socks5:")
|
||||
type = "socks";
|
||||
else if (proxyServer.protocol === "socks4:")
|
||||
type = "socks4";
|
||||
else if (proxyServer.protocol === "https:")
|
||||
type = "https";
|
||||
if (proxyServer.port === "") {
|
||||
if (proxyServer.protocol === "http:")
|
||||
port = 80;
|
||||
else if (proxyServer.protocol === "https:")
|
||||
port = 443;
|
||||
}
|
||||
return {
|
||||
type,
|
||||
bypass: proxy.bypass ? proxy.bypass.split(",").map((domain) => domain.trim()) : [],
|
||||
host: proxyServer.hostname,
|
||||
port,
|
||||
username: proxy.username,
|
||||
password: proxy.password
|
||||
};
|
||||
}
|
||||
const kBandaidFirefoxUserPrefs = {};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
FFBrowser,
|
||||
FFBrowserContext
|
||||
});
|
147
node_modules/playwright-core/lib/server/firefox/ffConnection.js
generated
vendored
Normal file
147
node_modules/playwright-core/lib/server/firefox/ffConnection.js
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var ffConnection_exports = {};
|
||||
__export(ffConnection_exports, {
|
||||
ConnectionEvents: () => ConnectionEvents,
|
||||
FFConnection: () => FFConnection,
|
||||
FFSession: () => FFSession,
|
||||
kBrowserCloseMessageId: () => kBrowserCloseMessageId
|
||||
});
|
||||
module.exports = __toCommonJS(ffConnection_exports);
|
||||
var import_events = require("events");
|
||||
var import_debugLogger = require("../utils/debugLogger");
|
||||
var import_helper = require("../helper");
|
||||
var import_protocolError = require("../protocolError");
|
||||
const ConnectionEvents = {
|
||||
Disconnected: Symbol("Disconnected")
|
||||
};
|
||||
const kBrowserCloseMessageId = -9999;
|
||||
class FFConnection extends import_events.EventEmitter {
|
||||
constructor(transport, protocolLogger, browserLogsCollector) {
|
||||
super();
|
||||
this.setMaxListeners(0);
|
||||
this._transport = transport;
|
||||
this._protocolLogger = protocolLogger;
|
||||
this._browserLogsCollector = browserLogsCollector;
|
||||
this._lastId = 0;
|
||||
this._sessions = /* @__PURE__ */ new Map();
|
||||
this._closed = false;
|
||||
this.rootSession = new FFSession(this, "", (message) => this._rawSend(message));
|
||||
this._sessions.set("", this.rootSession);
|
||||
this._transport.onmessage = this._onMessage.bind(this);
|
||||
this._transport.onclose = this._onClose.bind(this);
|
||||
}
|
||||
nextMessageId() {
|
||||
return ++this._lastId;
|
||||
}
|
||||
_rawSend(message) {
|
||||
this._protocolLogger("send", message);
|
||||
this._transport.send(message);
|
||||
}
|
||||
async _onMessage(message) {
|
||||
this._protocolLogger("receive", message);
|
||||
if (message.id === kBrowserCloseMessageId)
|
||||
return;
|
||||
const session = this._sessions.get(message.sessionId || "");
|
||||
if (session)
|
||||
session.dispatchMessage(message);
|
||||
}
|
||||
_onClose(reason) {
|
||||
this._closed = true;
|
||||
this._transport.onmessage = void 0;
|
||||
this._transport.onclose = void 0;
|
||||
this._browserDisconnectedLogs = import_helper.helper.formatBrowserLogs(this._browserLogsCollector.recentLogs(), reason);
|
||||
this.rootSession.dispose();
|
||||
Promise.resolve().then(() => this.emit(ConnectionEvents.Disconnected));
|
||||
}
|
||||
close() {
|
||||
if (!this._closed)
|
||||
this._transport.close();
|
||||
}
|
||||
createSession(sessionId) {
|
||||
const session = new FFSession(this, sessionId, (message) => this._rawSend({ ...message, sessionId }));
|
||||
this._sessions.set(sessionId, session);
|
||||
return session;
|
||||
}
|
||||
}
|
||||
class FFSession extends import_events.EventEmitter {
|
||||
constructor(connection, sessionId, rawSend) {
|
||||
super();
|
||||
this._disposed = false;
|
||||
this._crashed = false;
|
||||
this.setMaxListeners(0);
|
||||
this._callbacks = /* @__PURE__ */ new Map();
|
||||
this._connection = connection;
|
||||
this._sessionId = sessionId;
|
||||
this._rawSend = rawSend;
|
||||
this.on = super.on;
|
||||
this.addListener = super.addListener;
|
||||
this.off = super.removeListener;
|
||||
this.removeListener = super.removeListener;
|
||||
this.once = super.once;
|
||||
}
|
||||
markAsCrashed() {
|
||||
this._crashed = true;
|
||||
}
|
||||
async send(method, params) {
|
||||
if (this._crashed || this._disposed || this._connection._closed || this._connection._browserDisconnectedLogs)
|
||||
throw new import_protocolError.ProtocolError(this._crashed ? "crashed" : "closed", void 0, this._connection._browserDisconnectedLogs);
|
||||
const id = this._connection.nextMessageId();
|
||||
this._rawSend({ method, params, id });
|
||||
return new Promise((resolve, reject) => {
|
||||
this._callbacks.set(id, { resolve, reject, error: new import_protocolError.ProtocolError("error", method) });
|
||||
});
|
||||
}
|
||||
sendMayFail(method, params) {
|
||||
return this.send(method, params).catch((error) => import_debugLogger.debugLogger.log("error", error));
|
||||
}
|
||||
dispatchMessage(object) {
|
||||
if (object.id) {
|
||||
const callback = this._callbacks.get(object.id);
|
||||
if (callback) {
|
||||
this._callbacks.delete(object.id);
|
||||
if (object.error) {
|
||||
callback.error.setMessage(object.error.message);
|
||||
callback.reject(callback.error);
|
||||
} else {
|
||||
callback.resolve(object.result);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Promise.resolve().then(() => this.emit(object.method, object.params));
|
||||
}
|
||||
}
|
||||
dispose() {
|
||||
this._disposed = true;
|
||||
this._connection._sessions.delete(this._sessionId);
|
||||
for (const callback of this._callbacks.values()) {
|
||||
callback.error.type = this._crashed ? "crashed" : "closed";
|
||||
callback.error.logs = this._connection._browserDisconnectedLogs;
|
||||
callback.reject(callback.error);
|
||||
}
|
||||
this._callbacks.clear();
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ConnectionEvents,
|
||||
FFConnection,
|
||||
FFSession,
|
||||
kBrowserCloseMessageId
|
||||
});
|
150
node_modules/playwright-core/lib/server/firefox/ffExecutionContext.js
generated
vendored
Normal file
150
node_modules/playwright-core/lib/server/firefox/ffExecutionContext.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var ffExecutionContext_exports = {};
|
||||
__export(ffExecutionContext_exports, {
|
||||
FFExecutionContext: () => FFExecutionContext,
|
||||
createHandle: () => createHandle
|
||||
});
|
||||
module.exports = __toCommonJS(ffExecutionContext_exports);
|
||||
var import_assert = require("../../utils/isomorphic/assert");
|
||||
var import_stackTrace = require("../../utils/isomorphic/stackTrace");
|
||||
var import_utilityScriptSerializers = require("../../utils/isomorphic/utilityScriptSerializers");
|
||||
var js = __toESM(require("../javascript"));
|
||||
var dom = __toESM(require("../dom"));
|
||||
var import_protocolError = require("../protocolError");
|
||||
class FFExecutionContext {
|
||||
constructor(session, executionContextId) {
|
||||
this._session = session;
|
||||
this._executionContextId = executionContextId;
|
||||
}
|
||||
async rawEvaluateJSON(expression) {
|
||||
const payload = await this._session.send("Runtime.evaluate", {
|
||||
expression,
|
||||
returnByValue: true,
|
||||
executionContextId: this._executionContextId
|
||||
}).catch(rewriteError);
|
||||
checkException(payload.exceptionDetails);
|
||||
return payload.result.value;
|
||||
}
|
||||
async rawEvaluateHandle(context, expression) {
|
||||
const payload = await this._session.send("Runtime.evaluate", {
|
||||
expression,
|
||||
returnByValue: false,
|
||||
executionContextId: this._executionContextId
|
||||
}).catch(rewriteError);
|
||||
checkException(payload.exceptionDetails);
|
||||
return createHandle(context, payload.result);
|
||||
}
|
||||
async evaluateWithArguments(expression, returnByValue, utilityScript, values, handles) {
|
||||
const payload = await this._session.send("Runtime.callFunction", {
|
||||
functionDeclaration: expression,
|
||||
args: [
|
||||
{ objectId: utilityScript._objectId, value: void 0 },
|
||||
...values.map((value) => ({ value })),
|
||||
...handles.map((handle) => ({ objectId: handle._objectId, value: void 0 }))
|
||||
],
|
||||
returnByValue,
|
||||
executionContextId: this._executionContextId
|
||||
}).catch(rewriteError);
|
||||
checkException(payload.exceptionDetails);
|
||||
if (returnByValue)
|
||||
return (0, import_utilityScriptSerializers.parseEvaluationResultValue)(payload.result.value);
|
||||
return createHandle(utilityScript._context, payload.result);
|
||||
}
|
||||
async getProperties(object) {
|
||||
const response = await this._session.send("Runtime.getObjectProperties", {
|
||||
executionContextId: this._executionContextId,
|
||||
objectId: object._objectId
|
||||
});
|
||||
const result = /* @__PURE__ */ new Map();
|
||||
for (const property of response.properties)
|
||||
result.set(property.name, createHandle(object._context, property.value));
|
||||
return result;
|
||||
}
|
||||
async releaseHandle(handle) {
|
||||
if (!handle._objectId)
|
||||
return;
|
||||
await this._session.send("Runtime.disposeObject", {
|
||||
executionContextId: this._executionContextId,
|
||||
objectId: handle._objectId
|
||||
});
|
||||
}
|
||||
}
|
||||
function checkException(exceptionDetails) {
|
||||
if (!exceptionDetails)
|
||||
return;
|
||||
if (exceptionDetails.value)
|
||||
throw new js.JavaScriptErrorInEvaluate(JSON.stringify(exceptionDetails.value));
|
||||
else
|
||||
throw new js.JavaScriptErrorInEvaluate(exceptionDetails.text + (exceptionDetails.stack ? "\n" + exceptionDetails.stack : ""));
|
||||
}
|
||||
function rewriteError(error) {
|
||||
if (error.message.includes("cyclic object value") || error.message.includes("Object is not serializable"))
|
||||
return { result: { type: "undefined", value: void 0 } };
|
||||
if (error instanceof TypeError && error.message.startsWith("Converting circular structure to JSON"))
|
||||
(0, import_stackTrace.rewriteErrorMessage)(error, error.message + " Are you passing a nested JSHandle?");
|
||||
if (!js.isJavaScriptErrorInEvaluate(error) && !(0, import_protocolError.isSessionClosedError)(error))
|
||||
throw new Error("Execution context was destroyed, most likely because of a navigation.");
|
||||
throw error;
|
||||
}
|
||||
function potentiallyUnserializableValue(remoteObject) {
|
||||
const value = remoteObject.value;
|
||||
const unserializableValue = remoteObject.unserializableValue;
|
||||
return unserializableValue ? js.parseUnserializableValue(unserializableValue) : value;
|
||||
}
|
||||
function renderPreview(object) {
|
||||
if (object.type === "undefined")
|
||||
return "undefined";
|
||||
if (object.unserializableValue)
|
||||
return String(object.unserializableValue);
|
||||
if (object.type === "symbol")
|
||||
return "Symbol()";
|
||||
if (object.subtype === "regexp")
|
||||
return "RegExp";
|
||||
if (object.subtype === "weakmap")
|
||||
return "WeakMap";
|
||||
if (object.subtype === "weakset")
|
||||
return "WeakSet";
|
||||
if (object.subtype)
|
||||
return object.subtype[0].toUpperCase() + object.subtype.slice(1);
|
||||
if ("value" in object)
|
||||
return String(object.value);
|
||||
}
|
||||
function createHandle(context, remoteObject) {
|
||||
if (remoteObject.subtype === "node") {
|
||||
(0, import_assert.assert)(context instanceof dom.FrameExecutionContext);
|
||||
return new dom.ElementHandle(context, remoteObject.objectId);
|
||||
}
|
||||
return new js.JSHandle(context, remoteObject.subtype || remoteObject.type || "", renderPreview(remoteObject), remoteObject.objectId, potentiallyUnserializableValue(remoteObject));
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
FFExecutionContext,
|
||||
createHandle
|
||||
});
|
159
node_modules/playwright-core/lib/server/firefox/ffInput.js
generated
vendored
Normal file
159
node_modules/playwright-core/lib/server/firefox/ffInput.js
generated
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var ffInput_exports = {};
|
||||
__export(ffInput_exports, {
|
||||
RawKeyboardImpl: () => RawKeyboardImpl,
|
||||
RawMouseImpl: () => RawMouseImpl,
|
||||
RawTouchscreenImpl: () => RawTouchscreenImpl
|
||||
});
|
||||
module.exports = __toCommonJS(ffInput_exports);
|
||||
function toModifiersMask(modifiers) {
|
||||
let mask = 0;
|
||||
if (modifiers.has("Alt"))
|
||||
mask |= 1;
|
||||
if (modifiers.has("Control"))
|
||||
mask |= 2;
|
||||
if (modifiers.has("Shift"))
|
||||
mask |= 4;
|
||||
if (modifiers.has("Meta"))
|
||||
mask |= 8;
|
||||
return mask;
|
||||
}
|
||||
function toButtonNumber(button) {
|
||||
if (button === "left")
|
||||
return 0;
|
||||
if (button === "middle")
|
||||
return 1;
|
||||
if (button === "right")
|
||||
return 2;
|
||||
return 0;
|
||||
}
|
||||
function toButtonsMask(buttons) {
|
||||
let mask = 0;
|
||||
if (buttons.has("left"))
|
||||
mask |= 1;
|
||||
if (buttons.has("right"))
|
||||
mask |= 2;
|
||||
if (buttons.has("middle"))
|
||||
mask |= 4;
|
||||
return mask;
|
||||
}
|
||||
class RawKeyboardImpl {
|
||||
constructor(client) {
|
||||
this._client = client;
|
||||
}
|
||||
async keydown(progress, modifiers, keyName, description, autoRepeat) {
|
||||
let text = description.text;
|
||||
if (text === "\r")
|
||||
text = "";
|
||||
const { code, key, location } = description;
|
||||
await progress.race(this._client.send("Page.dispatchKeyEvent", {
|
||||
type: "keydown",
|
||||
keyCode: description.keyCodeWithoutLocation,
|
||||
code,
|
||||
key,
|
||||
repeat: autoRepeat,
|
||||
location,
|
||||
text
|
||||
}));
|
||||
}
|
||||
async keyup(progress, modifiers, keyName, description) {
|
||||
const { code, key, location } = description;
|
||||
await progress.race(this._client.send("Page.dispatchKeyEvent", {
|
||||
type: "keyup",
|
||||
key,
|
||||
keyCode: description.keyCodeWithoutLocation,
|
||||
code,
|
||||
location,
|
||||
repeat: false
|
||||
}));
|
||||
}
|
||||
async sendText(progress, text) {
|
||||
await progress.race(this._client.send("Page.insertText", { text }));
|
||||
}
|
||||
}
|
||||
class RawMouseImpl {
|
||||
constructor(client) {
|
||||
this._client = client;
|
||||
}
|
||||
async move(progress, x, y, button, buttons, modifiers, forClick) {
|
||||
await progress.race(this._client.send("Page.dispatchMouseEvent", {
|
||||
type: "mousemove",
|
||||
button: 0,
|
||||
buttons: toButtonsMask(buttons),
|
||||
x: Math.floor(x),
|
||||
y: Math.floor(y),
|
||||
modifiers: toModifiersMask(modifiers)
|
||||
}));
|
||||
}
|
||||
async down(progress, x, y, button, buttons, modifiers, clickCount) {
|
||||
await progress.race(this._client.send("Page.dispatchMouseEvent", {
|
||||
type: "mousedown",
|
||||
button: toButtonNumber(button),
|
||||
buttons: toButtonsMask(buttons),
|
||||
x: Math.floor(x),
|
||||
y: Math.floor(y),
|
||||
modifiers: toModifiersMask(modifiers),
|
||||
clickCount
|
||||
}));
|
||||
}
|
||||
async up(progress, x, y, button, buttons, modifiers, clickCount) {
|
||||
await progress.race(this._client.send("Page.dispatchMouseEvent", {
|
||||
type: "mouseup",
|
||||
button: toButtonNumber(button),
|
||||
buttons: toButtonsMask(buttons),
|
||||
x: Math.floor(x),
|
||||
y: Math.floor(y),
|
||||
modifiers: toModifiersMask(modifiers),
|
||||
clickCount
|
||||
}));
|
||||
}
|
||||
async wheel(progress, x, y, buttons, modifiers, deltaX, deltaY) {
|
||||
await this._page.mainFrame().evaluateExpression(`new Promise(requestAnimationFrame)`, { world: "utility" });
|
||||
await progress.race(this._client.send("Page.dispatchWheelEvent", {
|
||||
deltaX,
|
||||
deltaY,
|
||||
x: Math.floor(x),
|
||||
y: Math.floor(y),
|
||||
deltaZ: 0,
|
||||
modifiers: toModifiersMask(modifiers)
|
||||
}));
|
||||
}
|
||||
setPage(page) {
|
||||
this._page = page;
|
||||
}
|
||||
}
|
||||
class RawTouchscreenImpl {
|
||||
constructor(client) {
|
||||
this._client = client;
|
||||
}
|
||||
async tap(progress, x, y, modifiers) {
|
||||
await progress.race(this._client.send("Page.dispatchTapEvent", {
|
||||
x,
|
||||
y,
|
||||
modifiers: toModifiersMask(modifiers)
|
||||
}));
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
RawKeyboardImpl,
|
||||
RawMouseImpl,
|
||||
RawTouchscreenImpl
|
||||
});
|
256
node_modules/playwright-core/lib/server/firefox/ffNetworkManager.js
generated
vendored
Normal file
256
node_modules/playwright-core/lib/server/firefox/ffNetworkManager.js
generated
vendored
Normal file
@@ -0,0 +1,256 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var ffNetworkManager_exports = {};
|
||||
__export(ffNetworkManager_exports, {
|
||||
FFNetworkManager: () => FFNetworkManager
|
||||
});
|
||||
module.exports = __toCommonJS(ffNetworkManager_exports);
|
||||
var import_eventsHelper = require("../utils/eventsHelper");
|
||||
var network = __toESM(require("../network"));
|
||||
class FFNetworkManager {
|
||||
constructor(session, page) {
|
||||
this._session = session;
|
||||
this._requests = /* @__PURE__ */ new Map();
|
||||
this._page = page;
|
||||
this._eventListeners = [
|
||||
import_eventsHelper.eventsHelper.addEventListener(session, "Network.requestWillBeSent", this._onRequestWillBeSent.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(session, "Network.responseReceived", this._onResponseReceived.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(session, "Network.requestFinished", this._onRequestFinished.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(session, "Network.requestFailed", this._onRequestFailed.bind(this))
|
||||
];
|
||||
}
|
||||
dispose() {
|
||||
import_eventsHelper.eventsHelper.removeEventListeners(this._eventListeners);
|
||||
}
|
||||
async setRequestInterception(enabled) {
|
||||
await Promise.all([
|
||||
this._session.send("Network.setRequestInterception", { enabled }),
|
||||
this._session.send("Page.setCacheDisabled", { cacheDisabled: enabled })
|
||||
]);
|
||||
}
|
||||
_onRequestWillBeSent(event) {
|
||||
const redirectedFrom = event.redirectedFrom ? this._requests.get(event.redirectedFrom) || null : null;
|
||||
const frame = redirectedFrom ? redirectedFrom.request.frame() : event.frameId ? this._page.frameManager.frame(event.frameId) : null;
|
||||
if (!frame)
|
||||
return;
|
||||
if (event.method === "OPTIONS" && !event.isIntercepted)
|
||||
return;
|
||||
if (redirectedFrom)
|
||||
this._requests.delete(redirectedFrom._id);
|
||||
const request = new InterceptableRequest(frame, redirectedFrom, event);
|
||||
let route;
|
||||
if (event.isIntercepted)
|
||||
route = new FFRouteImpl(this._session, request);
|
||||
this._requests.set(request._id, request);
|
||||
this._page.frameManager.requestStarted(request.request, route);
|
||||
}
|
||||
_onResponseReceived(event) {
|
||||
const request = this._requests.get(event.requestId);
|
||||
if (!request)
|
||||
return;
|
||||
const getResponseBody = async () => {
|
||||
const response2 = await this._session.send("Network.getResponseBody", {
|
||||
requestId: request._id
|
||||
});
|
||||
if (response2.evicted)
|
||||
throw new Error(`Response body for ${request.request.method()} ${request.request.url()} was evicted!`);
|
||||
return Buffer.from(response2.base64body, "base64");
|
||||
};
|
||||
const startTime = event.timing.startTime;
|
||||
function relativeToStart(time) {
|
||||
if (!time)
|
||||
return -1;
|
||||
return (time - startTime) / 1e3;
|
||||
}
|
||||
const timing = {
|
||||
startTime: startTime / 1e3,
|
||||
domainLookupStart: relativeToStart(event.timing.domainLookupStart),
|
||||
domainLookupEnd: relativeToStart(event.timing.domainLookupEnd),
|
||||
connectStart: relativeToStart(event.timing.connectStart),
|
||||
secureConnectionStart: relativeToStart(event.timing.secureConnectionStart),
|
||||
connectEnd: relativeToStart(event.timing.connectEnd),
|
||||
requestStart: relativeToStart(event.timing.requestStart),
|
||||
responseStart: relativeToStart(event.timing.responseStart)
|
||||
};
|
||||
const response = new network.Response(request.request, event.status, event.statusText, parseMultivalueHeaders(event.headers), timing, getResponseBody, event.fromServiceWorker);
|
||||
if (event?.remoteIPAddress && typeof event?.remotePort === "number") {
|
||||
response._serverAddrFinished({
|
||||
ipAddress: event.remoteIPAddress,
|
||||
port: event.remotePort
|
||||
});
|
||||
} else {
|
||||
response._serverAddrFinished();
|
||||
}
|
||||
response._securityDetailsFinished({
|
||||
protocol: event?.securityDetails?.protocol,
|
||||
subjectName: event?.securityDetails?.subjectName,
|
||||
issuer: event?.securityDetails?.issuer,
|
||||
validFrom: event?.securityDetails?.validFrom,
|
||||
validTo: event?.securityDetails?.validTo
|
||||
});
|
||||
response.setRawResponseHeaders(null);
|
||||
response.setResponseHeadersSize(null);
|
||||
this._page.frameManager.requestReceivedResponse(response);
|
||||
}
|
||||
_onRequestFinished(event) {
|
||||
const request = this._requests.get(event.requestId);
|
||||
if (!request)
|
||||
return;
|
||||
const response = request.request._existingResponse();
|
||||
response.setTransferSize(event.transferSize);
|
||||
response.setEncodedBodySize(event.encodedBodySize);
|
||||
const isRedirected = response.status() >= 300 && response.status() <= 399;
|
||||
const responseEndTime = event.responseEndTime ? event.responseEndTime / 1e3 - response.timing().startTime : -1;
|
||||
if (isRedirected) {
|
||||
response._requestFinished(responseEndTime);
|
||||
} else {
|
||||
this._requests.delete(request._id);
|
||||
response._requestFinished(responseEndTime);
|
||||
}
|
||||
if (event.protocolVersion)
|
||||
response._setHttpVersion(event.protocolVersion);
|
||||
this._page.frameManager.reportRequestFinished(request.request, response);
|
||||
}
|
||||
_onRequestFailed(event) {
|
||||
const request = this._requests.get(event.requestId);
|
||||
if (!request)
|
||||
return;
|
||||
this._requests.delete(request._id);
|
||||
const response = request.request._existingResponse();
|
||||
if (response) {
|
||||
response.setTransferSize(null);
|
||||
response.setEncodedBodySize(null);
|
||||
response._requestFinished(-1);
|
||||
}
|
||||
request.request._setFailureText(event.errorCode);
|
||||
this._page.frameManager.requestFailed(request.request, event.errorCode === "NS_BINDING_ABORTED");
|
||||
}
|
||||
}
|
||||
const causeToResourceType = {
|
||||
TYPE_INVALID: "other",
|
||||
TYPE_OTHER: "other",
|
||||
TYPE_SCRIPT: "script",
|
||||
TYPE_IMAGE: "image",
|
||||
TYPE_STYLESHEET: "stylesheet",
|
||||
TYPE_OBJECT: "other",
|
||||
TYPE_DOCUMENT: "document",
|
||||
TYPE_SUBDOCUMENT: "document",
|
||||
TYPE_REFRESH: "document",
|
||||
TYPE_XBL: "other",
|
||||
TYPE_PING: "other",
|
||||
TYPE_XMLHTTPREQUEST: "xhr",
|
||||
TYPE_OBJECT_SUBREQUEST: "other",
|
||||
TYPE_DTD: "other",
|
||||
TYPE_FONT: "font",
|
||||
TYPE_MEDIA: "media",
|
||||
TYPE_WEBSOCKET: "websocket",
|
||||
TYPE_CSP_REPORT: "other",
|
||||
TYPE_XSLT: "other",
|
||||
TYPE_BEACON: "other",
|
||||
TYPE_FETCH: "fetch",
|
||||
TYPE_IMAGESET: "image",
|
||||
TYPE_WEB_MANIFEST: "manifest"
|
||||
};
|
||||
const internalCauseToResourceType = {
|
||||
TYPE_INTERNAL_EVENTSOURCE: "eventsource"
|
||||
};
|
||||
class InterceptableRequest {
|
||||
constructor(frame, redirectedFrom, payload) {
|
||||
this._id = payload.requestId;
|
||||
if (redirectedFrom)
|
||||
redirectedFrom._redirectedTo = this;
|
||||
let postDataBuffer = null;
|
||||
if (payload.postData)
|
||||
postDataBuffer = Buffer.from(payload.postData, "base64");
|
||||
this.request = new network.Request(
|
||||
frame._page.browserContext,
|
||||
frame,
|
||||
null,
|
||||
redirectedFrom ? redirectedFrom.request : null,
|
||||
payload.navigationId,
|
||||
payload.url,
|
||||
internalCauseToResourceType[payload.internalCause] || causeToResourceType[payload.cause] || "other",
|
||||
payload.method,
|
||||
postDataBuffer,
|
||||
payload.headers
|
||||
);
|
||||
this.request.setRawRequestHeaders(null);
|
||||
}
|
||||
_finalRequest() {
|
||||
let request = this;
|
||||
while (request._redirectedTo)
|
||||
request = request._redirectedTo;
|
||||
return request;
|
||||
}
|
||||
}
|
||||
class FFRouteImpl {
|
||||
constructor(session, request) {
|
||||
this._session = session;
|
||||
this._request = request;
|
||||
}
|
||||
async continue(overrides) {
|
||||
await this._session.sendMayFail("Network.resumeInterceptedRequest", {
|
||||
requestId: this._request._id,
|
||||
url: overrides.url,
|
||||
method: overrides.method,
|
||||
headers: overrides.headers,
|
||||
postData: overrides.postData ? Buffer.from(overrides.postData).toString("base64") : void 0
|
||||
});
|
||||
}
|
||||
async fulfill(response) {
|
||||
const base64body = response.isBase64 ? response.body : Buffer.from(response.body).toString("base64");
|
||||
await this._session.sendMayFail("Network.fulfillInterceptedRequest", {
|
||||
requestId: this._request._id,
|
||||
status: response.status,
|
||||
statusText: network.statusText(response.status),
|
||||
headers: response.headers,
|
||||
base64body
|
||||
});
|
||||
}
|
||||
async abort(errorCode) {
|
||||
await this._session.sendMayFail("Network.abortInterceptedRequest", {
|
||||
requestId: this._request._id,
|
||||
errorCode
|
||||
});
|
||||
}
|
||||
}
|
||||
function parseMultivalueHeaders(headers) {
|
||||
const result = [];
|
||||
for (const header of headers) {
|
||||
const separator = header.name.toLowerCase() === "set-cookie" ? "\n" : ",";
|
||||
const tokens = header.value.split(separator).map((s) => s.trim());
|
||||
for (const token of tokens)
|
||||
result.push({ name: header.name, value: token });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
FFNetworkManager
|
||||
});
|
504
node_modules/playwright-core/lib/server/firefox/ffPage.js
generated
vendored
Normal file
504
node_modules/playwright-core/lib/server/firefox/ffPage.js
generated
vendored
Normal file
@@ -0,0 +1,504 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var ffPage_exports = {};
|
||||
__export(ffPage_exports, {
|
||||
FFPage: () => FFPage,
|
||||
UTILITY_WORLD_NAME: () => UTILITY_WORLD_NAME
|
||||
});
|
||||
module.exports = __toCommonJS(ffPage_exports);
|
||||
var import_eventsHelper = require("../utils/eventsHelper");
|
||||
var dialog = __toESM(require("../dialog"));
|
||||
var dom = __toESM(require("../dom"));
|
||||
var import_page = require("../page");
|
||||
var import_page2 = require("../page");
|
||||
var import_ffAccessibility = require("./ffAccessibility");
|
||||
var import_ffConnection = require("./ffConnection");
|
||||
var import_ffExecutionContext = require("./ffExecutionContext");
|
||||
var import_ffInput = require("./ffInput");
|
||||
var import_ffNetworkManager = require("./ffNetworkManager");
|
||||
var import_debugLogger = require("../utils/debugLogger");
|
||||
var import_stackTrace = require("../../utils/isomorphic/stackTrace");
|
||||
var import_browserContext = require("../browserContext");
|
||||
var import_errors = require("../errors");
|
||||
const UTILITY_WORLD_NAME = "__playwright_utility_world__";
|
||||
class FFPage {
|
||||
constructor(session, browserContext, opener) {
|
||||
this.cspErrorsAsynchronousForInlineScripts = true;
|
||||
this._reportedAsNew = false;
|
||||
this._workers = /* @__PURE__ */ new Map();
|
||||
this._initScripts = [];
|
||||
this._session = session;
|
||||
this._opener = opener;
|
||||
this.rawKeyboard = new import_ffInput.RawKeyboardImpl(session);
|
||||
this.rawMouse = new import_ffInput.RawMouseImpl(session);
|
||||
this.rawTouchscreen = new import_ffInput.RawTouchscreenImpl(session);
|
||||
this._contextIdToContext = /* @__PURE__ */ new Map();
|
||||
this._browserContext = browserContext;
|
||||
this._page = new import_page2.Page(this, browserContext);
|
||||
this.rawMouse.setPage(this._page);
|
||||
this._networkManager = new import_ffNetworkManager.FFNetworkManager(session, this._page);
|
||||
this._page.on(import_page2.Page.Events.FrameDetached, (frame) => this._removeContextsForFrame(frame));
|
||||
this._eventListeners = [
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.eventFired", this._onEventFired.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.frameAttached", this._onFrameAttached.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.frameDetached", this._onFrameDetached.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.navigationAborted", this._onNavigationAborted.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.navigationCommitted", this._onNavigationCommitted.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.navigationStarted", this._onNavigationStarted.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.sameDocumentNavigation", this._onSameDocumentNavigation.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Runtime.executionContextCreated", this._onExecutionContextCreated.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Runtime.executionContextDestroyed", this._onExecutionContextDestroyed.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Runtime.executionContextsCleared", this._onExecutionContextsCleared.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.linkClicked", (event) => this._onLinkClicked(event.phase)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.uncaughtError", this._onUncaughtError.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Runtime.console", this._onConsole.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.dialogOpened", this._onDialogOpened.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.bindingCalled", this._onBindingCalled.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.fileChooserOpened", this._onFileChooserOpened.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.workerCreated", this._onWorkerCreated.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.workerDestroyed", this._onWorkerDestroyed.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.dispatchMessageFromWorker", this._onDispatchMessageFromWorker.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.crashed", this._onCrashed.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.videoRecordingStarted", this._onVideoRecordingStarted.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.webSocketCreated", this._onWebSocketCreated.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.webSocketClosed", this._onWebSocketClosed.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.webSocketFrameReceived", this._onWebSocketFrameReceived.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.webSocketFrameSent", this._onWebSocketFrameSent.bind(this)),
|
||||
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.screencastFrame", this._onScreencastFrame.bind(this))
|
||||
];
|
||||
this._session.once("Page.ready", () => {
|
||||
if (this._reportedAsNew)
|
||||
return;
|
||||
this._reportedAsNew = true;
|
||||
this._page.reportAsNew(this._opener?._page);
|
||||
});
|
||||
this.addInitScript(new import_page.InitScript(""), UTILITY_WORLD_NAME).catch((e) => this._markAsError(e));
|
||||
}
|
||||
async _markAsError(error) {
|
||||
if (this._reportedAsNew)
|
||||
return;
|
||||
this._reportedAsNew = true;
|
||||
this._page.reportAsNew(this._opener?._page, error);
|
||||
}
|
||||
_onWebSocketCreated(event) {
|
||||
this._page.frameManager.onWebSocketCreated(webSocketId(event.frameId, event.wsid), event.requestURL);
|
||||
this._page.frameManager.onWebSocketRequest(webSocketId(event.frameId, event.wsid));
|
||||
}
|
||||
_onWebSocketClosed(event) {
|
||||
if (event.error)
|
||||
this._page.frameManager.webSocketError(webSocketId(event.frameId, event.wsid), event.error);
|
||||
this._page.frameManager.webSocketClosed(webSocketId(event.frameId, event.wsid));
|
||||
}
|
||||
_onWebSocketFrameReceived(event) {
|
||||
this._page.frameManager.webSocketFrameReceived(webSocketId(event.frameId, event.wsid), event.opcode, event.data);
|
||||
}
|
||||
_onWebSocketFrameSent(event) {
|
||||
this._page.frameManager.onWebSocketFrameSent(webSocketId(event.frameId, event.wsid), event.opcode, event.data);
|
||||
}
|
||||
_onExecutionContextCreated(payload) {
|
||||
const { executionContextId, auxData } = payload;
|
||||
const frame = this._page.frameManager.frame(auxData.frameId);
|
||||
if (!frame)
|
||||
return;
|
||||
const delegate = new import_ffExecutionContext.FFExecutionContext(this._session, executionContextId);
|
||||
let worldName = null;
|
||||
if (auxData.name === UTILITY_WORLD_NAME)
|
||||
worldName = "utility";
|
||||
else if (!auxData.name)
|
||||
worldName = "main";
|
||||
const context = new dom.FrameExecutionContext(delegate, frame, worldName);
|
||||
if (worldName)
|
||||
frame._contextCreated(worldName, context);
|
||||
this._contextIdToContext.set(executionContextId, context);
|
||||
}
|
||||
_onExecutionContextDestroyed(payload) {
|
||||
const { executionContextId } = payload;
|
||||
const context = this._contextIdToContext.get(executionContextId);
|
||||
if (!context)
|
||||
return;
|
||||
this._contextIdToContext.delete(executionContextId);
|
||||
context.frame._contextDestroyed(context);
|
||||
}
|
||||
_onExecutionContextsCleared() {
|
||||
for (const executionContextId of Array.from(this._contextIdToContext.keys()))
|
||||
this._onExecutionContextDestroyed({ executionContextId });
|
||||
}
|
||||
_removeContextsForFrame(frame) {
|
||||
for (const [contextId, context] of this._contextIdToContext) {
|
||||
if (context.frame === frame)
|
||||
this._contextIdToContext.delete(contextId);
|
||||
}
|
||||
}
|
||||
_onLinkClicked(phase) {
|
||||
if (phase === "before")
|
||||
this._page.frameManager.frameWillPotentiallyRequestNavigation();
|
||||
else
|
||||
this._page.frameManager.frameDidPotentiallyRequestNavigation();
|
||||
}
|
||||
_onNavigationStarted(params) {
|
||||
this._page.frameManager.frameRequestedNavigation(params.frameId, params.navigationId);
|
||||
}
|
||||
_onNavigationAborted(params) {
|
||||
this._page.frameManager.frameAbortedNavigation(params.frameId, params.errorText, params.navigationId);
|
||||
}
|
||||
_onNavigationCommitted(params) {
|
||||
for (const [workerId, worker] of this._workers) {
|
||||
if (worker.frameId === params.frameId)
|
||||
this._onWorkerDestroyed({ workerId });
|
||||
}
|
||||
this._page.frameManager.frameCommittedNewDocumentNavigation(params.frameId, params.url, params.name || "", params.navigationId || "", false);
|
||||
}
|
||||
_onSameDocumentNavigation(params) {
|
||||
this._page.frameManager.frameCommittedSameDocumentNavigation(params.frameId, params.url);
|
||||
}
|
||||
_onFrameAttached(params) {
|
||||
this._page.frameManager.frameAttached(params.frameId, params.parentFrameId);
|
||||
}
|
||||
_onFrameDetached(params) {
|
||||
this._page.frameManager.frameDetached(params.frameId);
|
||||
}
|
||||
_onEventFired(payload) {
|
||||
const { frameId, name } = payload;
|
||||
if (name === "load")
|
||||
this._page.frameManager.frameLifecycleEvent(frameId, "load");
|
||||
if (name === "DOMContentLoaded")
|
||||
this._page.frameManager.frameLifecycleEvent(frameId, "domcontentloaded");
|
||||
}
|
||||
_onUncaughtError(params) {
|
||||
const { name, message } = (0, import_stackTrace.splitErrorMessage)(params.message);
|
||||
const error = new Error(message);
|
||||
error.stack = params.message + "\n" + params.stack.split("\n").filter(Boolean).map((a) => a.replace(/([^@]*)@(.*)/, " at $1 ($2)")).join("\n");
|
||||
error.name = name;
|
||||
this._page.emitOnContextOnceInitialized(import_browserContext.BrowserContext.Events.PageError, error, this._page);
|
||||
}
|
||||
_onConsole(payload) {
|
||||
const { type, args, executionContextId, location } = payload;
|
||||
const context = this._contextIdToContext.get(executionContextId);
|
||||
if (!context)
|
||||
return;
|
||||
this._page.addConsoleMessage(type === "warn" ? "warning" : type, args.map((arg) => (0, import_ffExecutionContext.createHandle)(context, arg)), location);
|
||||
}
|
||||
_onDialogOpened(params) {
|
||||
this._page.browserContext.dialogManager.dialogDidOpen(new dialog.Dialog(
|
||||
this._page,
|
||||
params.type,
|
||||
params.message,
|
||||
async (accept, promptText) => {
|
||||
await this._session.sendMayFail("Page.handleDialog", { dialogId: params.dialogId, accept, promptText });
|
||||
},
|
||||
params.defaultValue
|
||||
));
|
||||
}
|
||||
async _onBindingCalled(event) {
|
||||
const pageOrError = await this._page.waitForInitializedOrError();
|
||||
if (!(pageOrError instanceof Error)) {
|
||||
const context = this._contextIdToContext.get(event.executionContextId);
|
||||
if (context)
|
||||
await this._page.onBindingCalled(event.payload, context);
|
||||
}
|
||||
}
|
||||
async _onFileChooserOpened(payload) {
|
||||
const { executionContextId, element } = payload;
|
||||
const context = this._contextIdToContext.get(executionContextId);
|
||||
if (!context)
|
||||
return;
|
||||
const handle = (0, import_ffExecutionContext.createHandle)(context, element).asElement();
|
||||
await this._page._onFileChooserOpened(handle);
|
||||
}
|
||||
async _onWorkerCreated(event) {
|
||||
const workerId = event.workerId;
|
||||
const worker = new import_page2.Worker(this._page, event.url);
|
||||
const workerSession = new import_ffConnection.FFSession(this._session._connection, workerId, (message) => {
|
||||
this._session.send("Page.sendMessageToWorker", {
|
||||
frameId: event.frameId,
|
||||
workerId,
|
||||
message: JSON.stringify(message)
|
||||
}).catch((e) => {
|
||||
workerSession.dispatchMessage({ id: message.id, method: "", params: {}, error: { message: e.message, data: void 0 } });
|
||||
});
|
||||
});
|
||||
this._workers.set(workerId, { session: workerSession, frameId: event.frameId });
|
||||
this._page.addWorker(workerId, worker);
|
||||
workerSession.once("Runtime.executionContextCreated", (event2) => {
|
||||
worker.createExecutionContext(new import_ffExecutionContext.FFExecutionContext(workerSession, event2.executionContextId));
|
||||
});
|
||||
workerSession.on("Runtime.console", (event2) => {
|
||||
const { type, args, location } = event2;
|
||||
const context = worker.existingExecutionContext;
|
||||
this._page.addConsoleMessage(type, args.map((arg) => (0, import_ffExecutionContext.createHandle)(context, arg)), location);
|
||||
});
|
||||
}
|
||||
_onWorkerDestroyed(event) {
|
||||
const workerId = event.workerId;
|
||||
const worker = this._workers.get(workerId);
|
||||
if (!worker)
|
||||
return;
|
||||
worker.session.dispose();
|
||||
this._workers.delete(workerId);
|
||||
this._page.removeWorker(workerId);
|
||||
}
|
||||
async _onDispatchMessageFromWorker(event) {
|
||||
const worker = this._workers.get(event.workerId);
|
||||
if (!worker)
|
||||
return;
|
||||
worker.session.dispatchMessage(JSON.parse(event.message));
|
||||
}
|
||||
async _onCrashed(event) {
|
||||
this._session.markAsCrashed();
|
||||
this._page._didCrash();
|
||||
}
|
||||
_onVideoRecordingStarted(event) {
|
||||
this._browserContext._browser._videoStarted(this._browserContext, event.screencastId, event.file, this._page.waitForInitializedOrError());
|
||||
}
|
||||
didClose() {
|
||||
this._markAsError(new import_errors.TargetClosedError());
|
||||
this._session.dispose();
|
||||
import_eventsHelper.eventsHelper.removeEventListeners(this._eventListeners);
|
||||
this._networkManager.dispose();
|
||||
this._page._didClose();
|
||||
}
|
||||
async navigateFrame(frame, url, referer) {
|
||||
const response = await this._session.send("Page.navigate", { url, referer, frameId: frame._id });
|
||||
return { newDocumentId: response.navigationId || void 0 };
|
||||
}
|
||||
async updateExtraHTTPHeaders() {
|
||||
await this._session.send("Network.setExtraHTTPHeaders", { headers: this._page.extraHTTPHeaders() || [] });
|
||||
}
|
||||
async updateEmulatedViewportSize() {
|
||||
const viewportSize = this._page.emulatedSize()?.viewport ?? null;
|
||||
await this._session.send("Page.setViewportSize", { viewportSize });
|
||||
}
|
||||
async bringToFront() {
|
||||
await this._session.send("Page.bringToFront", {});
|
||||
}
|
||||
async updateEmulateMedia() {
|
||||
const emulatedMedia = this._page.emulatedMedia();
|
||||
const colorScheme = emulatedMedia.colorScheme === "no-override" ? void 0 : emulatedMedia.colorScheme;
|
||||
const reducedMotion = emulatedMedia.reducedMotion === "no-override" ? void 0 : emulatedMedia.reducedMotion;
|
||||
const forcedColors = emulatedMedia.forcedColors === "no-override" ? void 0 : emulatedMedia.forcedColors;
|
||||
const contrast = emulatedMedia.contrast === "no-override" ? void 0 : emulatedMedia.contrast;
|
||||
await this._session.send("Page.setEmulatedMedia", {
|
||||
// Empty string means reset.
|
||||
type: emulatedMedia.media === "no-override" ? "" : emulatedMedia.media,
|
||||
colorScheme,
|
||||
reducedMotion,
|
||||
forcedColors,
|
||||
contrast
|
||||
});
|
||||
}
|
||||
async updateRequestInterception() {
|
||||
await this._networkManager.setRequestInterception(this._page.needsRequestInterception());
|
||||
}
|
||||
async updateFileChooserInterception() {
|
||||
const enabled = this._page.fileChooserIntercepted();
|
||||
await this._session.send("Page.setInterceptFileChooserDialog", { enabled }).catch(() => {
|
||||
});
|
||||
}
|
||||
async reload() {
|
||||
await this._session.send("Page.reload");
|
||||
}
|
||||
async goBack() {
|
||||
const { success } = await this._session.send("Page.goBack", { frameId: this._page.mainFrame()._id });
|
||||
return success;
|
||||
}
|
||||
async goForward() {
|
||||
const { success } = await this._session.send("Page.goForward", { frameId: this._page.mainFrame()._id });
|
||||
return success;
|
||||
}
|
||||
async requestGC() {
|
||||
await this._session.send("Heap.collectGarbage");
|
||||
}
|
||||
async addInitScript(initScript, worldName) {
|
||||
this._initScripts.push({ initScript, worldName });
|
||||
await this._updateInitScripts();
|
||||
}
|
||||
async removeInitScripts(initScripts) {
|
||||
const set = new Set(initScripts);
|
||||
this._initScripts = this._initScripts.filter((s) => !set.has(s.initScript));
|
||||
await this._updateInitScripts();
|
||||
}
|
||||
async _updateInitScripts() {
|
||||
await this._session.send("Page.setInitScripts", { scripts: this._initScripts.map((s) => ({ script: s.initScript.source, worldName: s.worldName })) });
|
||||
}
|
||||
async closePage(runBeforeUnload) {
|
||||
await this._session.send("Page.close", { runBeforeUnload });
|
||||
}
|
||||
async setBackgroundColor(color) {
|
||||
if (color)
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
async takeScreenshot(progress, format, documentRect, viewportRect, quality, fitsViewport, scale) {
|
||||
if (!documentRect) {
|
||||
const scrollOffset = await this._page.mainFrame().waitForFunctionValueInUtility(progress, () => ({ x: window.scrollX, y: window.scrollY }));
|
||||
documentRect = {
|
||||
x: viewportRect.x + scrollOffset.x,
|
||||
y: viewportRect.y + scrollOffset.y,
|
||||
width: viewportRect.width,
|
||||
height: viewportRect.height
|
||||
};
|
||||
}
|
||||
const { data } = await progress.race(this._session.send("Page.screenshot", {
|
||||
mimeType: "image/" + format,
|
||||
clip: documentRect,
|
||||
quality,
|
||||
omitDeviceScaleFactor: scale === "css"
|
||||
}));
|
||||
return Buffer.from(data, "base64");
|
||||
}
|
||||
async getContentFrame(handle) {
|
||||
const { contentFrameId } = await this._session.send("Page.describeNode", {
|
||||
frameId: handle._context.frame._id,
|
||||
objectId: handle._objectId
|
||||
});
|
||||
if (!contentFrameId)
|
||||
return null;
|
||||
return this._page.frameManager.frame(contentFrameId);
|
||||
}
|
||||
async getOwnerFrame(handle) {
|
||||
const { ownerFrameId } = await this._session.send("Page.describeNode", {
|
||||
frameId: handle._context.frame._id,
|
||||
objectId: handle._objectId
|
||||
});
|
||||
return ownerFrameId || null;
|
||||
}
|
||||
async getBoundingBox(handle) {
|
||||
const quads = await this.getContentQuads(handle);
|
||||
if (!quads || !quads.length)
|
||||
return null;
|
||||
let minX = Infinity;
|
||||
let maxX = -Infinity;
|
||||
let minY = Infinity;
|
||||
let maxY = -Infinity;
|
||||
for (const quad of quads) {
|
||||
for (const point of quad) {
|
||||
minX = Math.min(minX, point.x);
|
||||
maxX = Math.max(maxX, point.x);
|
||||
minY = Math.min(minY, point.y);
|
||||
maxY = Math.max(maxY, point.y);
|
||||
}
|
||||
}
|
||||
return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
||||
}
|
||||
async scrollRectIntoViewIfNeeded(handle, rect) {
|
||||
return await this._session.send("Page.scrollIntoViewIfNeeded", {
|
||||
frameId: handle._context.frame._id,
|
||||
objectId: handle._objectId,
|
||||
rect
|
||||
}).then(() => "done").catch((e) => {
|
||||
if (e instanceof Error && e.message.includes("Node is detached from document"))
|
||||
return "error:notconnected";
|
||||
if (e instanceof Error && e.message.includes("Node does not have a layout object"))
|
||||
return "error:notvisible";
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
async setScreencastOptions(options) {
|
||||
if (options) {
|
||||
const { screencastId } = await this._session.send("Page.startScreencast", options);
|
||||
this._screencastId = screencastId;
|
||||
} else {
|
||||
await this._session.send("Page.stopScreencast");
|
||||
}
|
||||
}
|
||||
_onScreencastFrame(event) {
|
||||
if (!this._screencastId)
|
||||
return;
|
||||
const screencastId = this._screencastId;
|
||||
this._page.throttleScreencastFrameAck(() => {
|
||||
this._session.send("Page.screencastFrameAck", { screencastId }).catch((e) => import_debugLogger.debugLogger.log("error", e));
|
||||
});
|
||||
const buffer = Buffer.from(event.data, "base64");
|
||||
this._page.emit(import_page2.Page.Events.ScreencastFrame, {
|
||||
buffer,
|
||||
width: event.deviceWidth,
|
||||
height: event.deviceHeight
|
||||
});
|
||||
}
|
||||
rafCountForStablePosition() {
|
||||
return 1;
|
||||
}
|
||||
async getContentQuads(handle) {
|
||||
const result = await this._session.sendMayFail("Page.getContentQuads", {
|
||||
frameId: handle._context.frame._id,
|
||||
objectId: handle._objectId
|
||||
});
|
||||
if (!result)
|
||||
return null;
|
||||
return result.quads.map((quad) => [quad.p1, quad.p2, quad.p3, quad.p4]);
|
||||
}
|
||||
async setInputFilePaths(handle, files) {
|
||||
await this._session.send("Page.setFileInputFiles", {
|
||||
frameId: handle._context.frame._id,
|
||||
objectId: handle._objectId,
|
||||
files
|
||||
});
|
||||
}
|
||||
async adoptElementHandle(handle, to) {
|
||||
const result = await this._session.send("Page.adoptNode", {
|
||||
frameId: handle._context.frame._id,
|
||||
objectId: handle._objectId,
|
||||
executionContextId: to.delegate._executionContextId
|
||||
});
|
||||
if (!result.remoteObject)
|
||||
throw new Error(dom.kUnableToAdoptErrorMessage);
|
||||
return (0, import_ffExecutionContext.createHandle)(to, result.remoteObject);
|
||||
}
|
||||
async getAccessibilityTree(needle) {
|
||||
return (0, import_ffAccessibility.getAccessibilityTree)(this._session, needle);
|
||||
}
|
||||
async inputActionEpilogue() {
|
||||
}
|
||||
async resetForReuse(progress) {
|
||||
await this.rawMouse.move(progress, -1, -1, "none", /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), false);
|
||||
}
|
||||
async getFrameElement(frame) {
|
||||
const parent = frame.parentFrame();
|
||||
if (!parent)
|
||||
throw new Error("Frame has been detached.");
|
||||
const context = await parent._mainContext();
|
||||
const result = await this._session.send("Page.adoptNode", {
|
||||
frameId: frame._id,
|
||||
executionContextId: context.delegate._executionContextId
|
||||
});
|
||||
if (!result.remoteObject)
|
||||
throw new Error("Frame has been detached.");
|
||||
return (0, import_ffExecutionContext.createHandle)(context, result.remoteObject);
|
||||
}
|
||||
shouldToggleStyleSheetToSyncAnimations() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function webSocketId(frameId, wsid) {
|
||||
return `${frameId}---${wsid}`;
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
FFPage,
|
||||
UTILITY_WORLD_NAME
|
||||
});
|
105
node_modules/playwright-core/lib/server/firefox/firefox.js
generated
vendored
Normal file
105
node_modules/playwright-core/lib/server/firefox/firefox.js
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var firefox_exports = {};
|
||||
__export(firefox_exports, {
|
||||
Firefox: () => Firefox
|
||||
});
|
||||
module.exports = __toCommonJS(firefox_exports);
|
||||
var import_os = __toESM(require("os"));
|
||||
var import_path = __toESM(require("path"));
|
||||
var import_ffBrowser = require("./ffBrowser");
|
||||
var import_ffConnection = require("./ffConnection");
|
||||
var import_ascii = require("../utils/ascii");
|
||||
var import_browserType = require("../browserType");
|
||||
var import_manualPromise = require("../../utils/isomorphic/manualPromise");
|
||||
class Firefox extends import_browserType.BrowserType {
|
||||
constructor(parent) {
|
||||
super(parent, "firefox");
|
||||
}
|
||||
connectToTransport(transport, options) {
|
||||
return import_ffBrowser.FFBrowser.connect(this.attribution.playwright, transport, options);
|
||||
}
|
||||
doRewriteStartupLog(error) {
|
||||
if (!error.logs)
|
||||
return error;
|
||||
if (error.logs.includes(`as root in a regular user's session is not supported.`))
|
||||
error.logs = "\n" + (0, import_ascii.wrapInASCIIBox)(`Firefox is unable to launch if the $HOME folder isn't owned by the current user.
|
||||
Workaround: Set the HOME=/root environment variable${process.env.GITHUB_ACTION ? " in your GitHub Actions workflow file" : ""} when running Playwright.`, 1);
|
||||
if (error.logs.includes("no DISPLAY environment variable specified"))
|
||||
error.logs = "\n" + (0, import_ascii.wrapInASCIIBox)(import_browserType.kNoXServerRunningError, 1);
|
||||
return error;
|
||||
}
|
||||
amendEnvironment(env) {
|
||||
if (!import_path.default.isAbsolute(import_os.default.homedir()))
|
||||
throw new Error(`Cannot launch Firefox with relative home directory. Did you set ${import_os.default.platform() === "win32" ? "USERPROFILE" : "HOME"} to a relative path?`);
|
||||
if (import_os.default.platform() === "linux") {
|
||||
return { ...env, SNAP_NAME: void 0, SNAP_INSTANCE_NAME: void 0 };
|
||||
}
|
||||
return env;
|
||||
}
|
||||
attemptToGracefullyCloseBrowser(transport) {
|
||||
const message = { method: "Browser.close", params: {}, id: import_ffConnection.kBrowserCloseMessageId };
|
||||
transport.send(message);
|
||||
}
|
||||
defaultArgs(options, isPersistent, userDataDir) {
|
||||
const { args = [], headless } = options;
|
||||
const userDataDirArg = args.find((arg) => arg.startsWith("-profile") || arg.startsWith("--profile"));
|
||||
if (userDataDirArg)
|
||||
throw this._createUserDataDirArgMisuseError("--profile");
|
||||
if (args.find((arg) => arg.startsWith("-juggler")))
|
||||
throw new Error("Use the port parameter instead of -juggler argument");
|
||||
const firefoxArguments = ["-no-remote"];
|
||||
if (headless) {
|
||||
firefoxArguments.push("-headless");
|
||||
} else {
|
||||
firefoxArguments.push("-wait-for-browser");
|
||||
firefoxArguments.push("-foreground");
|
||||
}
|
||||
firefoxArguments.push(`-profile`, userDataDir);
|
||||
firefoxArguments.push("-juggler-pipe");
|
||||
firefoxArguments.push(...args);
|
||||
if (isPersistent)
|
||||
firefoxArguments.push("about:blank");
|
||||
else
|
||||
firefoxArguments.push("-silent");
|
||||
return firefoxArguments;
|
||||
}
|
||||
waitForReadyState(options, browserLogsCollector) {
|
||||
const result = new import_manualPromise.ManualPromise();
|
||||
browserLogsCollector.onMessage((message) => {
|
||||
if (message.includes("Juggler listening to the pipe"))
|
||||
result.resolve({});
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Firefox
|
||||
});
|
16
node_modules/playwright-core/lib/server/firefox/protocol.d.js
generated
vendored
Normal file
16
node_modules/playwright-core/lib/server/firefox/protocol.d.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
var protocol_d_exports = {};
|
||||
module.exports = __toCommonJS(protocol_d_exports);
|
Reference in New Issue
Block a user