mirror of
https://github.com/TheBinaryNinja/tvapp2.git
synced 2026-06-04 05:35:41 -04:00
build: bump to v1.1.1
This commit is contained in:
3267
tvapp2/node_modules/.package-lock.json
generated
vendored
3267
tvapp2/node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
32
tvapp2/node_modules/playwright-core/browsers.json
generated
vendored
32
tvapp2/node_modules/playwright-core/browsers.json
generated
vendored
@@ -3,31 +3,43 @@
|
||||
"browsers": [
|
||||
{
|
||||
"name": "chromium",
|
||||
"revision": "1155",
|
||||
"revision": "1161",
|
||||
"installByDefault": true,
|
||||
"browserVersion": "133.0.6943.16"
|
||||
"browserVersion": "134.0.6998.35"
|
||||
},
|
||||
{
|
||||
"name": "chromium-headless-shell",
|
||||
"revision": "1161",
|
||||
"installByDefault": true,
|
||||
"browserVersion": "134.0.6998.35"
|
||||
},
|
||||
{
|
||||
"name": "chromium-tip-of-tree",
|
||||
"revision": "1293",
|
||||
"revision": "1304",
|
||||
"installByDefault": false,
|
||||
"browserVersion": "133.0.6943.0"
|
||||
"browserVersion": "135.0.7021.0"
|
||||
},
|
||||
{
|
||||
"name": "chromium-tip-of-tree-headless-shell",
|
||||
"revision": "1304",
|
||||
"installByDefault": false,
|
||||
"browserVersion": "135.0.7021.0"
|
||||
},
|
||||
{
|
||||
"name": "firefox",
|
||||
"revision": "1471",
|
||||
"revision": "1475",
|
||||
"installByDefault": true,
|
||||
"browserVersion": "134.0"
|
||||
"browserVersion": "135.0"
|
||||
},
|
||||
{
|
||||
"name": "firefox-beta",
|
||||
"revision": "1467",
|
||||
"revision": "1471",
|
||||
"installByDefault": false,
|
||||
"browserVersion": "133.0b9"
|
||||
"browserVersion": "136.0b4"
|
||||
},
|
||||
{
|
||||
"name": "webkit",
|
||||
"revision": "2123",
|
||||
"revision": "2140",
|
||||
"installByDefault": true,
|
||||
"revisionOverrides": {
|
||||
"debian11-x64": "2105",
|
||||
@@ -41,7 +53,7 @@
|
||||
"ubuntu20.04-x64": "2092",
|
||||
"ubuntu20.04-arm64": "2092"
|
||||
},
|
||||
"browserVersion": "18.2"
|
||||
"browserVersion": "18.4"
|
||||
},
|
||||
{
|
||||
"name": "ffmpeg",
|
||||
|
||||
1
tvapp2/node_modules/playwright-core/index.js
generated
vendored
1
tvapp2/node_modules/playwright-core/index.js
generated
vendored
@@ -19,7 +19,6 @@ const semver = currentNodeVersion.split('.');
|
||||
const [major] = [+semver[0]];
|
||||
|
||||
if (major < minimumMajorNodeVersion) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
'You are running Node.js ' +
|
||||
currentNodeVersion +
|
||||
|
||||
8
tvapp2/node_modules/playwright-core/lib/androidServerImpl.js
generated
vendored
8
tvapp2/node_modules/playwright-core/lib/androidServerImpl.js
generated
vendored
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AndroidServerLauncherImpl = void 0;
|
||||
var _utilsBundle = require("./utilsBundle");
|
||||
var _utils = require("./utils");
|
||||
var _playwright = require("./server/playwright");
|
||||
var _playwrightServer = require("./remote/playwrightServer");
|
||||
var _playwright = require("./server/playwright");
|
||||
var _crypto = require("./server/utils/crypto");
|
||||
var _utilsBundle = require("./utilsBundle");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -43,7 +43,7 @@ class AndroidServerLauncherImpl {
|
||||
}
|
||||
if (devices.length > 1) throw new Error(`More than one device found. Please specify deviceSerialNumber`);
|
||||
const device = devices[0];
|
||||
const path = options.wsPath ? options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}` : `/${(0, _utils.createGuid)()}`;
|
||||
const path = options.wsPath ? options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}` : `/${(0, _crypto.createGuid)()}`;
|
||||
|
||||
// 2. Start the server
|
||||
const server = new _playwrightServer.PlaywrightServer({
|
||||
|
||||
27
tvapp2/node_modules/playwright-core/lib/browserServerImpl.js
generated
vendored
27
tvapp2/node_modules/playwright-core/lib/browserServerImpl.js
generated
vendored
@@ -4,15 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BrowserServerLauncherImpl = void 0;
|
||||
var _utilsBundle = require("./utilsBundle");
|
||||
var _clientHelper = require("./client/clientHelper");
|
||||
var _utils = require("./utils");
|
||||
var _instrumentation = require("./server/instrumentation");
|
||||
var _playwright = require("./server/playwright");
|
||||
var _socksProxy = require("./server/utils/socksProxy");
|
||||
var _playwrightServer = require("./remote/playwrightServer");
|
||||
var _helper = require("./server/helper");
|
||||
var _stackTrace = require("./utils/stackTrace");
|
||||
var _socksProxy = require("./common/socksProxy");
|
||||
var _instrumentation = require("./server/instrumentation");
|
||||
var _playwright = require("./server/playwright");
|
||||
var _crypto = require("./server/utils/crypto");
|
||||
var _stackTrace = require("./utils/isomorphic/stackTrace");
|
||||
var _utilsBundle = require("./utilsBundle");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -49,13 +48,13 @@ class BrowserServerLauncherImpl {
|
||||
...options,
|
||||
ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : undefined,
|
||||
ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs),
|
||||
env: options.env ? (0, _clientHelper.envObjectToArray)(options.env) : undefined
|
||||
env: options.env ? envObjectToArray(options.env) : undefined
|
||||
}, toProtocolLogger(options.logger)).catch(e => {
|
||||
const log = _helper.helper.formatBrowserLogs(metadata.log);
|
||||
(0, _stackTrace.rewriteErrorMessage)(e, `${e.message} Failed to launch browser.${log}`);
|
||||
throw e;
|
||||
});
|
||||
const path = options.wsPath ? options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}` : `/${(0, _utils.createGuid)()}`;
|
||||
const path = options.wsPath ? options.wsPath.startsWith('/') ? options.wsPath : `/${options.wsPath}` : `/${(0, _crypto.createGuid)()}`;
|
||||
|
||||
// 2. Start the server
|
||||
const server = new _playwrightServer.PlaywrightServer({
|
||||
@@ -89,4 +88,14 @@ function toProtocolLogger(logger) {
|
||||
return logger ? (direction, message) => {
|
||||
if (logger.isEnabled('protocol', 'verbose')) logger.log('protocol', 'verbose', (direction === 'send' ? 'SEND ► ' : '◀ RECV ') + JSON.stringify(message), [], {});
|
||||
} : undefined;
|
||||
}
|
||||
function envObjectToArray(env) {
|
||||
const result = [];
|
||||
for (const name in env) {
|
||||
if (!Object.is(env[name], undefined)) result.push({
|
||||
name,
|
||||
value: String(env[name])
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
12
tvapp2/node_modules/playwright-core/lib/cli/driver.js
generated
vendored
12
tvapp2/node_modules/playwright-core/lib/cli/driver.js
generated
vendored
@@ -9,13 +9,13 @@ exports.runDriver = runDriver;
|
||||
exports.runServer = runServer;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var playwright = _interopRequireWildcard(require("../.."));
|
||||
var _server = require("../server");
|
||||
var _transport = require("../protocol/transport");
|
||||
var _pipeTransport = require("../server/utils/pipeTransport");
|
||||
var _playwrightServer = require("../remote/playwrightServer");
|
||||
var _processLauncher = require("../utils/processLauncher");
|
||||
var _server = require("../server");
|
||||
var _processLauncher = require("../server/utils/processLauncher");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -48,7 +48,7 @@ function runDriver() {
|
||||
});
|
||||
return new _server.PlaywrightDispatcher(rootScope, playwright);
|
||||
});
|
||||
const transport = new _transport.PipeTransport(process.stdout, process.stdin);
|
||||
const transport = new _pipeTransport.PipeTransport(process.stdout, process.stdin);
|
||||
transport.onmessage = message => dispatcherConnection.dispatch(JSON.parse(message));
|
||||
// Certain Language Binding JSON parsers (e.g. .NET) do not like strings with lone surrogates.
|
||||
const isJavaScriptLanguageBinding = !process.env.PW_LANG_NAME || process.env.PW_LANG_NAME === 'javascript';
|
||||
|
||||
18
tvapp2/node_modules/playwright-core/lib/cli/program.js
generated
vendored
18
tvapp2/node_modules/playwright-core/lib/cli/program.js
generated
vendored
@@ -12,16 +12,16 @@ Object.defineProperty(exports, "program", {
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _os = _interopRequireDefault(require("os"));
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _utilsBundle = require("../utilsBundle");
|
||||
var _driver = require("./driver");
|
||||
var _traceViewer = require("../server/trace/viewer/traceViewer");
|
||||
var playwright = _interopRequireWildcard(require("../.."));
|
||||
var _utils = require("../utils");
|
||||
var _driver = require("./driver");
|
||||
var _server = require("../server");
|
||||
var _errors = require("../client/errors");
|
||||
var _utils = require("../utils");
|
||||
var _traceViewer = require("../server/trace/viewer/traceViewer");
|
||||
var _ascii = require("../server/utils/ascii");
|
||||
var _utilsBundle = require("../utilsBundle");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -97,7 +97,7 @@ _utilsBundle.program.command('install [browser...]').description('ensure browser
|
||||
// For '--no-shell' option, commander sets `shell: false` instead.
|
||||
if (options.shell === false) options.noShell = true;
|
||||
if ((0, _utils.isLikelyNpxGlobal)()) {
|
||||
console.error((0, _utils.wrapInASCIIBox)([`WARNING: It looks like you are running 'npx playwright install' without first`, `installing your project's dependencies.`, ``, `To avoid unexpected behavior, please install your dependencies first, and`, `then run Playwright's install command:`, ``, ` npm install`, ` npx playwright install`, ``, `If your project does not yet depend on Playwright, first install the`, `applicable npm package (most commonly @playwright/test), and`, `then run Playwright's install command to download the browsers:`, ``, ` npm install @playwright/test`, ` npx playwright install`, ``].join('\n'), 1));
|
||||
console.error((0, _ascii.wrapInASCIIBox)([`WARNING: It looks like you are running 'npx playwright install' without first`, `installing your project's dependencies.`, ``, `To avoid unexpected behavior, please install your dependencies first, and`, `then run Playwright's install command:`, ``, ` npm install`, ` npx playwright install`, ``, `If your project does not yet depend on Playwright, first install the`, `applicable npm package (most commonly @playwright/test), and`, `then run Playwright's install command to download the browsers:`, ``, ` npm install @playwright/test`, ` npx playwright install`, ``].join('\n'), 1));
|
||||
}
|
||||
try {
|
||||
const hasNoArguments = !args.length;
|
||||
@@ -408,7 +408,7 @@ async function openPage(context, url) {
|
||||
if (url) {
|
||||
if (_fs.default.existsSync(url)) url = 'file://' + _path.default.resolve(url);else if (!url.startsWith('http') && !url.startsWith('file://') && !url.startsWith('about:') && !url.startsWith('data:')) url = 'http://' + url;
|
||||
await page.goto(url).catch(error => {
|
||||
if (process.env.PWTEST_CLI_AUTO_EXIT_WHEN && (0, _errors.isTargetClosedError)(error)) {
|
||||
if (process.env.PWTEST_CLI_AUTO_EXIT_WHEN) {
|
||||
// Tests with PWTEST_CLI_AUTO_EXIT_WHEN might close page too fast, resulting
|
||||
// in a stray navigation aborted error. We should ignore it.
|
||||
} else {
|
||||
|
||||
3
tvapp2/node_modules/playwright-core/lib/cli/programWithTestStub.js
generated
vendored
3
tvapp2/node_modules/playwright-core/lib/cli/programWithTestStub.js
generated
vendored
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "program", {
|
||||
return _program.program;
|
||||
}
|
||||
});
|
||||
var _processLauncher = require("../server/utils/processLauncher");
|
||||
var _utils = require("../utils");
|
||||
var _program = require("./program");
|
||||
/**
|
||||
@@ -60,7 +61,7 @@ function addExternalPlaywrightTestCommands() {
|
||||
playwrightTest.description(`${description} Available in @playwright/test package.`);
|
||||
playwrightTest.action(async () => {
|
||||
printPlaywrightTestError(command);
|
||||
(0, _utils.gracefullyProcessExitDoNotHang)(1);
|
||||
(0, _processLauncher.gracefullyProcessExitDoNotHang)(1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
95
tvapp2/node_modules/playwright-core/lib/client/android.js
generated
vendored
95
tvapp2/node_modules/playwright-core/lib/client/android.js
generated
vendored
@@ -4,18 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AndroidWebView = exports.AndroidSocket = exports.AndroidInput = exports.AndroidDevice = exports.Android = void 0;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _utils = require("../utils");
|
||||
var _events = require("./events");
|
||||
var _eventEmitter = require("./eventEmitter");
|
||||
var _browserContext = require("./browserContext");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _timeoutSettings = require("../common/timeoutSettings");
|
||||
var _waiter = require("./waiter");
|
||||
var _events2 = require("events");
|
||||
var _connection = require("./connection");
|
||||
var _errors = require("./errors");
|
||||
var _timeoutRunner = require("../utils/timeoutRunner");
|
||||
let _Symbol$asyncDispose;
|
||||
var _events = require("./events");
|
||||
var _waiter = require("./waiter");
|
||||
var _timeoutSettings = require("./timeoutSettings");
|
||||
var _rtti = require("../utils/isomorphic/rtti");
|
||||
var _time = require("../utils/isomorphic/time");
|
||||
var _timeoutRunner = require("../utils/isomorphic/timeoutRunner");
|
||||
var _webSocket = require("./webSocket");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -31,7 +30,7 @@ let _Symbol$asyncDispose;
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class Android extends _channelOwner.ChannelOwner {
|
||||
static from(android) {
|
||||
return android._object;
|
||||
@@ -40,13 +39,15 @@ class Android extends _channelOwner.ChannelOwner {
|
||||
super(parent, type, guid, initializer);
|
||||
this._timeoutSettings = void 0;
|
||||
this._serverLauncher = void 0;
|
||||
this._timeoutSettings = new _timeoutSettings.TimeoutSettings();
|
||||
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._platform);
|
||||
}
|
||||
setDefaultTimeout(timeout) {
|
||||
this._timeoutSettings.setDefaultTimeout(timeout);
|
||||
this._channel.setDefaultTimeoutNoReply({
|
||||
timeout
|
||||
});
|
||||
this._wrapApiCall(async () => {
|
||||
await this._channel.setDefaultTimeoutNoReply({
|
||||
timeout
|
||||
});
|
||||
}, true).catch(() => {});
|
||||
}
|
||||
async devices(options = {}) {
|
||||
const {
|
||||
@@ -60,68 +61,44 @@ class Android extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
async connect(wsEndpoint, options = {}) {
|
||||
return await this._wrapApiCall(async () => {
|
||||
const deadline = options.timeout ? (0, _utils.monotonicTime)() + options.timeout : 0;
|
||||
const deadline = options.timeout ? (0, _time.monotonicTime)() + options.timeout : 0;
|
||||
const headers = {
|
||||
'x-playwright-browser': 'android',
|
||||
...options.headers
|
||||
};
|
||||
const localUtils = this._connection.localUtils();
|
||||
const connectParams = {
|
||||
wsEndpoint,
|
||||
headers,
|
||||
slowMo: options.slowMo,
|
||||
timeout: options.timeout
|
||||
};
|
||||
const {
|
||||
pipe
|
||||
} = await localUtils._channel.connect(connectParams);
|
||||
const closePipe = () => pipe.close().catch(() => {});
|
||||
const connection = new _connection.Connection(localUtils, this._instrumentation);
|
||||
connection.markAsRemote();
|
||||
connection.on('close', closePipe);
|
||||
const connection = await (0, _webSocket.connectOverWebSocket)(this._connection, connectParams);
|
||||
let device;
|
||||
let closeError;
|
||||
const onPipeClosed = () => {
|
||||
connection.on('close', () => {
|
||||
var _device;
|
||||
(_device = device) === null || _device === void 0 || _device._didClose();
|
||||
connection.close(closeError);
|
||||
};
|
||||
pipe.on('closed', onPipeClosed);
|
||||
connection.onmessage = message => pipe.send({
|
||||
message
|
||||
}).catch(onPipeClosed);
|
||||
pipe.on('message', ({
|
||||
message
|
||||
}) => {
|
||||
try {
|
||||
connection.dispatch(message);
|
||||
} catch (e) {
|
||||
closeError = String(e);
|
||||
closePipe();
|
||||
}
|
||||
});
|
||||
const result = await (0, _timeoutRunner.raceAgainstDeadline)(async () => {
|
||||
const playwright = await connection.initializePlaywright();
|
||||
if (!playwright._initializer.preConnectedAndroidDevice) {
|
||||
closePipe();
|
||||
connection.close();
|
||||
throw new Error('Malformed endpoint. Did you use Android.launchServer method?');
|
||||
}
|
||||
device = AndroidDevice.from(playwright._initializer.preConnectedAndroidDevice);
|
||||
device._shouldCloseConnectionOnClose = true;
|
||||
device.on(_events.Events.AndroidDevice.Close, closePipe);
|
||||
device.on(_events.Events.AndroidDevice.Close, () => connection.close());
|
||||
return device;
|
||||
}, deadline);
|
||||
if (!result.timedOut) {
|
||||
return result.result;
|
||||
} else {
|
||||
closePipe();
|
||||
connection.close();
|
||||
throw new Error(`Timeout ${options.timeout}ms exceeded`);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Android = Android;
|
||||
_Symbol$asyncDispose = Symbol.asyncDispose;
|
||||
class AndroidDevice extends _channelOwner.ChannelOwner {
|
||||
static from(androidDevice) {
|
||||
return androidDevice._object;
|
||||
@@ -133,7 +110,7 @@ class AndroidDevice extends _channelOwner.ChannelOwner {
|
||||
this._shouldCloseConnectionOnClose = false;
|
||||
this.input = void 0;
|
||||
this.input = new AndroidInput(this);
|
||||
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(parent._timeoutSettings);
|
||||
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._platform, parent._timeoutSettings);
|
||||
this._channel.on('webViewAdded', ({
|
||||
webView
|
||||
}) => this._onWebViewAdded(webView));
|
||||
@@ -154,9 +131,11 @@ class AndroidDevice extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
setDefaultTimeout(timeout) {
|
||||
this._timeoutSettings.setDefaultTimeout(timeout);
|
||||
this._channel.setDefaultTimeoutNoReply({
|
||||
timeout
|
||||
});
|
||||
this._wrapApiCall(async () => {
|
||||
await this._channel.setDefaultTimeoutNoReply({
|
||||
timeout
|
||||
});
|
||||
}, true).catch(() => {});
|
||||
}
|
||||
serial() {
|
||||
return this._initializer.serial;
|
||||
@@ -262,10 +241,10 @@ class AndroidDevice extends _channelOwner.ChannelOwner {
|
||||
const {
|
||||
binary
|
||||
} = await this._channel.screenshot();
|
||||
if (options.path) await _fs.default.promises.writeFile(options.path, binary);
|
||||
if (options.path) await this._platform.fs().promises.writeFile(options.path, binary);
|
||||
return binary;
|
||||
}
|
||||
async [_Symbol$asyncDispose]() {
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.close();
|
||||
}
|
||||
async close() {
|
||||
@@ -294,19 +273,19 @@ class AndroidDevice extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
async installApk(file, options) {
|
||||
await this._channel.installApk({
|
||||
file: await loadFile(file),
|
||||
file: await loadFile(this._platform, file),
|
||||
args: options && options.args
|
||||
});
|
||||
}
|
||||
async push(file, path, options) {
|
||||
await this._channel.push({
|
||||
file: await loadFile(file),
|
||||
file: await loadFile(this._platform, file),
|
||||
path,
|
||||
mode: options ? options.mode : undefined
|
||||
});
|
||||
}
|
||||
async launchBrowser(options = {}) {
|
||||
const contextOptions = await (0, _browserContext.prepareBrowserContextParams)(options);
|
||||
const contextOptions = await (0, _browserContext.prepareBrowserContextParams)(this._platform, options);
|
||||
const result = await this._channel.launchBrowser(contextOptions);
|
||||
const context = _browserContext.BrowserContext.from(result.context);
|
||||
context._setOptions(contextOptions, {});
|
||||
@@ -350,8 +329,8 @@ class AndroidSocket extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
}
|
||||
exports.AndroidSocket = AndroidSocket;
|
||||
async function loadFile(file) {
|
||||
if ((0, _utils.isString)(file)) return await _fs.default.promises.readFile(file);
|
||||
async function loadFile(platform, file) {
|
||||
if ((0, _rtti.isString)(file)) return await platform.fs().promises.readFile(file);
|
||||
return file;
|
||||
}
|
||||
class AndroidInput {
|
||||
@@ -411,7 +390,7 @@ function toSelectorChannel(selector) {
|
||||
} = selector;
|
||||
const toRegex = value => {
|
||||
if (value === undefined) return undefined;
|
||||
if ((0, _utils.isRegExp)(value)) return value.source;
|
||||
if ((0, _rtti.isRegExp)(value)) return value.source;
|
||||
return '^' + value.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d') + '$';
|
||||
};
|
||||
return {
|
||||
@@ -439,9 +418,9 @@ function toSelectorChannel(selector) {
|
||||
selected
|
||||
};
|
||||
}
|
||||
class AndroidWebView extends _events2.EventEmitter {
|
||||
class AndroidWebView extends _eventEmitter.EventEmitter {
|
||||
constructor(device, data) {
|
||||
super();
|
||||
super(device._platform);
|
||||
this._device = void 0;
|
||||
this._data = void 0;
|
||||
this._pagePromise = void 0;
|
||||
|
||||
11
tvapp2/node_modules/playwright-core/lib/client/artifact.js
generated
vendored
11
tvapp2/node_modules/playwright-core/lib/client/artifact.js
generated
vendored
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Artifact = void 0;
|
||||
var fs = _interopRequireWildcard(require("fs"));
|
||||
var _stream = require("./stream");
|
||||
var _fileUtils = require("../utils/fileUtils");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
var _stream = require("./stream");
|
||||
var _fileUtils = require("./fileUtils");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -43,9 +40,9 @@ class Artifact extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
const result = await this._channel.saveAsStream();
|
||||
const stream = _stream.Stream.from(result.stream);
|
||||
await (0, _fileUtils.mkdirIfNeeded)(path);
|
||||
await (0, _fileUtils.mkdirIfNeeded)(this._platform, path);
|
||||
await new Promise((resolve, reject) => {
|
||||
stream.stream().pipe(fs.createWriteStream(path)).on('finish', resolve).on('error', reject);
|
||||
stream.stream().pipe(this._platform.fs().createWriteStream(path)).on('finish', resolve).on('error', reject);
|
||||
});
|
||||
}
|
||||
async failure() {
|
||||
|
||||
29
tvapp2/node_modules/playwright-core/lib/client/browser.js
generated
vendored
29
tvapp2/node_modules/playwright-core/lib/client/browser.js
generated
vendored
@@ -4,15 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Browser = void 0;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _browserContext = require("./browserContext");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _events = require("./events");
|
||||
var _errors = require("./errors");
|
||||
var _cdpSession = require("./cdpSession");
|
||||
var _artifact = require("./artifact");
|
||||
var _utils = require("../utils");
|
||||
let _Symbol$asyncDispose;
|
||||
var _browserContext = require("./browserContext");
|
||||
var _cdpSession = require("./cdpSession");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _errors = require("./errors");
|
||||
var _events = require("./events");
|
||||
var _fileUtils = require("./fileUtils");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -28,8 +26,7 @@ let _Symbol$asyncDispose;
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
_Symbol$asyncDispose = Symbol.asyncDispose;
|
||||
|
||||
class Browser extends _channelOwner.ChannelOwner {
|
||||
static from(browser) {
|
||||
return browser._object;
|
||||
@@ -44,8 +41,6 @@ class Browser extends _channelOwner.ChannelOwner {
|
||||
this._options = {};
|
||||
this._name = void 0;
|
||||
this._path = void 0;
|
||||
// Used from @playwright/test fixtures.
|
||||
this._connectHeaders = void 0;
|
||||
this._closeReason = void 0;
|
||||
this._name = initializer.name;
|
||||
this._channel.on('close', () => this._didClose());
|
||||
@@ -76,10 +71,10 @@ class Browser extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
async _innerNewContext(options = {}, forReuse) {
|
||||
options = {
|
||||
...this._browserType._defaultContextOptions,
|
||||
...this._browserType._playwright._defaultContextOptions,
|
||||
...options
|
||||
};
|
||||
const contextOptions = await (0, _browserContext.prepareBrowserContextParams)(options);
|
||||
const contextOptions = await (0, _browserContext.prepareBrowserContextParams)(this._platform, options);
|
||||
const response = forReuse ? await this._channel.newContextForReuse(contextOptions) : await this._channel.newContext(contextOptions);
|
||||
const context = _browserContext.BrowserContext.from(response.context);
|
||||
await this._browserType._didCreateContext(context, contextOptions, this._options, options.logger || this._logger);
|
||||
@@ -118,13 +113,13 @@ class Browser extends _channelOwner.ChannelOwner {
|
||||
const buffer = await artifact.readIntoBuffer();
|
||||
await artifact.delete();
|
||||
if (this._path) {
|
||||
await (0, _utils.mkdirIfNeeded)(this._path);
|
||||
await _fs.default.promises.writeFile(this._path, buffer);
|
||||
await (0, _fileUtils.mkdirIfNeeded)(this._platform, this._path);
|
||||
await this._platform.fs().promises.writeFile(this._path, buffer);
|
||||
this._path = undefined;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
async [_Symbol$asyncDispose]() {
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.close();
|
||||
}
|
||||
async close(options = {}) {
|
||||
|
||||
133
tvapp2/node_modules/playwright-core/lib/client/browserContext.js
generated
vendored
133
tvapp2/node_modules/playwright-core/lib/client/browserContext.js
generated
vendored
@@ -6,31 +6,33 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.BrowserContext = void 0;
|
||||
exports.prepareBrowserContextParams = prepareBrowserContextParams;
|
||||
exports.toClientCertificatesProtocol = toClientCertificatesProtocol;
|
||||
var _page = require("./page");
|
||||
var _frame = require("./frame");
|
||||
var network = _interopRequireWildcard(require("./network"));
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _artifact = require("./artifact");
|
||||
var _browser = require("./browser");
|
||||
var _cdpSession = require("./cdpSession");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _clientHelper = require("./clientHelper");
|
||||
var _browser = require("./browser");
|
||||
var _worker = require("./worker");
|
||||
var _events = require("./events");
|
||||
var _timeoutSettings = require("../common/timeoutSettings");
|
||||
var _waiter = require("./waiter");
|
||||
var _utils = require("../utils");
|
||||
var _cdpSession = require("./cdpSession");
|
||||
var _tracing = require("./tracing");
|
||||
var _artifact = require("./artifact");
|
||||
var _fetch = require("./fetch");
|
||||
var _stackTrace = require("../utils/stackTrace");
|
||||
var _harRouter = require("./harRouter");
|
||||
var _clock = require("./clock");
|
||||
var _consoleMessage = require("./consoleMessage");
|
||||
var _dialog = require("./dialog");
|
||||
var _webError = require("./webError");
|
||||
var _errors = require("./errors");
|
||||
var _clock = require("./clock");
|
||||
let _Symbol$asyncDispose;
|
||||
var _events = require("./events");
|
||||
var _fetch = require("./fetch");
|
||||
var _frame = require("./frame");
|
||||
var _harRouter = require("./harRouter");
|
||||
var network = _interopRequireWildcard(require("./network"));
|
||||
var _page = require("./page");
|
||||
var _tracing = require("./tracing");
|
||||
var _waiter = require("./waiter");
|
||||
var _webError = require("./webError");
|
||||
var _worker = require("./worker");
|
||||
var _timeoutSettings = require("./timeoutSettings");
|
||||
var _fileUtils = require("./fileUtils");
|
||||
var _headers = require("../utils/isomorphic/headers");
|
||||
var _urlMatch = require("../utils/isomorphic/urlMatch");
|
||||
var _rtti = require("../utils/isomorphic/rtti");
|
||||
var _stackTrace = require("../utils/isomorphic/stackTrace");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
@@ -47,10 +49,7 @@ let _Symbol$asyncDispose;
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
_Symbol$asyncDispose = Symbol.asyncDispose;
|
||||
|
||||
class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
static from(context) {
|
||||
return context._object;
|
||||
@@ -67,7 +66,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
this._browser = null;
|
||||
this._browserType = void 0;
|
||||
this._bindings = new Map();
|
||||
this._timeoutSettings = new _timeoutSettings.TimeoutSettings();
|
||||
this._timeoutSettings = void 0;
|
||||
this._ownerPage = void 0;
|
||||
this._closedPromise = void 0;
|
||||
this._options = {};
|
||||
@@ -81,6 +80,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
this._closeWasCalled = false;
|
||||
this._closeReason = void 0;
|
||||
this._harRouters = [];
|
||||
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._platform);
|
||||
if (parent instanceof _browser.Browser) this._browser = parent;
|
||||
(_this$_browser = this._browser) === null || _this$_browser === void 0 || _this$_browser._contexts.add(this);
|
||||
this._isChromium = ((_this$_browser2 = this._browser) === null || _this$_browser2 === void 0 ? void 0 : _this$_browser2._name) === 'chromium';
|
||||
@@ -116,7 +116,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
this.emit(_events.Events.BrowserContext.ServiceWorker, serviceWorker);
|
||||
});
|
||||
this._channel.on('console', event => {
|
||||
const consoleMessage = new _consoleMessage.ConsoleMessage(event);
|
||||
const consoleMessage = new _consoleMessage.ConsoleMessage(this._platform, event);
|
||||
this.emit(_events.Events.BrowserContext.Console, consoleMessage);
|
||||
const page = consoleMessage.page();
|
||||
if (page) page.emit(_events.Events.Page.Console, consoleMessage);
|
||||
@@ -233,18 +233,18 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
setDefaultNavigationTimeout(timeout) {
|
||||
this._timeoutSettings.setDefaultNavigationTimeout(timeout);
|
||||
this._wrapApiCall(async () => {
|
||||
this._channel.setDefaultNavigationTimeoutNoReply({
|
||||
await this._channel.setDefaultNavigationTimeoutNoReply({
|
||||
timeout
|
||||
}).catch(() => {});
|
||||
}, true);
|
||||
});
|
||||
}, true).catch(() => {});
|
||||
}
|
||||
setDefaultTimeout(timeout) {
|
||||
this._timeoutSettings.setDefaultTimeout(timeout);
|
||||
this._wrapApiCall(async () => {
|
||||
this._channel.setDefaultTimeoutNoReply({
|
||||
await this._channel.setDefaultTimeoutNoReply({
|
||||
timeout
|
||||
}).catch(() => {});
|
||||
}, true);
|
||||
});
|
||||
}, true).catch(() => {});
|
||||
}
|
||||
browser() {
|
||||
return this._browser;
|
||||
@@ -270,15 +270,15 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
async clearCookies(options = {}) {
|
||||
await this._channel.clearCookies({
|
||||
name: (0, _utils.isString)(options.name) ? options.name : undefined,
|
||||
nameRegexSource: (0, _utils.isRegExp)(options.name) ? options.name.source : undefined,
|
||||
nameRegexFlags: (0, _utils.isRegExp)(options.name) ? options.name.flags : undefined,
|
||||
domain: (0, _utils.isString)(options.domain) ? options.domain : undefined,
|
||||
domainRegexSource: (0, _utils.isRegExp)(options.domain) ? options.domain.source : undefined,
|
||||
domainRegexFlags: (0, _utils.isRegExp)(options.domain) ? options.domain.flags : undefined,
|
||||
path: (0, _utils.isString)(options.path) ? options.path : undefined,
|
||||
pathRegexSource: (0, _utils.isRegExp)(options.path) ? options.path.source : undefined,
|
||||
pathRegexFlags: (0, _utils.isRegExp)(options.path) ? options.path.flags : undefined
|
||||
name: (0, _rtti.isString)(options.name) ? options.name : undefined,
|
||||
nameRegexSource: (0, _rtti.isRegExp)(options.name) ? options.name.source : undefined,
|
||||
nameRegexFlags: (0, _rtti.isRegExp)(options.name) ? options.name.flags : undefined,
|
||||
domain: (0, _rtti.isString)(options.domain) ? options.domain : undefined,
|
||||
domainRegexSource: (0, _rtti.isRegExp)(options.domain) ? options.domain.source : undefined,
|
||||
domainRegexFlags: (0, _rtti.isRegExp)(options.domain) ? options.domain.flags : undefined,
|
||||
path: (0, _rtti.isString)(options.path) ? options.path : undefined,
|
||||
pathRegexSource: (0, _rtti.isRegExp)(options.path) ? options.path.source : undefined,
|
||||
pathRegexFlags: (0, _rtti.isRegExp)(options.path) ? options.path.flags : undefined
|
||||
});
|
||||
}
|
||||
async grantPermissions(permissions, options) {
|
||||
@@ -298,7 +298,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
async setExtraHTTPHeaders(headers) {
|
||||
network.validateHeaders(headers);
|
||||
await this._channel.setExtraHTTPHeaders({
|
||||
headers: (0, _utils.headersObjectToArray)(headers)
|
||||
headers: (0, _headers.headersObjectToArray)(headers)
|
||||
});
|
||||
}
|
||||
async setOffline(offline) {
|
||||
@@ -312,7 +312,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
});
|
||||
}
|
||||
async addInitScript(script, arg) {
|
||||
const source = await (0, _clientHelper.evaluationScript)(script, arg);
|
||||
const source = await (0, _clientHelper.evaluationScript)(this._platform, script, arg);
|
||||
await this._channel.addInitScript({
|
||||
source
|
||||
});
|
||||
@@ -332,7 +332,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
this._bindings.set(name, binding);
|
||||
}
|
||||
async route(url, handler, options = {}) {
|
||||
this._routes.unshift(new network.RouteHandler(this._options.baseURL, url, handler, options.times));
|
||||
this._routes.unshift(new network.RouteHandler(this._platform, this._options.baseURL, url, handler, options.times));
|
||||
await this._updateInterceptionPatterns();
|
||||
}
|
||||
async routeWebSocket(url, handler) {
|
||||
@@ -358,11 +358,13 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
});
|
||||
}
|
||||
async routeFromHAR(har, options = {}) {
|
||||
const localUtils = this._connection.localUtils();
|
||||
if (!localUtils) throw new Error('Route from har is not supported in thin clients');
|
||||
if (options.update) {
|
||||
await this._recordIntoHAR(har, null, options);
|
||||
return;
|
||||
}
|
||||
const harRouter = await _harRouter.HarRouter.create(this._connection.localUtils(), har, options.notFound || 'abort', {
|
||||
const harRouter = await _harRouter.HarRouter.create(localUtils, har, options.notFound || 'abort', {
|
||||
urlMatch: options.url
|
||||
});
|
||||
this._harRouters.push(harRouter);
|
||||
@@ -380,7 +382,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
const removed = [];
|
||||
const remaining = [];
|
||||
for (const route of this._routes) {
|
||||
if ((0, _utils.urlMatchesEqual)(route.url, url) && (!handler || route.handler === handler)) removed.push(route);else remaining.push(route);
|
||||
if ((0, _urlMatch.urlMatchesEqual)(route.url, url) && (!handler || route.handler === handler)) removed.push(route);else remaining.push(route);
|
||||
}
|
||||
await this._unrouteInternal(removed, remaining, 'default');
|
||||
}
|
||||
@@ -420,10 +422,12 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
});
|
||||
}
|
||||
async storageState(options = {}) {
|
||||
const state = await this._channel.storageState();
|
||||
const state = await this._channel.storageState({
|
||||
indexedDB: options.indexedDB
|
||||
});
|
||||
if (options.path) {
|
||||
await (0, _utils.mkdirIfNeeded)(options.path);
|
||||
await _fs.default.promises.writeFile(options.path, JSON.stringify(state, undefined, 2), 'utf8');
|
||||
await (0, _fileUtils.mkdirIfNeeded)(this._platform, options.path);
|
||||
await this._platform.fs().promises.writeFile(options.path, JSON.stringify(state, undefined, 2), 'utf8');
|
||||
}
|
||||
return state;
|
||||
}
|
||||
@@ -451,7 +455,7 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
this.tracing._resetStackCounter();
|
||||
this.emit(_events.Events.BrowserContext.Close, this);
|
||||
}
|
||||
async [_Symbol$asyncDispose]() {
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.close();
|
||||
}
|
||||
async close(options = {}) {
|
||||
@@ -473,8 +477,10 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
const isCompressed = harParams.content === 'attach' || harParams.path.endsWith('.zip');
|
||||
const needCompressed = harParams.path.endsWith('.zip');
|
||||
if (isCompressed && !needCompressed) {
|
||||
const localUtils = this._connection.localUtils();
|
||||
if (!localUtils) throw new Error('Uncompressed har is not supported in thin clients');
|
||||
await artifact.saveAs(harParams.path + '.tmp');
|
||||
await this._connection.localUtils()._channel.harUnzip({
|
||||
await localUtils.harUnzip({
|
||||
zipFile: harParams.path + '.tmp',
|
||||
harFile: harParams.path
|
||||
});
|
||||
@@ -492,10 +498,10 @@ class BrowserContext extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
}
|
||||
exports.BrowserContext = BrowserContext;
|
||||
async function prepareStorageState(options) {
|
||||
async function prepareStorageState(platform, options) {
|
||||
if (typeof options.storageState !== 'string') return options.storageState;
|
||||
try {
|
||||
return JSON.parse(await _fs.default.promises.readFile(options.storageState, 'utf8'));
|
||||
return JSON.parse(await platform.fs().promises.readFile(options.storageState, 'utf8'));
|
||||
} catch (e) {
|
||||
(0, _stackTrace.rewriteErrorMessage)(e, `Error reading storage state from ${options.storageState}:\n` + e.message);
|
||||
throw e;
|
||||
@@ -506,28 +512,29 @@ function prepareRecordHarOptions(options) {
|
||||
return {
|
||||
path: options.path,
|
||||
content: options.content || (options.omitContent ? 'omit' : undefined),
|
||||
urlGlob: (0, _utils.isString)(options.urlFilter) ? options.urlFilter : undefined,
|
||||
urlRegexSource: (0, _utils.isRegExp)(options.urlFilter) ? options.urlFilter.source : undefined,
|
||||
urlRegexFlags: (0, _utils.isRegExp)(options.urlFilter) ? options.urlFilter.flags : undefined,
|
||||
urlGlob: (0, _rtti.isString)(options.urlFilter) ? options.urlFilter : undefined,
|
||||
urlRegexSource: (0, _rtti.isRegExp)(options.urlFilter) ? options.urlFilter.source : undefined,
|
||||
urlRegexFlags: (0, _rtti.isRegExp)(options.urlFilter) ? options.urlFilter.flags : undefined,
|
||||
mode: options.mode
|
||||
};
|
||||
}
|
||||
async function prepareBrowserContextParams(options) {
|
||||
async function prepareBrowserContextParams(platform, options) {
|
||||
if (options.videoSize && !options.videosPath) throw new Error(`"videoSize" option requires "videosPath" to be specified`);
|
||||
if (options.extraHTTPHeaders) network.validateHeaders(options.extraHTTPHeaders);
|
||||
const contextParams = {
|
||||
...options,
|
||||
viewport: options.viewport === null ? undefined : options.viewport,
|
||||
noDefaultViewport: options.viewport === null,
|
||||
extraHTTPHeaders: options.extraHTTPHeaders ? (0, _utils.headersObjectToArray)(options.extraHTTPHeaders) : undefined,
|
||||
storageState: await prepareStorageState(options),
|
||||
extraHTTPHeaders: options.extraHTTPHeaders ? (0, _headers.headersObjectToArray)(options.extraHTTPHeaders) : undefined,
|
||||
storageState: await prepareStorageState(platform, options),
|
||||
serviceWorkers: options.serviceWorkers,
|
||||
recordHar: prepareRecordHarOptions(options.recordHar),
|
||||
colorScheme: options.colorScheme === null ? 'no-override' : options.colorScheme,
|
||||
reducedMotion: options.reducedMotion === null ? 'no-override' : options.reducedMotion,
|
||||
forcedColors: options.forcedColors === null ? 'no-override' : options.forcedColors,
|
||||
contrast: options.contrast === null ? 'no-override' : options.contrast,
|
||||
acceptDownloads: toAcceptDownloadsProtocol(options.acceptDownloads),
|
||||
clientCertificates: await toClientCertificatesProtocol(options.clientCertificates)
|
||||
clientCertificates: await toClientCertificatesProtocol(platform, options.clientCertificates)
|
||||
};
|
||||
if (!contextParams.recordVideo && options.videosPath) {
|
||||
contextParams.recordVideo = {
|
||||
@@ -535,7 +542,7 @@ async function prepareBrowserContextParams(options) {
|
||||
size: options.videoSize
|
||||
};
|
||||
}
|
||||
if (contextParams.recordVideo && contextParams.recordVideo.dir) contextParams.recordVideo.dir = _path.default.resolve(process.cwd(), contextParams.recordVideo.dir);
|
||||
if (contextParams.recordVideo && contextParams.recordVideo.dir) contextParams.recordVideo.dir = platform.path().resolve(contextParams.recordVideo.dir);
|
||||
return contextParams;
|
||||
}
|
||||
function toAcceptDownloadsProtocol(acceptDownloads) {
|
||||
@@ -543,11 +550,11 @@ function toAcceptDownloadsProtocol(acceptDownloads) {
|
||||
if (acceptDownloads) return 'accept';
|
||||
return 'deny';
|
||||
}
|
||||
async function toClientCertificatesProtocol(certs) {
|
||||
async function toClientCertificatesProtocol(platform, certs) {
|
||||
if (!certs) return undefined;
|
||||
const bufferizeContent = async (value, path) => {
|
||||
if (value) return value;
|
||||
if (path) return await _fs.default.promises.readFile(path);
|
||||
if (path) return await platform.fs().promises.readFile(path);
|
||||
};
|
||||
return await Promise.all(certs.map(async cert => ({
|
||||
origin: cert.origin,
|
||||
|
||||
94
tvapp2/node_modules/playwright-core/lib/client/browserType.js
generated
vendored
94
tvapp2/node_modules/playwright-core/lib/client/browserType.js
generated
vendored
@@ -7,11 +7,13 @@ exports.BrowserType = void 0;
|
||||
var _browser3 = require("./browser");
|
||||
var _browserContext = require("./browserContext");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _connection = require("./connection");
|
||||
var _events = require("./events");
|
||||
var _clientHelper = require("./clientHelper");
|
||||
var _utils = require("../utils");
|
||||
var _timeoutRunner = require("../utils/timeoutRunner");
|
||||
var _events = require("./events");
|
||||
var _assert = require("../utils/isomorphic/assert");
|
||||
var _headers = require("../utils/isomorphic/headers");
|
||||
var _time = require("../utils/isomorphic/time");
|
||||
var _timeoutRunner = require("../utils/isomorphic/timeoutRunner");
|
||||
var _webSocket = require("./webSocket");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -36,11 +38,6 @@ class BrowserType extends _channelOwner.ChannelOwner {
|
||||
this._serverLauncher = void 0;
|
||||
this._contexts = new Set();
|
||||
this._playwright = void 0;
|
||||
// Instrumentation.
|
||||
this._defaultContextOptions = void 0;
|
||||
this._defaultContextTimeout = void 0;
|
||||
this._defaultContextNavigationTimeout = void 0;
|
||||
this._defaultLaunchOptions = void 0;
|
||||
}
|
||||
static from(browserType) {
|
||||
return browserType._object;
|
||||
@@ -53,12 +50,12 @@ class BrowserType extends _channelOwner.ChannelOwner {
|
||||
return this._initializer.name;
|
||||
}
|
||||
async launch(options = {}) {
|
||||
var _this$_defaultLaunchO;
|
||||
(0, _utils.assert)(!options.userDataDir, 'userDataDir option is not supported in `browserType.launch`. Use `browserType.launchPersistentContext` instead');
|
||||
(0, _utils.assert)(!options.port, 'Cannot specify a port without launching as a server.');
|
||||
const logger = options.logger || ((_this$_defaultLaunchO = this._defaultLaunchOptions) === null || _this$_defaultLaunchO === void 0 ? void 0 : _this$_defaultLaunchO.logger);
|
||||
var _this$_playwright$_de;
|
||||
(0, _assert.assert)(!options.userDataDir, 'userDataDir option is not supported in `browserType.launch`. Use `browserType.launchPersistentContext` instead');
|
||||
(0, _assert.assert)(!options.port, 'Cannot specify a port without launching as a server.');
|
||||
const logger = options.logger || ((_this$_playwright$_de = this._playwright._defaultLaunchOptions) === null || _this$_playwright$_de === void 0 ? void 0 : _this$_playwright$_de.logger);
|
||||
options = {
|
||||
...this._defaultLaunchOptions,
|
||||
...this._playwright._defaultLaunchOptions,
|
||||
...options
|
||||
};
|
||||
const launchOptions = {
|
||||
@@ -76,28 +73,28 @@ class BrowserType extends _channelOwner.ChannelOwner {
|
||||
async launchServer(options = {}) {
|
||||
if (!this._serverLauncher) throw new Error('Launching server is not supported');
|
||||
options = {
|
||||
...this._defaultLaunchOptions,
|
||||
...this._playwright._defaultLaunchOptions,
|
||||
...options
|
||||
};
|
||||
return await this._serverLauncher.launchServer(options);
|
||||
}
|
||||
async launchPersistentContext(userDataDir, options = {}) {
|
||||
var _this$_defaultLaunchO2;
|
||||
const logger = options.logger || ((_this$_defaultLaunchO2 = this._defaultLaunchOptions) === null || _this$_defaultLaunchO2 === void 0 ? void 0 : _this$_defaultLaunchO2.logger);
|
||||
(0, _utils.assert)(!options.port, 'Cannot specify a port without launching as a server.');
|
||||
var _this$_playwright$_de2;
|
||||
const logger = options.logger || ((_this$_playwright$_de2 = this._playwright._defaultLaunchOptions) === null || _this$_playwright$_de2 === void 0 ? void 0 : _this$_playwright$_de2.logger);
|
||||
(0, _assert.assert)(!options.port, 'Cannot specify a port without launching as a server.');
|
||||
options = {
|
||||
...this._defaultLaunchOptions,
|
||||
...this._defaultContextOptions,
|
||||
...this._playwright._defaultLaunchOptions,
|
||||
...this._playwright._defaultContextOptions,
|
||||
...options
|
||||
};
|
||||
const contextParams = await (0, _browserContext.prepareBrowserContextParams)(options);
|
||||
const contextParams = await (0, _browserContext.prepareBrowserContextParams)(this._platform, options);
|
||||
const persistentParams = {
|
||||
...contextParams,
|
||||
ignoreDefaultArgs: Array.isArray(options.ignoreDefaultArgs) ? options.ignoreDefaultArgs : undefined,
|
||||
ignoreAllDefaultArgs: !!options.ignoreDefaultArgs && !Array.isArray(options.ignoreDefaultArgs),
|
||||
env: options.env ? (0, _clientHelper.envObjectToArray)(options.env) : undefined,
|
||||
channel: options.channel,
|
||||
userDataDir
|
||||
userDataDir: this._platform.path().isAbsolute(userDataDir) || !userDataDir ? userDataDir : this._platform.path().resolve(userDataDir)
|
||||
};
|
||||
return await this._wrapApiCall(async () => {
|
||||
const result = await this._channel.launchPersistentContext(persistentParams);
|
||||
@@ -111,19 +108,18 @@ class BrowserType extends _channelOwner.ChannelOwner {
|
||||
...options,
|
||||
wsEndpoint: optionsOrWsEndpoint
|
||||
});
|
||||
(0, _utils.assert)(optionsOrWsEndpoint.wsEndpoint, 'options.wsEndpoint is required');
|
||||
(0, _assert.assert)(optionsOrWsEndpoint.wsEndpoint, 'options.wsEndpoint is required');
|
||||
return await this._connect(optionsOrWsEndpoint);
|
||||
}
|
||||
async _connect(params) {
|
||||
const logger = params.logger;
|
||||
return await this._wrapApiCall(async () => {
|
||||
var _params$exposeNetwork;
|
||||
const deadline = params.timeout ? (0, _utils.monotonicTime)() + params.timeout : 0;
|
||||
const deadline = params.timeout ? (0, _time.monotonicTime)() + params.timeout : 0;
|
||||
const headers = {
|
||||
'x-playwright-browser': this.name(),
|
||||
...params.headers
|
||||
};
|
||||
const localUtils = this._connection.localUtils();
|
||||
const connectParams = {
|
||||
wsEndpoint: params.wsEndpoint,
|
||||
headers,
|
||||
@@ -132,69 +128,39 @@ class BrowserType extends _channelOwner.ChannelOwner {
|
||||
timeout: params.timeout
|
||||
};
|
||||
if (params.__testHookRedirectPortForwarding) connectParams.socksProxyRedirectPortForTest = params.__testHookRedirectPortForwarding;
|
||||
const {
|
||||
pipe,
|
||||
headers: connectHeaders
|
||||
} = await localUtils._channel.connect(connectParams);
|
||||
const closePipe = () => pipe.close().catch(() => {});
|
||||
const connection = new _connection.Connection(localUtils, this._instrumentation);
|
||||
connection.markAsRemote();
|
||||
connection.on('close', closePipe);
|
||||
const connection = await (0, _webSocket.connectOverWebSocket)(this._connection, connectParams);
|
||||
let browser;
|
||||
let closeError;
|
||||
const onPipeClosed = reason => {
|
||||
connection.on('close', () => {
|
||||
// Emulate all pages, contexts and the browser closing upon disconnect.
|
||||
for (const context of ((_browser = browser) === null || _browser === void 0 ? void 0 : _browser.contexts()) || []) {
|
||||
var _browser;
|
||||
for (const page of context.pages()) page._onClose();
|
||||
context._onClose();
|
||||
}
|
||||
connection.close(reason || closeError);
|
||||
// Give a chance to any API call promises to reject upon page/context closure.
|
||||
// This happens naturally when we receive page.onClose and browser.onClose from the server
|
||||
// in separate tasks. However, upon pipe closure we used to dispatch them all synchronously
|
||||
// here and promises did not have a chance to reject.
|
||||
// The order of rejects vs closure is a part of the API contract and our test runner
|
||||
// relies on it to attribute rejections to the right test.
|
||||
setTimeout(() => {
|
||||
var _browser2;
|
||||
return (_browser2 = browser) === null || _browser2 === void 0 ? void 0 : _browser2._didClose();
|
||||
}, 0);
|
||||
};
|
||||
pipe.on('closed', params => onPipeClosed(params.reason));
|
||||
connection.onmessage = message => this._wrapApiCall(() => pipe.send({
|
||||
message
|
||||
}).catch(() => onPipeClosed()), /* isInternal */true);
|
||||
pipe.on('message', ({
|
||||
message
|
||||
}) => {
|
||||
try {
|
||||
connection.dispatch(message);
|
||||
} catch (e) {
|
||||
closeError = String(e);
|
||||
closePipe();
|
||||
}
|
||||
});
|
||||
const result = await (0, _timeoutRunner.raceAgainstDeadline)(async () => {
|
||||
// For tests.
|
||||
if (params.__testHookBeforeCreateBrowser) await params.__testHookBeforeCreateBrowser();
|
||||
const playwright = await connection.initializePlaywright();
|
||||
if (!playwright._initializer.preLaunchedBrowser) {
|
||||
closePipe();
|
||||
connection.close();
|
||||
throw new Error('Malformed endpoint. Did you use BrowserType.launchServer method?');
|
||||
}
|
||||
playwright._setSelectors(this._playwright.selectors);
|
||||
browser = _browser3.Browser.from(playwright._initializer.preLaunchedBrowser);
|
||||
this._didLaunchBrowser(browser, {}, logger);
|
||||
browser._shouldCloseConnectionOnClose = true;
|
||||
browser._connectHeaders = connectHeaders;
|
||||
browser.on(_events.Events.Browser.Disconnected, () => this._wrapApiCall(() => closePipe(), /* isInternal */true));
|
||||
browser.on(_events.Events.Browser.Disconnected, () => connection.close());
|
||||
return browser;
|
||||
}, deadline);
|
||||
if (!result.timedOut) {
|
||||
return result.result;
|
||||
} else {
|
||||
closePipe();
|
||||
connection.close();
|
||||
throw new Error(`Timeout ${params.timeout}ms exceeded`);
|
||||
}
|
||||
});
|
||||
@@ -202,12 +168,12 @@ class BrowserType extends _channelOwner.ChannelOwner {
|
||||
async connectOverCDP(endpointURLOrOptions, options) {
|
||||
if (typeof endpointURLOrOptions === 'string') return await this._connectOverCDP(endpointURLOrOptions, options);
|
||||
const endpointURL = 'endpointURL' in endpointURLOrOptions ? endpointURLOrOptions.endpointURL : endpointURLOrOptions.wsEndpoint;
|
||||
(0, _utils.assert)(endpointURL, 'Cannot connect over CDP without wsEndpoint.');
|
||||
(0, _assert.assert)(endpointURL, 'Cannot connect over CDP without wsEndpoint.');
|
||||
return await this.connectOverCDP(endpointURL, endpointURLOrOptions);
|
||||
}
|
||||
async _connectOverCDP(endpointURL, params = {}) {
|
||||
if (this.name() !== 'chromium') throw new Error('Connecting over CDP is only supported in Chromium.');
|
||||
const headers = params.headers ? (0, _utils.headersObjectToArray)(params.headers) : undefined;
|
||||
const headers = params.headers ? (0, _headers.headersObjectToArray)(params.headers) : undefined;
|
||||
const result = await this._channel.connectOverCDP({
|
||||
endpointURL,
|
||||
headers,
|
||||
@@ -229,8 +195,8 @@ class BrowserType extends _channelOwner.ChannelOwner {
|
||||
context._browserType = this;
|
||||
this._contexts.add(context);
|
||||
context._setOptions(contextOptions, browserOptions);
|
||||
if (this._defaultContextTimeout !== undefined) context.setDefaultTimeout(this._defaultContextTimeout);
|
||||
if (this._defaultContextNavigationTimeout !== undefined) context.setDefaultNavigationTimeout(this._defaultContextNavigationTimeout);
|
||||
if (this._playwright._defaultContextTimeout !== undefined) context.setDefaultTimeout(this._playwright._defaultContextTimeout);
|
||||
if (this._playwright._defaultContextNavigationTimeout !== undefined) context.setDefaultNavigationTimeout(this._playwright._defaultContextNavigationTimeout);
|
||||
await this._instrumentation.runAfterCreateBrowserContext(context);
|
||||
}
|
||||
async _willCloseContext(context) {
|
||||
|
||||
43
tvapp2/node_modules/playwright-core/lib/client/channelOwner.js
generated
vendored
43
tvapp2/node_modules/playwright-core/lib/client/channelOwner.js
generated
vendored
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.ChannelOwner = void 0;
|
||||
var _eventEmitter = require("./eventEmitter");
|
||||
var _validator = require("../protocol/validator");
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
var _stackTrace = require("../utils/stackTrace");
|
||||
var _utils = require("../utils");
|
||||
var _zones = require("../utils/zones");
|
||||
var _clientStackTrace = require("./clientStackTrace");
|
||||
var _stackTrace = require("../utils/isomorphic/stackTrace");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -28,7 +26,8 @@ var _zones = require("../utils/zones");
|
||||
|
||||
class ChannelOwner extends _eventEmitter.EventEmitter {
|
||||
constructor(parent, type, guid, initializer) {
|
||||
super();
|
||||
const connection = parent instanceof ChannelOwner ? parent._connection : parent;
|
||||
super(connection._platform);
|
||||
this._connection = void 0;
|
||||
this._parent = void 0;
|
||||
this._objects = new Map();
|
||||
@@ -42,7 +41,7 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
|
||||
this._isInternalType = false;
|
||||
this._wasCollected = false;
|
||||
this.setMaxListeners(0);
|
||||
this._connection = parent instanceof ChannelOwner ? parent._connection : parent;
|
||||
this._connection = connection;
|
||||
this._type = type;
|
||||
this._guid = guid;
|
||||
this._parent = parent instanceof ChannelOwner ? parent : undefined;
|
||||
@@ -52,7 +51,7 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
|
||||
this._parent._objects.set(guid, this);
|
||||
this._logger = this._parent._logger;
|
||||
}
|
||||
this._channel = this._createChannel(new _eventEmitter.EventEmitter());
|
||||
this._channel = this._createChannel(new _eventEmitter.EventEmitter(connection._platform));
|
||||
this._initializer = initializer;
|
||||
}
|
||||
markAsInternalType() {
|
||||
@@ -118,6 +117,13 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
|
||||
objects: Array.from(this._objects.values()).map(o => o._debugScopeState())
|
||||
};
|
||||
}
|
||||
_validatorToWireContext() {
|
||||
return {
|
||||
tChannelImpl: tChannelImplToWire,
|
||||
binary: this._connection.rawBuffers() ? 'buffer' : 'toBase64',
|
||||
isUnderTest: () => this._platform.isUnderTest()
|
||||
};
|
||||
}
|
||||
_createChannel(base) {
|
||||
const channel = new Proxy(base, {
|
||||
get: (obj, prop) => {
|
||||
@@ -126,16 +132,13 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
|
||||
if (validator) {
|
||||
return async params => {
|
||||
return await this._wrapApiCall(async apiZone => {
|
||||
const validatedParams = validator(params, '', {
|
||||
tChannelImpl: tChannelImplToWire,
|
||||
binary: this._connection.rawBuffers() ? 'buffer' : 'toBase64'
|
||||
});
|
||||
const validatedParams = validator(params, '', this._validatorToWireContext());
|
||||
if (!apiZone.isInternal && !apiZone.reported) {
|
||||
// Reporting/tracing/logging this api call for the first time.
|
||||
apiZone.params = params;
|
||||
apiZone.reported = true;
|
||||
this._instrumentation.onApiCallBegin(apiZone);
|
||||
logApiCall(this._logger, `=> ${apiZone.apiName} started`);
|
||||
logApiCall(this._platform, this._logger, `=> ${apiZone.apiName} started`);
|
||||
return await this._connection.sendMessageToServer(this, prop, validatedParams, apiZone.apiName, apiZone.frames, apiZone.stepId);
|
||||
}
|
||||
// Since this api call is either internal, or has already been reported/traced once,
|
||||
@@ -153,10 +156,10 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
|
||||
}
|
||||
async _wrapApiCall(func, isInternal) {
|
||||
const logger = this._logger;
|
||||
const existingApiZone = _zones.zones.zoneData('apiZone');
|
||||
const existingApiZone = this._platform.zones.current().data();
|
||||
if (existingApiZone) return await func(existingApiZone);
|
||||
if (isInternal === undefined) isInternal = this._isInternalType;
|
||||
const stackTrace = (0, _stackTrace.captureLibraryStackTrace)();
|
||||
const stackTrace = (0, _clientStackTrace.captureLibraryStackTrace)(this._platform);
|
||||
const apiZone = {
|
||||
apiName: stackTrace.apiName,
|
||||
frames: stackTrace.frames,
|
||||
@@ -166,20 +169,20 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
|
||||
stepId: undefined
|
||||
};
|
||||
try {
|
||||
const result = await _zones.zones.run('apiZone', apiZone, async () => await func(apiZone));
|
||||
const result = await this._platform.zones.current().push(apiZone).run(async () => await func(apiZone));
|
||||
if (!isInternal) {
|
||||
logApiCall(logger, `<= ${apiZone.apiName} succeeded`);
|
||||
logApiCall(this._platform, logger, `<= ${apiZone.apiName} succeeded`);
|
||||
this._instrumentation.onApiCallEnd(apiZone);
|
||||
}
|
||||
return result;
|
||||
} catch (e) {
|
||||
const innerError = (process.env.PWDEBUGIMPL || (0, _utils.isUnderTest)()) && e.stack ? '\n<inner error>\n' + e.stack : '';
|
||||
const innerError = (this._platform.showInternalStackFrames() || this._platform.isUnderTest()) && e.stack ? '\n<inner error>\n' + e.stack : '';
|
||||
if (apiZone.apiName && !apiZone.apiName.includes('<anonymous>')) e.message = apiZone.apiName + ': ' + e.message;
|
||||
const stackFrames = '\n' + (0, _stackTrace.stringifyStackFrames)(stackTrace.frames).join('\n') + innerError;
|
||||
if (stackFrames.trim()) e.stack = e.message + stackFrames;else e.stack = '';
|
||||
if (!isInternal) {
|
||||
apiZone.error = e;
|
||||
logApiCall(logger, `<= ${apiZone.apiName} failed`);
|
||||
logApiCall(this._platform, logger, `<= ${apiZone.apiName} failed`);
|
||||
this._instrumentation.onApiCallEnd(apiZone);
|
||||
}
|
||||
throw e;
|
||||
@@ -201,11 +204,11 @@ class ChannelOwner extends _eventEmitter.EventEmitter {
|
||||
}
|
||||
}
|
||||
exports.ChannelOwner = ChannelOwner;
|
||||
function logApiCall(logger, message) {
|
||||
function logApiCall(platform, logger, message) {
|
||||
if (logger && logger.isEnabled('api', 'info')) logger.log('api', 'info', message, [], {
|
||||
color: 'cyan'
|
||||
});
|
||||
_debugLogger.debugLogger.log('api', message);
|
||||
platform.log('api', message);
|
||||
}
|
||||
function tChannelImplToWire(names, arg, path, context) {
|
||||
if (arg._object instanceof ChannelOwner && (names === '*' || names.includes(arg._object._type))) return {
|
||||
|
||||
10
tvapp2/node_modules/playwright-core/lib/client/clientHelper.js
generated
vendored
10
tvapp2/node_modules/playwright-core/lib/client/clientHelper.js
generated
vendored
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.addSourceUrlToScript = addSourceUrlToScript;
|
||||
exports.envObjectToArray = envObjectToArray;
|
||||
exports.evaluationScript = evaluationScript;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _utils = require("../utils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _rtti = require("../utils/isomorphic/rtti");
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
@@ -36,17 +34,17 @@ function envObjectToArray(env) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
async function evaluationScript(fun, arg, addSourceUrl = true) {
|
||||
async function evaluationScript(platform, fun, arg, addSourceUrl = true) {
|
||||
if (typeof fun === 'function') {
|
||||
const source = fun.toString();
|
||||
const argString = Object.is(arg, undefined) ? 'undefined' : JSON.stringify(arg);
|
||||
return `(${source})(${argString})`;
|
||||
}
|
||||
if (arg !== undefined) throw new Error('Cannot evaluate a string with arguments');
|
||||
if ((0, _utils.isString)(fun)) return fun;
|
||||
if ((0, _rtti.isString)(fun)) return fun;
|
||||
if (fun.content !== undefined) return fun.content;
|
||||
if (fun.path !== undefined) {
|
||||
let source = await _fs.default.promises.readFile(fun.path, 'utf8');
|
||||
let source = await platform.fs().promises.readFile(fun.path, 'utf8');
|
||||
if (addSourceUrl) source = addSourceUrlToScript(source, fun.path);
|
||||
return source;
|
||||
}
|
||||
|
||||
85
tvapp2/node_modules/playwright-core/lib/client/connection.js
generated
vendored
85
tvapp2/node_modules/playwright-core/lib/client/connection.js
generated
vendored
@@ -4,35 +4,34 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Connection = void 0;
|
||||
var _eventEmitter = require("./eventEmitter");
|
||||
var _android = require("./android");
|
||||
var _artifact = require("./artifact");
|
||||
var _browser = require("./browser");
|
||||
var _browserContext = require("./browserContext");
|
||||
var _browserType = require("./browserType");
|
||||
var _cdpSession = require("./cdpSession");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _clientInstrumentation = require("./clientInstrumentation");
|
||||
var _dialog = require("./dialog");
|
||||
var _electron = require("./electron");
|
||||
var _elementHandle = require("./elementHandle");
|
||||
var _errors = require("./errors");
|
||||
var _fetch = require("./fetch");
|
||||
var _frame = require("./frame");
|
||||
var _jsHandle = require("./jsHandle");
|
||||
var _jsonPipe = require("./jsonPipe");
|
||||
var _localUtils = require("./localUtils");
|
||||
var _network = require("./network");
|
||||
var _page = require("./page");
|
||||
var _worker = require("./worker");
|
||||
var _dialog = require("./dialog");
|
||||
var _errors = require("./errors");
|
||||
var _cdpSession = require("./cdpSession");
|
||||
var _playwright = require("./playwright");
|
||||
var _electron = require("./electron");
|
||||
var _stream = require("./stream");
|
||||
var _writableStream = require("./writableStream");
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
var _selectors = require("./selectors");
|
||||
var _android = require("./android");
|
||||
var _artifact = require("./artifact");
|
||||
var _events = require("events");
|
||||
var _jsonPipe = require("./jsonPipe");
|
||||
var _fetch = require("./fetch");
|
||||
var _localUtils = require("./localUtils");
|
||||
var _stream = require("./stream");
|
||||
var _tracing = require("./tracing");
|
||||
var _worker = require("./worker");
|
||||
var _writableStream = require("./writableStream");
|
||||
var _validator = require("../protocol/validator");
|
||||
var _clientInstrumentation = require("./clientInstrumentation");
|
||||
var _utils = require("../utils");
|
||||
var _stackTrace = require("../utils/isomorphic/stackTrace");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -60,9 +59,9 @@ class Root extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
}
|
||||
class DummyChannelOwner extends _channelOwner.ChannelOwner {}
|
||||
class Connection extends _events.EventEmitter {
|
||||
constructor(localUtils, instrumentation) {
|
||||
super();
|
||||
class Connection extends _eventEmitter.EventEmitter {
|
||||
constructor(platform, localUtils, instrumentation, headers = []) {
|
||||
super(platform);
|
||||
this._objects = new Map();
|
||||
this.onmessage = message => {};
|
||||
this._lastId = 0;
|
||||
@@ -76,9 +75,12 @@ class Connection extends _events.EventEmitter {
|
||||
this.toImpl = void 0;
|
||||
this._tracingCount = 0;
|
||||
this._instrumentation = void 0;
|
||||
// Used from @playwright/test fixtures -> TODO remove?
|
||||
this.headers = void 0;
|
||||
this._instrumentation = instrumentation || (0, _clientInstrumentation.createInstrumentation)();
|
||||
this._localUtils = localUtils;
|
||||
this._rootObject = new Root(this);
|
||||
this.headers = headers;
|
||||
}
|
||||
markAsRemote() {
|
||||
this._isRemote = true;
|
||||
@@ -117,9 +119,9 @@ class Connection extends _events.EventEmitter {
|
||||
method,
|
||||
params
|
||||
};
|
||||
if (_debugLogger.debugLogger.isEnabled('channel')) {
|
||||
if (this._platform.isLogEnabled('channel')) {
|
||||
// Do not include metadata in debug logs to avoid noise.
|
||||
_debugLogger.debugLogger.log('channel', 'SEND> ' + JSON.stringify(message));
|
||||
this._platform.log('channel', 'SEND> ' + JSON.stringify(message));
|
||||
}
|
||||
const location = frames[0] ? {
|
||||
file: frames[0].file,
|
||||
@@ -132,7 +134,7 @@ class Connection extends _events.EventEmitter {
|
||||
internal: !apiName,
|
||||
stepId
|
||||
};
|
||||
if (this._tracingCount && frames && type !== 'LocalUtils') (_this$_localUtils = this._localUtils) === null || _this$_localUtils === void 0 || _this$_localUtils._channel.addStackToTracingNoReply({
|
||||
if (this._tracingCount && frames && type !== 'LocalUtils') (_this$_localUtils = this._localUtils) === null || _this$_localUtils === void 0 || _this$_localUtils.addStackToTracingNoReply({
|
||||
callData: {
|
||||
stack: frames,
|
||||
id
|
||||
@@ -140,7 +142,7 @@ class Connection extends _events.EventEmitter {
|
||||
}).catch(() => {});
|
||||
// We need to exit zones before calling into the server, otherwise
|
||||
// when we receive events from the server, we would be in an API zone.
|
||||
_utils.zones.empty().run(() => this.onmessage({
|
||||
this._platform.zones.empty.run(() => this.onmessage({
|
||||
...message,
|
||||
metadata
|
||||
}));
|
||||
@@ -152,6 +154,13 @@ class Connection extends _events.EventEmitter {
|
||||
method
|
||||
}));
|
||||
}
|
||||
_validatorFromWireContext() {
|
||||
return {
|
||||
tChannelImpl: this._tChannelImplFromWire.bind(this),
|
||||
binary: this._rawBuffers ? 'buffer' : 'fromBase64',
|
||||
isUnderTest: () => this._platform.isUnderTest()
|
||||
};
|
||||
}
|
||||
dispatch(message) {
|
||||
if (this._closedError) return;
|
||||
const {
|
||||
@@ -164,24 +173,21 @@ class Connection extends _events.EventEmitter {
|
||||
log
|
||||
} = message;
|
||||
if (id) {
|
||||
if (_debugLogger.debugLogger.isEnabled('channel')) _debugLogger.debugLogger.log('channel', '<RECV ' + JSON.stringify(message));
|
||||
if (this._platform.isLogEnabled('channel')) this._platform.log('channel', '<RECV ' + JSON.stringify(message));
|
||||
const callback = this._callbacks.get(id);
|
||||
if (!callback) throw new Error(`Cannot find command to respond: ${id}`);
|
||||
this._callbacks.delete(id);
|
||||
if (error && !result) {
|
||||
const parsedError = (0, _errors.parseError)(error);
|
||||
(0, _utils.rewriteErrorMessage)(parsedError, parsedError.message + (0, _utils.formatCallLog)(log));
|
||||
(0, _stackTrace.rewriteErrorMessage)(parsedError, parsedError.message + formatCallLog(this._platform, log));
|
||||
callback.reject(parsedError);
|
||||
} else {
|
||||
const validator = (0, _validator.findValidator)(callback.type, callback.method, 'Result');
|
||||
callback.resolve(validator(result, '', {
|
||||
tChannelImpl: this._tChannelImplFromWire.bind(this),
|
||||
binary: this._rawBuffers ? 'buffer' : 'fromBase64'
|
||||
}));
|
||||
callback.resolve(validator(result, '', this._validatorFromWireContext()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_debugLogger.debugLogger.isEnabled('channel')) _debugLogger.debugLogger.log('channel', '<EVENT ' + JSON.stringify(message));
|
||||
if (this._platform.isLogEnabled('channel')) this._platform.log('channel', '<EVENT ' + JSON.stringify(message));
|
||||
if (method === '__create__') {
|
||||
this._createRemoteObject(guid, params.type, params.guid, params.initializer);
|
||||
return;
|
||||
@@ -199,10 +205,7 @@ class Connection extends _events.EventEmitter {
|
||||
return;
|
||||
}
|
||||
const validator = (0, _validator.findValidator)(object._type, method, 'Event');
|
||||
object._channel.emit(method, validator(params, '', {
|
||||
tChannelImpl: this._tChannelImplFromWire.bind(this),
|
||||
binary: this._rawBuffers ? 'buffer' : 'fromBase64'
|
||||
}));
|
||||
object._channel.emit(method, validator(params, '', this._validatorFromWireContext()));
|
||||
}
|
||||
close(cause) {
|
||||
if (this._closedError) return;
|
||||
@@ -225,10 +228,7 @@ class Connection extends _events.EventEmitter {
|
||||
if (!parent) throw new Error(`Cannot find parent object ${parentGuid} to create ${guid}`);
|
||||
let result;
|
||||
const validator = (0, _validator.findValidator)(type, '', 'Initializer');
|
||||
initializer = validator(initializer, '', {
|
||||
tChannelImpl: this._tChannelImplFromWire.bind(this),
|
||||
binary: this._rawBuffers ? 'buffer' : 'fromBase64'
|
||||
});
|
||||
initializer = validator(initializer, '', this._validatorFromWireContext());
|
||||
switch (type) {
|
||||
case 'Android':
|
||||
result = new _android.Android(parent, type, guid, initializer);
|
||||
@@ -330,4 +330,11 @@ class Connection extends _events.EventEmitter {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
exports.Connection = Connection;
|
||||
exports.Connection = Connection;
|
||||
function formatCallLog(platform, log) {
|
||||
if (!log || !log.some(l => !!l)) return '';
|
||||
return `
|
||||
Call log:
|
||||
${platform.colors.dim(log.join('\n'))}
|
||||
`;
|
||||
}
|
||||
11
tvapp2/node_modules/playwright-core/lib/client/consoleMessage.js
generated
vendored
11
tvapp2/node_modules/playwright-core/lib/client/consoleMessage.js
generated
vendored
@@ -4,10 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ConsoleMessage = void 0;
|
||||
var util = _interopRequireWildcard(require("util"));
|
||||
var _jsHandle = require("./jsHandle");
|
||||
var _page = require("./page");
|
||||
let _util$inspect$custom;
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -23,15 +21,14 @@ let _util$inspect$custom;
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
_util$inspect$custom = util.inspect.custom;
|
||||
|
||||
class ConsoleMessage {
|
||||
constructor(event) {
|
||||
constructor(platform, event) {
|
||||
this._page = void 0;
|
||||
this._event = void 0;
|
||||
this._page = 'page' in event && event.page ? _page.Page.from(event.page) : null;
|
||||
this._event = event;
|
||||
if (platform.inspectCustom) this[platform.inspectCustom] = () => this._inspect();
|
||||
}
|
||||
page() {
|
||||
return this._page;
|
||||
@@ -48,7 +45,7 @@ class ConsoleMessage {
|
||||
location() {
|
||||
return this._event.location;
|
||||
}
|
||||
[_util$inspect$custom]() {
|
||||
_inspect() {
|
||||
return this.text();
|
||||
}
|
||||
}
|
||||
|
||||
20
tvapp2/node_modules/playwright-core/lib/client/electron.js
generated
vendored
20
tvapp2/node_modules/playwright-core/lib/client/electron.js
generated
vendored
@@ -4,16 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ElectronApplication = exports.Electron = void 0;
|
||||
var _timeoutSettings = require("../common/timeoutSettings");
|
||||
var _browserContext = require("./browserContext");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _clientHelper = require("./clientHelper");
|
||||
var _consoleMessage = require("./consoleMessage");
|
||||
var _errors = require("./errors");
|
||||
var _events = require("./events");
|
||||
var _jsHandle = require("./jsHandle");
|
||||
var _consoleMessage = require("./consoleMessage");
|
||||
var _waiter = require("./waiter");
|
||||
var _errors = require("./errors");
|
||||
let _Symbol$asyncDispose;
|
||||
var _timeoutSettings = require("./timeoutSettings");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -29,6 +28,7 @@ let _Symbol$asyncDispose;
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class Electron extends _channelOwner.ChannelOwner {
|
||||
static from(electron) {
|
||||
return electron._object;
|
||||
@@ -38,8 +38,8 @@ class Electron extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
async launch(options = {}) {
|
||||
const params = {
|
||||
...(await (0, _browserContext.prepareBrowserContextParams)(options)),
|
||||
env: (0, _clientHelper.envObjectToArray)(options.env ? options.env : process.env),
|
||||
...(await (0, _browserContext.prepareBrowserContextParams)(this._platform, options)),
|
||||
env: (0, _clientHelper.envObjectToArray)(options.env ? options.env : this._platform.env),
|
||||
tracesDir: options.tracesDir
|
||||
};
|
||||
const app = ElectronApplication.from((await this._channel.launch(params)).electronApplication);
|
||||
@@ -48,7 +48,6 @@ class Electron extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
}
|
||||
exports.Electron = Electron;
|
||||
_Symbol$asyncDispose = Symbol.asyncDispose;
|
||||
class ElectronApplication extends _channelOwner.ChannelOwner {
|
||||
static from(electronApplication) {
|
||||
return electronApplication._object;
|
||||
@@ -57,14 +56,15 @@ class ElectronApplication extends _channelOwner.ChannelOwner {
|
||||
super(parent, type, guid, initializer);
|
||||
this._context = void 0;
|
||||
this._windows = new Set();
|
||||
this._timeoutSettings = new _timeoutSettings.TimeoutSettings();
|
||||
this._timeoutSettings = void 0;
|
||||
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._platform);
|
||||
this._context = _browserContext.BrowserContext.from(initializer.context);
|
||||
for (const page of this._context._pages) this._onPage(page);
|
||||
this._context.on(_events.Events.BrowserContext.Page, page => this._onPage(page));
|
||||
this._channel.on('close', () => {
|
||||
this.emit(_events.Events.ElectronApplication.Close);
|
||||
});
|
||||
this._channel.on('console', event => this.emit(_events.Events.ElectronApplication.Console, new _consoleMessage.ConsoleMessage(event)));
|
||||
this._channel.on('console', event => this.emit(_events.Events.ElectronApplication.Console, new _consoleMessage.ConsoleMessage(this._platform, event)));
|
||||
this._setEventToSubscriptionMapping(new Map([[_events.Events.ElectronApplication.Console, 'console']]));
|
||||
}
|
||||
process() {
|
||||
@@ -86,7 +86,7 @@ class ElectronApplication extends _channelOwner.ChannelOwner {
|
||||
context() {
|
||||
return this._context;
|
||||
}
|
||||
async [_Symbol$asyncDispose]() {
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.close();
|
||||
}
|
||||
async close() {
|
||||
|
||||
65
tvapp2/node_modules/playwright-core/lib/client/elementHandle.js
generated
vendored
65
tvapp2/node_modules/playwright-core/lib/client/elementHandle.js
generated
vendored
@@ -9,15 +9,11 @@ exports.convertSelectOptionValues = convertSelectOptionValues;
|
||||
exports.determineScreenshotType = determineScreenshotType;
|
||||
var _frame = require("./frame");
|
||||
var _jsHandle = require("./jsHandle");
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _utilsBundle = require("../utilsBundle");
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _utils = require("../utils");
|
||||
var _fileUtils = require("../utils/fileUtils");
|
||||
var _assert = require("../utils/isomorphic/assert");
|
||||
var _fileUtils = require("./fileUtils");
|
||||
var _rtti = require("../utils/isomorphic/rtti");
|
||||
var _writableStream = require("./writableStream");
|
||||
var _stream = require("stream");
|
||||
var _util = require("util");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _mimeType = require("../utils/isomorphic/mimeType");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -34,7 +30,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const pipelineAsync = (0, _util.promisify)(_stream.pipeline);
|
||||
class ElementHandle extends _jsHandle.JSHandle {
|
||||
static from(handle) {
|
||||
return handle._object;
|
||||
@@ -56,6 +51,10 @@ class ElementHandle extends _jsHandle.JSHandle {
|
||||
async contentFrame() {
|
||||
return _frame.Frame.fromNullable((await this._elementChannel.contentFrame()).frame);
|
||||
}
|
||||
async _generateLocatorString() {
|
||||
const value = (await this._elementChannel.generateLocatorString()).value;
|
||||
return value === undefined ? null : value;
|
||||
}
|
||||
async getAttribute(name) {
|
||||
const value = (await this._elementChannel.getAttribute({
|
||||
name
|
||||
@@ -133,7 +132,7 @@ class ElementHandle extends _jsHandle.JSHandle {
|
||||
async setInputFiles(files, options = {}) {
|
||||
const frame = await this.ownerFrame();
|
||||
if (!frame) throw new Error('Cannot set input files to detached element');
|
||||
const converted = await convertInputFiles(files, frame.page().context());
|
||||
const converted = await convertInputFiles(this._platform, files, frame.page().context());
|
||||
await this._elementChannel.setInputFiles({
|
||||
...converted,
|
||||
...options
|
||||
@@ -168,21 +167,22 @@ class ElementHandle extends _jsHandle.JSHandle {
|
||||
return value === undefined ? null : value;
|
||||
}
|
||||
async screenshot(options = {}) {
|
||||
const mask = options.mask;
|
||||
const copy = {
|
||||
...options,
|
||||
mask: undefined
|
||||
};
|
||||
if (!copy.type) copy.type = determineScreenshotType(options);
|
||||
if (options.mask) {
|
||||
copy.mask = options.mask.map(locator => ({
|
||||
if (mask) {
|
||||
copy.mask = mask.map(locator => ({
|
||||
frame: locator._frame._channel,
|
||||
selector: locator._selector
|
||||
}));
|
||||
}
|
||||
const result = await this._elementChannel.screenshot(copy);
|
||||
if (options.path) {
|
||||
await (0, _fileUtils.mkdirIfNeeded)(options.path);
|
||||
await _fs.default.promises.writeFile(options.path, result.binary);
|
||||
await (0, _fileUtils.mkdirIfNeeded)(this._platform, options.path);
|
||||
await this._platform.fs().promises.writeFile(options.path, result.binary);
|
||||
}
|
||||
return result.binary;
|
||||
}
|
||||
@@ -234,11 +234,11 @@ function convertSelectOptionValues(values) {
|
||||
if (values === null) return {};
|
||||
if (!Array.isArray(values)) values = [values];
|
||||
if (!values.length) return {};
|
||||
for (let i = 0; i < values.length; i++) (0, _utils.assert)(values[i] !== null, `options[${i}]: expected object, got null`);
|
||||
for (let i = 0; i < values.length; i++) (0, _assert.assert)(values[i] !== null, `options[${i}]: expected object, got null`);
|
||||
if (values[0] instanceof ElementHandle) return {
|
||||
elements: values.map(v => v._elementChannel)
|
||||
};
|
||||
if ((0, _utils.isString)(values[0])) return {
|
||||
if ((0, _rtti.isString)(values[0])) return {
|
||||
options: values.map(valueOrLabel => ({
|
||||
valueOrLabel
|
||||
}))
|
||||
@@ -250,50 +250,49 @@ function convertSelectOptionValues(values) {
|
||||
function filePayloadExceedsSizeLimit(payloads) {
|
||||
return payloads.reduce((size, item) => size + (item.buffer ? item.buffer.byteLength : 0), 0) >= _fileUtils.fileUploadSizeLimit;
|
||||
}
|
||||
async function resolvePathsAndDirectoryForInputFiles(items) {
|
||||
var _localPaths2;
|
||||
async function resolvePathsAndDirectoryForInputFiles(platform, items) {
|
||||
var _localPaths;
|
||||
let localPaths;
|
||||
let localDirectory;
|
||||
for (const item of items) {
|
||||
const stat = await _fs.default.promises.stat(item);
|
||||
const stat = await platform.fs().promises.stat(item);
|
||||
if (stat.isDirectory()) {
|
||||
if (localDirectory) throw new Error('Multiple directories are not supported');
|
||||
localDirectory = _path.default.resolve(item);
|
||||
localDirectory = platform.path().resolve(item);
|
||||
} else {
|
||||
var _localPaths;
|
||||
(_localPaths = localPaths) !== null && _localPaths !== void 0 ? _localPaths : localPaths = [];
|
||||
localPaths.push(_path.default.resolve(item));
|
||||
localPaths !== null && localPaths !== void 0 ? localPaths : localPaths = [];
|
||||
localPaths.push(platform.path().resolve(item));
|
||||
}
|
||||
}
|
||||
if ((_localPaths2 = localPaths) !== null && _localPaths2 !== void 0 && _localPaths2.length && localDirectory) throw new Error('File paths must be all files or a single directory');
|
||||
if ((_localPaths = localPaths) !== null && _localPaths !== void 0 && _localPaths.length && localDirectory) throw new Error('File paths must be all files or a single directory');
|
||||
return [localPaths, localDirectory];
|
||||
}
|
||||
async function convertInputFiles(files, context) {
|
||||
async function convertInputFiles(platform, files, context) {
|
||||
const items = Array.isArray(files) ? files.slice() : [files];
|
||||
if (items.some(item => typeof item === 'string')) {
|
||||
if (!items.every(item => typeof item === 'string')) throw new Error('File paths cannot be mixed with buffers');
|
||||
const [localPaths, localDirectory] = await resolvePathsAndDirectoryForInputFiles(items);
|
||||
const [localPaths, localDirectory] = await resolvePathsAndDirectoryForInputFiles(platform, items);
|
||||
if (context._connection.isRemote()) {
|
||||
const files = localDirectory ? (await _fs.default.promises.readdir(localDirectory, {
|
||||
const files = localDirectory ? (await platform.fs().promises.readdir(localDirectory, {
|
||||
withFileTypes: true,
|
||||
recursive: true
|
||||
})).filter(f => f.isFile()).map(f => _path.default.join(f.path, f.name)) : localPaths;
|
||||
})).filter(f => f.isFile()).map(f => platform.path().join(f.path, f.name)) : localPaths;
|
||||
const {
|
||||
writableStreams,
|
||||
rootDir
|
||||
} = await context._wrapApiCall(async () => context._channel.createTempFiles({
|
||||
rootDirName: localDirectory ? _path.default.basename(localDirectory) : undefined,
|
||||
rootDirName: localDirectory ? platform.path().basename(localDirectory) : undefined,
|
||||
items: await Promise.all(files.map(async file => {
|
||||
const lastModifiedMs = (await _fs.default.promises.stat(file)).mtimeMs;
|
||||
const lastModifiedMs = (await platform.fs().promises.stat(file)).mtimeMs;
|
||||
return {
|
||||
name: localDirectory ? _path.default.relative(localDirectory, file) : _path.default.basename(file),
|
||||
name: localDirectory ? platform.path().relative(localDirectory, file) : platform.path().basename(file),
|
||||
lastModifiedMs
|
||||
};
|
||||
}))
|
||||
}), true);
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const writable = _writableStream.WritableStream.from(writableStreams[i]);
|
||||
await pipelineAsync(_fs.default.createReadStream(files[i]), writable.stream());
|
||||
await platform.streamFile(files[i], writable.stream());
|
||||
}
|
||||
return {
|
||||
directoryStream: rootDir,
|
||||
@@ -313,7 +312,7 @@ async function convertInputFiles(files, context) {
|
||||
}
|
||||
function determineScreenshotType(options) {
|
||||
if (options.path) {
|
||||
const mimeType = _utilsBundle.mime.getType(options.path);
|
||||
const mimeType = (0, _mimeType.getMimeTypeForPath)(options.path);
|
||||
if (mimeType === 'image/png') return 'png';else if (mimeType === 'image/jpeg') return 'jpeg';
|
||||
throw new Error(`path: unsupported mime type "${mimeType}"`);
|
||||
}
|
||||
|
||||
4
tvapp2/node_modules/playwright-core/lib/client/errors.js
generated
vendored
4
tvapp2/node_modules/playwright-core/lib/client/errors.js
generated
vendored
@@ -7,8 +7,8 @@ exports.TimeoutError = exports.TargetClosedError = void 0;
|
||||
exports.isTargetClosedError = isTargetClosedError;
|
||||
exports.parseError = parseError;
|
||||
exports.serializeError = serializeError;
|
||||
var _utils = require("../utils");
|
||||
var _serializers = require("../protocol/serializers");
|
||||
var _rtti = require("../utils/isomorphic/rtti");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -42,7 +42,7 @@ function isTargetClosedError(error) {
|
||||
return error instanceof TargetClosedError;
|
||||
}
|
||||
function serializeError(e) {
|
||||
if ((0, _utils.isError)(e)) return {
|
||||
if ((0, _rtti.isError)(e)) return {
|
||||
error: {
|
||||
message: e.message,
|
||||
stack: e.stack,
|
||||
|
||||
13
tvapp2/node_modules/playwright-core/lib/client/eventEmitter.js
generated
vendored
13
tvapp2/node_modules/playwright-core/lib/client/eventEmitter.js
generated
vendored
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.EventEmitter = void 0;
|
||||
var _events = require("events");
|
||||
var _utils = require("../utils");
|
||||
/**
|
||||
* Copyright Joyent, Inc. and other Node contributors.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
@@ -31,12 +29,14 @@ var _utils = require("../utils");
|
||||
*/
|
||||
|
||||
class EventEmitter {
|
||||
constructor() {
|
||||
constructor(platform) {
|
||||
this._events = undefined;
|
||||
this._eventsCount = 0;
|
||||
this._maxListeners = undefined;
|
||||
this._pendingHandlers = new Map();
|
||||
this._rejectionHandler = void 0;
|
||||
this._platform = void 0;
|
||||
this._platform = platform;
|
||||
if (this._events === undefined || this._events === Object.getPrototypeOf(this)._events) {
|
||||
this._events = Object.create(null);
|
||||
this._eventsCount = 0;
|
||||
@@ -51,7 +51,7 @@ class EventEmitter {
|
||||
return this;
|
||||
}
|
||||
getMaxListeners() {
|
||||
return this._maxListeners === undefined ? _events.EventEmitter.defaultMaxListeners : this._maxListeners;
|
||||
return this._maxListeners === undefined ? this._platform.defaultMaxListeners() : this._maxListeners;
|
||||
}
|
||||
emit(type, ...args) {
|
||||
const events = this._events;
|
||||
@@ -130,7 +130,7 @@ class EventEmitter {
|
||||
w.emitter = this;
|
||||
w.type = type;
|
||||
w.count = existing.length;
|
||||
if (!(0, _utils.isUnderTest)()) {
|
||||
if (!this._platform.isUnderTest()) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(w);
|
||||
}
|
||||
@@ -191,14 +191,11 @@ class EventEmitter {
|
||||
if (options.behavior === 'wait') {
|
||||
const errors = [];
|
||||
this._rejectionHandler = error => errors.push(error);
|
||||
// eslint-disable-next-line internal-playwright/await-promise-in-class-returns
|
||||
return this._waitFor(type).then(() => {
|
||||
if (errors.length) throw errors[0];
|
||||
});
|
||||
}
|
||||
if (options.behavior === 'ignoreErrors') this._rejectionHandler = () => {};
|
||||
|
||||
// eslint-disable-next-line internal-playwright/await-promise-in-class-returns
|
||||
return Promise.resolve();
|
||||
}
|
||||
_removeAllListeners(type) {
|
||||
|
||||
121
tvapp2/node_modules/playwright-core/lib/client/fetch.js
generated
vendored
121
tvapp2/node_modules/playwright-core/lib/client/fetch.js
generated
vendored
@@ -4,17 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.APIResponse = exports.APIRequestContext = exports.APIRequest = void 0;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var util = _interopRequireWildcard(require("util"));
|
||||
var _utils = require("../utils");
|
||||
var _fileUtils = require("../utils/fileUtils");
|
||||
var _browserContext = require("./browserContext");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _errors = require("./errors");
|
||||
var _network = require("./network");
|
||||
var _tracing = require("./tracing");
|
||||
var _errors = require("./errors");
|
||||
var _browserContext = require("./browserContext");
|
||||
let _Symbol$asyncDispose, _Symbol$asyncDispose2, _util$inspect$custom;
|
||||
var _assert = require("../utils/isomorphic/assert");
|
||||
var _fileUtils = require("./fileUtils");
|
||||
var _headers = require("../utils/isomorphic/headers");
|
||||
var _rtti = require("../utils/isomorphic/rtti");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -30,42 +28,37 @@ let _Symbol$asyncDispose, _Symbol$asyncDispose2, _util$inspect$custom;
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class APIRequest {
|
||||
constructor(playwright) {
|
||||
this._playwright = void 0;
|
||||
this._contexts = new Set();
|
||||
// Instrumentation.
|
||||
this._defaultContextOptions = void 0;
|
||||
this._playwright = playwright;
|
||||
}
|
||||
async newContext(options = {}) {
|
||||
var _this$_defaultContext;
|
||||
var _this$_playwright$_de, _this$_playwright$_de2;
|
||||
options = {
|
||||
...this._defaultContextOptions,
|
||||
...this._playwright._defaultContextOptions,
|
||||
timeout: this._playwright._defaultContextTimeout,
|
||||
...options
|
||||
};
|
||||
const storageState = typeof options.storageState === 'string' ? JSON.parse(await _fs.default.promises.readFile(options.storageState, 'utf8')) : options.storageState;
|
||||
// We do not expose tracesDir in the API, so do not allow options to accidentally override it.
|
||||
const tracesDir = (_this$_defaultContext = this._defaultContextOptions) === null || _this$_defaultContext === void 0 ? void 0 : _this$_defaultContext.tracesDir;
|
||||
const storageState = typeof options.storageState === 'string' ? JSON.parse(await this._playwright._platform.fs().promises.readFile(options.storageState, 'utf8')) : options.storageState;
|
||||
const context = APIRequestContext.from((await this._playwright._channel.newRequest({
|
||||
...options,
|
||||
extraHTTPHeaders: options.extraHTTPHeaders ? (0, _utils.headersObjectToArray)(options.extraHTTPHeaders) : undefined,
|
||||
extraHTTPHeaders: options.extraHTTPHeaders ? (0, _headers.headersObjectToArray)(options.extraHTTPHeaders) : undefined,
|
||||
storageState,
|
||||
tracesDir,
|
||||
clientCertificates: await (0, _browserContext.toClientCertificatesProtocol)(options.clientCertificates)
|
||||
tracesDir: (_this$_playwright$_de = this._playwright._defaultLaunchOptions) === null || _this$_playwright$_de === void 0 ? void 0 : _this$_playwright$_de.tracesDir,
|
||||
// We do not expose tracesDir in the API, so do not allow options to accidentally override it.
|
||||
clientCertificates: await (0, _browserContext.toClientCertificatesProtocol)(this._playwright._platform, options.clientCertificates)
|
||||
})).request);
|
||||
this._contexts.add(context);
|
||||
context._request = this;
|
||||
context._tracing._tracesDir = tracesDir;
|
||||
context._tracing._tracesDir = (_this$_playwright$_de2 = this._playwright._defaultLaunchOptions) === null || _this$_playwright$_de2 === void 0 ? void 0 : _this$_playwright$_de2.tracesDir;
|
||||
await context._instrumentation.runAfterCreateRequestContext(context);
|
||||
return context;
|
||||
}
|
||||
}
|
||||
exports.APIRequest = APIRequest;
|
||||
_Symbol$asyncDispose = Symbol.asyncDispose;
|
||||
class APIRequestContext extends _channelOwner.ChannelOwner {
|
||||
static from(channel) {
|
||||
return channel._object;
|
||||
@@ -77,7 +70,7 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
|
||||
this._closeReason = void 0;
|
||||
this._tracing = _tracing.Tracing.from(initializer.tracing);
|
||||
}
|
||||
async [_Symbol$asyncDispose]() {
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.dispose();
|
||||
}
|
||||
async dispose(options = {}) {
|
||||
@@ -130,8 +123,8 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
|
||||
});
|
||||
}
|
||||
async fetch(urlOrRequest, options = {}) {
|
||||
const url = (0, _utils.isString)(urlOrRequest) ? urlOrRequest : undefined;
|
||||
const request = (0, _utils.isString)(urlOrRequest) ? undefined : urlOrRequest;
|
||||
const url = (0, _rtti.isString)(urlOrRequest) ? urlOrRequest : undefined;
|
||||
const request = (0, _rtti.isString)(urlOrRequest) ? undefined : urlOrRequest;
|
||||
return await this._innerFetch({
|
||||
url,
|
||||
request,
|
||||
@@ -142,23 +135,23 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
|
||||
return await this._wrapApiCall(async () => {
|
||||
var _options$request, _options$request2, _options$request3;
|
||||
if (this._closeReason) throw new _errors.TargetClosedError(this._closeReason);
|
||||
(0, _utils.assert)(options.request || typeof options.url === 'string', 'First argument must be either URL string or Request');
|
||||
(0, _utils.assert)((options.data === undefined ? 0 : 1) + (options.form === undefined ? 0 : 1) + (options.multipart === undefined ? 0 : 1) <= 1, `Only one of 'data', 'form' or 'multipart' can be specified`);
|
||||
(0, _utils.assert)(options.maxRedirects === undefined || options.maxRedirects >= 0, `'maxRedirects' must be greater than or equal to '0'`);
|
||||
(0, _utils.assert)(options.maxRetries === undefined || options.maxRetries >= 0, `'maxRetries' must be greater than or equal to '0'`);
|
||||
(0, _assert.assert)(options.request || typeof options.url === 'string', 'First argument must be either URL string or Request');
|
||||
(0, _assert.assert)((options.data === undefined ? 0 : 1) + (options.form === undefined ? 0 : 1) + (options.multipart === undefined ? 0 : 1) <= 1, `Only one of 'data', 'form' or 'multipart' can be specified`);
|
||||
(0, _assert.assert)(options.maxRedirects === undefined || options.maxRedirects >= 0, `'maxRedirects' must be greater than or equal to '0'`);
|
||||
(0, _assert.assert)(options.maxRetries === undefined || options.maxRetries >= 0, `'maxRetries' must be greater than or equal to '0'`);
|
||||
const url = options.url !== undefined ? options.url : options.request.url();
|
||||
const method = options.method || ((_options$request = options.request) === null || _options$request === void 0 ? void 0 : _options$request.method());
|
||||
let encodedParams = undefined;
|
||||
if (typeof options.params === 'string') encodedParams = options.params;else if (options.params instanceof URLSearchParams) encodedParams = options.params.toString();
|
||||
// Cannot call allHeaders() here as the request may be paused inside route handler.
|
||||
const headersObj = options.headers || ((_options$request2 = options.request) === null || _options$request2 === void 0 ? void 0 : _options$request2.headers());
|
||||
const headers = headersObj ? (0, _utils.headersObjectToArray)(headersObj) : undefined;
|
||||
const headers = headersObj ? (0, _headers.headersObjectToArray)(headersObj) : undefined;
|
||||
let jsonData;
|
||||
let formData;
|
||||
let multipartData;
|
||||
let postDataBuffer;
|
||||
if (options.data !== undefined) {
|
||||
if ((0, _utils.isString)(options.data)) {
|
||||
if ((0, _rtti.isString)(options.data)) {
|
||||
if (isJsonContentType(headers)) jsonData = isJsonParsable(options.data) ? options.data : JSON.stringify(options.data);else postDataBuffer = Buffer.from(options.data, 'utf8');
|
||||
} else if (Buffer.isBuffer(options.data)) {
|
||||
postDataBuffer = options.data;
|
||||
@@ -185,7 +178,7 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
|
||||
if (globalThis.FormData && options.multipart instanceof FormData) {
|
||||
const form = options.multipart;
|
||||
for (const [name, value] of form.entries()) {
|
||||
if ((0, _utils.isString)(value)) {
|
||||
if ((0, _rtti.isString)(value)) {
|
||||
multipartData.push({
|
||||
name,
|
||||
value
|
||||
@@ -204,7 +197,7 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
} else {
|
||||
// Convert file-like values to ServerFilePayload structs.
|
||||
for (const [name, value] of Object.entries(options.multipart)) multipartData.push(await toFormField(name, value));
|
||||
for (const [name, value] of Object.entries(options.multipart)) multipartData.push(await toFormField(this._platform, name, value));
|
||||
}
|
||||
}
|
||||
if (postDataBuffer === undefined && jsonData === undefined && formData === undefined && multipartData === undefined) postDataBuffer = ((_options$request3 = options.request) === null || _options$request3 === void 0 ? void 0 : _options$request3.postDataBuffer()) || undefined;
|
||||
@@ -232,16 +225,19 @@ class APIRequestContext extends _channelOwner.ChannelOwner {
|
||||
});
|
||||
}
|
||||
async storageState(options = {}) {
|
||||
const state = await this._channel.storageState();
|
||||
const state = await this._channel.storageState({
|
||||
indexedDB: options.indexedDB
|
||||
});
|
||||
if (options.path) {
|
||||
await (0, _fileUtils.mkdirIfNeeded)(options.path);
|
||||
await _fs.default.promises.writeFile(options.path, JSON.stringify(state, undefined, 2), 'utf8');
|
||||
await (0, _fileUtils.mkdirIfNeeded)(this._platform, options.path);
|
||||
await this._platform.fs().promises.writeFile(options.path, JSON.stringify(state, undefined, 2), 'utf8');
|
||||
}
|
||||
return state;
|
||||
}
|
||||
}
|
||||
exports.APIRequestContext = APIRequestContext;
|
||||
async function toFormField(name, value) {
|
||||
async function toFormField(platform, name, value) {
|
||||
const typeOfValue = typeof value;
|
||||
if (isFilePayload(value)) {
|
||||
const payload = value;
|
||||
if (!Buffer.isBuffer(payload.buffer)) throw new Error(`Unexpected buffer type of 'data.${name}'`);
|
||||
@@ -249,15 +245,15 @@ async function toFormField(name, value) {
|
||||
name,
|
||||
file: filePayloadToJson(payload)
|
||||
};
|
||||
} else if (value instanceof _fs.default.ReadStream) {
|
||||
} else if (typeOfValue === 'string' || typeOfValue === 'number' || typeOfValue === 'boolean') {
|
||||
return {
|
||||
name,
|
||||
file: await readStreamToJson(value)
|
||||
value: String(value)
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
name,
|
||||
value: String(value)
|
||||
file: await readStreamToJson(platform, value)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -270,8 +266,6 @@ function isJsonParsable(value) {
|
||||
if (e instanceof SyntaxError) return false;else throw e;
|
||||
}
|
||||
}
|
||||
_Symbol$asyncDispose2 = Symbol.asyncDispose;
|
||||
_util$inspect$custom = util.inspect.custom;
|
||||
class APIResponse {
|
||||
constructor(context, initializer) {
|
||||
this._initializer = void 0;
|
||||
@@ -280,6 +274,7 @@ class APIResponse {
|
||||
this._request = context;
|
||||
this._initializer = initializer;
|
||||
this._headers = new _network.RawHeaders(this._initializer.headers);
|
||||
if (context._platform.inspectCustom) this[context._platform.inspectCustom] = () => this._inspect();
|
||||
}
|
||||
ok() {
|
||||
return this._initializer.status >= 200 && this._initializer.status <= 299;
|
||||
@@ -300,16 +295,18 @@ class APIResponse {
|
||||
return this._headers.headersArray();
|
||||
}
|
||||
async body() {
|
||||
try {
|
||||
const result = await this._request._channel.fetchResponseBody({
|
||||
fetchUid: this._fetchUid()
|
||||
});
|
||||
if (result.binary === undefined) throw new Error('Response has been disposed');
|
||||
return result.binary;
|
||||
} catch (e) {
|
||||
if ((0, _errors.isTargetClosedError)(e)) throw new Error('Response has been disposed');
|
||||
throw e;
|
||||
}
|
||||
return await this._request._wrapApiCall(async () => {
|
||||
try {
|
||||
const result = await this._request._channel.fetchResponseBody({
|
||||
fetchUid: this._fetchUid()
|
||||
});
|
||||
if (result.binary === undefined) throw new Error('Response has been disposed');
|
||||
return result.binary;
|
||||
} catch (e) {
|
||||
if ((0, _errors.isTargetClosedError)(e)) throw new Error('Response has been disposed');
|
||||
throw e;
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
async text() {
|
||||
const content = await this.body();
|
||||
@@ -319,7 +316,7 @@ class APIResponse {
|
||||
const content = await this.text();
|
||||
return JSON.parse(content);
|
||||
}
|
||||
async [_Symbol$asyncDispose2]() {
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.dispose();
|
||||
}
|
||||
async dispose() {
|
||||
@@ -327,7 +324,7 @@ class APIResponse {
|
||||
fetchUid: this._fetchUid()
|
||||
});
|
||||
}
|
||||
[_util$inspect$custom]() {
|
||||
_inspect() {
|
||||
const headers = this.headersArray().map(({
|
||||
name,
|
||||
value
|
||||
@@ -354,7 +351,7 @@ function filePayloadToJson(payload) {
|
||||
buffer: payload.buffer
|
||||
};
|
||||
}
|
||||
async function readStreamToJson(stream) {
|
||||
async function readStreamToJson(platform, stream) {
|
||||
const buffer = await new Promise((resolve, reject) => {
|
||||
const chunks = [];
|
||||
stream.on('data', chunk => chunks.push(chunk));
|
||||
@@ -363,7 +360,7 @@ async function readStreamToJson(stream) {
|
||||
});
|
||||
const streamPath = Buffer.isBuffer(stream.path) ? stream.path.toString('utf8') : stream.path;
|
||||
return {
|
||||
name: _path.default.basename(streamPath),
|
||||
name: platform.path().basename(streamPath),
|
||||
buffer
|
||||
};
|
||||
}
|
||||
@@ -380,10 +377,12 @@ function isJsonContentType(headers) {
|
||||
function objectToArray(map) {
|
||||
if (!map) return undefined;
|
||||
const result = [];
|
||||
for (const [name, value] of Object.entries(map)) result.push({
|
||||
name,
|
||||
value: String(value)
|
||||
});
|
||||
for (const [name, value] of Object.entries(map)) {
|
||||
if (value !== undefined) result.push({
|
||||
name,
|
||||
value: String(value)
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function isFilePayload(value) {
|
||||
|
||||
51
tvapp2/node_modules/playwright-core/lib/client/frame.js
generated
vendored
51
tvapp2/node_modules/playwright-core/lib/client/frame.js
generated
vendored
@@ -5,22 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.Frame = void 0;
|
||||
exports.verifyLoadState = verifyLoadState;
|
||||
var _utils = require("../utils");
|
||||
var _eventEmitter = require("./eventEmitter");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _locator = require("./locator");
|
||||
var _locatorUtils = require("../utils/isomorphic/locatorUtils");
|
||||
var _elementHandle = require("./elementHandle");
|
||||
var _jsHandle = require("./jsHandle");
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var network = _interopRequireWildcard(require("./network"));
|
||||
var _events = require("events");
|
||||
var _waiter = require("./waiter");
|
||||
var _events2 = require("./events");
|
||||
var _types = require("./types");
|
||||
var _clientHelper = require("./clientHelper");
|
||||
var _elementHandle = require("./elementHandle");
|
||||
var _events = require("./events");
|
||||
var _jsHandle = require("./jsHandle");
|
||||
var _locator = require("./locator");
|
||||
var network = _interopRequireWildcard(require("./network"));
|
||||
var _types = require("./types");
|
||||
var _waiter = require("./waiter");
|
||||
var _assert = require("../utils/isomorphic/assert");
|
||||
var _locatorUtils = require("../utils/isomorphic/locatorUtils");
|
||||
var _urlMatch = require("../utils/isomorphic/urlMatch");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
@@ -55,7 +54,7 @@ class Frame extends _channelOwner.ChannelOwner {
|
||||
this._detached = false;
|
||||
this._childFrames = new Set();
|
||||
this._page = void 0;
|
||||
this._eventEmitter = new _events.EventEmitter();
|
||||
this._eventEmitter = new _eventEmitter.EventEmitter(parent._platform);
|
||||
this._eventEmitter.setMaxListeners(0);
|
||||
this._parentFrame = Frame.fromNullable(initializer.parentFrame);
|
||||
if (this._parentFrame) this._parentFrame._childFrames.add(this);
|
||||
@@ -68,14 +67,14 @@ class Frame extends _channelOwner.ChannelOwner {
|
||||
this._eventEmitter.emit('loadstate', event.add);
|
||||
}
|
||||
if (event.remove) this._loadStates.delete(event.remove);
|
||||
if (!this._parentFrame && event.add === 'load' && this._page) this._page.emit(_events2.Events.Page.Load, this._page);
|
||||
if (!this._parentFrame && event.add === 'domcontentloaded' && this._page) this._page.emit(_events2.Events.Page.DOMContentLoaded, this._page);
|
||||
if (!this._parentFrame && event.add === 'load' && this._page) this._page.emit(_events.Events.Page.Load, this._page);
|
||||
if (!this._parentFrame && event.add === 'domcontentloaded' && this._page) this._page.emit(_events.Events.Page.DOMContentLoaded, this._page);
|
||||
});
|
||||
this._channel.on('navigated', event => {
|
||||
this._url = event.url;
|
||||
this._name = event.name;
|
||||
this._eventEmitter.emit('navigated', event);
|
||||
if (!event.error && this._page) this._page.emit(_events2.Events.Page.FrameNavigated, this);
|
||||
if (!event.error && this._page) this._page.emit(_events.Events.Page.FrameNavigated, this);
|
||||
});
|
||||
}
|
||||
page() {
|
||||
@@ -92,9 +91,9 @@ class Frame extends _channelOwner.ChannelOwner {
|
||||
_setupNavigationWaiter(options) {
|
||||
const waiter = new _waiter.Waiter(this._page, '');
|
||||
if (this._page.isClosed()) waiter.rejectImmediately(this._page._closeErrorWithReason());
|
||||
waiter.rejectOnEvent(this._page, _events2.Events.Page.Close, () => this._page._closeErrorWithReason());
|
||||
waiter.rejectOnEvent(this._page, _events2.Events.Page.Crash, new Error('Navigation failed because page crashed!'));
|
||||
waiter.rejectOnEvent(this._page, _events2.Events.Page.FrameDetached, new Error('Navigating frame was detached!'), frame => frame === this);
|
||||
waiter.rejectOnEvent(this._page, _events.Events.Page.Close, () => this._page._closeErrorWithReason());
|
||||
waiter.rejectOnEvent(this._page, _events.Events.Page.Crash, new Error('Navigation failed because page crashed!'));
|
||||
waiter.rejectOnEvent(this._page, _events.Events.Page.FrameDetached, new Error('Navigating frame was detached!'), frame => frame === this);
|
||||
const timeout = this._page._timeoutSettings.navigationTimeout(options);
|
||||
waiter.rejectOnTimeout(timeout, `Timeout ${timeout}ms exceeded.`);
|
||||
return waiter;
|
||||
@@ -110,7 +109,7 @@ class Frame extends _channelOwner.ChannelOwner {
|
||||
// Any failed navigation results in a rejection.
|
||||
if (event.error) return true;
|
||||
waiter.log(` navigated to "${event.url}"`);
|
||||
return (0, _utils.urlMatches)((_this$_page = this._page) === null || _this$_page === void 0 ? void 0 : _this$_page.context()._options.baseURL, event.url, options.url);
|
||||
return (0, _urlMatch.urlMatches)((_this$_page = this._page) === null || _this$_page === void 0 ? void 0 : _this$_page.context()._options.baseURL, event.url, options.url);
|
||||
});
|
||||
if (navigatedEvent.error) {
|
||||
const e = new Error(navigatedEvent.error);
|
||||
@@ -146,7 +145,7 @@ class Frame extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
async waitForURL(url, options = {}) {
|
||||
var _this$_page2;
|
||||
if ((0, _utils.urlMatches)((_this$_page2 = this._page) === null || _this$_page2 === void 0 ? void 0 : _this$_page2.context()._options.baseURL, this.url(), url)) return await this.waitForLoadState(options.waitUntil, options);
|
||||
if ((0, _urlMatch.urlMatches)((_this$_page2 = this._page) === null || _this$_page2 === void 0 ? void 0 : _this$_page2.context()._options.baseURL, this.url(), url)) return await this.waitForLoadState(options.waitUntil, options);
|
||||
await this.waitForNavigation({
|
||||
url,
|
||||
...options
|
||||
@@ -268,7 +267,7 @@ class Frame extends _channelOwner.ChannelOwner {
|
||||
...options
|
||||
};
|
||||
if (copy.path) {
|
||||
copy.content = (await _fs.default.promises.readFile(copy.path)).toString();
|
||||
copy.content = (await this._platform.fs().promises.readFile(copy.path)).toString();
|
||||
copy.content = (0, _clientHelper.addSourceUrlToScript)(copy.content, copy.path);
|
||||
}
|
||||
return _elementHandle.ElementHandle.from((await this._channel.addScriptTag({
|
||||
@@ -280,7 +279,7 @@ class Frame extends _channelOwner.ChannelOwner {
|
||||
...options
|
||||
};
|
||||
if (copy.path) {
|
||||
copy.content = (await _fs.default.promises.readFile(copy.path)).toString();
|
||||
copy.content = (await this._platform.fs().promises.readFile(copy.path)).toString();
|
||||
copy.content += '/*# sourceURL=' + copy.path.replace(/\n/g, '') + '*/';
|
||||
}
|
||||
return _elementHandle.ElementHandle.from((await this._channel.addStyleTag({
|
||||
@@ -440,7 +439,7 @@ class Frame extends _channelOwner.ChannelOwner {
|
||||
})).values;
|
||||
}
|
||||
async setInputFiles(selector, files, options = {}) {
|
||||
const converted = await (0, _elementHandle.convertInputFiles)(files, this.page().context());
|
||||
const converted = await (0, _elementHandle.convertInputFiles)(this._platform, files, this.page().context());
|
||||
await this._channel.setInputFiles({
|
||||
selector,
|
||||
...converted,
|
||||
@@ -482,7 +481,7 @@ class Frame extends _channelOwner.ChannelOwner {
|
||||
});
|
||||
}
|
||||
async waitForFunction(pageFunction, arg, options = {}) {
|
||||
if (typeof options.polling === 'string') (0, _utils.assert)(options.polling === 'raf', 'Unknown polling option: ' + options.polling);
|
||||
if (typeof options.polling === 'string') (0, _assert.assert)(options.polling === 'raf', 'Unknown polling option: ' + options.polling);
|
||||
const result = await this._channel.waitForFunction({
|
||||
...options,
|
||||
pollingInterval: options.polling === 'raf' ? undefined : options.polling,
|
||||
|
||||
16
tvapp2/node_modules/playwright-core/lib/client/harRouter.js
generated
vendored
16
tvapp2/node_modules/playwright-core/lib/client/harRouter.js
generated
vendored
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.HarRouter = void 0;
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
let _Symbol$asyncDispose;
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -21,13 +19,13 @@ let _Symbol$asyncDispose;
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
_Symbol$asyncDispose = Symbol.asyncDispose;
|
||||
|
||||
class HarRouter {
|
||||
static async create(localUtils, file, notFoundAction, options) {
|
||||
const {
|
||||
harId,
|
||||
error
|
||||
} = await localUtils._channel.harOpen({
|
||||
} = await localUtils.harOpen({
|
||||
file
|
||||
});
|
||||
if (error) throw new Error(error);
|
||||
@@ -45,7 +43,7 @@ class HarRouter {
|
||||
}
|
||||
async _handle(route) {
|
||||
const request = route.request();
|
||||
const response = await this._localUtils._channel.harLookup({
|
||||
const response = await this._localUtils.harLookup({
|
||||
harId: this._harId,
|
||||
url: request.url(),
|
||||
method: request.method(),
|
||||
@@ -54,7 +52,7 @@ class HarRouter {
|
||||
isNavigationRequest: request.isNavigationRequest()
|
||||
});
|
||||
if (response.action === 'redirect') {
|
||||
_debugLogger.debugLogger.log('api', `HAR: ${route.request().url()} redirected to ${response.redirectURL}`);
|
||||
route._platform.log('api', `HAR: ${route.request().url()} redirected to ${response.redirectURL}`);
|
||||
await route._redirectNavigationRequest(response.redirectURL);
|
||||
return;
|
||||
}
|
||||
@@ -72,7 +70,7 @@ class HarRouter {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (response.action === 'error') _debugLogger.debugLogger.log('api', 'HAR: ' + response.message);
|
||||
if (response.action === 'error') route._platform.log('api', 'HAR: ' + response.message);
|
||||
// Report the error, but fall through to the default handler.
|
||||
|
||||
if (this._notFoundAction === 'abort') {
|
||||
@@ -87,11 +85,11 @@ class HarRouter {
|
||||
async addPageRoute(page) {
|
||||
await page.route(this._options.urlMatch || '**/*', route => this._handle(route));
|
||||
}
|
||||
async [_Symbol$asyncDispose]() {
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.dispose();
|
||||
}
|
||||
dispose() {
|
||||
this._localUtils._channel.harClose({
|
||||
this._localUtils.harClose({
|
||||
harId: this._harId
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
7
tvapp2/node_modules/playwright-core/lib/client/jsHandle.js
generated
vendored
7
tvapp2/node_modules/playwright-core/lib/client/jsHandle.js
generated
vendored
@@ -8,9 +8,8 @@ exports.assertMaxArguments = assertMaxArguments;
|
||||
exports.parseResult = parseResult;
|
||||
exports.serializeArgument = serializeArgument;
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _serializers = require("../protocol/serializers");
|
||||
var _errors = require("./errors");
|
||||
let _Symbol$asyncDispose;
|
||||
var _serializers = require("../protocol/serializers");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -26,7 +25,7 @@ let _Symbol$asyncDispose;
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
_Symbol$asyncDispose = Symbol.asyncDispose;
|
||||
|
||||
class JSHandle extends _channelOwner.ChannelOwner {
|
||||
static from(handle) {
|
||||
return handle._object;
|
||||
@@ -75,7 +74,7 @@ class JSHandle extends _channelOwner.ChannelOwner {
|
||||
asElement() {
|
||||
return null;
|
||||
}
|
||||
async [_Symbol$asyncDispose]() {
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.dispose();
|
||||
}
|
||||
async dispose() {
|
||||
|
||||
24
tvapp2/node_modules/playwright-core/lib/client/localUtils.js
generated
vendored
24
tvapp2/node_modules/playwright-core/lib/client/localUtils.js
generated
vendored
@@ -32,5 +32,29 @@ class LocalUtils extends _channelOwner.ChannelOwner {
|
||||
descriptor
|
||||
} of initializer.deviceDescriptors) this.devices[name] = descriptor;
|
||||
}
|
||||
async zip(params) {
|
||||
return await this._channel.zip(params);
|
||||
}
|
||||
async harOpen(params) {
|
||||
return await this._channel.harOpen(params);
|
||||
}
|
||||
async harLookup(params) {
|
||||
return await this._channel.harLookup(params);
|
||||
}
|
||||
async harClose(params) {
|
||||
return await this._channel.harClose(params);
|
||||
}
|
||||
async harUnzip(params) {
|
||||
return await this._channel.harUnzip(params);
|
||||
}
|
||||
async tracingStarted(params) {
|
||||
return await this._channel.tracingStarted(params);
|
||||
}
|
||||
async traceDiscarded(params) {
|
||||
return await this._channel.traceDiscarded(params);
|
||||
}
|
||||
async addStackToTracingNoReply(params) {
|
||||
return await this._channel.addStackToTracingNoReply(params);
|
||||
}
|
||||
}
|
||||
exports.LocalUtils = LocalUtils;
|
||||
33
tvapp2/node_modules/playwright-core/lib/client/locator.js
generated
vendored
33
tvapp2/node_modules/playwright-core/lib/client/locator.js
generated
vendored
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.Locator = exports.FrameLocator = void 0;
|
||||
exports.setTestIdAttribute = setTestIdAttribute;
|
||||
exports.testIdAttributeName = testIdAttributeName;
|
||||
var util = _interopRequireWildcard(require("util"));
|
||||
var _utils = require("../utils");
|
||||
var _elementHandle = require("./elementHandle");
|
||||
var _jsHandle = require("./jsHandle");
|
||||
var _stringUtils = require("../utils/isomorphic/stringUtils");
|
||||
var _locatorGenerators = require("../utils/isomorphic/locatorGenerators");
|
||||
var _locatorUtils = require("../utils/isomorphic/locatorUtils");
|
||||
let _util$inspect$custom;
|
||||
var _stringUtils = require("../utils/isomorphic/stringUtils");
|
||||
var _rtti = require("../utils/isomorphic/rtti");
|
||||
var _time = require("../utils/isomorphic/time");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -28,9 +28,7 @@ let _util$inspect$custom;
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
_util$inspect$custom = util.inspect.custom;
|
||||
|
||||
class Locator {
|
||||
constructor(frame, selector, options) {
|
||||
this._frame = void 0;
|
||||
@@ -49,12 +47,14 @@ class Locator {
|
||||
if (locator._frame !== frame) throw new Error(`Inner "hasNot" locator must belong to the same frame.`);
|
||||
this._selector += ` >> internal:has-not=` + JSON.stringify(locator._selector);
|
||||
}
|
||||
if ((options === null || options === void 0 ? void 0 : options.visible) !== undefined) this._selector += ` >> visible=${options.visible ? 'true' : 'false'}`;
|
||||
if (this._frame._platform.inspectCustom) this[this._frame._platform.inspectCustom] = () => this._inspect();
|
||||
}
|
||||
async _withElement(task, timeout) {
|
||||
timeout = this._frame.page()._timeoutSettings.timeout({
|
||||
timeout
|
||||
});
|
||||
const deadline = timeout ? (0, _utils.monotonicTime)() + timeout : 0;
|
||||
const deadline = timeout ? (0, _time.monotonicTime)() + timeout : 0;
|
||||
return await this._frame._wrapApiCall(async () => {
|
||||
const result = await this._frame._channel.waitForSelector({
|
||||
selector: this._selector,
|
||||
@@ -65,7 +65,7 @@ class Locator {
|
||||
const handle = _elementHandle.ElementHandle.fromNullable(result.element);
|
||||
if (!handle) throw new Error(`Could not resolve ${this._selector} to DOM Element`);
|
||||
try {
|
||||
return await task(handle, deadline ? deadline - (0, _utils.monotonicTime)() : 0);
|
||||
return await task(handle, deadline ? deadline - (0, _time.monotonicTime)() : 0);
|
||||
} finally {
|
||||
await handle.dispose();
|
||||
}
|
||||
@@ -136,7 +136,7 @@ class Locator {
|
||||
return await this._frame._highlight(this._selector);
|
||||
}
|
||||
locator(selectorOrLocator, options) {
|
||||
if ((0, _utils.isString)(selectorOrLocator)) return new Locator(this._frame, this._selector + ' >> ' + selectorOrLocator, options);
|
||||
if ((0, _rtti.isString)(selectorOrLocator)) return new Locator(this._frame, this._selector + ' >> ' + selectorOrLocator, options);
|
||||
if (selectorOrLocator._frame !== this._frame) throw new Error(`Locators must belong to the same frame.`);
|
||||
return new Locator(this._frame, this._selector + ' >> internal:chain=' + JSON.stringify(selectorOrLocator._selector), options);
|
||||
}
|
||||
@@ -213,6 +213,9 @@ class Locator {
|
||||
async count() {
|
||||
return await this._frame._queryCount(this._selector);
|
||||
}
|
||||
async _generateLocatorString() {
|
||||
return await this._withElement(h => h._generateLocatorString());
|
||||
}
|
||||
async getAttribute(name, options) {
|
||||
return await this._frame.getAttribute(this._selector, name, {
|
||||
strict: true,
|
||||
@@ -286,14 +289,18 @@ class Locator {
|
||||
});
|
||||
}
|
||||
async screenshot(options = {}) {
|
||||
const mask = options.mask;
|
||||
return await this._withElement((h, timeout) => h.screenshot({
|
||||
...options,
|
||||
mask,
|
||||
timeout
|
||||
}), options.timeout);
|
||||
}
|
||||
async ariaSnapshot(options) {
|
||||
const result = await this._frame._channel.ariaSnapshot({
|
||||
...options,
|
||||
id: options === null || options === void 0 ? void 0 : options._id,
|
||||
mode: options === null || options === void 0 ? void 0 : options._mode,
|
||||
selector: this._selector
|
||||
});
|
||||
return result.snapshot;
|
||||
@@ -381,11 +388,11 @@ class Locator {
|
||||
if (result.received !== undefined) result.received = (0, _jsHandle.parseResult)(result.received);
|
||||
return result;
|
||||
}
|
||||
[_util$inspect$custom]() {
|
||||
_inspect() {
|
||||
return this.toString();
|
||||
}
|
||||
toString() {
|
||||
return (0, _utils.asLocator)('javascript', this._selector);
|
||||
return (0, _locatorGenerators.asLocator)('javascript', this._selector);
|
||||
}
|
||||
}
|
||||
exports.Locator = Locator;
|
||||
@@ -397,7 +404,7 @@ class FrameLocator {
|
||||
this._frameSelector = selector;
|
||||
}
|
||||
locator(selectorOrLocator, options) {
|
||||
if ((0, _utils.isString)(selectorOrLocator)) return new Locator(this._frame, this._frameSelector + ' >> internal:control=enter-frame >> ' + selectorOrLocator, options);
|
||||
if ((0, _rtti.isString)(selectorOrLocator)) return new Locator(this._frame, this._frameSelector + ' >> internal:control=enter-frame >> ' + selectorOrLocator, options);
|
||||
if (selectorOrLocator._frame !== this._frame) throw new Error(`Locators must belong to the same frame.`);
|
||||
return new Locator(this._frame, this._frameSelector + ' >> internal:control=enter-frame >> ' + selectorOrLocator._selector, options);
|
||||
}
|
||||
|
||||
82
tvapp2/node_modules/playwright-core/lib/client/network.js
generated
vendored
82
tvapp2/node_modules/playwright-core/lib/client/network.js
generated
vendored
@@ -5,19 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.WebSocketRouteHandler = exports.WebSocketRoute = exports.WebSocket = exports.RouteHandler = exports.Route = exports.Response = exports.Request = exports.RawHeaders = void 0;
|
||||
exports.validateHeaders = validateHeaders;
|
||||
var _url = require("url");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _frame = require("./frame");
|
||||
var _worker = require("./worker");
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _utilsBundle = require("../utilsBundle");
|
||||
var _utils = require("../utils");
|
||||
var _manualPromise = require("../utils/manualPromise");
|
||||
var _events = require("./events");
|
||||
var _waiter = require("./waiter");
|
||||
var _fetch = require("./fetch");
|
||||
var _errors = require("./errors");
|
||||
let _Symbol$asyncDispose;
|
||||
var _events = require("./events");
|
||||
var _fetch = require("./fetch");
|
||||
var _frame = require("./frame");
|
||||
var _waiter = require("./waiter");
|
||||
var _worker = require("./worker");
|
||||
var _assert = require("../utils/isomorphic/assert");
|
||||
var _headers = require("../utils/isomorphic/headers");
|
||||
var _urlMatch = require("../utils/isomorphic/urlMatch");
|
||||
var _manualPromise = require("../utils/isomorphic/manualPromise");
|
||||
var _multimap = require("../utils/isomorphic/multimap");
|
||||
var _rtti = require("../utils/isomorphic/rtti");
|
||||
var _stackTrace = require("../utils/isomorphic/stackTrace");
|
||||
var _mimeType = require("../utils/isomorphic/mimeType");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -33,7 +35,7 @@ let _Symbol$asyncDispose;
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class Request extends _channelOwner.ChannelOwner {
|
||||
static from(request) {
|
||||
return request._object;
|
||||
@@ -88,7 +90,7 @@ class Request extends _channelOwner.ChannelOwner {
|
||||
const contentType = this.headers()['content-type'];
|
||||
if (contentType !== null && contentType !== void 0 && contentType.includes('application/x-www-form-urlencoded')) {
|
||||
const entries = {};
|
||||
const parsed = new _url.URLSearchParams(postData);
|
||||
const parsed = new URLSearchParams(postData);
|
||||
for (const [k, v] of parsed.entries()) entries[k] = v;
|
||||
return entries;
|
||||
}
|
||||
@@ -134,7 +136,7 @@ class Request extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
frame() {
|
||||
if (!this._initializer.frame) {
|
||||
(0, _utils.assert)(this.serviceWorker());
|
||||
(0, _assert.assert)(this.serviceWorker());
|
||||
throw new Error('Service Worker requests do not have an associated frame.');
|
||||
}
|
||||
const frame = _frame.Frame.from(this._initializer.frame);
|
||||
@@ -184,7 +186,7 @@ class Request extends _channelOwner.ChannelOwner {
|
||||
if (overrides.url) this._fallbackOverrides.url = overrides.url;
|
||||
if (overrides.method) this._fallbackOverrides.method = overrides.method;
|
||||
if (overrides.headers) this._fallbackOverrides.headers = overrides.headers;
|
||||
if ((0, _utils.isString)(overrides.postData)) this._fallbackOverrides.postDataBuffer = Buffer.from(overrides.postData, 'utf-8');else if (overrides.postData instanceof Buffer) this._fallbackOverrides.postDataBuffer = overrides.postData;else if (overrides.postData) this._fallbackOverrides.postDataBuffer = Buffer.from(JSON.stringify(overrides.postData), 'utf-8');
|
||||
if ((0, _rtti.isString)(overrides.postData)) this._fallbackOverrides.postDataBuffer = Buffer.from(overrides.postData, 'utf-8');else if (overrides.postData instanceof Buffer) this._fallbackOverrides.postDataBuffer = overrides.postData;else if (overrides.postData) this._fallbackOverrides.postDataBuffer = Buffer.from(JSON.stringify(overrides.postData), 'utf-8');
|
||||
}
|
||||
_fallbackOverridesForContinue() {
|
||||
return this._fallbackOverrides;
|
||||
@@ -272,13 +274,12 @@ class Route extends _channelOwner.ChannelOwner {
|
||||
body
|
||||
} = options;
|
||||
if (options.json !== undefined) {
|
||||
(0, _utils.assert)(options.body === undefined, 'Can specify either body or json parameters');
|
||||
(0, _assert.assert)(options.body === undefined, 'Can specify either body or json parameters');
|
||||
body = JSON.stringify(options.json);
|
||||
}
|
||||
if (options.response instanceof _fetch.APIResponse) {
|
||||
var _statusOption, _headersOption;
|
||||
(_statusOption = statusOption) !== null && _statusOption !== void 0 ? _statusOption : statusOption = options.response.status();
|
||||
(_headersOption = headersOption) !== null && _headersOption !== void 0 ? _headersOption : headersOption = options.response.headers();
|
||||
statusOption !== null && statusOption !== void 0 ? statusOption : statusOption = options.response.status();
|
||||
headersOption !== null && headersOption !== void 0 ? headersOption : headersOption = options.response.headers();
|
||||
if (body === undefined && options.path === undefined) {
|
||||
if (options.response._request._connection === this._connection) fetchResponseUid = options.response._fetchUid();else body = await options.response.body();
|
||||
}
|
||||
@@ -286,11 +287,11 @@ class Route extends _channelOwner.ChannelOwner {
|
||||
let isBase64 = false;
|
||||
let length = 0;
|
||||
if (options.path) {
|
||||
const buffer = await _fs.default.promises.readFile(options.path);
|
||||
const buffer = await this._platform.fs().promises.readFile(options.path);
|
||||
body = buffer.toString('base64');
|
||||
isBase64 = true;
|
||||
length = buffer.length;
|
||||
} else if ((0, _utils.isString)(body)) {
|
||||
} else if ((0, _rtti.isString)(body)) {
|
||||
isBase64 = false;
|
||||
length = Buffer.byteLength(body);
|
||||
} else if (body) {
|
||||
@@ -300,11 +301,11 @@ class Route extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
const headers = {};
|
||||
for (const header of Object.keys(headersOption || {})) headers[header.toLowerCase()] = String(headersOption[header]);
|
||||
if (options.contentType) headers['content-type'] = String(options.contentType);else if (options.json) headers['content-type'] = 'application/json';else if (options.path) headers['content-type'] = _utilsBundle.mime.getType(options.path) || 'application/octet-stream';
|
||||
if (options.contentType) headers['content-type'] = String(options.contentType);else if (options.json) headers['content-type'] = 'application/json';else if (options.path) headers['content-type'] = (0, _mimeType.getMimeTypeForPath)(options.path) || 'application/octet-stream';
|
||||
if (length && !('content-length' in headers)) headers['content-length'] = String(length);
|
||||
await this._raceWithTargetClose(this._channel.fulfill({
|
||||
status: statusOption || 200,
|
||||
headers: (0, _utils.headersObjectToArray)(headers),
|
||||
headers: (0, _headers.headersObjectToArray)(headers),
|
||||
body,
|
||||
isBase64,
|
||||
fetchResponseUid
|
||||
@@ -329,14 +330,13 @@ class Route extends _channelOwner.ChannelOwner {
|
||||
return await this._raceWithTargetClose(this._channel.continue({
|
||||
url: options.url,
|
||||
method: options.method,
|
||||
headers: options.headers ? (0, _utils.headersObjectToArray)(options.headers) : undefined,
|
||||
headers: options.headers ? (0, _headers.headersObjectToArray)(options.headers) : undefined,
|
||||
postData: options.postDataBuffer,
|
||||
isFallback
|
||||
}));
|
||||
}
|
||||
}
|
||||
exports.Route = Route;
|
||||
_Symbol$asyncDispose = Symbol.asyncDispose;
|
||||
class WebSocketRoute extends _channelOwner.ChannelOwner {
|
||||
static from(route) {
|
||||
return route._object;
|
||||
@@ -370,7 +370,7 @@ class WebSocketRoute extends _channelOwner.ChannelOwner {
|
||||
}).catch(() => {});
|
||||
},
|
||||
send: message => {
|
||||
if ((0, _utils.isString)(message)) this._channel.sendToServer({
|
||||
if ((0, _rtti.isString)(message)) this._channel.sendToServer({
|
||||
message,
|
||||
isBase64: false
|
||||
}).catch(() => {});else this._channel.sendToServer({
|
||||
@@ -439,7 +439,7 @@ class WebSocketRoute extends _channelOwner.ChannelOwner {
|
||||
return this._server;
|
||||
}
|
||||
send(message) {
|
||||
if ((0, _utils.isString)(message)) this._channel.sendToPage({
|
||||
if ((0, _rtti.isString)(message)) this._channel.sendToPage({
|
||||
message,
|
||||
isBase64: false
|
||||
}).catch(() => {});else this._channel.sendToPage({
|
||||
@@ -453,7 +453,7 @@ class WebSocketRoute extends _channelOwner.ChannelOwner {
|
||||
onClose(handler) {
|
||||
this._onPageClose = handler;
|
||||
}
|
||||
async [_Symbol$asyncDispose]() {
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.close();
|
||||
}
|
||||
async _afterHandle() {
|
||||
@@ -476,9 +476,9 @@ class WebSocketRouteHandler {
|
||||
const patterns = [];
|
||||
let all = false;
|
||||
for (const handler of handlers) {
|
||||
if ((0, _utils.isString)(handler.url)) patterns.push({
|
||||
if ((0, _rtti.isString)(handler.url)) patterns.push({
|
||||
glob: handler.url
|
||||
});else if ((0, _utils.isRegExp)(handler.url)) patterns.push({
|
||||
});else if ((0, _rtti.isRegExp)(handler.url)) patterns.push({
|
||||
regexSource: handler.url.source,
|
||||
regexFlags: handler.url.flags
|
||||
});else all = true;
|
||||
@@ -489,7 +489,7 @@ class WebSocketRouteHandler {
|
||||
return patterns;
|
||||
}
|
||||
matches(wsURL) {
|
||||
return (0, _utils.urlMatches)(this._baseURL, wsURL, this.url);
|
||||
return (0, _urlMatch.urlMatches)(this._baseURL, wsURL, this.url);
|
||||
}
|
||||
async handle(webSocketRoute) {
|
||||
const handler = this.handler;
|
||||
@@ -644,11 +644,11 @@ exports.WebSocket = WebSocket;
|
||||
function validateHeaders(headers) {
|
||||
for (const key of Object.keys(headers)) {
|
||||
const value = headers[key];
|
||||
if (!Object.is(value, undefined) && !(0, _utils.isString)(value)) throw new Error(`Expected value of header "${key}" to be String, but "${typeof value}" is found.`);
|
||||
if (!Object.is(value, undefined) && !(0, _rtti.isString)(value)) throw new Error(`Expected value of header "${key}" to be String, but "${typeof value}" is found.`);
|
||||
}
|
||||
}
|
||||
class RouteHandler {
|
||||
constructor(baseURL, url, handler, times = Number.MAX_SAFE_INTEGER) {
|
||||
constructor(platform, baseURL, url, handler, times = Number.MAX_SAFE_INTEGER) {
|
||||
this.handledCount = 0;
|
||||
this._baseURL = void 0;
|
||||
this._times = void 0;
|
||||
@@ -656,20 +656,20 @@ class RouteHandler {
|
||||
this.handler = void 0;
|
||||
this._ignoreException = false;
|
||||
this._activeInvocations = new Set();
|
||||
this._svedZone = void 0;
|
||||
this._savedZone = void 0;
|
||||
this._baseURL = baseURL;
|
||||
this._times = times;
|
||||
this.url = url;
|
||||
this.handler = handler;
|
||||
this._svedZone = _utils.zones.current().without('apiZone');
|
||||
this._savedZone = platform.zones.current().pop();
|
||||
}
|
||||
static prepareInterceptionPatterns(handlers) {
|
||||
const patterns = [];
|
||||
let all = false;
|
||||
for (const handler of handlers) {
|
||||
if ((0, _utils.isString)(handler.url)) patterns.push({
|
||||
if ((0, _rtti.isString)(handler.url)) patterns.push({
|
||||
glob: handler.url
|
||||
});else if ((0, _utils.isRegExp)(handler.url)) patterns.push({
|
||||
});else if ((0, _rtti.isRegExp)(handler.url)) patterns.push({
|
||||
regexSource: handler.url.source,
|
||||
regexFlags: handler.url.flags
|
||||
});else all = true;
|
||||
@@ -680,10 +680,10 @@ class RouteHandler {
|
||||
return patterns;
|
||||
}
|
||||
matches(requestURL) {
|
||||
return (0, _utils.urlMatches)(this._baseURL, requestURL, this.url);
|
||||
return (0, _urlMatch.urlMatches)(this._baseURL, requestURL, this.url);
|
||||
}
|
||||
async handle(route) {
|
||||
return await this._svedZone.run(async () => this._handleImpl(route));
|
||||
return await this._savedZone.run(async () => this._handleImpl(route));
|
||||
}
|
||||
async _handleImpl(route) {
|
||||
const handlerInvocation = {
|
||||
@@ -699,7 +699,7 @@ class RouteHandler {
|
||||
if ((0, _errors.isTargetClosedError)(e)) {
|
||||
// We are failing in the handler because the target close closed.
|
||||
// Give user a hint!
|
||||
(0, _utils.rewriteErrorMessage)(e, `"${e.message}" while running route callback.\nConsider awaiting \`await page.unrouteAll({ behavior: 'ignoreErrors' })\`\nbefore the end of the test to ignore remaining routes in flight.`);
|
||||
(0, _stackTrace.rewriteErrorMessage)(e, `"${e.message}" while running route callback.\nConsider awaiting \`await page.unrouteAll({ behavior: 'ignoreErrors' })\`\nbefore the end of the test to ignore remaining routes in flight.`);
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
@@ -745,7 +745,7 @@ class RawHeaders {
|
||||
}
|
||||
constructor(headers) {
|
||||
this._headersArray = void 0;
|
||||
this._headersMap = new _utils.MultiMap();
|
||||
this._headersMap = new _multimap.MultiMap();
|
||||
this._headersArray = headers;
|
||||
for (const header of headers) this._headersMap.set(header.name.toLowerCase(), header.value);
|
||||
}
|
||||
|
||||
85
tvapp2/node_modules/playwright-core/lib/client/page.js
generated
vendored
85
tvapp2/node_modules/playwright-core/lib/client/page.js
generated
vendored
@@ -4,11 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Page = exports.BindingCall = void 0;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _errors = require("./errors");
|
||||
var _timeoutSettings = require("../common/timeoutSettings");
|
||||
var _utils = require("../utils");
|
||||
var _accessibility = require("./accessibility");
|
||||
var _artifact = require("./artifact");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
@@ -16,17 +11,25 @@ var _clientHelper = require("./clientHelper");
|
||||
var _coverage = require("./coverage");
|
||||
var _download = require("./download");
|
||||
var _elementHandle = require("./elementHandle");
|
||||
var _errors = require("./errors");
|
||||
var _events = require("./events");
|
||||
var _fileChooser = require("./fileChooser");
|
||||
var _frame = require("./frame");
|
||||
var _harRouter = require("./harRouter");
|
||||
var _input = require("./input");
|
||||
var _jsHandle = require("./jsHandle");
|
||||
var _network = require("./network");
|
||||
var _video = require("./video");
|
||||
var _waiter = require("./waiter");
|
||||
var _worker = require("./worker");
|
||||
var _harRouter = require("./harRouter");
|
||||
let _Symbol$asyncDispose;
|
||||
var _timeoutSettings = require("./timeoutSettings");
|
||||
var _assert = require("../utils/isomorphic/assert");
|
||||
var _fileUtils = require("./fileUtils");
|
||||
var _headers = require("../utils/isomorphic/headers");
|
||||
var _stringUtils = require("../utils/isomorphic/stringUtils");
|
||||
var _urlMatch = require("../utils/isomorphic/urlMatch");
|
||||
var _manualPromise = require("../utils/isomorphic/manualPromise");
|
||||
var _rtti = require("../utils/isomorphic/rtti");
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
@@ -43,8 +46,7 @@ let _Symbol$asyncDispose;
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
_Symbol$asyncDispose = Symbol.asyncDispose;
|
||||
|
||||
class Page extends _channelOwner.ChannelOwner {
|
||||
static from(page) {
|
||||
return page._object;
|
||||
@@ -60,7 +62,7 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
this._frames = new Set();
|
||||
this._workers = new Set();
|
||||
this._closed = false;
|
||||
this._closedOrCrashedScope = new _utils.LongStandingScope();
|
||||
this._closedOrCrashedScope = new _manualPromise.LongStandingScope();
|
||||
this._viewportSize = void 0;
|
||||
this._routes = [];
|
||||
this._webSocketRoutes = [];
|
||||
@@ -80,7 +82,7 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
this._harRouters = [];
|
||||
this._locatorHandlers = new Map();
|
||||
this._browserContext = parent;
|
||||
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._browserContext._timeoutSettings);
|
||||
this._timeoutSettings = new _timeoutSettings.TimeoutSettings(this._platform, this._browserContext._timeoutSettings);
|
||||
this.accessibility = new _accessibility.Accessibility(this._channel);
|
||||
this.keyboard = new _input.Keyboard(this);
|
||||
this.mouse = new _input.Mouse(this);
|
||||
@@ -208,12 +210,12 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
return this._mainFrame;
|
||||
}
|
||||
frame(frameSelector) {
|
||||
const name = (0, _utils.isString)(frameSelector) ? frameSelector : frameSelector.name;
|
||||
const url = (0, _utils.isObject)(frameSelector) ? frameSelector.url : undefined;
|
||||
(0, _utils.assert)(name || url, 'Either name or url matcher should be specified');
|
||||
const name = (0, _rtti.isString)(frameSelector) ? frameSelector : frameSelector.name;
|
||||
const url = (0, _rtti.isObject)(frameSelector) ? frameSelector.url : undefined;
|
||||
(0, _assert.assert)(name || url, 'Either name or url matcher should be specified');
|
||||
return this.frames().find(f => {
|
||||
if (name) return f.name() === name;
|
||||
return (0, _utils.urlMatches)(this._browserContext._options.baseURL, f.url(), url);
|
||||
return (0, _urlMatch.urlMatches)(this._browserContext._options.baseURL, f.url(), url);
|
||||
}) || null;
|
||||
}
|
||||
frames() {
|
||||
@@ -222,18 +224,18 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
setDefaultNavigationTimeout(timeout) {
|
||||
this._timeoutSettings.setDefaultNavigationTimeout(timeout);
|
||||
this._wrapApiCall(async () => {
|
||||
this._channel.setDefaultNavigationTimeoutNoReply({
|
||||
await this._channel.setDefaultNavigationTimeoutNoReply({
|
||||
timeout
|
||||
}).catch(() => {});
|
||||
}, true);
|
||||
});
|
||||
}, true).catch(() => {});
|
||||
}
|
||||
setDefaultTimeout(timeout) {
|
||||
this._timeoutSettings.setDefaultTimeout(timeout);
|
||||
this._wrapApiCall(async () => {
|
||||
this._channel.setDefaultTimeoutNoReply({
|
||||
await this._channel.setDefaultTimeoutNoReply({
|
||||
timeout
|
||||
}).catch(() => {});
|
||||
}, true);
|
||||
});
|
||||
}, true).catch(() => {});
|
||||
}
|
||||
_forceVideo() {
|
||||
if (!this._video) this._video = new _video.Video(this, this._connection);
|
||||
@@ -293,7 +295,7 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
async setExtraHTTPHeaders(headers) {
|
||||
(0, _network.validateHeaders)(headers);
|
||||
await this._channel.setExtraHTTPHeaders({
|
||||
headers: (0, _utils.headersObjectToArray)(headers)
|
||||
headers: (0, _headers.headersObjectToArray)(headers)
|
||||
});
|
||||
}
|
||||
url() {
|
||||
@@ -368,7 +370,7 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
async waitForRequest(urlOrPredicate, options = {}) {
|
||||
const predicate = async request => {
|
||||
if ((0, _utils.isString)(urlOrPredicate) || (0, _utils.isRegExp)(urlOrPredicate)) return (0, _utils.urlMatches)(this._browserContext._options.baseURL, request.url(), urlOrPredicate);
|
||||
if ((0, _rtti.isString)(urlOrPredicate) || (0, _rtti.isRegExp)(urlOrPredicate)) return (0, _urlMatch.urlMatches)(this._browserContext._options.baseURL, request.url(), urlOrPredicate);
|
||||
return await urlOrPredicate(request);
|
||||
};
|
||||
const trimmedUrl = trimUrl(urlOrPredicate);
|
||||
@@ -380,7 +382,7 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
async waitForResponse(urlOrPredicate, options = {}) {
|
||||
const predicate = async response => {
|
||||
if ((0, _utils.isString)(urlOrPredicate) || (0, _utils.isRegExp)(urlOrPredicate)) return (0, _utils.urlMatches)(this._browserContext._options.baseURL, response.url(), urlOrPredicate);
|
||||
if ((0, _rtti.isString)(urlOrPredicate) || (0, _rtti.isRegExp)(urlOrPredicate)) return (0, _urlMatch.urlMatches)(this._browserContext._options.baseURL, response.url(), urlOrPredicate);
|
||||
return await urlOrPredicate(response);
|
||||
};
|
||||
const trimmedUrl = trimUrl(urlOrPredicate);
|
||||
@@ -432,7 +434,8 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
media: options.media === null ? 'no-override' : options.media,
|
||||
colorScheme: options.colorScheme === null ? 'no-override' : options.colorScheme,
|
||||
reducedMotion: options.reducedMotion === null ? 'no-override' : options.reducedMotion,
|
||||
forcedColors: options.forcedColors === null ? 'no-override' : options.forcedColors
|
||||
forcedColors: options.forcedColors === null ? 'no-override' : options.forcedColors,
|
||||
contrast: options.contrast === null ? 'no-override' : options.contrast
|
||||
});
|
||||
}
|
||||
async setViewportSize(viewportSize) {
|
||||
@@ -449,21 +452,23 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
return await this._mainFrame.evaluate(pageFunction, arg);
|
||||
}
|
||||
async addInitScript(script, arg) {
|
||||
const source = await (0, _clientHelper.evaluationScript)(script, arg);
|
||||
const source = await (0, _clientHelper.evaluationScript)(this._platform, script, arg);
|
||||
await this._channel.addInitScript({
|
||||
source
|
||||
});
|
||||
}
|
||||
async route(url, handler, options = {}) {
|
||||
this._routes.unshift(new _network.RouteHandler(this._browserContext._options.baseURL, url, handler, options.times));
|
||||
this._routes.unshift(new _network.RouteHandler(this._platform, this._browserContext._options.baseURL, url, handler, options.times));
|
||||
await this._updateInterceptionPatterns();
|
||||
}
|
||||
async routeFromHAR(har, options = {}) {
|
||||
const localUtils = this._connection.localUtils();
|
||||
if (!localUtils) throw new Error('Route from har is not supported in thin clients');
|
||||
if (options.update) {
|
||||
await this._browserContext._recordIntoHAR(har, this, options);
|
||||
return;
|
||||
}
|
||||
const harRouter = await _harRouter.HarRouter.create(this._connection.localUtils(), har, options.notFound || 'abort', {
|
||||
const harRouter = await _harRouter.HarRouter.create(localUtils, har, options.notFound || 'abort', {
|
||||
urlMatch: options.url
|
||||
});
|
||||
this._harRouters.push(harRouter);
|
||||
@@ -485,7 +490,7 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
const removed = [];
|
||||
const remaining = [];
|
||||
for (const route of this._routes) {
|
||||
if ((0, _utils.urlMatchesEqual)(route.url, url) && (!handler || route.handler === handler)) removed.push(route);else remaining.push(route);
|
||||
if ((0, _urlMatch.urlMatchesEqual)(route.url, url) && (!handler || route.handler === handler)) removed.push(route);else remaining.push(route);
|
||||
}
|
||||
await this._unrouteInternal(removed, remaining, 'default');
|
||||
}
|
||||
@@ -509,21 +514,22 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
});
|
||||
}
|
||||
async screenshot(options = {}) {
|
||||
const mask = options.mask;
|
||||
const copy = {
|
||||
...options,
|
||||
mask: undefined
|
||||
};
|
||||
if (!copy.type) copy.type = (0, _elementHandle.determineScreenshotType)(options);
|
||||
if (options.mask) {
|
||||
copy.mask = options.mask.map(locator => ({
|
||||
if (mask) {
|
||||
copy.mask = mask.map(locator => ({
|
||||
frame: locator._frame._channel,
|
||||
selector: locator._selector
|
||||
}));
|
||||
}
|
||||
const result = await this._channel.screenshot(copy);
|
||||
if (options.path) {
|
||||
await (0, _utils.mkdirIfNeeded)(options.path);
|
||||
await _fs.default.promises.writeFile(options.path, result.binary);
|
||||
await (0, _fileUtils.mkdirIfNeeded)(this._platform, options.path);
|
||||
await this._platform.fs().promises.writeFile(options.path, result.binary);
|
||||
}
|
||||
return result.binary;
|
||||
}
|
||||
@@ -549,7 +555,7 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
async bringToFront() {
|
||||
await this._channel.bringToFront();
|
||||
}
|
||||
async [_Symbol$asyncDispose]() {
|
||||
async [Symbol.asyncDispose]() {
|
||||
await this.close();
|
||||
}
|
||||
async close(options = {}) {
|
||||
@@ -678,7 +684,7 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
async pause(_options) {
|
||||
var _this$_instrumentatio;
|
||||
if (require('inspector').url()) return;
|
||||
if (this._platform.isJSDebuggerAttached()) return;
|
||||
const defaultNavigationTimeout = this._browserContext._timeoutSettings.defaultNavigationTimeout();
|
||||
const defaultTimeout = this._browserContext._timeoutSettings.defaultTimeout();
|
||||
this._browserContext.setDefaultNavigationTimeout(0);
|
||||
@@ -705,10 +711,11 @@ class Page extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
const result = await this._channel.pdf(transportOptions);
|
||||
if (options.path) {
|
||||
await _fs.default.promises.mkdir(_path.default.dirname(options.path), {
|
||||
const platform = this._platform;
|
||||
await platform.fs().promises.mkdir(platform.path().dirname(options.path), {
|
||||
recursive: true
|
||||
});
|
||||
await _fs.default.promises.writeFile(options.path, result.pdf);
|
||||
await platform.fs().promises.writeFile(options.path, result.pdf);
|
||||
}
|
||||
return result.pdf;
|
||||
}
|
||||
@@ -743,6 +750,6 @@ class BindingCall extends _channelOwner.ChannelOwner {
|
||||
}
|
||||
exports.BindingCall = BindingCall;
|
||||
function trimUrl(param) {
|
||||
if ((0, _utils.isRegExp)(param)) return `/${(0, _utils.trimStringWithEllipsis)(param.source, 50)}/${param.flags}`;
|
||||
if ((0, _utils.isString)(param)) return `"${(0, _utils.trimStringWithEllipsis)(param, 50)}"`;
|
||||
if ((0, _rtti.isRegExp)(param)) return `/${(0, _stringUtils.trimStringWithEllipsis)(param.source, 50)}/${param.flags}`;
|
||||
if ((0, _rtti.isString)(param)) return `"${(0, _stringUtils.trimStringWithEllipsis)(param, 50)}"`;
|
||||
}
|
||||
22
tvapp2/node_modules/playwright-core/lib/client/playwright.js
generated
vendored
22
tvapp2/node_modules/playwright-core/lib/client/playwright.js
generated
vendored
@@ -4,11 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Playwright = void 0;
|
||||
var _errors = require("./errors");
|
||||
var _android = require("./android");
|
||||
var _browser = require("./browser");
|
||||
var _browserType = require("./browserType");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _electron = require("./electron");
|
||||
var _errors = require("./errors");
|
||||
var _fetch = require("./fetch");
|
||||
var _selectors = require("./selectors");
|
||||
/**
|
||||
@@ -42,6 +43,11 @@ class Playwright extends _channelOwner.ChannelOwner {
|
||||
this.selectors = void 0;
|
||||
this.request = void 0;
|
||||
this.errors = void 0;
|
||||
// Instrumentation.
|
||||
this._defaultLaunchOptions = void 0;
|
||||
this._defaultContextOptions = void 0;
|
||||
this._defaultContextTimeout = void 0;
|
||||
this._defaultContextNavigationTimeout = void 0;
|
||||
this.request = new _fetch.APIRequest(this);
|
||||
this.chromium = _browserType.BrowserType.from(initializer.chromium);
|
||||
this.chromium._playwright = this;
|
||||
@@ -76,5 +82,19 @@ class Playwright extends _channelOwner.ChannelOwner {
|
||||
static from(channel) {
|
||||
return channel._object;
|
||||
}
|
||||
_browserTypes() {
|
||||
return [this.chromium, this.firefox, this.webkit, this._bidiChromium, this._bidiFirefox];
|
||||
}
|
||||
_preLaunchedBrowser() {
|
||||
const browser = _browser.Browser.from(this._initializer.preLaunchedBrowser);
|
||||
browser._browserType = this[browser._name];
|
||||
return browser;
|
||||
}
|
||||
_allContexts() {
|
||||
return this._browserTypes().flatMap(type => [...type._contexts]);
|
||||
}
|
||||
_allPages() {
|
||||
return this._allContexts().flatMap(context => context.pages());
|
||||
}
|
||||
}
|
||||
exports.Playwright = Playwright;
|
||||
10
tvapp2/node_modules/playwright-core/lib/client/selectors.js
generated
vendored
10
tvapp2/node_modules/playwright-core/lib/client/selectors.js
generated
vendored
@@ -4,9 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SelectorsOwner = exports.Selectors = void 0;
|
||||
var _clientHelper = require("./clientHelper");
|
||||
exports.setPlatformForSelectors = setPlatformForSelectors;
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _clientHelper = require("./clientHelper");
|
||||
var _locator = require("./locator");
|
||||
var _platform = require("./platform");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -23,13 +25,17 @@ var _locator = require("./locator");
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
let platform = _platform.emptyPlatform;
|
||||
function setPlatformForSelectors(p) {
|
||||
platform = p;
|
||||
}
|
||||
class Selectors {
|
||||
constructor() {
|
||||
this._channels = new Set();
|
||||
this._registrations = [];
|
||||
}
|
||||
async register(name, script, options = {}) {
|
||||
const source = await (0, _clientHelper.evaluationScript)(script, undefined, false);
|
||||
const source = await (0, _clientHelper.evaluationScript)(platform, script, undefined, false);
|
||||
const params = {
|
||||
...options,
|
||||
name,
|
||||
|
||||
23
tvapp2/node_modules/playwright-core/lib/client/stream.js
generated
vendored
23
tvapp2/node_modules/playwright-core/lib/client/stream.js
generated
vendored
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Stream = void 0;
|
||||
var _stream = require("stream");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
@@ -30,25 +29,7 @@ class Stream extends _channelOwner.ChannelOwner {
|
||||
super(parent, type, guid, initializer);
|
||||
}
|
||||
stream() {
|
||||
return new StreamImpl(this._channel);
|
||||
return this._platform.streamReadable(this._channel);
|
||||
}
|
||||
}
|
||||
exports.Stream = Stream;
|
||||
class StreamImpl extends _stream.Readable {
|
||||
constructor(channel) {
|
||||
super();
|
||||
this._channel = void 0;
|
||||
this._channel = channel;
|
||||
}
|
||||
async _read() {
|
||||
const result = await this._channel.read({
|
||||
size: 1024 * 1024
|
||||
});
|
||||
if (result.binary.byteLength) this.push(result.binary);else this.push(null);
|
||||
}
|
||||
_destroy(error, callback) {
|
||||
// Stream might be destroyed after the connection was closed.
|
||||
this._channel.close().catch(e => null);
|
||||
super._destroy(error, callback);
|
||||
}
|
||||
}
|
||||
exports.Stream = Stream;
|
||||
17
tvapp2/node_modules/playwright-core/lib/client/tracing.js
generated
vendored
17
tvapp2/node_modules/playwright-core/lib/client/tracing.js
generated
vendored
@@ -70,15 +70,16 @@ class Tracing extends _channelOwner.ChannelOwner {
|
||||
}, false);
|
||||
}
|
||||
async _startCollectingStacks(traceName) {
|
||||
var _this$_connection$loc;
|
||||
if (!this._isTracing) {
|
||||
this._isTracing = true;
|
||||
this._connection.setIsTracing(true);
|
||||
}
|
||||
const result = await this._connection.localUtils()._channel.tracingStarted({
|
||||
const result = await ((_this$_connection$loc = this._connection.localUtils()) === null || _this$_connection$loc === void 0 ? void 0 : _this$_connection$loc.tracingStarted({
|
||||
tracesDir: this._tracesDir,
|
||||
traceName
|
||||
});
|
||||
this._stacksId = result.stacksId;
|
||||
}));
|
||||
this._stacksId = result === null || result === void 0 ? void 0 : result.stacksId;
|
||||
}
|
||||
async stopChunk(options = {}) {
|
||||
await this._doStopChunk(options.path);
|
||||
@@ -94,17 +95,19 @@ class Tracing extends _channelOwner.ChannelOwner {
|
||||
await this._channel.tracingStopChunk({
|
||||
mode: 'discard'
|
||||
});
|
||||
if (this._stacksId) await this._connection.localUtils()._channel.traceDiscarded({
|
||||
if (this._stacksId) await this._connection.localUtils().traceDiscarded({
|
||||
stacksId: this._stacksId
|
||||
});
|
||||
return;
|
||||
}
|
||||
const localUtils = this._connection.localUtils();
|
||||
if (!localUtils) throw new Error('Cannot save trace in thin clients');
|
||||
const isLocal = !this._connection.isRemote();
|
||||
if (isLocal) {
|
||||
const result = await this._channel.tracingStopChunk({
|
||||
mode: 'entries'
|
||||
});
|
||||
await this._connection.localUtils()._channel.zip({
|
||||
await localUtils.zip({
|
||||
zipFile: filePath,
|
||||
entries: result.entries,
|
||||
mode: 'write',
|
||||
@@ -119,7 +122,7 @@ class Tracing extends _channelOwner.ChannelOwner {
|
||||
|
||||
// The artifact may be missing if the browser closed while stopping tracing.
|
||||
if (!result.artifact) {
|
||||
if (this._stacksId) await this._connection.localUtils()._channel.traceDiscarded({
|
||||
if (this._stacksId) await localUtils.traceDiscarded({
|
||||
stacksId: this._stacksId
|
||||
});
|
||||
return;
|
||||
@@ -129,7 +132,7 @@ class Tracing extends _channelOwner.ChannelOwner {
|
||||
const artifact = _artifact.Artifact.from(result.artifact);
|
||||
await artifact.saveAs(filePath);
|
||||
await artifact.delete();
|
||||
await this._connection.localUtils()._channel.zip({
|
||||
await localUtils.zip({
|
||||
zipFile: filePath,
|
||||
entries: [],
|
||||
mode: 'append',
|
||||
|
||||
4
tvapp2/node_modules/playwright-core/lib/client/video.js
generated
vendored
4
tvapp2/node_modules/playwright-core/lib/client/video.js
generated
vendored
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Video = void 0;
|
||||
var _utils = require("../utils");
|
||||
var _manualPromise = require("../utils/isomorphic/manualPromise");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -24,7 +24,7 @@ var _utils = require("../utils");
|
||||
class Video {
|
||||
constructor(page, connection) {
|
||||
this._artifact = null;
|
||||
this._artifactReadyPromise = new _utils.ManualPromise();
|
||||
this._artifactReadyPromise = new _manualPromise.ManualPromise();
|
||||
this._isRemote = false;
|
||||
this._isRemote = connection.isRemote();
|
||||
this._artifact = page._closedOrCrashedScope.safeRace(this._artifactReadyPromise);
|
||||
|
||||
11
tvapp2/node_modules/playwright-core/lib/client/waiter.js
generated
vendored
11
tvapp2/node_modules/playwright-core/lib/client/waiter.js
generated
vendored
@@ -4,9 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Waiter = void 0;
|
||||
var _stackTrace = require("../utils/stackTrace");
|
||||
var _errors = require("./errors");
|
||||
var _utils = require("../utils");
|
||||
var _stackTrace = require("../utils/isomorphic/stackTrace");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -33,9 +32,9 @@ class Waiter {
|
||||
this._waitId = void 0;
|
||||
this._error = void 0;
|
||||
this._savedZone = void 0;
|
||||
this._waitId = (0, _utils.createGuid)();
|
||||
this._waitId = channelOwner._platform.createGuid();
|
||||
this._channelOwner = channelOwner;
|
||||
this._savedZone = _utils.zones.current().without('apiZone');
|
||||
this._savedZone = channelOwner._platform.zones.current().pop();
|
||||
this._channelOwner._channel.waitForEventInfo({
|
||||
info: {
|
||||
waitId: this._waitId,
|
||||
@@ -111,8 +110,8 @@ class Waiter {
|
||||
phase: 'log',
|
||||
message: s
|
||||
}
|
||||
}).catch(() => {});
|
||||
}, true);
|
||||
});
|
||||
}, true).catch(() => {});
|
||||
}
|
||||
_rejectOn(promise, dispose) {
|
||||
this._failures.push(promise);
|
||||
|
||||
8
tvapp2/node_modules/playwright-core/lib/client/worker.js
generated
vendored
8
tvapp2/node_modules/playwright-core/lib/client/worker.js
generated
vendored
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Worker = void 0;
|
||||
var _events = require("./events");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
var _jsHandle = require("./jsHandle");
|
||||
var _utils = require("../utils");
|
||||
var _errors = require("./errors");
|
||||
var _events = require("./events");
|
||||
var _jsHandle = require("./jsHandle");
|
||||
var _manualPromise = require("../utils/isomorphic/manualPromise");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -35,7 +35,7 @@ class Worker extends _channelOwner.ChannelOwner {
|
||||
// Set for web workers.
|
||||
this._context = void 0;
|
||||
// Set for service workers.
|
||||
this._closedScope = new _utils.LongStandingScope();
|
||||
this._closedScope = new _manualPromise.LongStandingScope();
|
||||
this._channel.on('close', () => {
|
||||
if (this._page) this._page._workers.delete(this);
|
||||
if (this._context) this._context._serviceWorkers.delete(this);
|
||||
|
||||
23
tvapp2/node_modules/playwright-core/lib/client/writableStream.js
generated
vendored
23
tvapp2/node_modules/playwright-core/lib/client/writableStream.js
generated
vendored
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.WritableStream = void 0;
|
||||
var _stream = require("stream");
|
||||
var _channelOwner = require("./channelOwner");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
@@ -30,25 +29,7 @@ class WritableStream extends _channelOwner.ChannelOwner {
|
||||
super(parent, type, guid, initializer);
|
||||
}
|
||||
stream() {
|
||||
return new WritableStreamImpl(this._channel);
|
||||
return this._platform.streamWritable(this._channel);
|
||||
}
|
||||
}
|
||||
exports.WritableStream = WritableStream;
|
||||
class WritableStreamImpl extends _stream.Writable {
|
||||
constructor(channel) {
|
||||
super();
|
||||
this._channel = void 0;
|
||||
this._channel = channel;
|
||||
}
|
||||
async _write(chunk, encoding, callback) {
|
||||
const error = await this._channel.write({
|
||||
binary: typeof chunk === 'string' ? Buffer.from(chunk) : chunk
|
||||
}).catch(e => e);
|
||||
callback(error || null);
|
||||
}
|
||||
async _final(callback) {
|
||||
// Stream might be destroyed after the connection was closed.
|
||||
const error = await this._channel.close().catch(e => e);
|
||||
callback(error || null);
|
||||
}
|
||||
}
|
||||
exports.WritableStream = WritableStream;
|
||||
569
tvapp2/node_modules/playwright-core/lib/common/socksProxy.js
generated
vendored
569
tvapp2/node_modules/playwright-core/lib/common/socksProxy.js
generated
vendored
@@ -1,569 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SocksProxyHandler = exports.SocksProxy = void 0;
|
||||
exports.parsePattern = parsePattern;
|
||||
var _events = _interopRequireDefault(require("events"));
|
||||
var _net = _interopRequireDefault(require("net"));
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
var _happyEyeballs = require("../utils/happy-eyeballs");
|
||||
var _utils = require("../utils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// https://tools.ietf.org/html/rfc1928
|
||||
var SocksAuth = /*#__PURE__*/function (SocksAuth) {
|
||||
SocksAuth[SocksAuth["NO_AUTHENTICATION_REQUIRED"] = 0] = "NO_AUTHENTICATION_REQUIRED";
|
||||
SocksAuth[SocksAuth["GSSAPI"] = 1] = "GSSAPI";
|
||||
SocksAuth[SocksAuth["USERNAME_PASSWORD"] = 2] = "USERNAME_PASSWORD";
|
||||
SocksAuth[SocksAuth["NO_ACCEPTABLE_METHODS"] = 255] = "NO_ACCEPTABLE_METHODS";
|
||||
return SocksAuth;
|
||||
}(SocksAuth || {});
|
||||
var SocksAddressType = /*#__PURE__*/function (SocksAddressType) {
|
||||
SocksAddressType[SocksAddressType["IPv4"] = 1] = "IPv4";
|
||||
SocksAddressType[SocksAddressType["FqName"] = 3] = "FqName";
|
||||
SocksAddressType[SocksAddressType["IPv6"] = 4] = "IPv6";
|
||||
return SocksAddressType;
|
||||
}(SocksAddressType || {});
|
||||
var SocksCommand = /*#__PURE__*/function (SocksCommand) {
|
||||
SocksCommand[SocksCommand["CONNECT"] = 1] = "CONNECT";
|
||||
SocksCommand[SocksCommand["BIND"] = 2] = "BIND";
|
||||
SocksCommand[SocksCommand["UDP_ASSOCIATE"] = 3] = "UDP_ASSOCIATE";
|
||||
return SocksCommand;
|
||||
}(SocksCommand || {});
|
||||
var SocksReply = /*#__PURE__*/function (SocksReply) {
|
||||
SocksReply[SocksReply["Succeeded"] = 0] = "Succeeded";
|
||||
SocksReply[SocksReply["GeneralServerFailure"] = 1] = "GeneralServerFailure";
|
||||
SocksReply[SocksReply["NotAllowedByRuleSet"] = 2] = "NotAllowedByRuleSet";
|
||||
SocksReply[SocksReply["NetworkUnreachable"] = 3] = "NetworkUnreachable";
|
||||
SocksReply[SocksReply["HostUnreachable"] = 4] = "HostUnreachable";
|
||||
SocksReply[SocksReply["ConnectionRefused"] = 5] = "ConnectionRefused";
|
||||
SocksReply[SocksReply["TtlExpired"] = 6] = "TtlExpired";
|
||||
SocksReply[SocksReply["CommandNotSupported"] = 7] = "CommandNotSupported";
|
||||
SocksReply[SocksReply["AddressTypeNotSupported"] = 8] = "AddressTypeNotSupported";
|
||||
return SocksReply;
|
||||
}(SocksReply || {});
|
||||
class SocksConnection {
|
||||
constructor(uid, socket, client) {
|
||||
this._buffer = Buffer.from([]);
|
||||
this._offset = 0;
|
||||
this._fence = 0;
|
||||
this._fenceCallback = void 0;
|
||||
this._socket = void 0;
|
||||
this._boundOnData = void 0;
|
||||
this._uid = void 0;
|
||||
this._client = void 0;
|
||||
this._uid = uid;
|
||||
this._socket = socket;
|
||||
this._client = client;
|
||||
this._boundOnData = this._onData.bind(this);
|
||||
socket.on('data', this._boundOnData);
|
||||
socket.on('close', () => this._onClose());
|
||||
socket.on('end', () => this._onClose());
|
||||
socket.on('error', () => this._onClose());
|
||||
this._run().catch(() => this._socket.end());
|
||||
}
|
||||
async _run() {
|
||||
(0, _utils.assert)(await this._authenticate());
|
||||
const {
|
||||
command,
|
||||
host,
|
||||
port
|
||||
} = await this._parseRequest();
|
||||
if (command !== SocksCommand.CONNECT) {
|
||||
this._writeBytes(Buffer.from([0x05, SocksReply.CommandNotSupported, 0x00,
|
||||
// RSV
|
||||
0x01,
|
||||
// IPv4
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
// Address
|
||||
0x00, 0x00 // Port
|
||||
]));
|
||||
return;
|
||||
}
|
||||
this._socket.off('data', this._boundOnData);
|
||||
this._client.onSocketRequested({
|
||||
uid: this._uid,
|
||||
host,
|
||||
port
|
||||
});
|
||||
}
|
||||
async _authenticate() {
|
||||
// Request:
|
||||
// +----+----------+----------+
|
||||
// |VER | NMETHODS | METHODS |
|
||||
// +----+----------+----------+
|
||||
// | 1 | 1 | 1 to 255 |
|
||||
// +----+----------+----------+
|
||||
|
||||
// Response:
|
||||
// +----+--------+
|
||||
// |VER | METHOD |
|
||||
// +----+--------+
|
||||
// | 1 | 1 |
|
||||
// +----+--------+
|
||||
|
||||
const version = await this._readByte();
|
||||
(0, _utils.assert)(version === 0x05, 'The VER field must be set to x05 for this version of the protocol, was ' + version);
|
||||
const nMethods = await this._readByte();
|
||||
(0, _utils.assert)(nMethods, 'No authentication methods specified');
|
||||
const methods = await this._readBytes(nMethods);
|
||||
for (const method of methods) {
|
||||
if (method === 0) {
|
||||
this._writeBytes(Buffer.from([version, method]));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
this._writeBytes(Buffer.from([version, SocksAuth.NO_ACCEPTABLE_METHODS]));
|
||||
return false;
|
||||
}
|
||||
async _parseRequest() {
|
||||
// Request.
|
||||
// +----+-----+-------+------+----------+----------+
|
||||
// |VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT |
|
||||
// +----+-----+-------+------+----------+----------+
|
||||
// | 1 | 1 | X'00' | 1 | Variable | 2 |
|
||||
// +----+-----+-------+------+----------+----------+
|
||||
|
||||
// Response.
|
||||
// +----+-----+-------+------+----------+----------+
|
||||
// |VER | REP | RSV | ATYP | BND.ADDR | BND.PORT |
|
||||
// +----+-----+-------+------+----------+----------+
|
||||
// | 1 | 1 | X'00' | 1 | Variable | 2 |
|
||||
// +----+-----+-------+------+----------+----------+
|
||||
|
||||
const version = await this._readByte();
|
||||
(0, _utils.assert)(version === 0x05, 'The VER field must be set to x05 for this version of the protocol, was ' + version);
|
||||
const command = await this._readByte();
|
||||
await this._readByte(); // skip reserved.
|
||||
const addressType = await this._readByte();
|
||||
let host = '';
|
||||
switch (addressType) {
|
||||
case SocksAddressType.IPv4:
|
||||
host = (await this._readBytes(4)).join('.');
|
||||
break;
|
||||
case SocksAddressType.FqName:
|
||||
const length = await this._readByte();
|
||||
host = (await this._readBytes(length)).toString();
|
||||
break;
|
||||
case SocksAddressType.IPv6:
|
||||
const bytes = await this._readBytes(16);
|
||||
const tokens = [];
|
||||
for (let i = 0; i < 8; ++i) tokens.push(bytes.readUInt16BE(i * 2).toString(16));
|
||||
host = tokens.join(':');
|
||||
break;
|
||||
}
|
||||
const port = (await this._readBytes(2)).readUInt16BE(0);
|
||||
this._buffer = Buffer.from([]);
|
||||
this._offset = 0;
|
||||
this._fence = 0;
|
||||
return {
|
||||
command,
|
||||
host,
|
||||
port
|
||||
};
|
||||
}
|
||||
async _readByte() {
|
||||
const buffer = await this._readBytes(1);
|
||||
return buffer[0];
|
||||
}
|
||||
async _readBytes(length) {
|
||||
this._fence = this._offset + length;
|
||||
if (!this._buffer || this._buffer.length < this._fence) await new Promise(f => this._fenceCallback = f);
|
||||
this._offset += length;
|
||||
return this._buffer.slice(this._offset - length, this._offset);
|
||||
}
|
||||
_writeBytes(buffer) {
|
||||
if (this._socket.writable) this._socket.write(buffer);
|
||||
}
|
||||
_onClose() {
|
||||
this._client.onSocketClosed({
|
||||
uid: this._uid
|
||||
});
|
||||
}
|
||||
_onData(buffer) {
|
||||
this._buffer = Buffer.concat([this._buffer, buffer]);
|
||||
if (this._fenceCallback && this._buffer.length >= this._fence) {
|
||||
const callback = this._fenceCallback;
|
||||
this._fenceCallback = undefined;
|
||||
callback();
|
||||
}
|
||||
}
|
||||
socketConnected(host, port) {
|
||||
this._writeBytes(Buffer.from([0x05, SocksReply.Succeeded, 0x00,
|
||||
// RSV
|
||||
...ipToSocksAddress(host),
|
||||
// ATYP, Address
|
||||
port >> 8, port & 0xFF // Port
|
||||
]));
|
||||
this._socket.on('data', data => this._client.onSocketData({
|
||||
uid: this._uid,
|
||||
data
|
||||
}));
|
||||
}
|
||||
socketFailed(errorCode) {
|
||||
const buffer = Buffer.from([0x05, 0, 0x00,
|
||||
// RSV
|
||||
...ipToSocksAddress('0.0.0.0'),
|
||||
// ATYP, Address
|
||||
0, 0 // Port
|
||||
]);
|
||||
switch (errorCode) {
|
||||
case 'ENOENT':
|
||||
case 'ENOTFOUND':
|
||||
case 'ETIMEDOUT':
|
||||
case 'EHOSTUNREACH':
|
||||
buffer[1] = SocksReply.HostUnreachable;
|
||||
break;
|
||||
case 'ENETUNREACH':
|
||||
buffer[1] = SocksReply.NetworkUnreachable;
|
||||
break;
|
||||
case 'ECONNREFUSED':
|
||||
buffer[1] = SocksReply.ConnectionRefused;
|
||||
break;
|
||||
case 'ERULESET':
|
||||
buffer[1] = SocksReply.NotAllowedByRuleSet;
|
||||
break;
|
||||
}
|
||||
this._writeBytes(buffer);
|
||||
this._socket.end();
|
||||
}
|
||||
sendData(data) {
|
||||
this._socket.write(data);
|
||||
}
|
||||
end() {
|
||||
this._socket.end();
|
||||
}
|
||||
error(error) {
|
||||
this._socket.destroy(new Error(error));
|
||||
}
|
||||
}
|
||||
function hexToNumber(hex) {
|
||||
// Note: parseInt has a few issues including ignoring trailing characters and allowing leading 0x.
|
||||
return [...hex].reduce((value, digit) => {
|
||||
const code = digit.charCodeAt(0);
|
||||
if (code >= 48 && code <= 57)
|
||||
// 0..9
|
||||
return value + code;
|
||||
if (code >= 97 && code <= 102)
|
||||
// a..f
|
||||
return value + (code - 97) + 10;
|
||||
if (code >= 65 && code <= 70)
|
||||
// A..F
|
||||
return value + (code - 65) + 10;
|
||||
throw new Error('Invalid IPv6 token ' + hex);
|
||||
}, 0);
|
||||
}
|
||||
function ipToSocksAddress(address) {
|
||||
if (_net.default.isIPv4(address)) {
|
||||
return [0x01,
|
||||
// IPv4
|
||||
...address.split('.', 4).map(t => +t & 0xFF) // Address
|
||||
];
|
||||
}
|
||||
if (_net.default.isIPv6(address)) {
|
||||
const result = [0x04]; // IPv6
|
||||
const tokens = address.split(':', 8);
|
||||
while (tokens.length < 8) tokens.unshift('');
|
||||
for (const token of tokens) {
|
||||
const value = hexToNumber(token);
|
||||
result.push(value >> 8 & 0xFF, value & 0xFF); // Big-endian
|
||||
}
|
||||
return result;
|
||||
}
|
||||
throw new Error('Only IPv4 and IPv6 addresses are supported');
|
||||
}
|
||||
function starMatchToRegex(pattern) {
|
||||
const source = pattern.split('*').map(s => {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping
|
||||
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}).join('.*');
|
||||
return new RegExp('^' + source + '$');
|
||||
}
|
||||
|
||||
// This follows "Proxy bypass rules" syntax without implicit and negative rules.
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:net/docs/proxy.md;l=331
|
||||
function parsePattern(pattern) {
|
||||
if (!pattern) return () => false;
|
||||
const matchers = pattern.split(',').map(token => {
|
||||
const match = token.match(/^(.*?)(?::(\d+))?$/);
|
||||
if (!match) throw new Error(`Unsupported token "${token}" in pattern "${pattern}"`);
|
||||
const tokenPort = match[2] ? +match[2] : undefined;
|
||||
const portMatches = port => tokenPort === undefined || tokenPort === port;
|
||||
let tokenHost = match[1];
|
||||
if (tokenHost === '<loopback>') {
|
||||
return (host, port) => {
|
||||
if (!portMatches(port)) return false;
|
||||
return host === 'localhost' || host.endsWith('.localhost') || host === '127.0.0.1' || host === '[::1]';
|
||||
};
|
||||
}
|
||||
if (tokenHost === '*') return (host, port) => portMatches(port);
|
||||
if (_net.default.isIPv4(tokenHost) || _net.default.isIPv6(tokenHost)) return (host, port) => host === tokenHost && portMatches(port);
|
||||
if (tokenHost[0] === '.') tokenHost = '*' + tokenHost;
|
||||
const tokenRegex = starMatchToRegex(tokenHost);
|
||||
return (host, port) => {
|
||||
if (!portMatches(port)) return false;
|
||||
if (_net.default.isIPv4(host) || _net.default.isIPv6(host)) return false;
|
||||
return !!host.match(tokenRegex);
|
||||
};
|
||||
});
|
||||
return (host, port) => matchers.some(matcher => matcher(host, port));
|
||||
}
|
||||
class SocksProxy extends _events.default {
|
||||
constructor() {
|
||||
super();
|
||||
this._server = void 0;
|
||||
this._connections = new Map();
|
||||
this._sockets = new Set();
|
||||
this._closed = false;
|
||||
this._port = void 0;
|
||||
this._patternMatcher = () => false;
|
||||
this._directSockets = new Map();
|
||||
this._server = new _net.default.Server(socket => {
|
||||
const uid = (0, _utils.createGuid)();
|
||||
const connection = new SocksConnection(uid, socket, this);
|
||||
this._connections.set(uid, connection);
|
||||
});
|
||||
this._server.on('connection', socket => {
|
||||
if (this._closed) {
|
||||
socket.destroy();
|
||||
return;
|
||||
}
|
||||
this._sockets.add(socket);
|
||||
socket.once('close', () => this._sockets.delete(socket));
|
||||
});
|
||||
}
|
||||
setPattern(pattern) {
|
||||
try {
|
||||
this._patternMatcher = parsePattern(pattern);
|
||||
} catch (e) {
|
||||
this._patternMatcher = () => false;
|
||||
}
|
||||
}
|
||||
async _handleDirect(request) {
|
||||
try {
|
||||
var _this$_connections$ge4;
|
||||
const socket = await (0, _happyEyeballs.createSocket)(request.host, request.port);
|
||||
socket.on('data', data => {
|
||||
var _this$_connections$ge;
|
||||
return (_this$_connections$ge = this._connections.get(request.uid)) === null || _this$_connections$ge === void 0 ? void 0 : _this$_connections$ge.sendData(data);
|
||||
});
|
||||
socket.on('error', error => {
|
||||
var _this$_connections$ge2;
|
||||
(_this$_connections$ge2 = this._connections.get(request.uid)) === null || _this$_connections$ge2 === void 0 || _this$_connections$ge2.error(error.message);
|
||||
this._directSockets.delete(request.uid);
|
||||
});
|
||||
socket.on('end', () => {
|
||||
var _this$_connections$ge3;
|
||||
(_this$_connections$ge3 = this._connections.get(request.uid)) === null || _this$_connections$ge3 === void 0 || _this$_connections$ge3.end();
|
||||
this._directSockets.delete(request.uid);
|
||||
});
|
||||
const localAddress = socket.localAddress;
|
||||
const localPort = socket.localPort;
|
||||
this._directSockets.set(request.uid, socket);
|
||||
(_this$_connections$ge4 = this._connections.get(request.uid)) === null || _this$_connections$ge4 === void 0 || _this$_connections$ge4.socketConnected(localAddress, localPort);
|
||||
} catch (error) {
|
||||
var _this$_connections$ge5;
|
||||
(_this$_connections$ge5 = this._connections.get(request.uid)) === null || _this$_connections$ge5 === void 0 || _this$_connections$ge5.socketFailed(error.code);
|
||||
}
|
||||
}
|
||||
port() {
|
||||
return this._port;
|
||||
}
|
||||
async listen(port, hostname) {
|
||||
return new Promise(f => {
|
||||
this._server.listen(port, hostname, () => {
|
||||
const port = this._server.address().port;
|
||||
this._port = port;
|
||||
f(port);
|
||||
});
|
||||
});
|
||||
}
|
||||
async close() {
|
||||
if (this._closed) return;
|
||||
this._closed = true;
|
||||
for (const socket of this._sockets) socket.destroy();
|
||||
this._sockets.clear();
|
||||
await new Promise(f => this._server.close(f));
|
||||
}
|
||||
onSocketRequested(payload) {
|
||||
if (!this._patternMatcher(payload.host, payload.port)) {
|
||||
this._handleDirect(payload);
|
||||
return;
|
||||
}
|
||||
this.emit(SocksProxy.Events.SocksRequested, payload);
|
||||
}
|
||||
onSocketData(payload) {
|
||||
const direct = this._directSockets.get(payload.uid);
|
||||
if (direct) {
|
||||
direct.write(payload.data);
|
||||
return;
|
||||
}
|
||||
this.emit(SocksProxy.Events.SocksData, payload);
|
||||
}
|
||||
onSocketClosed(payload) {
|
||||
const direct = this._directSockets.get(payload.uid);
|
||||
if (direct) {
|
||||
direct.destroy();
|
||||
this._directSockets.delete(payload.uid);
|
||||
return;
|
||||
}
|
||||
this.emit(SocksProxy.Events.SocksClosed, payload);
|
||||
}
|
||||
socketConnected({
|
||||
uid,
|
||||
host,
|
||||
port
|
||||
}) {
|
||||
var _this$_connections$ge6;
|
||||
(_this$_connections$ge6 = this._connections.get(uid)) === null || _this$_connections$ge6 === void 0 || _this$_connections$ge6.socketConnected(host, port);
|
||||
}
|
||||
socketFailed({
|
||||
uid,
|
||||
errorCode
|
||||
}) {
|
||||
var _this$_connections$ge7;
|
||||
(_this$_connections$ge7 = this._connections.get(uid)) === null || _this$_connections$ge7 === void 0 || _this$_connections$ge7.socketFailed(errorCode);
|
||||
}
|
||||
sendSocketData({
|
||||
uid,
|
||||
data
|
||||
}) {
|
||||
var _this$_connections$ge8;
|
||||
(_this$_connections$ge8 = this._connections.get(uid)) === null || _this$_connections$ge8 === void 0 || _this$_connections$ge8.sendData(data);
|
||||
}
|
||||
sendSocketEnd({
|
||||
uid
|
||||
}) {
|
||||
var _this$_connections$ge9;
|
||||
(_this$_connections$ge9 = this._connections.get(uid)) === null || _this$_connections$ge9 === void 0 || _this$_connections$ge9.end();
|
||||
}
|
||||
sendSocketError({
|
||||
uid,
|
||||
error
|
||||
}) {
|
||||
var _this$_connections$ge10;
|
||||
(_this$_connections$ge10 = this._connections.get(uid)) === null || _this$_connections$ge10 === void 0 || _this$_connections$ge10.error(error);
|
||||
}
|
||||
}
|
||||
exports.SocksProxy = SocksProxy;
|
||||
SocksProxy.Events = {
|
||||
SocksRequested: 'socksRequested',
|
||||
SocksData: 'socksData',
|
||||
SocksClosed: 'socksClosed'
|
||||
};
|
||||
class SocksProxyHandler extends _events.default {
|
||||
constructor(pattern, redirectPortForTest) {
|
||||
super();
|
||||
this._sockets = new Map();
|
||||
this._patternMatcher = () => false;
|
||||
this._redirectPortForTest = void 0;
|
||||
this._patternMatcher = parsePattern(pattern);
|
||||
this._redirectPortForTest = redirectPortForTest;
|
||||
}
|
||||
cleanup() {
|
||||
for (const uid of this._sockets.keys()) this.socketClosed({
|
||||
uid
|
||||
});
|
||||
}
|
||||
async socketRequested({
|
||||
uid,
|
||||
host,
|
||||
port
|
||||
}) {
|
||||
_debugLogger.debugLogger.log('socks', `[${uid}] => request ${host}:${port}`);
|
||||
if (!this._patternMatcher(host, port)) {
|
||||
const payload = {
|
||||
uid,
|
||||
errorCode: 'ERULESET'
|
||||
};
|
||||
_debugLogger.debugLogger.log('socks', `[${uid}] <= pattern error ${payload.errorCode}`);
|
||||
this.emit(SocksProxyHandler.Events.SocksFailed, payload);
|
||||
return;
|
||||
}
|
||||
if (host === 'local.playwright') host = 'localhost';
|
||||
try {
|
||||
if (this._redirectPortForTest) port = this._redirectPortForTest;
|
||||
const socket = await (0, _happyEyeballs.createSocket)(host, port);
|
||||
socket.on('data', data => {
|
||||
const payload = {
|
||||
uid,
|
||||
data
|
||||
};
|
||||
this.emit(SocksProxyHandler.Events.SocksData, payload);
|
||||
});
|
||||
socket.on('error', error => {
|
||||
const payload = {
|
||||
uid,
|
||||
error: error.message
|
||||
};
|
||||
_debugLogger.debugLogger.log('socks', `[${uid}] <= network socket error ${payload.error}`);
|
||||
this.emit(SocksProxyHandler.Events.SocksError, payload);
|
||||
this._sockets.delete(uid);
|
||||
});
|
||||
socket.on('end', () => {
|
||||
const payload = {
|
||||
uid
|
||||
};
|
||||
_debugLogger.debugLogger.log('socks', `[${uid}] <= network socket closed`);
|
||||
this.emit(SocksProxyHandler.Events.SocksEnd, payload);
|
||||
this._sockets.delete(uid);
|
||||
});
|
||||
const localAddress = socket.localAddress;
|
||||
const localPort = socket.localPort;
|
||||
this._sockets.set(uid, socket);
|
||||
const payload = {
|
||||
uid,
|
||||
host: localAddress,
|
||||
port: localPort
|
||||
};
|
||||
_debugLogger.debugLogger.log('socks', `[${uid}] <= connected to network ${payload.host}:${payload.port}`);
|
||||
this.emit(SocksProxyHandler.Events.SocksConnected, payload);
|
||||
} catch (error) {
|
||||
const payload = {
|
||||
uid,
|
||||
errorCode: error.code
|
||||
};
|
||||
_debugLogger.debugLogger.log('socks', `[${uid}] <= connect error ${payload.errorCode}`);
|
||||
this.emit(SocksProxyHandler.Events.SocksFailed, payload);
|
||||
}
|
||||
}
|
||||
sendSocketData({
|
||||
uid,
|
||||
data
|
||||
}) {
|
||||
var _this$_sockets$get;
|
||||
(_this$_sockets$get = this._sockets.get(uid)) === null || _this$_sockets$get === void 0 || _this$_sockets$get.write(data);
|
||||
}
|
||||
socketClosed({
|
||||
uid
|
||||
}) {
|
||||
var _this$_sockets$get2;
|
||||
_debugLogger.debugLogger.log('socks', `[${uid}] <= browser socket closed`);
|
||||
(_this$_sockets$get2 = this._sockets.get(uid)) === null || _this$_sockets$get2 === void 0 || _this$_sockets$get2.destroy();
|
||||
this._sockets.delete(uid);
|
||||
}
|
||||
}
|
||||
exports.SocksProxyHandler = SocksProxyHandler;
|
||||
SocksProxyHandler.Events = {
|
||||
SocksConnected: 'socksConnected',
|
||||
SocksData: 'socksData',
|
||||
SocksError: 'socksError',
|
||||
SocksFailed: 'socksFailed',
|
||||
SocksEnd: 'socksEnd'
|
||||
};
|
||||
73
tvapp2/node_modules/playwright-core/lib/common/timeoutSettings.js
generated
vendored
73
tvapp2/node_modules/playwright-core/lib/common/timeoutSettings.js
generated
vendored
@@ -1,73 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.TimeoutSettings = exports.DEFAULT_TIMEOUT = exports.DEFAULT_LAUNCH_TIMEOUT = void 0;
|
||||
var _utils = require("../utils");
|
||||
/**
|
||||
* Copyright 2019 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const DEFAULT_TIMEOUT = exports.DEFAULT_TIMEOUT = 30000;
|
||||
const DEFAULT_LAUNCH_TIMEOUT = exports.DEFAULT_LAUNCH_TIMEOUT = 3 * 60 * 1000; // 3 minutes
|
||||
|
||||
class TimeoutSettings {
|
||||
constructor(parent) {
|
||||
this._parent = void 0;
|
||||
this._defaultTimeout = void 0;
|
||||
this._defaultNavigationTimeout = void 0;
|
||||
this._parent = parent;
|
||||
}
|
||||
setDefaultTimeout(timeout) {
|
||||
this._defaultTimeout = timeout;
|
||||
}
|
||||
setDefaultNavigationTimeout(timeout) {
|
||||
this._defaultNavigationTimeout = timeout;
|
||||
}
|
||||
defaultNavigationTimeout() {
|
||||
return this._defaultNavigationTimeout;
|
||||
}
|
||||
defaultTimeout() {
|
||||
return this._defaultTimeout;
|
||||
}
|
||||
navigationTimeout(options) {
|
||||
if (typeof options.timeout === 'number') return options.timeout;
|
||||
if (this._defaultNavigationTimeout !== undefined) return this._defaultNavigationTimeout;
|
||||
if ((0, _utils.debugMode)()) return 0;
|
||||
if (this._defaultTimeout !== undefined) return this._defaultTimeout;
|
||||
if (this._parent) return this._parent.navigationTimeout(options);
|
||||
return DEFAULT_TIMEOUT;
|
||||
}
|
||||
timeout(options) {
|
||||
if (typeof options.timeout === 'number') return options.timeout;
|
||||
if ((0, _utils.debugMode)()) return 0;
|
||||
if (this._defaultTimeout !== undefined) return this._defaultTimeout;
|
||||
if (this._parent) return this._parent.timeout(options);
|
||||
return DEFAULT_TIMEOUT;
|
||||
}
|
||||
static timeout(options) {
|
||||
if (typeof options.timeout === 'number') return options.timeout;
|
||||
if ((0, _utils.debugMode)()) return 0;
|
||||
return DEFAULT_TIMEOUT;
|
||||
}
|
||||
static launchTimeout(options) {
|
||||
if (typeof options.timeout === 'number') return options.timeout;
|
||||
if ((0, _utils.debugMode)()) return 0;
|
||||
return DEFAULT_LAUNCH_TIMEOUT;
|
||||
}
|
||||
}
|
||||
exports.TimeoutSettings = TimeoutSettings;
|
||||
5
tvapp2/node_modules/playwright-core/lib/common/types.js
generated
vendored
5
tvapp2/node_modules/playwright-core/lib/common/types.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
2
tvapp2/node_modules/playwright-core/lib/generated/consoleApiSource.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/generated/consoleApiSource.js
generated
vendored
File diff suppressed because one or more lines are too long
2
tvapp2/node_modules/playwright-core/lib/generated/injectedScriptSource.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/generated/injectedScriptSource.js
generated
vendored
File diff suppressed because one or more lines are too long
98
tvapp2/node_modules/playwright-core/lib/image_tools/colorUtils.js
generated
vendored
98
tvapp2/node_modules/playwright-core/lib/image_tools/colorUtils.js
generated
vendored
@@ -1,98 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.blendWithWhite = blendWithWhite;
|
||||
exports.colorDeltaE94 = colorDeltaE94;
|
||||
exports.rgb2gray = rgb2gray;
|
||||
exports.srgb2xyz = srgb2xyz;
|
||||
exports.xyz2lab = xyz2lab;
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
function blendWithWhite(c, a) {
|
||||
return 255 + (c - 255) * a;
|
||||
}
|
||||
function rgb2gray(r, g, b) {
|
||||
// NOTE: this is the exact integer formula from SSIM.js.
|
||||
// See https://github.com/obartra/ssim/blob/ca8e3c6a6ff5f4f2e232239e0c3d91806f3c97d5/src/matlab/rgb2gray.ts#L56
|
||||
return 77 * r + 150 * g + 29 * b + 128 >> 8;
|
||||
}
|
||||
|
||||
// Perceived color difference defined by CIE94.
|
||||
// See https://en.wikipedia.org/wiki/Color_difference#CIE94
|
||||
//
|
||||
// The result of 1.0 is a "just-noticeable difference".
|
||||
//
|
||||
// Other results interpretation (taken from http://zschuessler.github.io/DeltaE/learn/):
|
||||
// < 1.0 Not perceptible by human eyes.
|
||||
// 1-2 Perceptible through close observation.
|
||||
// 2-10 Perceptible at a glance.
|
||||
// 11-49 Colors are more similar than opposite
|
||||
// 100 Colors are exact opposite
|
||||
function colorDeltaE94(rgb1, rgb2) {
|
||||
const [l1, a1, b1] = xyz2lab(srgb2xyz(rgb1));
|
||||
const [l2, a2, b2] = xyz2lab(srgb2xyz(rgb2));
|
||||
const deltaL = l1 - l2;
|
||||
const deltaA = a1 - a2;
|
||||
const deltaB = b1 - b2;
|
||||
const c1 = Math.sqrt(a1 ** 2 + b1 ** 2);
|
||||
const c2 = Math.sqrt(a2 ** 2 + b2 ** 2);
|
||||
const deltaC = c1 - c2;
|
||||
let deltaH = deltaA ** 2 + deltaB ** 2 - deltaC ** 2;
|
||||
deltaH = deltaH < 0 ? 0 : Math.sqrt(deltaH);
|
||||
// The k1, k2, kL, kC, kH values for "graphic arts" applications.
|
||||
// See https://en.wikipedia.org/wiki/Color_difference#CIE94
|
||||
const k1 = 0.045;
|
||||
const k2 = 0.015;
|
||||
const kL = 1;
|
||||
const kC = 1;
|
||||
const kH = 1;
|
||||
const sC = 1.0 + k1 * c1;
|
||||
const sH = 1.0 + k2 * c1;
|
||||
const sL = 1;
|
||||
return Math.sqrt((deltaL / sL / kL) ** 2 + (deltaC / sC / kC) ** 2 + (deltaH / sH / kH) ** 2);
|
||||
}
|
||||
|
||||
// sRGB -> 1-normalized XYZ (i.e. Y ∈ [0, 1]) with D65 illuminant
|
||||
// See https://en.wikipedia.org/wiki/SRGB#From_sRGB_to_CIE_XYZ
|
||||
function srgb2xyz(rgb) {
|
||||
let r = rgb[0] / 255;
|
||||
let g = rgb[1] / 255;
|
||||
let b = rgb[2] / 255;
|
||||
r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
|
||||
g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
|
||||
b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
|
||||
return [r * 0.4124 + g * 0.3576 + b * 0.1805, r * 0.2126 + g * 0.7152 + b * 0.0722, r * 0.0193 + g * 0.1192 + b * 0.9505];
|
||||
}
|
||||
const sigma_pow2 = 6 * 6 / 29 / 29;
|
||||
const sigma_pow3 = 6 * 6 * 6 / 29 / 29 / 29;
|
||||
|
||||
// 1-normalized CIE XYZ with D65 to L*a*b*
|
||||
// See https://en.wikipedia.org/wiki/CIELAB_color_space#From_CIEXYZ_to_CIELAB
|
||||
function xyz2lab(xyz) {
|
||||
const x = xyz[0] / 0.950489;
|
||||
const y = xyz[1];
|
||||
const z = xyz[2] / 1.088840;
|
||||
const fx = x > sigma_pow3 ? x ** (1 / 3) : x / 3 / sigma_pow2 + 4 / 29;
|
||||
const fy = y > sigma_pow3 ? y ** (1 / 3) : y / 3 / sigma_pow2 + 4 / 29;
|
||||
const fz = z > sigma_pow3 ? z ** (1 / 3) : z / 3 / sigma_pow2 + 4 / 29;
|
||||
const l = 116 * fy - 16;
|
||||
const a = 500 * (fx - fy);
|
||||
const b = 200 * (fy - fz);
|
||||
return [l, a, b];
|
||||
}
|
||||
108
tvapp2/node_modules/playwright-core/lib/image_tools/compare.js
generated
vendored
108
tvapp2/node_modules/playwright-core/lib/image_tools/compare.js
generated
vendored
@@ -1,108 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.compare = compare;
|
||||
var _colorUtils = require("./colorUtils");
|
||||
var _imageChannel = require("./imageChannel");
|
||||
var _stats = require("./stats");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const SSIM_WINDOW_RADIUS = 15;
|
||||
const VARIANCE_WINDOW_RADIUS = 1;
|
||||
function drawPixel(width, data, x, y, r, g, b) {
|
||||
const idx = (y * width + x) * 4;
|
||||
data[idx + 0] = r;
|
||||
data[idx + 1] = g;
|
||||
data[idx + 2] = b;
|
||||
data[idx + 3] = 255;
|
||||
}
|
||||
function compare(actual, expected, diff, width, height, options = {}) {
|
||||
const {
|
||||
maxColorDeltaE94 = 1.0
|
||||
} = options;
|
||||
const paddingSize = Math.max(VARIANCE_WINDOW_RADIUS, SSIM_WINDOW_RADIUS);
|
||||
const paddingColorEven = [255, 0, 255];
|
||||
const paddingColorOdd = [0, 255, 0];
|
||||
const [r1, g1, b1] = _imageChannel.ImageChannel.intoRGB(width, height, expected, {
|
||||
paddingSize,
|
||||
paddingColorEven,
|
||||
paddingColorOdd
|
||||
});
|
||||
const [r2, g2, b2] = _imageChannel.ImageChannel.intoRGB(width, height, actual, {
|
||||
paddingSize,
|
||||
paddingColorEven,
|
||||
paddingColorOdd
|
||||
});
|
||||
const noop = (x, y) => {};
|
||||
const drawRedPixel = diff ? (x, y) => drawPixel(width, diff, x - paddingSize, y - paddingSize, 255, 0, 0) : noop;
|
||||
const drawYellowPixel = diff ? (x, y) => drawPixel(width, diff, x - paddingSize, y - paddingSize, 255, 255, 0) : noop;
|
||||
const drawGrayPixel = diff ? (x, y) => {
|
||||
const gray = (0, _colorUtils.rgb2gray)(r1.get(x, y), g1.get(x, y), b1.get(x, y));
|
||||
const value = (0, _colorUtils.blendWithWhite)(gray, 0.1);
|
||||
drawPixel(width, diff, x - paddingSize, y - paddingSize, value, value, value);
|
||||
} : noop;
|
||||
let fastR, fastG, fastB;
|
||||
let diffCount = 0;
|
||||
for (let y = paddingSize; y < r1.height - paddingSize; ++y) {
|
||||
for (let x = paddingSize; x < r1.width - paddingSize; ++x) {
|
||||
// Fast-path: equal pixels.
|
||||
if (r1.get(x, y) === r2.get(x, y) && g1.get(x, y) === g2.get(x, y) && b1.get(x, y) === b2.get(x, y)) {
|
||||
drawGrayPixel(x, y);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Compare pixel colors using the dE94 color difference formulae.
|
||||
// The dE94 is normalized so that the value of 1.0 is the "just-noticeable-difference".
|
||||
// Color difference below 1.0 is not noticeable to a human eye, so we can disregard it.
|
||||
// See https://en.wikipedia.org/wiki/Color_difference
|
||||
const delta = (0, _colorUtils.colorDeltaE94)([r1.get(x, y), g1.get(x, y), b1.get(x, y)], [r2.get(x, y), g2.get(x, y), b2.get(x, y)]);
|
||||
if (delta <= maxColorDeltaE94) {
|
||||
drawGrayPixel(x, y);
|
||||
continue;
|
||||
}
|
||||
if (!fastR || !fastG || !fastB) {
|
||||
fastR = new _stats.FastStats(r1, r2);
|
||||
fastG = new _stats.FastStats(g1, g2);
|
||||
fastB = new _stats.FastStats(b1, b2);
|
||||
}
|
||||
const [varX1, varY1] = r1.boundXY(x - VARIANCE_WINDOW_RADIUS, y - VARIANCE_WINDOW_RADIUS);
|
||||
const [varX2, varY2] = r1.boundXY(x + VARIANCE_WINDOW_RADIUS, y + VARIANCE_WINDOW_RADIUS);
|
||||
const var1 = fastR.varianceC1(varX1, varY1, varX2, varY2) + fastG.varianceC1(varX1, varY1, varX2, varY2) + fastB.varianceC1(varX1, varY1, varX2, varY2);
|
||||
const var2 = fastR.varianceC2(varX1, varY1, varX2, varY2) + fastG.varianceC2(varX1, varY1, varX2, varY2) + fastB.varianceC2(varX1, varY1, varX2, varY2);
|
||||
// if this pixel is a part of a flood fill of a 3x3 square of either of the images, then it cannot be
|
||||
// anti-aliasing pixel so it must be a pixel difference.
|
||||
if (var1 === 0 || var2 === 0) {
|
||||
drawRedPixel(x, y);
|
||||
++diffCount;
|
||||
continue;
|
||||
}
|
||||
const [ssimX1, ssimY1] = r1.boundXY(x - SSIM_WINDOW_RADIUS, y - SSIM_WINDOW_RADIUS);
|
||||
const [ssimX2, ssimY2] = r1.boundXY(x + SSIM_WINDOW_RADIUS, y + SSIM_WINDOW_RADIUS);
|
||||
const ssimRGB = ((0, _stats.ssim)(fastR, ssimX1, ssimY1, ssimX2, ssimY2) + (0, _stats.ssim)(fastG, ssimX1, ssimY1, ssimX2, ssimY2) + (0, _stats.ssim)(fastB, ssimX1, ssimY1, ssimX2, ssimY2)) / 3.0;
|
||||
const isAntialiased = ssimRGB >= 0.99;
|
||||
if (isAntialiased) {
|
||||
drawYellowPixel(x, y);
|
||||
} else {
|
||||
drawRedPixel(x, y);
|
||||
++diffCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
return diffCount;
|
||||
}
|
||||
70
tvapp2/node_modules/playwright-core/lib/image_tools/imageChannel.js
generated
vendored
70
tvapp2/node_modules/playwright-core/lib/image_tools/imageChannel.js
generated
vendored
@@ -1,70 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ImageChannel = void 0;
|
||||
var _colorUtils = require("./colorUtils");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class ImageChannel {
|
||||
static intoRGB(width, height, data, options = {}) {
|
||||
const {
|
||||
paddingSize = 0,
|
||||
paddingColorOdd = [255, 0, 255],
|
||||
paddingColorEven = [0, 255, 0]
|
||||
} = options;
|
||||
const newWidth = width + 2 * paddingSize;
|
||||
const newHeight = height + 2 * paddingSize;
|
||||
const r = new Uint8Array(newWidth * newHeight);
|
||||
const g = new Uint8Array(newWidth * newHeight);
|
||||
const b = new Uint8Array(newWidth * newHeight);
|
||||
for (let y = 0; y < newHeight; ++y) {
|
||||
for (let x = 0; x < newWidth; ++x) {
|
||||
const index = y * newWidth + x;
|
||||
if (y >= paddingSize && y < newHeight - paddingSize && x >= paddingSize && x < newWidth - paddingSize) {
|
||||
const offset = ((y - paddingSize) * width + (x - paddingSize)) * 4;
|
||||
const alpha = data[offset + 3] === 255 ? 1 : data[offset + 3] / 255;
|
||||
r[index] = (0, _colorUtils.blendWithWhite)(data[offset], alpha);
|
||||
g[index] = (0, _colorUtils.blendWithWhite)(data[offset + 1], alpha);
|
||||
b[index] = (0, _colorUtils.blendWithWhite)(data[offset + 2], alpha);
|
||||
} else {
|
||||
const color = (y + x) % 2 === 0 ? paddingColorEven : paddingColorOdd;
|
||||
r[index] = color[0];
|
||||
g[index] = color[1];
|
||||
b[index] = color[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
return [new ImageChannel(newWidth, newHeight, r), new ImageChannel(newWidth, newHeight, g), new ImageChannel(newWidth, newHeight, b)];
|
||||
}
|
||||
constructor(width, height, data) {
|
||||
this.data = void 0;
|
||||
this.width = void 0;
|
||||
this.height = void 0;
|
||||
this.data = data;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
get(x, y) {
|
||||
return this.data[y * this.width + x];
|
||||
}
|
||||
boundXY(x, y) {
|
||||
return [Math.min(Math.max(x, 0), this.width - 1), Math.min(Math.max(y, 0), this.height - 1)];
|
||||
}
|
||||
}
|
||||
exports.ImageChannel = ImageChannel;
|
||||
102
tvapp2/node_modules/playwright-core/lib/image_tools/stats.js
generated
vendored
102
tvapp2/node_modules/playwright-core/lib/image_tools/stats.js
generated
vendored
@@ -1,102 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.FastStats = void 0;
|
||||
exports.ssim = ssim;
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Image channel has a 8-bit depth.
|
||||
const DYNAMIC_RANGE = 2 ** 8 - 1;
|
||||
function ssim(stats, x1, y1, x2, y2) {
|
||||
const mean1 = stats.meanC1(x1, y1, x2, y2);
|
||||
const mean2 = stats.meanC2(x1, y1, x2, y2);
|
||||
const var1 = stats.varianceC1(x1, y1, x2, y2);
|
||||
const var2 = stats.varianceC2(x1, y1, x2, y2);
|
||||
const cov = stats.covariance(x1, y1, x2, y2);
|
||||
const c1 = (0.01 * DYNAMIC_RANGE) ** 2;
|
||||
const c2 = (0.03 * DYNAMIC_RANGE) ** 2;
|
||||
return (2 * mean1 * mean2 + c1) * (2 * cov + c2) / (mean1 ** 2 + mean2 ** 2 + c1) / (var1 + var2 + c2);
|
||||
}
|
||||
class FastStats {
|
||||
constructor(c1, c2) {
|
||||
this.c1 = void 0;
|
||||
this.c2 = void 0;
|
||||
this._partialSumC1 = void 0;
|
||||
this._partialSumC2 = void 0;
|
||||
this._partialSumMult = void 0;
|
||||
this._partialSumSq1 = void 0;
|
||||
this._partialSumSq2 = void 0;
|
||||
this.c1 = c1;
|
||||
this.c2 = c2;
|
||||
const {
|
||||
width,
|
||||
height
|
||||
} = c1;
|
||||
this._partialSumC1 = new Array(width * height);
|
||||
this._partialSumC2 = new Array(width * height);
|
||||
this._partialSumSq1 = new Array(width * height);
|
||||
this._partialSumSq2 = new Array(width * height);
|
||||
this._partialSumMult = new Array(width * height);
|
||||
const recalc = (mx, idx, initial, x, y) => {
|
||||
mx[idx] = initial;
|
||||
if (y > 0) mx[idx] += mx[(y - 1) * width + x];
|
||||
if (x > 0) mx[idx] += mx[y * width + x - 1];
|
||||
if (x > 0 && y > 0) mx[idx] -= mx[(y - 1) * width + x - 1];
|
||||
};
|
||||
for (let y = 0; y < height; ++y) {
|
||||
for (let x = 0; x < width; ++x) {
|
||||
const idx = y * width + x;
|
||||
recalc(this._partialSumC1, idx, this.c1.data[idx], x, y);
|
||||
recalc(this._partialSumC2, idx, this.c2.data[idx], x, y);
|
||||
recalc(this._partialSumSq1, idx, this.c1.data[idx] * this.c1.data[idx], x, y);
|
||||
recalc(this._partialSumSq2, idx, this.c2.data[idx] * this.c2.data[idx], x, y);
|
||||
recalc(this._partialSumMult, idx, this.c1.data[idx] * this.c2.data[idx], x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
_sum(partialSum, x1, y1, x2, y2) {
|
||||
const width = this.c1.width;
|
||||
let result = partialSum[y2 * width + x2];
|
||||
if (y1 > 0) result -= partialSum[(y1 - 1) * width + x2];
|
||||
if (x1 > 0) result -= partialSum[y2 * width + x1 - 1];
|
||||
if (x1 > 0 && y1 > 0) result += partialSum[(y1 - 1) * width + x1 - 1];
|
||||
return result;
|
||||
}
|
||||
meanC1(x1, y1, x2, y2) {
|
||||
const N = (y2 - y1 + 1) * (x2 - x1 + 1);
|
||||
return this._sum(this._partialSumC1, x1, y1, x2, y2) / N;
|
||||
}
|
||||
meanC2(x1, y1, x2, y2) {
|
||||
const N = (y2 - y1 + 1) * (x2 - x1 + 1);
|
||||
return this._sum(this._partialSumC2, x1, y1, x2, y2) / N;
|
||||
}
|
||||
varianceC1(x1, y1, x2, y2) {
|
||||
const N = (y2 - y1 + 1) * (x2 - x1 + 1);
|
||||
return (this._sum(this._partialSumSq1, x1, y1, x2, y2) - this._sum(this._partialSumC1, x1, y1, x2, y2) ** 2 / N) / N;
|
||||
}
|
||||
varianceC2(x1, y1, x2, y2) {
|
||||
const N = (y2 - y1 + 1) * (x2 - x1 + 1);
|
||||
return (this._sum(this._partialSumSq2, x1, y1, x2, y2) - this._sum(this._partialSumC2, x1, y1, x2, y2) ** 2 / N) / N;
|
||||
}
|
||||
covariance(x1, y1, x2, y2) {
|
||||
const N = (y2 - y1 + 1) * (x2 - x1 + 1);
|
||||
return (this._sum(this._partialSumMult, x1, y1, x2, y2) - this._sum(this._partialSumC1, x1, y1, x2, y2) * this._sum(this._partialSumC2, x1, y1, x2, y2) / N) / N;
|
||||
}
|
||||
}
|
||||
exports.FastStats = FastStats;
|
||||
11
tvapp2/node_modules/playwright-core/lib/inProcessFactory.js
generated
vendored
11
tvapp2/node_modules/playwright-core/lib/inProcessFactory.js
generated
vendored
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createInProcessPlaywright = createInProcessPlaywright;
|
||||
var _server = require("./server");
|
||||
var _connection = require("./client/connection");
|
||||
var _browserServerImpl = require("./browserServerImpl");
|
||||
var _androidServerImpl = require("./androidServerImpl");
|
||||
var _browserServerImpl = require("./browserServerImpl");
|
||||
var _server = require("./server");
|
||||
var _nodePlatform = require("./server/utils/nodePlatform");
|
||||
var _connection = require("./client/connection");
|
||||
var _selectors = require("./client/selectors");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -28,7 +30,8 @@ function createInProcessPlaywright() {
|
||||
const playwright = (0, _server.createPlaywright)({
|
||||
sdkLanguage: process.env.PW_LANG_NAME || 'javascript'
|
||||
});
|
||||
const clientConnection = new _connection.Connection(undefined, undefined);
|
||||
(0, _selectors.setPlatformForSelectors)(_nodePlatform.nodePlatform);
|
||||
const clientConnection = new _connection.Connection(_nodePlatform.nodePlatform);
|
||||
clientConnection.useRawBuffers();
|
||||
const dispatcherConnection = new _server.DispatcherConnection(true /* local */);
|
||||
|
||||
|
||||
20
tvapp2/node_modules/playwright-core/lib/outofprocess.js
generated
vendored
20
tvapp2/node_modules/playwright-core/lib/outofprocess.js
generated
vendored
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.start = start;
|
||||
var _connection = require("./client/connection");
|
||||
var _transport = require("./protocol/transport");
|
||||
var childProcess = _interopRequireWildcard(require("child_process"));
|
||||
var path = _interopRequireWildcard(require("path"));
|
||||
var _manualPromise = require("./utils/manualPromise");
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _connection = require("./client/connection");
|
||||
var _pipeTransport = require("./server/utils/pipeTransport");
|
||||
var _manualPromise = require("./utils/isomorphic/manualPromise");
|
||||
var _nodePlatform = require("./server/utils/nodePlatform");
|
||||
var _selectors = require("./client/selectors");
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -28,6 +31,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
||||
*/
|
||||
|
||||
async function start(env = {}) {
|
||||
(0, _selectors.setPlatformForSelectors)(_nodePlatform.nodePlatform);
|
||||
const client = new PlaywrightClient(env);
|
||||
const playwright = await client._playwright;
|
||||
playwright.driverProcess = client._driverProcess;
|
||||
@@ -41,7 +45,7 @@ class PlaywrightClient {
|
||||
this._playwright = void 0;
|
||||
this._driverProcess = void 0;
|
||||
this._closePromise = new _manualPromise.ManualPromise();
|
||||
this._driverProcess = childProcess.fork(path.join(__dirname, '..', 'cli.js'), ['run-driver'], {
|
||||
this._driverProcess = childProcess.fork(_path.default.join(__dirname, '..', 'cli.js'), ['run-driver'], {
|
||||
stdio: 'pipe',
|
||||
detached: true,
|
||||
env: {
|
||||
@@ -51,8 +55,8 @@ class PlaywrightClient {
|
||||
});
|
||||
this._driverProcess.unref();
|
||||
this._driverProcess.stderr.on('data', data => process.stderr.write(data));
|
||||
const connection = new _connection.Connection(undefined, undefined);
|
||||
const transport = new _transport.PipeTransport(this._driverProcess.stdin, this._driverProcess.stdout);
|
||||
const connection = new _connection.Connection(_nodePlatform.nodePlatform);
|
||||
const transport = new _pipeTransport.PipeTransport(this._driverProcess.stdin, this._driverProcess.stdout);
|
||||
connection.onmessage = message => transport.send(JSON.stringify(message));
|
||||
transport.onmessage = message => connection.dispatch(JSON.parse(message));
|
||||
transport.onclose = () => this._closePromise.resolve();
|
||||
|
||||
82
tvapp2/node_modules/playwright-core/lib/protocol/transport.js
generated
vendored
82
tvapp2/node_modules/playwright-core/lib/protocol/transport.js
generated
vendored
@@ -1,82 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PipeTransport = void 0;
|
||||
var _utils = require("../utils");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class PipeTransport {
|
||||
constructor(pipeWrite, pipeRead, closeable, endian = 'le') {
|
||||
this._pipeWrite = void 0;
|
||||
this._data = Buffer.from([]);
|
||||
this._waitForNextTask = (0, _utils.makeWaitForNextTask)();
|
||||
this._closed = false;
|
||||
this._bytesLeft = 0;
|
||||
this.onmessage = void 0;
|
||||
this.onclose = void 0;
|
||||
this._endian = void 0;
|
||||
this._closeableStream = void 0;
|
||||
this._pipeWrite = pipeWrite;
|
||||
this._endian = endian;
|
||||
this._closeableStream = closeable;
|
||||
pipeRead.on('data', buffer => this._dispatch(buffer));
|
||||
pipeRead.on('close', () => {
|
||||
this._closed = true;
|
||||
if (this.onclose) this.onclose();
|
||||
});
|
||||
this.onmessage = undefined;
|
||||
this.onclose = undefined;
|
||||
}
|
||||
send(message) {
|
||||
if (this._closed) throw new Error('Pipe has been closed');
|
||||
const data = Buffer.from(message, 'utf-8');
|
||||
const dataLength = Buffer.alloc(4);
|
||||
if (this._endian === 'be') dataLength.writeUInt32BE(data.length, 0);else dataLength.writeUInt32LE(data.length, 0);
|
||||
this._pipeWrite.write(dataLength);
|
||||
this._pipeWrite.write(data);
|
||||
}
|
||||
close() {
|
||||
// Let it throw.
|
||||
this._closeableStream.close();
|
||||
}
|
||||
_dispatch(buffer) {
|
||||
this._data = Buffer.concat([this._data, buffer]);
|
||||
while (true) {
|
||||
if (!this._bytesLeft && this._data.length < 4) {
|
||||
// Need more data.
|
||||
break;
|
||||
}
|
||||
if (!this._bytesLeft) {
|
||||
this._bytesLeft = this._endian === 'be' ? this._data.readUInt32BE(0) : this._data.readUInt32LE(0);
|
||||
this._data = this._data.slice(4);
|
||||
}
|
||||
if (!this._bytesLeft || this._data.length < this._bytesLeft) {
|
||||
// Need more data.
|
||||
break;
|
||||
}
|
||||
const message = this._data.slice(0, this._bytesLeft);
|
||||
this._data = this._data.slice(this._bytesLeft);
|
||||
this._bytesLeft = 0;
|
||||
this._waitForNextTask(() => {
|
||||
if (this.onmessage) this.onmessage(message.toString('utf-8'));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.PipeTransport = PipeTransport;
|
||||
59
tvapp2/node_modules/playwright-core/lib/protocol/validator.js
generated
vendored
59
tvapp2/node_modules/playwright-core/lib/protocol/validator.js
generated
vendored
@@ -168,9 +168,38 @@ _validatorPrimitives.scheme.NameValue = (0, _validatorPrimitives.tObject)({
|
||||
name: _validatorPrimitives.tString,
|
||||
value: _validatorPrimitives.tString
|
||||
});
|
||||
_validatorPrimitives.scheme.IndexedDBDatabase = (0, _validatorPrimitives.tObject)({
|
||||
name: _validatorPrimitives.tString,
|
||||
version: _validatorPrimitives.tNumber,
|
||||
stores: (0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tObject)({
|
||||
name: _validatorPrimitives.tString,
|
||||
autoIncrement: _validatorPrimitives.tBoolean,
|
||||
keyPath: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tString),
|
||||
keyPathArray: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)(_validatorPrimitives.tString)),
|
||||
records: (0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tObject)({
|
||||
key: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tAny),
|
||||
keyEncoded: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tAny),
|
||||
value: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tAny),
|
||||
valueEncoded: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tAny)
|
||||
})),
|
||||
indexes: (0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tObject)({
|
||||
name: _validatorPrimitives.tString,
|
||||
keyPath: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tString),
|
||||
keyPathArray: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)(_validatorPrimitives.tString)),
|
||||
multiEntry: _validatorPrimitives.tBoolean,
|
||||
unique: _validatorPrimitives.tBoolean
|
||||
}))
|
||||
}))
|
||||
});
|
||||
_validatorPrimitives.scheme.SetOriginStorage = (0, _validatorPrimitives.tObject)({
|
||||
origin: _validatorPrimitives.tString,
|
||||
localStorage: (0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('NameValue')),
|
||||
indexedDB: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('IndexedDBDatabase')))
|
||||
});
|
||||
_validatorPrimitives.scheme.OriginStorage = (0, _validatorPrimitives.tObject)({
|
||||
origin: _validatorPrimitives.tString,
|
||||
localStorage: (0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('NameValue'))
|
||||
localStorage: (0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('NameValue')),
|
||||
indexedDB: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('IndexedDBDatabase')))
|
||||
});
|
||||
_validatorPrimitives.scheme.SerializedError = (0, _validatorPrimitives.tObject)({
|
||||
error: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({
|
||||
@@ -231,7 +260,9 @@ _validatorPrimitives.scheme.APIRequestContextFetchLogParams = (0, _validatorPrim
|
||||
_validatorPrimitives.scheme.APIRequestContextFetchLogResult = (0, _validatorPrimitives.tObject)({
|
||||
log: (0, _validatorPrimitives.tArray)(_validatorPrimitives.tString)
|
||||
});
|
||||
_validatorPrimitives.scheme.APIRequestContextStorageStateParams = (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({}));
|
||||
_validatorPrimitives.scheme.APIRequestContextStorageStateParams = (0, _validatorPrimitives.tObject)({
|
||||
indexedDB: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tBoolean)
|
||||
});
|
||||
_validatorPrimitives.scheme.APIRequestContextStorageStateResult = (0, _validatorPrimitives.tObject)({
|
||||
cookies: (0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('NetworkCookie')),
|
||||
origins: (0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('OriginStorage'))
|
||||
@@ -365,6 +396,7 @@ _validatorPrimitives.scheme.PlaywrightNewRequestParams = (0, _validatorPrimitive
|
||||
userAgent: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tString),
|
||||
ignoreHTTPSErrors: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tBoolean),
|
||||
extraHTTPHeaders: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('NameValue'))),
|
||||
failOnStatusCode: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tBoolean),
|
||||
clientCertificates: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tObject)({
|
||||
origin: _validatorPrimitives.tString,
|
||||
cert: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tBinary),
|
||||
@@ -387,7 +419,7 @@ _validatorPrimitives.scheme.PlaywrightNewRequestParams = (0, _validatorPrimitive
|
||||
timeout: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tNumber),
|
||||
storageState: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({
|
||||
cookies: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('NetworkCookie'))),
|
||||
origins: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('OriginStorage')))
|
||||
origins: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('SetOriginStorage')))
|
||||
})),
|
||||
tracesDir: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tString)
|
||||
});
|
||||
@@ -608,6 +640,7 @@ _validatorPrimitives.scheme.BrowserTypeLaunchPersistentContextParams = (0, _vali
|
||||
reducedMotion: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['reduce', 'no-preference', 'no-override'])),
|
||||
forcedColors: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['active', 'none', 'no-override'])),
|
||||
acceptDownloads: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['accept', 'deny', 'internal-browser-default'])),
|
||||
contrast: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['no-preference', 'more', 'no-override'])),
|
||||
baseURL: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tString),
|
||||
recordVideo: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({
|
||||
dir: _validatorPrimitives.tString,
|
||||
@@ -694,6 +727,7 @@ _validatorPrimitives.scheme.BrowserNewContextParams = (0, _validatorPrimitives.t
|
||||
reducedMotion: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['reduce', 'no-preference', 'no-override'])),
|
||||
forcedColors: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['active', 'none', 'no-override'])),
|
||||
acceptDownloads: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['accept', 'deny', 'internal-browser-default'])),
|
||||
contrast: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['no-preference', 'more', 'no-override'])),
|
||||
baseURL: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tString),
|
||||
recordVideo: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({
|
||||
dir: _validatorPrimitives.tString,
|
||||
@@ -713,7 +747,7 @@ _validatorPrimitives.scheme.BrowserNewContextParams = (0, _validatorPrimitives.t
|
||||
})),
|
||||
storageState: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({
|
||||
cookies: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('SetNetworkCookie'))),
|
||||
origins: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('OriginStorage')))
|
||||
origins: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('SetOriginStorage')))
|
||||
}))
|
||||
});
|
||||
_validatorPrimitives.scheme.BrowserNewContextResult = (0, _validatorPrimitives.tObject)({
|
||||
@@ -763,6 +797,7 @@ _validatorPrimitives.scheme.BrowserNewContextForReuseParams = (0, _validatorPrim
|
||||
reducedMotion: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['reduce', 'no-preference', 'no-override'])),
|
||||
forcedColors: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['active', 'none', 'no-override'])),
|
||||
acceptDownloads: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['accept', 'deny', 'internal-browser-default'])),
|
||||
contrast: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['no-preference', 'more', 'no-override'])),
|
||||
baseURL: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tString),
|
||||
recordVideo: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({
|
||||
dir: _validatorPrimitives.tString,
|
||||
@@ -782,7 +817,7 @@ _validatorPrimitives.scheme.BrowserNewContextForReuseParams = (0, _validatorPrim
|
||||
})),
|
||||
storageState: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({
|
||||
cookies: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('SetNetworkCookie'))),
|
||||
origins: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('OriginStorage')))
|
||||
origins: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('SetOriginStorage')))
|
||||
}))
|
||||
});
|
||||
_validatorPrimitives.scheme.BrowserNewContextForReuseResult = (0, _validatorPrimitives.tObject)({
|
||||
@@ -986,7 +1021,9 @@ _validatorPrimitives.scheme.BrowserContextSetOfflineParams = (0, _validatorPrimi
|
||||
offline: _validatorPrimitives.tBoolean
|
||||
});
|
||||
_validatorPrimitives.scheme.BrowserContextSetOfflineResult = (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({}));
|
||||
_validatorPrimitives.scheme.BrowserContextStorageStateParams = (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({}));
|
||||
_validatorPrimitives.scheme.BrowserContextStorageStateParams = (0, _validatorPrimitives.tObject)({
|
||||
indexedDB: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tBoolean)
|
||||
});
|
||||
_validatorPrimitives.scheme.BrowserContextStorageStateResult = (0, _validatorPrimitives.tObject)({
|
||||
cookies: (0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('NetworkCookie')),
|
||||
origins: (0, _validatorPrimitives.tArray)((0, _validatorPrimitives.tType)('OriginStorage'))
|
||||
@@ -1143,7 +1180,8 @@ _validatorPrimitives.scheme.PageEmulateMediaParams = (0, _validatorPrimitives.tO
|
||||
media: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['screen', 'print', 'no-override'])),
|
||||
colorScheme: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['dark', 'light', 'no-preference', 'no-override'])),
|
||||
reducedMotion: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['reduce', 'no-preference', 'no-override'])),
|
||||
forcedColors: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['active', 'none', 'no-override']))
|
||||
forcedColors: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['active', 'none', 'no-override'])),
|
||||
contrast: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['no-preference', 'more', 'no-override']))
|
||||
});
|
||||
_validatorPrimitives.scheme.PageEmulateMediaResult = (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({}));
|
||||
_validatorPrimitives.scheme.PageExposeBindingParams = (0, _validatorPrimitives.tObject)({
|
||||
@@ -1455,6 +1493,8 @@ _validatorPrimitives.scheme.FrameAddStyleTagResult = (0, _validatorPrimitives.tO
|
||||
});
|
||||
_validatorPrimitives.scheme.FrameAriaSnapshotParams = (0, _validatorPrimitives.tObject)({
|
||||
selector: _validatorPrimitives.tString,
|
||||
id: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tBoolean),
|
||||
mode: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['raw', 'regex'])),
|
||||
timeout: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tNumber)
|
||||
});
|
||||
_validatorPrimitives.scheme.FrameAriaSnapshotResult = (0, _validatorPrimitives.tObject)({
|
||||
@@ -1951,6 +1991,10 @@ _validatorPrimitives.scheme.ElementHandleFillParams = (0, _validatorPrimitives.t
|
||||
_validatorPrimitives.scheme.ElementHandleFillResult = (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({}));
|
||||
_validatorPrimitives.scheme.ElementHandleFocusParams = (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({}));
|
||||
_validatorPrimitives.scheme.ElementHandleFocusResult = (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({}));
|
||||
_validatorPrimitives.scheme.ElementHandleGenerateLocatorStringParams = (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({}));
|
||||
_validatorPrimitives.scheme.ElementHandleGenerateLocatorStringResult = (0, _validatorPrimitives.tObject)({
|
||||
value: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tString)
|
||||
});
|
||||
_validatorPrimitives.scheme.ElementHandleGetAttributeParams = (0, _validatorPrimitives.tObject)({
|
||||
name: _validatorPrimitives.tString
|
||||
});
|
||||
@@ -2660,6 +2704,7 @@ _validatorPrimitives.scheme.AndroidDeviceLaunchBrowserParams = (0, _validatorPri
|
||||
reducedMotion: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['reduce', 'no-preference', 'no-override'])),
|
||||
forcedColors: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['active', 'none', 'no-override'])),
|
||||
acceptDownloads: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['accept', 'deny', 'internal-browser-default'])),
|
||||
contrast: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tEnum)(['no-preference', 'more', 'no-override'])),
|
||||
baseURL: (0, _validatorPrimitives.tOptional)(_validatorPrimitives.tString),
|
||||
recordVideo: (0, _validatorPrimitives.tOptional)((0, _validatorPrimitives.tObject)({
|
||||
dir: _validatorPrimitives.tString,
|
||||
|
||||
3
tvapp2/node_modules/playwright-core/lib/protocol/validatorPrimitives.js
generated
vendored
3
tvapp2/node_modules/playwright-core/lib/protocol/validatorPrimitives.js
generated
vendored
@@ -8,7 +8,6 @@ exports.createMetadataValidator = createMetadataValidator;
|
||||
exports.findValidator = findValidator;
|
||||
exports.maybeFindValidator = maybeFindValidator;
|
||||
exports.tUndefined = exports.tType = exports.tString = exports.tOptional = exports.tObject = exports.tNumber = exports.tEnum = exports.tChannel = exports.tBoolean = exports.tBinary = exports.tArray = exports.tAny = exports.scheme = void 0;
|
||||
var _utils = require("../utils");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -107,7 +106,7 @@ const tObject = s => {
|
||||
const value = v(arg[key], path ? path + '.' + key : key, context);
|
||||
if (!Object.is(value, undefined)) result[key] = value;
|
||||
}
|
||||
if ((0, _utils.isUnderTest)()) {
|
||||
if (context.isUnderTest()) {
|
||||
for (const [key, value] of Object.entries(arg)) {
|
||||
if (key.startsWith('__testHook')) result[key] = value;
|
||||
}
|
||||
|
||||
30
tvapp2/node_modules/playwright-core/lib/remote/playwrightConnection.js
generated
vendored
30
tvapp2/node_modules/playwright-core/lib/remote/playwrightConnection.js
generated
vendored
@@ -4,14 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PlaywrightConnection = void 0;
|
||||
var _socksProxy = require("../server/utils/socksProxy");
|
||||
var _server = require("../server");
|
||||
var _browser = require("../server/browser");
|
||||
var _instrumentation = require("../server/instrumentation");
|
||||
var _socksProxy = require("../common/socksProxy");
|
||||
var _utils = require("../utils");
|
||||
var _android = require("../server/android/android");
|
||||
var _browser = require("../server/browser");
|
||||
var _debugControllerDispatcher = require("../server/dispatchers/debugControllerDispatcher");
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
var _instrumentation = require("../server/instrumentation");
|
||||
var _assert = require("../utils/isomorphic/assert");
|
||||
var _debug = require("../server/utils/debug");
|
||||
var _profiler = require("../server/utils/profiler");
|
||||
var _utils = require("../utils");
|
||||
var _debugLogger = require("../server/utils/debugLogger");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -44,8 +47,8 @@ class PlaywrightConnection {
|
||||
this._preLaunched = preLaunched;
|
||||
this._options = options;
|
||||
options.launchOptions = filterLaunchOptions(options.launchOptions, options.allowFSPaths);
|
||||
if (clientType === 'reuse-browser' || clientType === 'pre-launched-browser-or-android') (0, _utils.assert)(preLaunched.playwright);
|
||||
if (clientType === 'pre-launched-browser-or-android') (0, _utils.assert)(preLaunched.browser || preLaunched.androidDevice);
|
||||
if (clientType === 'reuse-browser' || clientType === 'pre-launched-browser-or-android') (0, _assert.assert)(preLaunched.playwright);
|
||||
if (clientType === 'pre-launched-browser-or-android') (0, _assert.assert)(preLaunched.browser || preLaunched.androidDevice);
|
||||
this._onClose = onClose;
|
||||
this._id = id;
|
||||
this._profileName = `${new Date().toISOString()}-${clientType}`;
|
||||
@@ -74,7 +77,7 @@ class PlaywrightConnection {
|
||||
return;
|
||||
}
|
||||
this._root = new _server.RootDispatcher(this._dispatcherConnection, async (scope, options) => {
|
||||
await (0, _utils.startProfiling)();
|
||||
await (0, _profiler.startProfiling)();
|
||||
if (clientType === 'reuse-browser') return await this._initReuseBrowsersMode(scope);
|
||||
if (clientType === 'pre-launched-browser-or-android') return this._preLaunched.browser ? await this._initPreLaunchedBrowserMode(scope) : await this._initPreLaunchedAndroidMode(scope);
|
||||
if (clientType === 'launch-browser') return await this._initLaunchBrowserMode(scope, options);
|
||||
@@ -88,7 +91,12 @@ class PlaywrightConnection {
|
||||
isServer: true
|
||||
});
|
||||
const ownedSocksProxy = await this._createOwnedSocksProxy(playwright);
|
||||
const browser = await playwright[this._options.browserName].launch((0, _instrumentation.serverSideCallMetadata)(), this._options.launchOptions);
|
||||
let browserName = this._options.browserName;
|
||||
if ('bidi' === browserName) {
|
||||
var _this$_options$launch;
|
||||
if ((_this$_options$launch = this._options.launchOptions) !== null && _this$_options$launch !== void 0 && (_this$_options$launch = _this$_options$launch.channel) !== null && _this$_options$launch !== void 0 && _this$_options$launch.toLocaleLowerCase().includes('firefox')) browserName = 'bidiFirefox';else browserName = 'bidiChromium';
|
||||
}
|
||||
const browser = await playwright[browserName].launch((0, _instrumentation.serverSideCallMetadata)(), this._options.launchOptions);
|
||||
this._cleanups.push(async () => {
|
||||
for (const browser of playwright.allBrowsers()) await browser.close({
|
||||
reason: 'Connection terminated'
|
||||
@@ -214,7 +222,7 @@ class PlaywrightConnection {
|
||||
this._root._dispose();
|
||||
_debugLogger.debugLogger.log('server', `[${this._id}] starting cleanup`);
|
||||
for (const cleanup of this._cleanups) await cleanup().catch(() => {});
|
||||
await (0, _utils.stopProfiling)(this._profileName);
|
||||
await (0, _profiler.stopProfiling)(this._profileName);
|
||||
this._onClose();
|
||||
_debugLogger.debugLogger.log('server', `[${this._id}] finished cleanup`);
|
||||
}
|
||||
@@ -260,7 +268,7 @@ function filterLaunchOptions(options, allowFSPaths) {
|
||||
chromiumSandbox: options.chromiumSandbox,
|
||||
firefoxUserPrefs: options.firefoxUserPrefs,
|
||||
slowMo: options.slowMo,
|
||||
executablePath: (0, _utils.isUnderTest)() || allowFSPaths ? options.executablePath : undefined,
|
||||
executablePath: (0, _debug.isUnderTest)() || allowFSPaths ? options.executablePath : undefined,
|
||||
downloadsPath: allowFSPaths ? options.downloadsPath : undefined
|
||||
};
|
||||
}
|
||||
|
||||
27
tvapp2/node_modules/playwright-core/lib/remote/playwrightServer.js
generated
vendored
27
tvapp2/node_modules/playwright-core/lib/remote/playwrightServer.js
generated
vendored
@@ -4,12 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PlaywrightServer = void 0;
|
||||
var _playwright = require("../server/playwright");
|
||||
var _playwrightConnection = require("./playwrightConnection");
|
||||
var _semaphore = require("../utils/semaphore");
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
var _utils = require("../utils");
|
||||
var _wsServer = require("../utils/wsServer");
|
||||
var _playwright = require("../server/playwright");
|
||||
var _debugLogger = require("../server/utils/debugLogger");
|
||||
var _semaphore = require("../utils/isomorphic/semaphore");
|
||||
var _wsServer = require("../server/utils/wsServer");
|
||||
var _ascii = require("../server/utils/ascii");
|
||||
var _userAgent = require("../server/utils/userAgent");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -39,7 +40,7 @@ class PlaywrightServer {
|
||||
const reuseBrowserSemaphore = new _semaphore.Semaphore(1);
|
||||
this._wsServer = new _wsServer.WSServer({
|
||||
onUpgrade: (request, socket) => {
|
||||
const uaError = (0, _utils.userAgentVersionMatchesErrorMessage)(request.headers['user-agent'] || '');
|
||||
const uaError = userAgentVersionMatchesErrorMessage(request.headers['user-agent'] || '');
|
||||
if (uaError) return {
|
||||
error: `HTTP/${request.httpVersion} 428 Precondition Required\r\n\r\n${uaError}`
|
||||
};
|
||||
@@ -108,4 +109,16 @@ class PlaywrightServer {
|
||||
await this._wsServer.close();
|
||||
}
|
||||
}
|
||||
exports.PlaywrightServer = PlaywrightServer;
|
||||
exports.PlaywrightServer = PlaywrightServer;
|
||||
function userAgentVersionMatchesErrorMessage(userAgent) {
|
||||
const match = userAgent.match(/^Playwright\/(\d+\.\d+\.\d+)/);
|
||||
if (!match) {
|
||||
// Cannot parse user agent - be lax.
|
||||
return;
|
||||
}
|
||||
const received = match[1].split('.').slice(0, 2).join('.');
|
||||
const expected = (0, _userAgent.getPlaywrightVersion)(true);
|
||||
if (received !== expected) {
|
||||
return (0, _ascii.wrapInASCIIBox)([`Playwright version mismatch:`, ` - server version: v${expected}`, ` - client version: v${received}`, ``, `If you are using VSCode extension, restart VSCode.`, ``, `If you are connecting to a remote service,`, `keep your local Playwright version in sync`, `with the remote service version.`, ``, `<3 Playwright Team`].join('\n'), 1);
|
||||
}
|
||||
}
|
||||
35
tvapp2/node_modules/playwright-core/lib/server/android/android.js
generated
vendored
35
tvapp2/node_modules/playwright-core/lib/server/android/android.js
generated
vendored
@@ -4,25 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AndroidDevice = exports.Android = void 0;
|
||||
var _utilsBundle = require("../../utilsBundle");
|
||||
var _events = require("events");
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _os = _interopRequireDefault(require("os"));
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _utils = require("../../utils");
|
||||
var _fileUtils = require("../../utils/fileUtils");
|
||||
var _timeoutSettings = require("../timeoutSettings");
|
||||
var _pipeTransport = require("../utils/pipeTransport");
|
||||
var _crypto = require("../utils/crypto");
|
||||
var _debug = require("../utils/debug");
|
||||
var _env = require("../utils/env");
|
||||
var _task = require("../utils/task");
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
var _utilsBundle = require("../../utilsBundle");
|
||||
var _browserContext = require("../browserContext");
|
||||
var _progress = require("../progress");
|
||||
var _crBrowser = require("../chromium/crBrowser");
|
||||
var _helper = require("../helper");
|
||||
var _transport = require("../../protocol/transport");
|
||||
var _debugLogger = require("../../utils/debugLogger");
|
||||
var _processLauncher = require("../../utils/processLauncher");
|
||||
var _timeoutSettings = require("../../common/timeoutSettings");
|
||||
var _instrumentation = require("../instrumentation");
|
||||
var _chromiumSwitches = require("../chromium/chromiumSwitches");
|
||||
var _crBrowser = require("../chromium/crBrowser");
|
||||
var _fileUtils = require("../utils/fileUtils");
|
||||
var _helper = require("../helper");
|
||||
var _instrumentation = require("../instrumentation");
|
||||
var _processLauncher = require("../utils/processLauncher");
|
||||
var _progress = require("../progress");
|
||||
var _registry = require("../registry");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright Microsoft Corporation. All rights reserved.
|
||||
*
|
||||
@@ -140,7 +143,7 @@ class AndroidDevice extends _instrumentation.SdkObject {
|
||||
await this.shell(`cmd package uninstall com.microsoft.playwright.androiddriver.test`);
|
||||
(0, _utilsBundle.debug)('pw:android')('Installing the new driver');
|
||||
const executable = _registry.registry.findExecutable('android');
|
||||
const packageManagerCommand = (0, _utils.getPackageManagerExecCommand)();
|
||||
const packageManagerCommand = (0, _env.getPackageManagerExecCommand)();
|
||||
for (const file of ['android-driver.apk', 'android-driver-target.apk']) {
|
||||
const fullName = _path.default.join(executable.directory, file);
|
||||
if (!_fs.default.existsSync(fullName)) throw new Error(`Please install Android driver apk using '${packageManagerCommand} playwright install android'`);
|
||||
@@ -152,7 +155,7 @@ class AndroidDevice extends _instrumentation.SdkObject {
|
||||
(0, _utilsBundle.debug)('pw:android')('Starting the new driver');
|
||||
this.shell('am instrument -w com.microsoft.playwright.androiddriver.test/androidx.test.runner.AndroidJUnitRunner').catch(e => (0, _utilsBundle.debug)('pw:android')(e));
|
||||
const socket = await this._waitForLocalAbstract('playwright_android_driver_socket');
|
||||
const transport = new _transport.PipeTransport(socket, socket, socket, 'be');
|
||||
const transport = new _pipeTransport.PipeTransport(socket, socket, socket, 'be');
|
||||
transport.onmessage = message => {
|
||||
const response = JSON.parse(message);
|
||||
const {
|
||||
@@ -213,7 +216,7 @@ class AndroidDevice extends _instrumentation.SdkObject {
|
||||
async launchBrowser(pkg = 'com.android.chrome', options) {
|
||||
(0, _utilsBundle.debug)('pw:android')('Force-stopping', pkg);
|
||||
await this._backend.runCommand(`shell:am force-stop ${pkg}`);
|
||||
const socketName = (0, _utils.isUnderTest)() ? 'webview_devtools_remote_playwright_test' : 'playwright_' + (0, _utils.createGuid)() + '_devtools_remote';
|
||||
const socketName = (0, _debug.isUnderTest)() ? 'webview_devtools_remote_playwright_test' : 'playwright_' + (0, _crypto.createGuid)() + '_devtools_remote';
|
||||
const commandLine = this._defaultArgs(options, socketName).join(' ');
|
||||
(0, _utilsBundle.debug)('pw:android')('Starting', pkg, commandLine);
|
||||
// encode commandLine to base64 to avoid issues (bash encoding) with special characters
|
||||
@@ -381,7 +384,7 @@ class AndroidBrowser extends _events.EventEmitter {
|
||||
this.device = void 0;
|
||||
this._socket = void 0;
|
||||
this._receiver = void 0;
|
||||
this._waitForNextTask = (0, _utils.makeWaitForNextTask)();
|
||||
this._waitForNextTask = (0, _task.makeWaitForNextTask)();
|
||||
this.onmessage = void 0;
|
||||
this.onclose = void 0;
|
||||
this.setMaxListeners(0);
|
||||
|
||||
28
tvapp2/node_modules/playwright-core/lib/server/android/backendAdb.js
generated
vendored
28
tvapp2/node_modules/playwright-core/lib/server/android/backendAdb.js
generated
vendored
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdbBackend = void 0;
|
||||
var _utilsBundle = require("../../utilsBundle");
|
||||
var net = _interopRequireWildcard(require("net"));
|
||||
var _events = require("events");
|
||||
var _utils = require("../../utils");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
var _net = _interopRequireDefault(require("net"));
|
||||
var _assert = require("../../utils/isomorphic/assert");
|
||||
var _crypto = require("../utils/crypto");
|
||||
var _utilsBundle = require("../../utilsBundle");
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright Microsoft Corporation. All rights reserved.
|
||||
*
|
||||
@@ -66,7 +66,7 @@ class AdbDevice {
|
||||
}
|
||||
async function runCommand(command, host = '127.0.0.1', port = 5037, serial) {
|
||||
(0, _utilsBundle.debug)('pw:adb:runCommand')(command, serial);
|
||||
const socket = new BufferedSocketWrapper(command, net.createConnection({
|
||||
const socket = new BufferedSocketWrapper(command, _net.default.createConnection({
|
||||
host,
|
||||
port
|
||||
}));
|
||||
@@ -74,11 +74,11 @@ async function runCommand(command, host = '127.0.0.1', port = 5037, serial) {
|
||||
if (serial) {
|
||||
await socket.write(encodeMessage(`host:transport:${serial}`));
|
||||
const status = await socket.read(4);
|
||||
(0, _utils.assert)(status.toString() === 'OKAY', status.toString());
|
||||
(0, _assert.assert)(status.toString() === 'OKAY', status.toString());
|
||||
}
|
||||
await socket.write(encodeMessage(command));
|
||||
const status = await socket.read(4);
|
||||
(0, _utils.assert)(status.toString() === 'OKAY', status.toString());
|
||||
(0, _assert.assert)(status.toString() === 'OKAY', status.toString());
|
||||
let commandOutput;
|
||||
if (!command.startsWith('shell:')) {
|
||||
const remainingLength = parseInt((await socket.read(4)).toString(), 16);
|
||||
@@ -92,18 +92,18 @@ async function runCommand(command, host = '127.0.0.1', port = 5037, serial) {
|
||||
}
|
||||
}
|
||||
async function open(command, host = '127.0.0.1', port = 5037, serial) {
|
||||
const socket = new BufferedSocketWrapper(command, net.createConnection({
|
||||
const socket = new BufferedSocketWrapper(command, _net.default.createConnection({
|
||||
host,
|
||||
port
|
||||
}));
|
||||
if (serial) {
|
||||
await socket.write(encodeMessage(`host:transport:${serial}`));
|
||||
const status = await socket.read(4);
|
||||
(0, _utils.assert)(status.toString() === 'OKAY', status.toString());
|
||||
(0, _assert.assert)(status.toString() === 'OKAY', status.toString());
|
||||
}
|
||||
await socket.write(encodeMessage(command));
|
||||
const status = await socket.read(4);
|
||||
(0, _utils.assert)(status.toString() === 'OKAY', status.toString());
|
||||
(0, _assert.assert)(status.toString() === 'OKAY', status.toString());
|
||||
return socket;
|
||||
}
|
||||
function encodeMessage(message) {
|
||||
@@ -114,7 +114,7 @@ function encodeMessage(message) {
|
||||
class BufferedSocketWrapper extends _events.EventEmitter {
|
||||
constructor(command, socket) {
|
||||
super();
|
||||
this.guid = (0, _utils.createGuid)();
|
||||
this.guid = (0, _crypto.createGuid)();
|
||||
this._socket = void 0;
|
||||
this._buffer = Buffer.from([]);
|
||||
this._isSocket = false;
|
||||
@@ -154,7 +154,7 @@ class BufferedSocketWrapper extends _events.EventEmitter {
|
||||
}
|
||||
async read(length) {
|
||||
await this._connectPromise;
|
||||
(0, _utils.assert)(!this._isSocket, 'Can not read by length in socket mode');
|
||||
(0, _assert.assert)(!this._isSocket, 'Can not read by length in socket mode');
|
||||
while (this._buffer.length < length) await new Promise(f => this._notifyReader = f);
|
||||
const result = this._buffer.slice(0, length);
|
||||
this._buffer = this._buffer.slice(length);
|
||||
@@ -166,7 +166,7 @@ class BufferedSocketWrapper extends _events.EventEmitter {
|
||||
return this._buffer;
|
||||
}
|
||||
becomeSocket() {
|
||||
(0, _utils.assert)(!this._buffer.length);
|
||||
(0, _assert.assert)(!this._buffer.length);
|
||||
this._isSocket = true;
|
||||
}
|
||||
}
|
||||
6
tvapp2/node_modules/playwright-core/lib/server/artifact.js
generated
vendored
6
tvapp2/node_modules/playwright-core/lib/server/artifact.js
generated
vendored
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.Artifact = void 0;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _utils = require("../utils");
|
||||
var _manualPromise = require("../utils/manualPromise");
|
||||
var _instrumentation = require("./instrumentation");
|
||||
var _errors = require("./errors");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _instrumentation = require("./instrumentation");
|
||||
var _manualPromise = require("../utils/isomorphic/manualPromise");
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
4
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiBrowser.js
generated
vendored
4
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiBrowser.js
generated
vendored
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Network = exports.BidiBrowserContext = exports.BidiBrowser = void 0;
|
||||
var _eventsHelper = require("../../utils/eventsHelper");
|
||||
var _eventsHelper = require("../utils/eventsHelper");
|
||||
var _browser = require("../browser");
|
||||
var _browserContext = require("../browserContext");
|
||||
var network = _interopRequireWildcard(require("../network"));
|
||||
@@ -13,7 +13,7 @@ var _bidiNetworkManager = require("./bidiNetworkManager");
|
||||
var _bidiPage = require("./bidiPage");
|
||||
var bidi = _interopRequireWildcard(require("./third_party/bidiProtocol"));
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
7
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiChromium.js
generated
vendored
7
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiChromium.js
generated
vendored
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.BidiChromium = void 0;
|
||||
var _os = _interopRequireDefault(require("os"));
|
||||
var _utils = require("../../utils");
|
||||
var _ascii = require("../utils/ascii");
|
||||
var _browserType = require("../browserType");
|
||||
var _chromiumSwitches = require("../chromium/chromiumSwitches");
|
||||
var _bidiBrowser = require("./bidiBrowser");
|
||||
var _bidiConnection = require("./bidiConnection");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _chromiumSwitches = require("../chromium/chromiumSwitches");
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -42,7 +43,7 @@ class BidiChromium extends _browserType.BrowserType {
|
||||
}
|
||||
doRewriteStartupLog(error) {
|
||||
if (!error.logs) return error;
|
||||
if (error.logs.includes('Missing X server')) error.logs = '\n' + (0, _utils.wrapInASCIIBox)(_browserType.kNoXServerRunningError, 1);
|
||||
if (error.logs.includes('Missing X server')) error.logs = '\n' + (0, _ascii.wrapInASCIIBox)(_browserType.kNoXServerRunningError, 1);
|
||||
// These error messages are taken from Chromium source code as of July, 2020:
|
||||
// https://github.com/chromium/chromium/blob/70565f67e79f79e17663ad1337dc6e63ee207ce9/content/browser/zygote_host/zygote_host_impl_linux.cc
|
||||
if (!error.logs.includes('crbug.com/357670') && !error.logs.includes('No usable sandbox!') && !error.logs.includes('crbug.com/638180')) return error;
|
||||
|
||||
2
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiConnection.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiConnection.js
generated
vendored
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.kBrowserCloseMessageId = exports.BidiSession = exports.BidiConnection = void 0;
|
||||
var _events = require("events");
|
||||
var _debugLogger = require("../../utils/debugLogger");
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
var _helper = require("../helper");
|
||||
var _protocolError = require("../protocolError");
|
||||
/**
|
||||
|
||||
110
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiExecutionContext.js
generated
vendored
110
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiExecutionContext.js
generated
vendored
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BidiExecutionContext = void 0;
|
||||
exports.createHandle = createHandle;
|
||||
var _utils = require("../../utils");
|
||||
var _utilityScriptSerializers = require("../isomorphic/utilityScriptSerializers");
|
||||
var js = _interopRequireWildcard(require("../javascript"));
|
||||
var dom = _interopRequireWildcard(require("../dom"));
|
||||
var _bidiDeserializer = require("./third_party/bidiDeserializer");
|
||||
var bidi = _interopRequireWildcard(require("./third_party/bidiProtocol"));
|
||||
var _bidiSerializer = require("./third_party/bidiSerializer");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -59,7 +62,7 @@ class BidiExecutionContext {
|
||||
if (response.type === 'exception') throw new js.JavaScriptErrorInEvaluate(response.exceptionDetails.text + '\nFull val: ' + JSON.stringify(response.exceptionDetails));
|
||||
throw new js.JavaScriptErrorInEvaluate('Unexpected response type: ' + JSON.stringify(response));
|
||||
}
|
||||
async rawEvaluateHandle(expression) {
|
||||
async rawEvaluateHandle(context, expression) {
|
||||
const response = await this._session.send('script.evaluate', {
|
||||
expression,
|
||||
target: this._target,
|
||||
@@ -73,20 +76,20 @@ class BidiExecutionContext {
|
||||
userActivation: true
|
||||
});
|
||||
if (response.type === 'success') {
|
||||
if ('handle' in response.result) return response.result.handle;
|
||||
if ('handle' in response.result) return createHandle(context, response.result);
|
||||
throw new js.JavaScriptErrorInEvaluate('Cannot get handle: ' + JSON.stringify(response.result));
|
||||
}
|
||||
if (response.type === 'exception') throw new js.JavaScriptErrorInEvaluate(response.exceptionDetails.text + '\nFull val: ' + JSON.stringify(response.exceptionDetails));
|
||||
throw new js.JavaScriptErrorInEvaluate('Unexpected response type: ' + JSON.stringify(response));
|
||||
}
|
||||
async evaluateWithArguments(functionDeclaration, returnByValue, utilityScript, values, objectIds) {
|
||||
async evaluateWithArguments(functionDeclaration, returnByValue, utilityScript, values, handles) {
|
||||
const response = await this._session.send('script.callFunction', {
|
||||
functionDeclaration,
|
||||
target: this._target,
|
||||
arguments: [{
|
||||
handle: utilityScript._objectId
|
||||
}, ...values.map(_bidiSerializer.BidiSerializer.serialize), ...objectIds.map(handle => ({
|
||||
handle
|
||||
}, ...values.map(_bidiSerializer.BidiSerializer.serialize), ...handles.map(handle => ({
|
||||
handle: handle._objectId
|
||||
}))],
|
||||
resultOwnership: returnByValue ? undefined : bidi.Script.ResultOwnership.Root,
|
||||
// Necessary for the handle to be returned.
|
||||
@@ -100,53 +103,72 @@ class BidiExecutionContext {
|
||||
if (response.type === 'exception') throw new js.JavaScriptErrorInEvaluate(response.exceptionDetails.text + '\nFull val: ' + JSON.stringify(response.exceptionDetails));
|
||||
if (response.type === 'success') {
|
||||
if (returnByValue) return (0, _utilityScriptSerializers.parseEvaluationResultValue)(_bidiDeserializer.BidiDeserializer.deserialize(response.result));
|
||||
const objectId = 'handle' in response.result ? response.result.handle : undefined;
|
||||
return utilityScript._context.createHandle({
|
||||
objectId,
|
||||
...response.result
|
||||
});
|
||||
return createHandle(utilityScript._context, response.result);
|
||||
}
|
||||
throw new js.JavaScriptErrorInEvaluate('Unexpected response type: ' + JSON.stringify(response));
|
||||
}
|
||||
async getProperties(context, objectId) {
|
||||
const handle = this.createHandle(context, {
|
||||
objectId
|
||||
async getProperties(handle) {
|
||||
const names = await handle.evaluate(object => {
|
||||
const names = [];
|
||||
const descriptors = Object.getOwnPropertyDescriptors(object);
|
||||
for (const name in descriptors) {
|
||||
var _descriptors$name;
|
||||
if ((_descriptors$name = descriptors[name]) !== null && _descriptors$name !== void 0 && _descriptors$name.enumerable) names.push(name);
|
||||
}
|
||||
return names;
|
||||
});
|
||||
try {
|
||||
const names = await handle.evaluate(object => {
|
||||
const names = [];
|
||||
const descriptors = Object.getOwnPropertyDescriptors(object);
|
||||
for (const name in descriptors) {
|
||||
var _descriptors$name;
|
||||
if ((_descriptors$name = descriptors[name]) !== null && _descriptors$name !== void 0 && _descriptors$name.enumerable) names.push(name);
|
||||
}
|
||||
return names;
|
||||
});
|
||||
const values = await Promise.all(names.map(name => handle.evaluateHandle((object, name) => object[name], name)));
|
||||
const map = new Map();
|
||||
for (let i = 0; i < names.length; i++) map.set(names[i], values[i]);
|
||||
return map;
|
||||
} finally {
|
||||
handle.dispose();
|
||||
}
|
||||
const values = await Promise.all(names.map(name => handle.evaluateHandle((object, name) => object[name], name)));
|
||||
const map = new Map();
|
||||
for (let i = 0; i < names.length; i++) map.set(names[i], values[i]);
|
||||
return map;
|
||||
}
|
||||
createHandle(context, jsRemoteObject) {
|
||||
const remoteObject = jsRemoteObject;
|
||||
return new js.JSHandle(context, remoteObject.type, renderPreview(remoteObject), jsRemoteObject.objectId, remoteObjectValue(remoteObject));
|
||||
}
|
||||
async releaseHandle(objectId) {
|
||||
async releaseHandle(handle) {
|
||||
if (!handle._objectId) return;
|
||||
await this._session.send('script.disown', {
|
||||
target: this._target,
|
||||
handles: [objectId]
|
||||
handles: [handle._objectId]
|
||||
});
|
||||
}
|
||||
async rawCallFunction(functionDeclaration, arg) {
|
||||
async nodeIdForElementHandle(handle) {
|
||||
const shared = await this._remoteValueForReference({
|
||||
handle: handle._objectId
|
||||
});
|
||||
// TODO: store sharedId in the handle.
|
||||
if (!('sharedId' in shared)) throw new Error('Element is not a node');
|
||||
return {
|
||||
sharedId: shared.sharedId
|
||||
};
|
||||
}
|
||||
async remoteObjectForNodeId(context, nodeId) {
|
||||
const result = await this._remoteValueForReference(nodeId, true);
|
||||
if (!('handle' in result)) throw new Error('Can\'t get remote object for nodeId');
|
||||
return createHandle(context, result);
|
||||
}
|
||||
async contentFrameIdForFrame(handle) {
|
||||
const contentWindow = await this._rawCallFunction('e => e.contentWindow', {
|
||||
handle: handle._objectId
|
||||
});
|
||||
if ((contentWindow === null || contentWindow === void 0 ? void 0 : contentWindow.type) === 'window') return contentWindow.value.context;
|
||||
return null;
|
||||
}
|
||||
async frameIdForWindowHandle(handle) {
|
||||
if (!handle._objectId) throw new Error('JSHandle is not a DOM node handle');
|
||||
const contentWindow = await this._remoteValueForReference({
|
||||
handle: handle._objectId
|
||||
});
|
||||
if (contentWindow.type === 'window') return contentWindow.value.context;
|
||||
return null;
|
||||
}
|
||||
async _remoteValueForReference(reference, createHandle) {
|
||||
return await this._rawCallFunction('e => e', reference, createHandle);
|
||||
}
|
||||
async _rawCallFunction(functionDeclaration, arg, createHandle) {
|
||||
const response = await this._session.send('script.callFunction', {
|
||||
functionDeclaration,
|
||||
target: this._target,
|
||||
arguments: [arg],
|
||||
resultOwnership: bidi.Script.ResultOwnership.Root,
|
||||
// Necessary for the handle to be returned.
|
||||
// "Root" is necessary for the handle to be returned.
|
||||
resultOwnership: createHandle ? bidi.Script.ResultOwnership.Root : bidi.Script.ResultOwnership.None,
|
||||
serializationOptions: {
|
||||
maxObjectDepth: 0,
|
||||
maxDomDepth: 0
|
||||
@@ -172,4 +194,12 @@ function remoteObjectValue(remoteObject) {
|
||||
if (remoteObject.type === 'number' && typeof remoteObject.value === 'string') return js.parseUnserializableValue(remoteObject.value);
|
||||
if ('value' in remoteObject) return remoteObject.value;
|
||||
return undefined;
|
||||
}
|
||||
function createHandle(context, remoteObject) {
|
||||
if (remoteObject.type === 'node') {
|
||||
(0, _utils.assert)(context instanceof dom.FrameExecutionContext);
|
||||
return new dom.ElementHandle(context, remoteObject.handle);
|
||||
}
|
||||
const objectId = 'handle' in remoteObject ? remoteObject.handle : undefined;
|
||||
return new js.JSHandle(context, remoteObject.type, renderPreview(remoteObject), objectId, remoteObjectValue(remoteObject));
|
||||
}
|
||||
7
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiFirefox.js
generated
vendored
7
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiFirefox.js
generated
vendored
@@ -7,11 +7,12 @@ exports.BidiFirefox = void 0;
|
||||
var _os = _interopRequireDefault(require("os"));
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _utils = require("../../utils");
|
||||
var _ascii = require("../utils/ascii");
|
||||
var _browserType = require("../browserType");
|
||||
var _bidiBrowser = require("./bidiBrowser");
|
||||
var _bidiConnection = require("./bidiConnection");
|
||||
var _firefoxPrefs = require("./third_party/firefoxPrefs");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -39,8 +40,8 @@ class BidiFirefox extends _browserType.BrowserType {
|
||||
doRewriteStartupLog(error) {
|
||||
if (!error.logs) return error;
|
||||
// https://github.com/microsoft/playwright/issues/6500
|
||||
if (error.logs.includes(`as root in a regular user's session is not supported.`)) error.logs = '\n' + (0, _utils.wrapInASCIIBox)(`Firefox is unable to launch if the $HOME folder isn't owned by the current user.\nWorkaround: 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, _utils.wrapInASCIIBox)(_browserType.kNoXServerRunningError, 1);
|
||||
if (error.logs.includes(`as root in a regular user's session is not supported.`)) error.logs = '\n' + (0, _ascii.wrapInASCIIBox)(`Firefox is unable to launch if the $HOME folder isn't owned by the current user.\nWorkaround: 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, _ascii.wrapInASCIIBox)(_browserType.kNoXServerRunningError, 1);
|
||||
return error;
|
||||
}
|
||||
amendEnvironment(env, userDataDir, executable, browserArguments) {
|
||||
|
||||
13
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiInput.js
generated
vendored
13
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiInput.js
generated
vendored
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.RawTouchscreenImpl = exports.RawMouseImpl = exports.RawKeyboardImpl = void 0;
|
||||
var bidi = _interopRequireWildcard(require("./third_party/bidiProtocol"));
|
||||
var _bidiKeyboard = require("./third_party/bidiKeyboard");
|
||||
var _input = require("../input");
|
||||
var _bidiKeyboard = require("./third_party/bidiKeyboard");
|
||||
var bidi = _interopRequireWildcard(require("./third_party/bidiProtocol"));
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -84,9 +84,6 @@ class RawMouseImpl {
|
||||
this._session = session;
|
||||
}
|
||||
async move(x, y, button, buttons, modifiers, forClick) {
|
||||
// Bidi throws when x/y are not integers.
|
||||
x = Math.round(x);
|
||||
y = Math.round(y);
|
||||
await this._performActions([{
|
||||
type: 'pointerMove',
|
||||
x,
|
||||
@@ -107,8 +104,8 @@ class RawMouseImpl {
|
||||
}
|
||||
async wheel(x, y, buttons, modifiers, deltaX, deltaY) {
|
||||
// Bidi throws when x/y are not integers.
|
||||
x = Math.round(x);
|
||||
y = Math.round(y);
|
||||
x = Math.floor(x);
|
||||
y = Math.floor(y);
|
||||
await this._session.send('input.performActions', {
|
||||
context: this._session.sessionId,
|
||||
actions: [{
|
||||
|
||||
6
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiNetworkManager.js
generated
vendored
6
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiNetworkManager.js
generated
vendored
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.BidiNetworkManager = void 0;
|
||||
exports.bidiBytesValueToString = bidiBytesValueToString;
|
||||
var _eventsHelper = require("../../utils/eventsHelper");
|
||||
var _eventsHelper = require("../utils/eventsHelper");
|
||||
var _cookieStore = require("../cookieStore");
|
||||
var network = _interopRequireWildcard(require("../network"));
|
||||
var bidi = _interopRequireWildcard(require("./third_party/bidiProtocol"));
|
||||
var _cookieStore = require("../cookieStore");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
4
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiOverCdp.js
generated
vendored
4
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiOverCdp.js
generated
vendored
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.connectBidiOverCdp = connectBidiOverCdp;
|
||||
var bidiMapper = _interopRequireWildcard(require("chromium-bidi/lib/cjs/bidiMapper/BidiMapper"));
|
||||
var bidiCdpConnection = _interopRequireWildcard(require("chromium-bidi/lib/cjs/cdp/CdpConnection"));
|
||||
var _debugLogger = require("../../utils/debugLogger");
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
82
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiPage.js
generated
vendored
82
tvapp2/node_modules/playwright-core/lib/server/bidi/bidiPage.js
generated
vendored
@@ -4,19 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BidiPage = void 0;
|
||||
var _eventsHelper = require("../../utils/eventsHelper");
|
||||
var _utils = require("../../utils");
|
||||
var dom = _interopRequireWildcard(require("../dom"));
|
||||
var dialog = _interopRequireWildcard(require("../dialog"));
|
||||
var _page = require("../page");
|
||||
var _bidiInput = require("./bidiInput");
|
||||
var bidi = _interopRequireWildcard(require("./third_party/bidiProtocol"));
|
||||
var _bidiExecutionContext = require("./bidiExecutionContext");
|
||||
var _bidiNetworkManager = require("./bidiNetworkManager");
|
||||
var _eventsHelper = require("../utils/eventsHelper");
|
||||
var _browserContext = require("../browserContext");
|
||||
var dialog = _interopRequireWildcard(require("../dialog"));
|
||||
var dom = _interopRequireWildcard(require("../dom"));
|
||||
var _page = require("../page");
|
||||
var _bidiExecutionContext = require("./bidiExecutionContext");
|
||||
var _bidiInput = require("./bidiInput");
|
||||
var _bidiNetworkManager = require("./bidiNetworkManager");
|
||||
var _bidiPdf = require("./bidiPdf");
|
||||
var bidi = _interopRequireWildcard(require("./third_party/bidiProtocol"));
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -101,7 +101,6 @@ class BidiPage {
|
||||
if (realmInfo.type !== 'window') return;
|
||||
const frame = this._page._frameManager.frame(realmInfo.context);
|
||||
if (!frame) return;
|
||||
const delegate = new _bidiExecutionContext.BidiExecutionContext(this._session, realmInfo);
|
||||
let worldName;
|
||||
if (!realmInfo.sandbox) {
|
||||
worldName = 'main';
|
||||
@@ -112,8 +111,8 @@ class BidiPage {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
const delegate = new _bidiExecutionContext.BidiExecutionContext(this._session, realmInfo);
|
||||
const context = new dom.FrameExecutionContext(delegate, frame, worldName);
|
||||
context[contextDelegateSymbol] = delegate;
|
||||
frame._contextCreated(worldName, context);
|
||||
this._realmToContext.set(realmInfo.realm, context);
|
||||
}
|
||||
@@ -202,10 +201,7 @@ class BidiPage {
|
||||
lineNumber: 1,
|
||||
columnNumber: 1
|
||||
};
|
||||
this._page._addConsoleMessage(entry.method, entry.args.map(arg => context.createHandle({
|
||||
objectId: arg.handle,
|
||||
...arg
|
||||
})), location, params.text || undefined);
|
||||
this._page._addConsoleMessage(entry.method, entry.args.map(arg => (0, _bidiExecutionContext.createHandle)(context, arg)), location, params.text || undefined);
|
||||
}
|
||||
async navigateFrame(frame, url, referrer) {
|
||||
const {
|
||||
@@ -352,21 +348,20 @@ class BidiPage {
|
||||
}
|
||||
async getContentFrame(handle) {
|
||||
const executionContext = toBidiExecutionContext(handle._context);
|
||||
const contentWindow = await executionContext.rawCallFunction('e => e.contentWindow', {
|
||||
handle: handle._objectId
|
||||
});
|
||||
if (contentWindow.type === 'window') {
|
||||
const frameId = contentWindow.value.context;
|
||||
const result = this._page._frameManager.frame(frameId);
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
const frameId = await executionContext.contentFrameIdForFrame(handle);
|
||||
if (!frameId) return null;
|
||||
return this._page._frameManager.frame(frameId);
|
||||
}
|
||||
async getOwnerFrame(handle) {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
isElementHandle(remoteObject) {
|
||||
return remoteObject.type === 'node';
|
||||
// TODO: switch to utility world?
|
||||
const windowHandle = await handle.evaluateHandle(node => {
|
||||
var _node$ownerDocument;
|
||||
const doc = (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : node;
|
||||
return doc.defaultView;
|
||||
});
|
||||
if (!windowHandle) return null;
|
||||
const executionContext = toBidiExecutionContext(handle._context);
|
||||
return executionContext.frameIdForWindowHandle(windowHandle);
|
||||
}
|
||||
async getBoundingBox(handle) {
|
||||
const box = await handle.evaluate(element => {
|
||||
@@ -449,29 +444,19 @@ class BidiPage {
|
||||
}));
|
||||
return quads;
|
||||
}
|
||||
async setInputFiles(handle, files) {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
async setInputFilePaths(handle, paths) {
|
||||
throw new Error('Method not implemented.');
|
||||
const fromContext = toBidiExecutionContext(handle._context);
|
||||
await this._session.send('input.setFiles', {
|
||||
context: this._session.sessionId,
|
||||
element: await fromContext.nodeIdForElementHandle(handle),
|
||||
files: paths
|
||||
});
|
||||
}
|
||||
async adoptElementHandle(handle, to) {
|
||||
const fromContext = toBidiExecutionContext(handle._context);
|
||||
const shared = await fromContext.rawCallFunction('x => x', {
|
||||
handle: handle._objectId
|
||||
});
|
||||
// TODO: store sharedId in the handle.
|
||||
if (!('sharedId' in shared)) throw new Error('Element is not a node');
|
||||
const sharedId = shared.sharedId;
|
||||
const nodeId = await fromContext.nodeIdForElementHandle(handle);
|
||||
const executionContext = toBidiExecutionContext(to);
|
||||
const result = await executionContext.rawCallFunction('x => x', {
|
||||
sharedId
|
||||
});
|
||||
if ('handle' in result) return to.createHandle({
|
||||
objectId: result.handle,
|
||||
...result
|
||||
});
|
||||
throw new Error('Failed to adopt element handle.');
|
||||
return await executionContext.remoteObjectForNodeId(to, nodeId);
|
||||
}
|
||||
async getAccessibilityTree(needle) {
|
||||
throw new Error('Method not implemented.');
|
||||
@@ -513,6 +498,5 @@ function addMainBinding(callback) {
|
||||
globalThis['__playwright__binding__'] = callback;
|
||||
}
|
||||
function toBidiExecutionContext(executionContext) {
|
||||
return executionContext[contextDelegateSymbol];
|
||||
}
|
||||
const contextDelegateSymbol = Symbol('delegate');
|
||||
return executionContext.delegate;
|
||||
}
|
||||
22
tvapp2/node_modules/playwright-core/lib/server/bidi/third_party/firefoxPrefs.js
generated
vendored
22
tvapp2/node_modules/playwright-core/lib/server/bidi/third_party/firefoxPrefs.js
generated
vendored
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.createProfile = createProfile;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
@@ -47,6 +47,13 @@ function defaultProfilePreferences(extraPrefs) {
|
||||
// console
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1543115
|
||||
'browser.dom.window.dump.enabled': true,
|
||||
// Make sure newtab weather doesn't hit the network to retrieve weather data.
|
||||
'browser.newtabpage.activity-stream.discoverystream.region-weather-config': '',
|
||||
// Make sure newtab wallpapers don't hit the network to retrieve wallpaper data.
|
||||
'browser.newtabpage.activity-stream.newtabWallpapers.enabled': false,
|
||||
'browser.newtabpage.activity-stream.newtabWallpapers.v2.enabled': false,
|
||||
// Make sure Topsites doesn't hit the network to retrieve sponsored tiles.
|
||||
'browser.newtabpage.activity-stream.showSponsoredTopSites': false,
|
||||
// Disable topstories
|
||||
'browser.newtabpage.activity-stream.feeds.system.topstories': false,
|
||||
// Always display a blank page
|
||||
@@ -112,6 +119,13 @@ function defaultProfilePreferences(extraPrefs) {
|
||||
// Disable slow script dialogues
|
||||
'dom.max_chrome_script_run_time': 0,
|
||||
'dom.max_script_run_time': 0,
|
||||
// Disable background timer throttling to allow tests to run in parallel
|
||||
// without a decrease in performance.
|
||||
'dom.min_background_timeout_value': 0,
|
||||
'dom.min_background_timeout_value_without_budget_throttling': 0,
|
||||
'dom.timeout.enable_budget_timer_throttling': false,
|
||||
// Disable HTTPS-First upgrades
|
||||
'dom.security.https_first': false,
|
||||
// Only load extensions from the application and user profile
|
||||
// AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION
|
||||
'extensions.autoDisableScopes': 0,
|
||||
@@ -141,10 +155,14 @@ function defaultProfilePreferences(extraPrefs) {
|
||||
'hangmonitor.timeout': 0,
|
||||
// Show chrome errors and warnings in the error console
|
||||
'javascript.options.showInConsole': true,
|
||||
// Do not throttle rendering (requestAnimationFrame) in background tabs
|
||||
'layout.testing.top-level-always-active': true,
|
||||
// Disable download and usage of OpenH264: and Widevine plugins
|
||||
'media.gmp-manager.updateEnabled': false,
|
||||
// Disable the GFX sanity window
|
||||
'media.sanity-test.disabled': true,
|
||||
// Disable connectivity service pings
|
||||
'network.connectivity-service.enabled': false,
|
||||
// Disable experimental feature that is only available in Nightly
|
||||
'network.cookie.sameSite.laxByDefault': false,
|
||||
// Do not prompt for temporary redirects
|
||||
@@ -169,8 +187,6 @@ function defaultProfilePreferences(extraPrefs) {
|
||||
'security.fileuri.strict_origin_policy': false,
|
||||
// Do not wait for the notification button security delay
|
||||
'security.notification_enable_delay': 0,
|
||||
// Ensure blocklist updates do not hit the network
|
||||
'services.settings.server': `http://${server}/dummy/blocklist/`,
|
||||
// Do not automatically fill sign-in forms with known usernames and
|
||||
// passwords
|
||||
'signon.autofillForms': false,
|
||||
|
||||
4
tvapp2/node_modules/playwright-core/lib/server/browser.js
generated
vendored
4
tvapp2/node_modules/playwright-core/lib/server/browser.js
generated
vendored
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Browser = void 0;
|
||||
var _artifact = require("./artifact");
|
||||
var _browserContext = require("./browserContext");
|
||||
var _page = require("./page");
|
||||
var _download = require("./download");
|
||||
var _instrumentation = require("./instrumentation");
|
||||
var _artifact = require("./artifact");
|
||||
var _page = require("./page");
|
||||
var _socksClientCertificatesInterceptor = require("./socksClientCertificatesInterceptor");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
|
||||
77
tvapp2/node_modules/playwright-core/lib/server/browserContext.js
generated
vendored
77
tvapp2/node_modules/playwright-core/lib/server/browserContext.js
generated
vendored
@@ -9,26 +9,29 @@ exports.normalizeProxySettings = normalizeProxySettings;
|
||||
exports.validateBrowserContextOptions = validateBrowserContextOptions;
|
||||
exports.verifyClientCertificates = verifyClientCertificates;
|
||||
exports.verifyGeolocation = verifyGeolocation;
|
||||
var _timeoutSettings = require("../common/timeoutSettings");
|
||||
var _utils = require("../utils");
|
||||
var _fileUtils = require("../utils/fileUtils");
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _timeoutSettings = require("./timeoutSettings");
|
||||
var _crypto = require("./utils/crypto");
|
||||
var _debug = require("./utils/debug");
|
||||
var _clock = require("./clock");
|
||||
var _debugger = require("./debugger");
|
||||
var _fetch = require("./fetch");
|
||||
var _fileUtils = require("./utils/fileUtils");
|
||||
var _harRecorder = require("./har/harRecorder");
|
||||
var _helper = require("./helper");
|
||||
var _instrumentation = require("./instrumentation");
|
||||
var utilityScriptSerializers = _interopRequireWildcard(require("./isomorphic/utilityScriptSerializers"));
|
||||
var network = _interopRequireWildcard(require("./network"));
|
||||
var _page6 = require("./page");
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _instrumentation = require("./instrumentation");
|
||||
var _debugger = require("./debugger");
|
||||
var _tracing = require("./trace/recorder/tracing");
|
||||
var _harRecorder = require("./har/harRecorder");
|
||||
var _recorder = require("./recorder");
|
||||
var consoleApiSource = _interopRequireWildcard(require("../generated/consoleApiSource"));
|
||||
var _fetch = require("./fetch");
|
||||
var _clock = require("./clock");
|
||||
var _recorderApp = require("./recorder/recorderApp");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var storageScript = _interopRequireWildcard(require("./storageScript"));
|
||||
var consoleApiSource = _interopRequireWildcard(require("../generated/consoleApiSource"));
|
||||
var _tracing = require("./trace/recorder/tracing");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
@@ -102,7 +105,7 @@ class BrowserContext extends _instrumentation.SdkObject {
|
||||
this._debugger = new _debugger.Debugger(this);
|
||||
|
||||
// When PWDEBUG=1, show inspector for each context.
|
||||
if ((0, _utils.debugMode)() === 'inspector') await _recorder.Recorder.show(this, _recorderApp.RecorderApp.factory(this), {
|
||||
if ((0, _debug.debugMode)() === 'inspector') await _recorder.Recorder.show(this, _recorderApp.RecorderApp.factory(this), {
|
||||
pauseOnNextStatement: true
|
||||
});
|
||||
|
||||
@@ -111,7 +114,7 @@ class BrowserContext extends _instrumentation.SdkObject {
|
||||
this._debugger.on(_debugger.Debugger.Events.PausedStateChanged, () => {
|
||||
if (this._debugger.isPaused()) _recorder.Recorder.showInspectorNoReply(this, _recorderApp.RecorderApp.factory(this));
|
||||
});
|
||||
if ((0, _utils.debugMode)() === 'console') await this.extendInjectedScript(consoleApiSource.source);
|
||||
if ((0, _debug.debugMode)() === 'console') await this.extendInjectedScript(consoleApiSource.source);
|
||||
if (this._options.serviceWorkers === 'block') await this.addInitScript(`\nif (navigator.serviceWorker) navigator.serviceWorker.register = async () => { console.warn('Service Worker registration blocked by Playwright'); };\n`);
|
||||
if (this._options.permissions) await this.grantPermissions(this._options.permissions);
|
||||
}
|
||||
@@ -400,24 +403,25 @@ class BrowserContext extends _instrumentation.SdkObject {
|
||||
addVisitedOrigin(origin) {
|
||||
this._origins.add(origin);
|
||||
}
|
||||
async storageState() {
|
||||
async storageState(indexedDB = false) {
|
||||
const result = {
|
||||
cookies: await this.cookies(),
|
||||
origins: []
|
||||
};
|
||||
const originsToSave = new Set(this._origins);
|
||||
const collectScript = `(${storageScript.collect})((${utilityScriptSerializers.source})(), ${this._browser.options.name === 'firefox'}, ${indexedDB})`;
|
||||
|
||||
// First try collecting storage stage from existing pages.
|
||||
for (const page of this.pages()) {
|
||||
const origin = page.mainFrame().origin();
|
||||
if (!origin || !originsToSave.has(origin)) continue;
|
||||
try {
|
||||
const storage = await page.mainFrame().nonStallingEvaluateInExistingContext(`({
|
||||
localStorage: Object.keys(localStorage).map(name => ({ name, value: localStorage.getItem(name) })),
|
||||
})`, 'utility');
|
||||
if (storage.localStorage.length) result.origins.push({
|
||||
var _storage$indexedDB;
|
||||
const storage = await page.mainFrame().nonStallingEvaluateInExistingContext(collectScript, 'utility');
|
||||
if (storage.localStorage.length || (_storage$indexedDB = storage.indexedDB) !== null && _storage$indexedDB !== void 0 && _storage$indexedDB.length) result.origins.push({
|
||||
origin,
|
||||
localStorage: storage.localStorage
|
||||
localStorage: storage.localStorage,
|
||||
indexedDB: storage.indexedDB
|
||||
});
|
||||
originsToSave.delete(origin);
|
||||
} catch {
|
||||
@@ -436,19 +440,17 @@ class BrowserContext extends _instrumentation.SdkObject {
|
||||
return true;
|
||||
});
|
||||
for (const origin of originsToSave) {
|
||||
const originStorage = {
|
||||
origin,
|
||||
localStorage: []
|
||||
};
|
||||
var _storage$indexedDB2;
|
||||
const frame = page.mainFrame();
|
||||
await frame.goto(internalMetadata, origin);
|
||||
const storage = await frame.evaluateExpression(`({
|
||||
localStorage: Object.keys(localStorage).map(name => ({ name, value: localStorage.getItem(name) })),
|
||||
})`, {
|
||||
const storage = await frame.evaluateExpression(collectScript, {
|
||||
world: 'utility'
|
||||
});
|
||||
originStorage.localStorage = storage.localStorage;
|
||||
if (storage.localStorage.length) result.origins.push(originStorage);
|
||||
if (storage.localStorage.length || (_storage$indexedDB2 = storage.indexedDB) !== null && _storage$indexedDB2 !== void 0 && _storage$indexedDB2.length) result.origins.push({
|
||||
origin,
|
||||
localStorage: storage.localStorage,
|
||||
indexedDB: storage.indexedDB
|
||||
});
|
||||
}
|
||||
await page.close(internalMetadata);
|
||||
}
|
||||
@@ -506,14 +508,9 @@ class BrowserContext extends _instrumentation.SdkObject {
|
||||
for (const originState of state.origins) {
|
||||
const frame = page.mainFrame();
|
||||
await frame.goto(metadata, originState.origin);
|
||||
await frame.evaluateExpression(`
|
||||
originState => {
|
||||
for (const { name, value } of (originState.localStorage || []))
|
||||
localStorage.setItem(name, value);
|
||||
}`, {
|
||||
isFunction: true,
|
||||
await frame.evaluateExpression(`(${storageScript.restore})(${JSON.stringify(originState)}, (${utilityScriptSerializers.source})())`, {
|
||||
world: 'utility'
|
||||
}, originState);
|
||||
});
|
||||
}
|
||||
await page.close(internalMetadata);
|
||||
}
|
||||
@@ -534,7 +531,7 @@ class BrowserContext extends _instrumentation.SdkObject {
|
||||
await Promise.all(this.pages().map(page => page.safeNonStallingEvaluateInAllFrames(expression, world, options)));
|
||||
}
|
||||
async _harStart(page, options) {
|
||||
const harId = (0, _utils.createGuid)();
|
||||
const harId = (0, _crypto.createGuid)();
|
||||
this._harRecorders.set(harId, new _harRecorder.HarRecorder(this, page, options));
|
||||
return harId;
|
||||
}
|
||||
@@ -659,7 +656,7 @@ function normalizeProxySettings(proxy) {
|
||||
bypass
|
||||
};
|
||||
}
|
||||
const paramsThatAllowContextReuse = ['colorScheme', 'forcedColors', 'reducedMotion', 'screen', 'userAgent', 'viewport'];
|
||||
const paramsThatAllowContextReuse = ['colorScheme', 'forcedColors', 'reducedMotion', 'contrast', 'screen', 'userAgent', 'viewport'];
|
||||
const defaultNewContextParamValues = {
|
||||
noDefaultViewport: false,
|
||||
ignoreHTTPSErrors: false,
|
||||
|
||||
35
tvapp2/node_modules/playwright-core/lib/server/browserType.js
generated
vendored
35
tvapp2/node_modules/playwright-core/lib/server/browserType.js
generated
vendored
@@ -5,25 +5,25 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.kNoXServerRunningError = exports.BrowserType = exports.BrowserReadyState = void 0;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var os = _interopRequireWildcard(require("os"));
|
||||
var _os = _interopRequireDefault(require("os"));
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _browserContext = require("./browserContext");
|
||||
var _registry = require("./registry");
|
||||
var _transport = require("./transport");
|
||||
var _processLauncher = require("../utils/processLauncher");
|
||||
var _pipeTransport = require("./pipeTransport");
|
||||
var _progress = require("./progress");
|
||||
var _timeoutSettings = require("../common/timeoutSettings");
|
||||
var _utils = require("../utils");
|
||||
var _fileUtils = require("../utils/fileUtils");
|
||||
var _timeoutSettings = require("./timeoutSettings");
|
||||
var _debug = require("./utils/debug");
|
||||
var _assert = require("../utils/isomorphic/assert");
|
||||
var _manualPromise = require("../utils/isomorphic/manualPromise");
|
||||
var _fileUtils = require("./utils/fileUtils");
|
||||
var _helper = require("./helper");
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
var _instrumentation = require("./instrumentation");
|
||||
var _pipeTransport = require("./pipeTransport");
|
||||
var _processLauncher = require("./utils/processLauncher");
|
||||
var _progress = require("./progress");
|
||||
var _protocolError = require("./protocolError");
|
||||
var _registry = require("./registry");
|
||||
var _socksClientCertificatesInterceptor = require("./socksClientCertificatesInterceptor");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _transport = require("./transport");
|
||||
var _debugLogger = require("./utils/debugLogger");
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -43,7 +43,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
const kNoXServerRunningError = exports.kNoXServerRunningError = 'Looks like you launched a headed browser without having a XServer running.\n' + 'Set either \'headless: true\' or use \'xvfb-run <your-playwright-app>\' before running Playwright.\n\n<3 Playwright Team';
|
||||
class BrowserReadyState {
|
||||
constructor() {
|
||||
this._wsEndpoint = new _utils.ManualPromise();
|
||||
this._wsEndpoint = new _manualPromise.ManualPromise();
|
||||
}
|
||||
onBrowserExit() {
|
||||
// Unblock launch when browser prematurely exits.
|
||||
@@ -178,16 +178,17 @@ class BrowserType extends _instrumentation.SdkObject {
|
||||
const env = options.env ? (0, _processLauncher.envArrayToObject)(options.env) : process.env;
|
||||
await this._createArtifactDirs(options);
|
||||
const tempDirectories = [];
|
||||
const artifactsDir = await _fs.default.promises.mkdtemp(_path.default.join(os.tmpdir(), 'playwright-artifacts-'));
|
||||
const artifactsDir = await _fs.default.promises.mkdtemp(_path.default.join(_os.default.tmpdir(), 'playwright-artifacts-'));
|
||||
tempDirectories.push(artifactsDir);
|
||||
if (userDataDir) {
|
||||
(0, _assert.assert)(_path.default.isAbsolute(userDataDir), 'userDataDir must be an absolute path');
|
||||
// Firefox bails if the profile directory does not exist, Chrome creates it. We ensure consistent behavior here.
|
||||
if (!(await (0, _fileUtils.existsAsync)(userDataDir))) await _fs.default.promises.mkdir(userDataDir, {
|
||||
recursive: true,
|
||||
mode: 0o700
|
||||
});
|
||||
} else {
|
||||
userDataDir = await _fs.default.promises.mkdtemp(_path.default.join(os.tmpdir(), `playwright_${this._name}dev_profile-`));
|
||||
userDataDir = await _fs.default.promises.mkdtemp(_path.default.join(_os.default.tmpdir(), `playwright_${this._name}dev_profile-`));
|
||||
tempDirectories.push(userDataDir);
|
||||
}
|
||||
await this.prepareUserDataDir(options, userDataDir);
|
||||
@@ -293,7 +294,7 @@ class BrowserType extends _instrumentation.SdkObject {
|
||||
downloadsPath,
|
||||
proxy
|
||||
} = options;
|
||||
if ((0, _utils.debugMode)()) headless = false;
|
||||
if ((0, _debug.debugMode)()) headless = false;
|
||||
if (downloadsPath && !_path.default.isAbsolute(downloadsPath)) downloadsPath = _path.default.join(process.cwd(), downloadsPath);
|
||||
if (this.attribution.playwright.options.socksProxyPort) proxy = {
|
||||
server: `socks5://127.0.0.1:${this.attribution.playwright.options.socksProxyPort}`
|
||||
|
||||
28
tvapp2/node_modules/playwright-core/lib/server/chromium/chromium.js
generated
vendored
28
tvapp2/node_modules/playwright-core/lib/server/chromium/chromium.js
generated
vendored
@@ -7,27 +7,27 @@ exports.Chromium = void 0;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _os = _interopRequireDefault(require("os"));
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _chromiumSwitches = require("./chromiumSwitches");
|
||||
var _crBrowser = require("./crBrowser");
|
||||
var _processLauncher = require("../../utils/processLauncher");
|
||||
var _crConnection = require("./crConnection");
|
||||
var _timeoutSettings = require("../timeoutSettings");
|
||||
var _utils = require("../../utils");
|
||||
var _ascii = require("../utils/ascii");
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
var _manualPromise = require("../../utils/isomorphic/manualPromise");
|
||||
var _network = require("../utils/network");
|
||||
var _userAgent = require("../utils/userAgent");
|
||||
var _browserContext = require("../browserContext");
|
||||
var _browserType = require("../browserType");
|
||||
var _helper = require("../helper");
|
||||
var _registry = require("../registry");
|
||||
var _transport = require("../transport");
|
||||
var _crDevTools = require("./crDevTools");
|
||||
var _browser = require("../browser");
|
||||
var _network = require("../../utils/network");
|
||||
var _userAgent = require("../../utils/userAgent");
|
||||
var _ascii = require("../../utils/ascii");
|
||||
var _utils = require("../../utils");
|
||||
var _fileUtils = require("../../utils/fileUtils");
|
||||
var _debugLogger = require("../../utils/debugLogger");
|
||||
var _fileUtils = require("../utils/fileUtils");
|
||||
var _processLauncher = require("../utils/processLauncher");
|
||||
var _progress = require("../progress");
|
||||
var _timeoutSettings = require("../../common/timeoutSettings");
|
||||
var _helper = require("../helper");
|
||||
var _registry = require("../registry");
|
||||
var _manualPromise = require("../../utils/manualPromise");
|
||||
var _browserContext = require("../browserContext");
|
||||
var _chromiumSwitches = require("./chromiumSwitches");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
|
||||
41
tvapp2/node_modules/playwright-core/lib/server/chromium/chromiumSwitches.js
generated
vendored
41
tvapp2/node_modules/playwright-core/lib/server/chromium/chromiumSwitches.js
generated
vendored
@@ -23,21 +23,44 @@ exports.chromiumSwitches = void 0;
|
||||
|
||||
// No dependencies as it is used from the Electron loader.
|
||||
|
||||
const disabledFeatures = [
|
||||
// See https://github.com/microsoft/playwright/pull/10380
|
||||
'AcceptCHFrame',
|
||||
// See https://github.com/microsoft/playwright/pull/10679
|
||||
'AutoExpandDetailsElement',
|
||||
// See https://github.com/microsoft/playwright/issues/14047
|
||||
'AvoidUnnecessaryBeforeUnloadCheckSync',
|
||||
// See https://github.com/microsoft/playwright/pull/12992
|
||||
'CertificateTransparencyComponentUpdater',
|
||||
// This makes Page.frameScheduledNavigation arrive much later after a click,
|
||||
// making our navigation auto-wait after click not working.
|
||||
// Can be removed once we deperecate noWaitAfter.
|
||||
// See https://github.com/microsoft/playwright/pull/34372.
|
||||
'DeferRendererTasksAfterInput', 'DestroyProfileOnBrowserClose',
|
||||
// See https://github.com/microsoft/playwright/pull/13854
|
||||
'DialMediaRouteProvider',
|
||||
// Chromium is disabling manifest version 2. Allow testing it as long as Chromium can actually run it.
|
||||
// Disabled in https://chromium-review.googlesource.com/c/chromium/src/+/6265903.
|
||||
'ExtensionManifestV2Disabled', 'GlobalMediaControls',
|
||||
// See https://github.com/microsoft/playwright/pull/27605
|
||||
'HttpsUpgrades', 'ImprovedCookieControls', 'LazyFrameLoading',
|
||||
// Hides the Lens feature in the URL address bar. Its not working in unofficial builds.
|
||||
'LensOverlay',
|
||||
// See https://github.com/microsoft/playwright/pull/8162
|
||||
'MediaRouter',
|
||||
// See https://github.com/microsoft/playwright/issues/28023
|
||||
'PaintHolding',
|
||||
// See https://github.com/microsoft/playwright/issues/32230
|
||||
'ThirdPartyStoragePartitioning',
|
||||
// See https://github.com/microsoft/playwright/issues/16126
|
||||
'Translate'];
|
||||
const chromiumSwitches = exports.chromiumSwitches = ['--disable-field-trial-config',
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:testing/variations/README.md
|
||||
'--disable-background-networking', '--disable-background-timer-throttling', '--disable-backgrounding-occluded-windows', '--disable-back-forward-cache',
|
||||
// Avoids surprises like main request not being intercepted during page.goBack().
|
||||
'--disable-breakpad', '--disable-client-side-phishing-detection', '--disable-component-extensions-with-background-pages', '--disable-component-update',
|
||||
// Avoids unneeded network activity after startup.
|
||||
'--no-default-browser-check', '--disable-default-apps', '--disable-dev-shm-usage', '--disable-extensions',
|
||||
// AvoidUnnecessaryBeforeUnloadCheckSync - https://github.com/microsoft/playwright/issues/14047
|
||||
// Translate - https://github.com/microsoft/playwright/issues/16126
|
||||
// HttpsUpgrades - https://github.com/microsoft/playwright/pull/27605
|
||||
// PaintHolding - https://github.com/microsoft/playwright/issues/28023
|
||||
// ThirdPartyStoragePartitioning - https://github.com/microsoft/playwright/issues/32230
|
||||
// LensOverlay - Hides the Lens feature in the URL address bar. Its not working in unofficial builds.
|
||||
// PlzDedicatedWorker - https://github.com/microsoft/playwright/issues/31747
|
||||
'--disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding,ThirdPartyStoragePartitioning,LensOverlay,PlzDedicatedWorker', '--allow-pre-commit-input', '--disable-hang-monitor', '--disable-ipc-flooding-protection', '--disable-popup-blocking', '--disable-prompt-on-repost', '--disable-renderer-backgrounding', '--force-color-profile=srgb', '--metrics-recording-only', '--no-first-run', '--enable-automation', '--password-store=basic', '--use-mock-keychain',
|
||||
'--no-default-browser-check', '--disable-default-apps', '--disable-dev-shm-usage', '--disable-extensions', '--disable-features=' + disabledFeatures.join(','), '--allow-pre-commit-input', '--disable-hang-monitor', '--disable-ipc-flooding-protection', '--disable-popup-blocking', '--disable-prompt-on-repost', '--disable-renderer-backgrounding', '--force-color-profile=srgb', '--metrics-recording-only', '--no-first-run', '--enable-automation', '--password-store=basic', '--use-mock-keychain',
|
||||
// See https://chromium-review.googlesource.com/c/chromium/src/+/2436773
|
||||
'--no-service-autorun', '--export-tagged-pdf',
|
||||
// https://chromium-review.googlesource.com/c/chromium/src/+/4853540
|
||||
|
||||
29
tvapp2/node_modules/playwright-core/lib/server/chromium/crBrowser.js
generated
vendored
29
tvapp2/node_modules/playwright-core/lib/server/chromium/crBrowser.js
generated
vendored
@@ -5,20 +5,21 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.CRBrowserContext = exports.CRBrowser = void 0;
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _assert = require("../../utils/isomorphic/assert");
|
||||
var _crypto = require("../utils/crypto");
|
||||
var _artifact = require("../artifact");
|
||||
var _browser = require("../browser");
|
||||
var _browserContext = require("../browserContext");
|
||||
var _utils = require("../../utils");
|
||||
var _frames = require("../frames");
|
||||
var network = _interopRequireWildcard(require("../network"));
|
||||
var _page = require("../page");
|
||||
var _frames = require("../frames");
|
||||
var _crConnection = require("./crConnection");
|
||||
var _crPage = require("./crPage");
|
||||
var _crProtocolHelper = require("./crProtocolHelper");
|
||||
var _crServiceWorker = require("./crServiceWorker");
|
||||
var _artifact = require("../artifact");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
@@ -143,7 +144,7 @@ class CRBrowser extends _browser.Browser {
|
||||
}) {
|
||||
if (targetInfo.type === 'browser') return;
|
||||
const session = this._session.createChildSession(sessionId);
|
||||
(0, _utils.assert)(targetInfo.browserContextId, 'targetInfo: ' + JSON.stringify(targetInfo, null, 2));
|
||||
(0, _assert.assert)(targetInfo.browserContextId, 'targetInfo: ' + JSON.stringify(targetInfo, null, 2));
|
||||
let context = this._contexts.get(targetInfo.browserContextId) || null;
|
||||
if (!context) {
|
||||
// TODO: auto attach only to pages from our contexts.
|
||||
@@ -159,9 +160,9 @@ class CRBrowser extends _browser.Browser {
|
||||
session.detach().catch(() => {});
|
||||
return;
|
||||
}
|
||||
(0, _utils.assert)(!this._crPages.has(targetInfo.targetId), 'Duplicate target ' + targetInfo.targetId);
|
||||
(0, _utils.assert)(!this._backgroundPages.has(targetInfo.targetId), 'Duplicate target ' + targetInfo.targetId);
|
||||
(0, _utils.assert)(!this._serviceWorkers.has(targetInfo.targetId), 'Duplicate target ' + targetInfo.targetId);
|
||||
(0, _assert.assert)(!this._crPages.has(targetInfo.targetId), 'Duplicate target ' + targetInfo.targetId);
|
||||
(0, _assert.assert)(!this._backgroundPages.has(targetInfo.targetId), 'Duplicate target ' + targetInfo.targetId);
|
||||
(0, _assert.assert)(!this._serviceWorkers.has(targetInfo.targetId), 'Duplicate target ' + targetInfo.targetId);
|
||||
if (targetInfo.type === 'background_page') {
|
||||
const backgroundPage = new _crPage.CRPage(session, targetInfo.targetId, context, null, {
|
||||
hasUIWindow: false,
|
||||
@@ -258,7 +259,7 @@ class CRBrowser extends _browser.Browser {
|
||||
return await this._connection.createBrowserSession();
|
||||
}
|
||||
async startTracing(page, options = {}) {
|
||||
(0, _utils.assert)(!this._tracingRecording, 'Cannot start recording trace while already recording trace.');
|
||||
(0, _assert.assert)(!this._tracingRecording, 'Cannot start recording trace while already recording trace.');
|
||||
this._tracingClient = page ? page._delegate._mainFrameSession._client : this._session;
|
||||
const defaultCategories = ['-*', 'devtools.timeline', 'v8.execute', 'disabled-by-default-devtools.timeline', 'disabled-by-default-devtools.timeline.frame', 'toplevel', 'blink.console', 'blink.user_timing', 'latencyInfo', 'disabled-by-default-devtools.timeline.stack', 'disabled-by-default-v8.cpu_profiler', 'disabled-by-default-v8.cpu_profiler.hires'];
|
||||
const {
|
||||
@@ -273,9 +274,9 @@ class CRBrowser extends _browser.Browser {
|
||||
});
|
||||
}
|
||||
async stopTracing() {
|
||||
(0, _utils.assert)(this._tracingClient, 'Tracing was not started.');
|
||||
(0, _assert.assert)(this._tracingClient, 'Tracing was not started.');
|
||||
const [event] = await Promise.all([new Promise(f => this._tracingClient.once('Tracing.tracingComplete', f)), this._tracingClient.send('Tracing.end')]);
|
||||
const tracingPath = _path.default.join(this.options.artifactsDir, (0, _utils.createGuid)() + '.crtrace');
|
||||
const tracingPath = _path.default.join(this.options.artifactsDir, (0, _crypto.createGuid)() + '.crtrace');
|
||||
await (0, _crProtocolHelper.saveProtocolStream)(this._tracingClient, event.stream, tracingPath);
|
||||
this._tracingRecording = false;
|
||||
const artifact = new _artifact.Artifact(this, tracingPath);
|
||||
@@ -297,7 +298,7 @@ class CRBrowserContext extends _browserContext.BrowserContext {
|
||||
this._authenticateProxyViaCredentials();
|
||||
}
|
||||
async _initialize() {
|
||||
(0, _utils.assert)(!Array.from(this._browser._crPages.values()).some(page => page._browserContext === this));
|
||||
(0, _assert.assert)(!Array.from(this._browser._crPages.values()).some(page => page._browserContext === this));
|
||||
const promises = [super._initialize()];
|
||||
if (this._browser.options.name !== 'clank' && this._options.acceptDownloads !== 'internal-browser-default') {
|
||||
promises.push(this._browser._session.send('Browser.setDownloadBehavior', {
|
||||
@@ -335,7 +336,7 @@ class CRBrowserContext extends _browserContext.BrowserContext {
|
||||
const page = this._browser._crPages.get(key);
|
||||
if (page._opener) newKeys.delete(key);
|
||||
}
|
||||
(0, _utils.assert)(newKeys.size === 1);
|
||||
(0, _assert.assert)(newKeys.size === 1);
|
||||
[targetId] = [...newKeys];
|
||||
}
|
||||
return this._browser._crPages.get(targetId)._page;
|
||||
|
||||
4
tvapp2/node_modules/playwright-core/lib/server/chromium/crConnection.js
generated
vendored
4
tvapp2/node_modules/playwright-core/lib/server/chromium/crConnection.js
generated
vendored
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.kBrowserCloseMessageId = exports.ConnectionEvents = exports.CRSession = exports.CRConnection = exports.CDPSession = void 0;
|
||||
var _utils = require("../../utils");
|
||||
var _events = require("events");
|
||||
var _debugLogger = require("../../utils/debugLogger");
|
||||
var _utils = require("../../utils");
|
||||
var _debugLogger = require("../utils/debugLogger");
|
||||
var _helper = require("../helper");
|
||||
var _protocolError = require("../protocolError");
|
||||
/**
|
||||
|
||||
2
tvapp2/node_modules/playwright-core/lib/server/chromium/crCoverage.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/chromium/crCoverage.js
generated
vendored
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.CRCoverage = void 0;
|
||||
var _eventsHelper = require("../../utils/eventsHelper");
|
||||
var _utils = require("../../utils");
|
||||
var _eventsHelper = require("../utils/eventsHelper");
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
|
||||
2
tvapp2/node_modules/playwright-core/lib/server/chromium/crDevTools.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/chromium/crDevTools.js
generated
vendored
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.CRDevTools = void 0;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
2
tvapp2/node_modules/playwright-core/lib/server/chromium/crDragDrop.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/chromium/crDragDrop.js
generated
vendored
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DragManager = void 0;
|
||||
var _utils = require("../../utils");
|
||||
var _crProtocolHelper = require("./crProtocolHelper");
|
||||
var _utils = require("../../utils");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
42
tvapp2/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js
generated
vendored
42
tvapp2/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js
generated
vendored
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.CRExecutionContext = void 0;
|
||||
exports.createHandle = createHandle;
|
||||
var _assert = require("../../utils/isomorphic/assert");
|
||||
var _crProtocolHelper = require("./crProtocolHelper");
|
||||
var js = _interopRequireWildcard(require("../javascript"));
|
||||
var _stackTrace = require("../../utils/stackTrace");
|
||||
var _stackTrace = require("../../utils/isomorphic/stackTrace");
|
||||
var _utilityScriptSerializers = require("../isomorphic/utilityScriptSerializers");
|
||||
var js = _interopRequireWildcard(require("../javascript"));
|
||||
var dom = _interopRequireWildcard(require("../dom"));
|
||||
var _protocolError = require("../protocolError");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
@@ -47,7 +50,7 @@ class CRExecutionContext {
|
||||
if (exceptionDetails) throw new js.JavaScriptErrorInEvaluate((0, _crProtocolHelper.getExceptionMessage)(exceptionDetails));
|
||||
return remoteObject.value;
|
||||
}
|
||||
async rawEvaluateHandle(expression) {
|
||||
async rawEvaluateHandle(context, expression) {
|
||||
const {
|
||||
exceptionDetails,
|
||||
result: remoteObject
|
||||
@@ -56,9 +59,9 @@ class CRExecutionContext {
|
||||
contextId: this._contextId
|
||||
}).catch(rewriteError);
|
||||
if (exceptionDetails) throw new js.JavaScriptErrorInEvaluate((0, _crProtocolHelper.getExceptionMessage)(exceptionDetails));
|
||||
return remoteObject.objectId;
|
||||
return createHandle(context, remoteObject);
|
||||
}
|
||||
async evaluateWithArguments(expression, returnByValue, utilityScript, values, objectIds) {
|
||||
async evaluateWithArguments(expression, returnByValue, utilityScript, values, handles) {
|
||||
const {
|
||||
exceptionDetails,
|
||||
result: remoteObject
|
||||
@@ -69,33 +72,31 @@ class CRExecutionContext {
|
||||
objectId: utilityScript._objectId
|
||||
}, ...values.map(value => ({
|
||||
value
|
||||
})), ...objectIds.map(objectId => ({
|
||||
objectId
|
||||
})), ...handles.map(handle => ({
|
||||
objectId: handle._objectId
|
||||
}))],
|
||||
returnByValue,
|
||||
awaitPromise: true,
|
||||
userGesture: true
|
||||
}).catch(rewriteError);
|
||||
if (exceptionDetails) throw new js.JavaScriptErrorInEvaluate((0, _crProtocolHelper.getExceptionMessage)(exceptionDetails));
|
||||
return returnByValue ? (0, _utilityScriptSerializers.parseEvaluationResultValue)(remoteObject.value) : utilityScript._context.createHandle(remoteObject);
|
||||
return returnByValue ? (0, _utilityScriptSerializers.parseEvaluationResultValue)(remoteObject.value) : createHandle(utilityScript._context, remoteObject);
|
||||
}
|
||||
async getProperties(context, objectId) {
|
||||
async getProperties(object) {
|
||||
const response = await this._client.send('Runtime.getProperties', {
|
||||
objectId,
|
||||
objectId: object._objectId,
|
||||
ownProperties: true
|
||||
});
|
||||
const result = new Map();
|
||||
for (const property of response.result) {
|
||||
if (!property.enumerable || !property.value) continue;
|
||||
result.set(property.name, context.createHandle(property.value));
|
||||
result.set(property.name, createHandle(object._context, property.value));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
createHandle(context, remoteObject) {
|
||||
return new js.JSHandle(context, remoteObject.subtype || remoteObject.type, renderPreview(remoteObject), remoteObject.objectId, potentiallyUnserializableValue(remoteObject));
|
||||
}
|
||||
async releaseHandle(objectId) {
|
||||
await (0, _crProtocolHelper.releaseObject)(this._client, objectId);
|
||||
async releaseHandle(handle) {
|
||||
if (!handle._objectId) return;
|
||||
await (0, _crProtocolHelper.releaseObject)(this._client, handle._objectId);
|
||||
}
|
||||
}
|
||||
exports.CRExecutionContext = CRExecutionContext;
|
||||
@@ -129,4 +130,11 @@ function renderPreview(object) {
|
||||
}
|
||||
if (object.subtype === 'array' && object.preview) return js.sparseArrayToString(object.preview.properties);
|
||||
return object.description;
|
||||
}
|
||||
function createHandle(context, remoteObject) {
|
||||
if (remoteObject.subtype === 'node') {
|
||||
(0, _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));
|
||||
}
|
||||
4
tvapp2/node_modules/playwright-core/lib/server/chromium/crInput.js
generated
vendored
4
tvapp2/node_modules/playwright-core/lib/server/chromium/crInput.js
generated
vendored
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.RawTouchscreenImpl = exports.RawMouseImpl = exports.RawKeyboardImpl = void 0;
|
||||
var _utils = require("../../utils");
|
||||
var input = _interopRequireWildcard(require("../input"));
|
||||
var _macEditingCommands = require("../macEditingCommands");
|
||||
var _utils = require("../../utils");
|
||||
var _crProtocolHelper = require("./crProtocolHelper");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
|
||||
8
tvapp2/node_modules/playwright-core/lib/server/chromium/crNetworkManager.js
generated
vendored
8
tvapp2/node_modules/playwright-core/lib/server/chromium/crNetworkManager.js
generated
vendored
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.CRNetworkManager = void 0;
|
||||
var _helper = require("../helper");
|
||||
var _eventsHelper = require("../../utils/eventsHelper");
|
||||
var network = _interopRequireWildcard(require("../network"));
|
||||
var _utils = require("../../utils");
|
||||
var _eventsHelper = require("../utils/eventsHelper");
|
||||
var _helper = require("../helper");
|
||||
var network = _interopRequireWildcard(require("../network"));
|
||||
var _protocolError = require("../protocolError");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
|
||||
41
tvapp2/node_modules/playwright-core/lib/server/chromium/crPage.js
generated
vendored
41
tvapp2/node_modules/playwright-core/lib/server/chromium/crPage.js
generated
vendored
@@ -5,16 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.CRPage = void 0;
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _eventsHelper = require("../../utils/eventsHelper");
|
||||
var _registry = require("../registry");
|
||||
var _stackTrace = require("../../utils/stackTrace");
|
||||
var _utils = require("../../utils");
|
||||
var _assert = require("../../utils/isomorphic/assert");
|
||||
var _crypto = require("../utils/crypto");
|
||||
var _eventsHelper = require("../utils/eventsHelper");
|
||||
var _stackTrace = require("../../utils/isomorphic/stackTrace");
|
||||
var dialog = _interopRequireWildcard(require("../dialog"));
|
||||
var dom = _interopRequireWildcard(require("../dom"));
|
||||
var frames = _interopRequireWildcard(require("../frames"));
|
||||
var _helper = require("../helper");
|
||||
var network = _interopRequireWildcard(require("../network"));
|
||||
var _page = require("../page");
|
||||
var _registry = require("../registry");
|
||||
var _crAccessibility = require("./crAccessibility");
|
||||
var _crBrowser = require("./crBrowser");
|
||||
var _crCoverage = require("./crCoverage");
|
||||
@@ -30,8 +31,8 @@ var _browserContext = require("../browserContext");
|
||||
var _errors = require("../errors");
|
||||
var _protocolError = require("../protocolError");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
@@ -251,9 +252,6 @@ class CRPage {
|
||||
async getOwnerFrame(handle) {
|
||||
return this._sessionForHandle(handle)._getOwnerFrame(handle);
|
||||
}
|
||||
isElementHandle(remoteObject) {
|
||||
return remoteObject.subtype === 'node';
|
||||
}
|
||||
async getBoundingBox(handle) {
|
||||
return this._sessionForHandle(handle)._getBoundingBox(handle);
|
||||
}
|
||||
@@ -278,9 +276,6 @@ class CRPage {
|
||||
async getContentQuads(handle) {
|
||||
return this._sessionForHandle(handle)._getContentQuads(handle);
|
||||
}
|
||||
async setInputFiles(handle, files) {
|
||||
await handle.evaluateInUtility(([injected, node, files]) => injected.setInputFiles(node, files), files);
|
||||
}
|
||||
async setInputFilePaths(handle, files) {
|
||||
const frame = await handle.ownerFrame();
|
||||
if (!frame) throw new Error('Cannot set input files to detached input element');
|
||||
@@ -386,7 +381,7 @@ class FrameSession {
|
||||
}
|
||||
let screencastOptions;
|
||||
if (!isSettingStorageState && this._isMainFrame() && this._crPage._browserContext._options.recordVideo && hasUIWindow) {
|
||||
const screencastId = (0, _utils.createGuid)();
|
||||
const screencastId = (0, _crypto.createGuid)();
|
||||
const outputFile = _path.default.join(this._crPage._browserContext._options.recordVideo.dir, screencastId + '.webm');
|
||||
screencastOptions = {
|
||||
// validateBrowserContextOptions ensures correct video size.
|
||||
@@ -576,7 +571,6 @@ class FrameSession {
|
||||
let worldName = null;
|
||||
if (contextPayload.auxData && !!contextPayload.auxData.isDefault) worldName = 'main';else if (contextPayload.name === UTILITY_WORLD_NAME) worldName = 'utility';
|
||||
const context = new dom.FrameExecutionContext(delegate, frame, worldName);
|
||||
context[contextDelegateSymbol] = delegate;
|
||||
if (worldName) frame._contextCreated(worldName, context);
|
||||
this._contextIdToContext.set(contextPayload.id, context);
|
||||
}
|
||||
@@ -630,7 +624,7 @@ class FrameSession {
|
||||
session.on('Target.attachedToTarget', event => this._onAttachedToTarget(event));
|
||||
session.on('Target.detachedFromTarget', event => this._onDetachedFromTarget(event));
|
||||
session.on('Runtime.consoleAPICalled', event => {
|
||||
const args = event.args.map(o => worker._existingExecutionContext.createHandle(o));
|
||||
const args = event.args.map(o => (0, _crExecutionContext.createHandle)(worker._existingExecutionContext, o));
|
||||
this._page._addConsoleMessage(event.type, args, (0, _crProtocolHelper.toConsoleMessageLocation)(event.stackTrace));
|
||||
});
|
||||
session.on('Runtime.exceptionThrown', exception => this._page.emitOnContextOnceInitialized(_browserContext.BrowserContext.Events.PageError, (0, _crProtocolHelper.exceptionToError)(exception.exceptionDetails), this._page));
|
||||
@@ -687,7 +681,7 @@ class FrameSession {
|
||||
}
|
||||
const context = this._contextIdToContext.get(event.executionContextId);
|
||||
if (!context) return;
|
||||
const values = event.args.map(arg => context.createHandle(arg));
|
||||
const values = event.args.map(arg => (0, _crExecutionContext.createHandle)(context, arg));
|
||||
this._page._addConsoleMessage(event.type, values, (0, _crProtocolHelper.toConsoleMessageLocation)(event.stackTrace));
|
||||
}
|
||||
async _onBindingCalled(event) {
|
||||
@@ -770,14 +764,14 @@ class FrameSession {
|
||||
});
|
||||
}
|
||||
async _createVideoRecorder(screencastId, options) {
|
||||
(0, _utils.assert)(!this._screencastId);
|
||||
(0, _assert.assert)(!this._screencastId);
|
||||
const ffmpegPath = _registry.registry.findExecutable('ffmpeg').executablePathOrDie(this._page.attribution.playwright.options.sdkLanguage);
|
||||
this._videoRecorder = await _videoRecorder.VideoRecorder.launch(this._crPage._page, ffmpegPath, options);
|
||||
this._screencastId = screencastId;
|
||||
}
|
||||
async _startVideoRecording(options) {
|
||||
const screencastId = this._screencastId;
|
||||
(0, _utils.assert)(screencastId);
|
||||
(0, _assert.assert)(screencastId);
|
||||
this._page.once(_page.Page.Events.Close, () => this._stopVideoRecording().catch(() => {}));
|
||||
const gotFirstFrame = new Promise(f => this._client.once('Page.screencastFrame', f));
|
||||
await this._startScreencast(this._videoRecorder, {
|
||||
@@ -818,7 +812,7 @@ class FrameSession {
|
||||
}
|
||||
async _updateViewport(preserveWindowBoundaries) {
|
||||
if (this._crPage._browserContext._browser.isClank()) return;
|
||||
(0, _utils.assert)(this._isMainFrame());
|
||||
(0, _assert.assert)(this._isMainFrame());
|
||||
const options = this._crPage._browserContext._options;
|
||||
const emulatedSize = this._page.emulatedSize();
|
||||
if (emulatedSize === null) return;
|
||||
@@ -903,6 +897,7 @@ class FrameSession {
|
||||
const colorScheme = emulatedMedia.colorScheme === 'no-override' ? '' : emulatedMedia.colorScheme;
|
||||
const reducedMotion = emulatedMedia.reducedMotion === 'no-override' ? '' : emulatedMedia.reducedMotion;
|
||||
const forcedColors = emulatedMedia.forcedColors === 'no-override' ? '' : emulatedMedia.forcedColors;
|
||||
const contrast = emulatedMedia.contrast === 'no-override' ? '' : emulatedMedia.contrast;
|
||||
const features = [{
|
||||
name: 'prefers-color-scheme',
|
||||
value: colorScheme
|
||||
@@ -912,6 +907,9 @@ class FrameSession {
|
||||
}, {
|
||||
name: 'forced-colors',
|
||||
value: forcedColors
|
||||
}, {
|
||||
name: 'prefers-contrast',
|
||||
value: contrast
|
||||
}];
|
||||
await this._client.send('Emulation.setEmulatedMedia', {
|
||||
media,
|
||||
@@ -1047,10 +1045,10 @@ class FrameSession {
|
||||
async _adoptBackendNodeId(backendNodeId, to) {
|
||||
const result = await this._client._sendMayFail('DOM.resolveNode', {
|
||||
backendNodeId,
|
||||
executionContextId: to[contextDelegateSymbol]._contextId
|
||||
executionContextId: to.delegate._contextId
|
||||
});
|
||||
if (!result || result.object.subtype === 'null') throw new Error(dom.kUnableToAdoptErrorMessage);
|
||||
return to.createHandle(result.object).asElement();
|
||||
return (0, _crExecutionContext.createHandle)(to, result.object).asElement();
|
||||
}
|
||||
}
|
||||
async function emulateLocale(session, locale) {
|
||||
@@ -1077,7 +1075,6 @@ async function emulateTimezone(session, timezoneId) {
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
const contextDelegateSymbol = Symbol('delegate');
|
||||
|
||||
// Chromium reference: https://source.chromium.org/chromium/chromium/src/+/main:components/embedder_support/user_agent_utils.cc;l=434;drc=70a6711e08e9f9e0d8e4c48e9ba5cab62eb010c2
|
||||
function calculateUserAgentMetadata(options) {
|
||||
|
||||
2
tvapp2/node_modules/playwright-core/lib/server/chromium/crPdf.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/chromium/crPdf.js
generated
vendored
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.CRPDF = void 0;
|
||||
var _utils = require("../../utils");
|
||||
var _crProtocolHelper = require("./crProtocolHelper");
|
||||
var _utils = require("../../utils");
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
|
||||
6
tvapp2/node_modules/playwright-core/lib/server/chromium/crProtocolHelper.js
generated
vendored
6
tvapp2/node_modules/playwright-core/lib/server/chromium/crProtocolHelper.js
generated
vendored
@@ -12,9 +12,9 @@ exports.toButtonsMask = toButtonsMask;
|
||||
exports.toConsoleMessageLocation = toConsoleMessageLocation;
|
||||
exports.toModifiersMask = toModifiersMask;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _fileUtils = require("../../utils/fileUtils");
|
||||
var _stackTrace = require("../../utils/stackTrace");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _stackTrace = require("../../utils/isomorphic/stackTrace");
|
||||
var _fileUtils = require("../utils/fileUtils");
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
|
||||
4
tvapp2/node_modules/playwright-core/lib/server/chromium/crServiceWorker.js
generated
vendored
4
tvapp2/node_modules/playwright-core/lib/server/chromium/crServiceWorker.js
generated
vendored
@@ -7,10 +7,10 @@ exports.CRServiceWorker = void 0;
|
||||
var _page = require("../page");
|
||||
var _crExecutionContext = require("./crExecutionContext");
|
||||
var _crNetworkManager = require("./crNetworkManager");
|
||||
var network = _interopRequireWildcard(require("../network"));
|
||||
var _browserContext = require("../browserContext");
|
||||
var network = _interopRequireWildcard(require("../network"));
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
6
tvapp2/node_modules/playwright-core/lib/server/chromium/videoRecorder.js
generated
vendored
6
tvapp2/node_modules/playwright-core/lib/server/chromium/videoRecorder.js
generated
vendored
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.VideoRecorder = void 0;
|
||||
var _utils = require("../../utils");
|
||||
var _page = require("../page");
|
||||
var _processLauncher = require("../../utils/processLauncher");
|
||||
var _progress = require("../progress");
|
||||
var _instrumentation = require("../instrumentation");
|
||||
var _page = require("../page");
|
||||
var _processLauncher = require("../utils/processLauncher");
|
||||
var _progress = require("../progress");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
2
tvapp2/node_modules/playwright-core/lib/server/clock.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/clock.js
generated
vendored
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.Clock = void 0;
|
||||
var clockSource = _interopRequireWildcard(require("../generated/clockSource"));
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
2
tvapp2/node_modules/playwright-core/lib/server/codegen/javascript.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/codegen/javascript.js
generated
vendored
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.JavaScriptLanguageGenerator = exports.JavaScriptFormatter = void 0;
|
||||
exports.quoteMultiline = quoteMultiline;
|
||||
var _language = require("./language");
|
||||
var _deviceDescriptors = require("../deviceDescriptors");
|
||||
var _utils = require("../../utils");
|
||||
var _deviceDescriptors = require("../deviceDescriptors");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
4
tvapp2/node_modules/playwright-core/lib/server/codegen/languages.js
generated
vendored
4
tvapp2/node_modules/playwright-core/lib/server/codegen/languages.js
generated
vendored
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.languageSet = languageSet;
|
||||
var _csharp = require("./csharp");
|
||||
var _java = require("./java");
|
||||
var _javascript = require("./javascript");
|
||||
var _jsonl = require("./jsonl");
|
||||
var _csharp = require("./csharp");
|
||||
var _python = require("./python");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
@@ -26,5 +26,5 @@ var _python = require("./python");
|
||||
*/
|
||||
|
||||
function languageSet() {
|
||||
return new Set([new _java.JavaLanguageGenerator('junit'), new _java.JavaLanguageGenerator('library'), new _javascript.JavaScriptLanguageGenerator( /* isPlaywrightTest */false), new _javascript.JavaScriptLanguageGenerator( /* isPlaywrightTest */true), new _python.PythonLanguageGenerator( /* isAsync */false, /* isPytest */true), new _python.PythonLanguageGenerator( /* isAsync */false, /* isPytest */false), new _python.PythonLanguageGenerator( /* isAsync */true, /* isPytest */false), new _csharp.CSharpLanguageGenerator('mstest'), new _csharp.CSharpLanguageGenerator('nunit'), new _csharp.CSharpLanguageGenerator('library'), new _jsonl.JsonlLanguageGenerator()]);
|
||||
return new Set([new _java.JavaLanguageGenerator('junit'), new _java.JavaLanguageGenerator('library'), new _javascript.JavaScriptLanguageGenerator(/* isPlaywrightTest */false), new _javascript.JavaScriptLanguageGenerator(/* isPlaywrightTest */true), new _python.PythonLanguageGenerator(/* isAsync */false, /* isPytest */true), new _python.PythonLanguageGenerator(/* isAsync */false, /* isPytest */false), new _python.PythonLanguageGenerator(/* isAsync */true, /* isPytest */false), new _csharp.CSharpLanguageGenerator('mstest'), new _csharp.CSharpLanguageGenerator('nunit'), new _csharp.CSharpLanguageGenerator('library'), new _jsonl.JsonlLanguageGenerator()]);
|
||||
}
|
||||
8
tvapp2/node_modules/playwright-core/lib/server/debugController.js
generated
vendored
8
tvapp2/node_modules/playwright-core/lib/server/debugController.js
generated
vendored
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DebugController = void 0;
|
||||
var _processLauncher = require("../utils/processLauncher");
|
||||
var _instrumentation = require("./instrumentation");
|
||||
var _processLauncher = require("./utils/processLauncher");
|
||||
var _recorder = require("./recorder");
|
||||
var _recorderApp = require("./recorder/recorderApp");
|
||||
var _utils = require("../utils");
|
||||
var _utilsBundle = require("../utilsBundle");
|
||||
var _locatorParser = require("../utils/isomorphic/locatorParser");
|
||||
var _ariaSnapshot = require("../utils/isomorphic/ariaSnapshot");
|
||||
var _utilsBundle = require("../utilsBundle");
|
||||
var _recorderApp = require("./recorder/recorderApp");
|
||||
var _locatorParser = require("../utils/isomorphic/locatorParser");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
2
tvapp2/node_modules/playwright-core/lib/server/deviceDescriptors.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/deviceDescriptors.js
generated
vendored
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.deviceDescriptors = void 0;
|
||||
var _deviceDescriptorsSource = _interopRequireDefault(require("./deviceDescriptorsSource.json"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright 2017 Google Inc. All rights reserved.
|
||||
* Modifications copyright (c) Microsoft Corporation.
|
||||
|
||||
274
tvapp2/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json
generated
vendored
274
tvapp2/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json
generated
vendored
File diff suppressed because it is too large
Load Diff
2
tvapp2/node_modules/playwright-core/lib/server/dispatchers/androidDispatcher.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/dispatchers/androidDispatcher.js
generated
vendored
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AndroidSocketDispatcher = exports.AndroidDispatcher = exports.AndroidDeviceDispatcher = void 0;
|
||||
var _browserContextDispatcher = require("./browserContextDispatcher");
|
||||
var _dispatcher = require("./dispatcher");
|
||||
var _android = require("../android/android");
|
||||
var _browserContextDispatcher = require("./browserContextDispatcher");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
6
tvapp2/node_modules/playwright-core/lib/server/dispatchers/artifactDispatcher.js
generated
vendored
6
tvapp2/node_modules/playwright-core/lib/server/dispatchers/artifactDispatcher.js
generated
vendored
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ArtifactDispatcher = void 0;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _dispatcher = require("./dispatcher");
|
||||
var _streamDispatcher = require("./streamDispatcher");
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _fileUtils = require("../../utils/fileUtils");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _fileUtils = require("../utils/fileUtils");
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
44
tvapp2/node_modules/playwright-core/lib/server/dispatchers/browserContextDispatcher.js
generated
vendored
44
tvapp2/node_modules/playwright-core/lib/server/dispatchers/browserContextDispatcher.js
generated
vendored
@@ -4,26 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BrowserContextDispatcher = void 0;
|
||||
var _fs = _interopRequireDefault(require("fs"));
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
var _browserContext = require("../browserContext");
|
||||
var _dispatcher = require("./dispatcher");
|
||||
var _pageDispatcher = require("./pageDispatcher");
|
||||
var _networkDispatchers = require("./networkDispatchers");
|
||||
var _crBrowser = require("../chromium/crBrowser");
|
||||
var _cdpSessionDispatcher = require("./cdpSessionDispatcher");
|
||||
var _recorder = require("../recorder");
|
||||
var _artifactDispatcher = require("./artifactDispatcher");
|
||||
var _tracingDispatcher = require("./tracingDispatcher");
|
||||
var fs = _interopRequireWildcard(require("fs"));
|
||||
var path = _interopRequireWildcard(require("path"));
|
||||
var _utils = require("../../utils");
|
||||
var _writableStreamDispatcher = require("./writableStreamDispatcher");
|
||||
var _cdpSessionDispatcher = require("./cdpSessionDispatcher");
|
||||
var _dialogDispatcher = require("./dialogDispatcher");
|
||||
var _errors = require("../errors");
|
||||
var _dispatcher = require("./dispatcher");
|
||||
var _elementHandlerDispatcher = require("./elementHandlerDispatcher");
|
||||
var _recorderApp = require("../recorder/recorderApp");
|
||||
var _networkDispatchers = require("./networkDispatchers");
|
||||
var _pageDispatcher = require("./pageDispatcher");
|
||||
var _crBrowser = require("../chromium/crBrowser");
|
||||
var _errors = require("../errors");
|
||||
var _recorder = require("../recorder");
|
||||
var _tracingDispatcher = require("./tracingDispatcher");
|
||||
var _webSocketRouteDispatcher = require("./webSocketRouteDispatcher");
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
var _writableStreamDispatcher = require("./writableStreamDispatcher");
|
||||
var _crypto = require("../utils/crypto");
|
||||
var _urlMatch = require("../../utils/isomorphic/urlMatch");
|
||||
var _recorderApp = require("../recorder/recorderApp");
|
||||
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -186,19 +186,19 @@ class BrowserContextDispatcher extends _dispatcher.Dispatcher {
|
||||
}
|
||||
async createTempFiles(params) {
|
||||
const dir = this._context._browser.options.artifactsDir;
|
||||
const tmpDir = path.join(dir, 'upload-' + (0, _utils.createGuid)());
|
||||
const tempDirWithRootName = params.rootDirName ? path.join(tmpDir, path.basename(params.rootDirName)) : tmpDir;
|
||||
await fs.promises.mkdir(tempDirWithRootName, {
|
||||
const tmpDir = _path.default.join(dir, 'upload-' + (0, _crypto.createGuid)());
|
||||
const tempDirWithRootName = params.rootDirName ? _path.default.join(tmpDir, _path.default.basename(params.rootDirName)) : tmpDir;
|
||||
await _fs.default.promises.mkdir(tempDirWithRootName, {
|
||||
recursive: true
|
||||
});
|
||||
this._context._tempDirs.push(tmpDir);
|
||||
return {
|
||||
rootDir: params.rootDirName ? new _writableStreamDispatcher.WritableStreamDispatcher(this, tempDirWithRootName) : undefined,
|
||||
writableStreams: await Promise.all(params.items.map(async item => {
|
||||
await fs.promises.mkdir(path.dirname(path.join(tempDirWithRootName, item.name)), {
|
||||
await _fs.default.promises.mkdir(_path.default.dirname(_path.default.join(tempDirWithRootName, item.name)), {
|
||||
recursive: true
|
||||
});
|
||||
const file = fs.createWriteStream(path.join(tempDirWithRootName, item.name));
|
||||
const file = _fs.default.createWriteStream(_path.default.join(tempDirWithRootName, item.name));
|
||||
return new _writableStreamDispatcher.WritableStreamDispatcher(this, file, item.lastModifiedMs);
|
||||
}))
|
||||
};
|
||||
@@ -273,7 +273,7 @@ class BrowserContextDispatcher extends _dispatcher.Dispatcher {
|
||||
}
|
||||
const urlMatchers = params.patterns.map(pattern => pattern.regexSource ? new RegExp(pattern.regexSource, pattern.regexFlags) : pattern.glob);
|
||||
await this._context.setRequestInterceptor((route, request) => {
|
||||
const matchesSome = urlMatchers.some(urlMatch => (0, _utils.urlMatches)(this._context._options.baseURL, request.url(), urlMatch));
|
||||
const matchesSome = urlMatchers.some(urlMatch => (0, _urlMatch.urlMatches)(this._context._options.baseURL, request.url(), urlMatch));
|
||||
if (!matchesSome) return false;
|
||||
this._dispatchEvent('route', {
|
||||
route: _networkDispatchers.RouteDispatcher.from(_networkDispatchers.RequestDispatcher.from(this, request), route)
|
||||
@@ -286,7 +286,7 @@ class BrowserContextDispatcher extends _dispatcher.Dispatcher {
|
||||
if (params.patterns.length) await _webSocketRouteDispatcher.WebSocketRouteDispatcher.installIfNeeded(this._context);
|
||||
}
|
||||
async storageState(params, metadata) {
|
||||
return await this._context.storageState();
|
||||
return await this._context.storageState(params.indexedDB);
|
||||
}
|
||||
async close(params, metadata) {
|
||||
metadata.potentiallyClosesScope = true;
|
||||
|
||||
2
tvapp2/node_modules/playwright-core/lib/server/dispatchers/browserTypeDispatcher.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/dispatchers/browserTypeDispatcher.js
generated
vendored
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BrowserTypeDispatcher = void 0;
|
||||
var _browserContextDispatcher = require("./browserContextDispatcher");
|
||||
var _browserDispatcher = require("./browserDispatcher");
|
||||
var _dispatcher = require("./dispatcher");
|
||||
var _browserContextDispatcher = require("./browserContextDispatcher");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
2
tvapp2/node_modules/playwright-core/lib/server/dispatchers/cdpSessionDispatcher.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/dispatchers/cdpSessionDispatcher.js
generated
vendored
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.CDPSessionDispatcher = void 0;
|
||||
var _crConnection = require("../chromium/crConnection");
|
||||
var _dispatcher = require("./dispatcher");
|
||||
var _crConnection = require("../chromium/crConnection");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
52
tvapp2/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js
generated
vendored
52
tvapp2/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js
generated
vendored
@@ -7,12 +7,14 @@ exports.dispatcherSymbol = exports.RootDispatcher = exports.DispatcherConnection
|
||||
exports.existingDispatcher = existingDispatcher;
|
||||
exports.setMaxDispatchersForTest = setMaxDispatchersForTest;
|
||||
var _events = require("events");
|
||||
var _eventsHelper = require("../utils/eventsHelper");
|
||||
var _validator = require("../../protocol/validator");
|
||||
var _utils = require("../../utils");
|
||||
var _debug = require("../utils/debug");
|
||||
var _errors = require("../errors");
|
||||
var _instrumentation = require("../instrumentation");
|
||||
var _eventsHelper = require("../..//utils/eventsHelper");
|
||||
var _protocolError = require("../protocolError");
|
||||
var _callLog = require("../callLog");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -39,8 +41,8 @@ function setMaxDispatchersForTest(value) {
|
||||
maxDispatchersOverride = value;
|
||||
}
|
||||
function maxDispatchersForBucket(gcBucket) {
|
||||
var _ref, _maxDispatchersOverri;
|
||||
return (_ref = (_maxDispatchersOverri = maxDispatchersOverride) !== null && _maxDispatchersOverri !== void 0 ? _maxDispatchersOverri : {
|
||||
var _ref;
|
||||
return (_ref = maxDispatchersOverride !== null && maxDispatchersOverride !== void 0 ? maxDispatchersOverride : {
|
||||
'JSHandle': 100000,
|
||||
'ElementHandle': 100000
|
||||
}[gcBucket]) !== null && _ref !== void 0 ? _ref : 10000;
|
||||
@@ -101,7 +103,7 @@ class Dispatcher extends _events.EventEmitter {
|
||||
}
|
||||
_dispatchEvent(method, params) {
|
||||
if (this._disposed) {
|
||||
if ((0, _utils.isUnderTest)()) throw new Error(`${this._guid} is sending "${String(method)}" event after being disposed`);
|
||||
if ((0, _debug.isUnderTest)()) throw new Error(`${this._guid} is sending "${String(method)}" event after being disposed`);
|
||||
// Just ignore this event outside of tests.
|
||||
return;
|
||||
}
|
||||
@@ -171,10 +173,7 @@ class DispatcherConnection {
|
||||
}
|
||||
sendEvent(dispatcher, event, params) {
|
||||
const validator = (0, _validator.findValidator)(dispatcher._type, event, 'Event');
|
||||
params = validator(params, '', {
|
||||
tChannelImpl: this._tChannelImplToWire.bind(this),
|
||||
binary: this._isLocal ? 'buffer' : 'toBase64'
|
||||
});
|
||||
params = validator(params, '', this._validatorToWireContext());
|
||||
this.onmessage({
|
||||
guid: dispatcher._guid,
|
||||
method: event,
|
||||
@@ -183,10 +182,7 @@ class DispatcherConnection {
|
||||
}
|
||||
sendCreate(parent, type, guid, initializer) {
|
||||
const validator = (0, _validator.findValidator)(type, '', 'Initializer');
|
||||
initializer = validator(initializer, '', {
|
||||
tChannelImpl: this._tChannelImplToWire.bind(this),
|
||||
binary: this._isLocal ? 'buffer' : 'toBase64'
|
||||
});
|
||||
initializer = validator(initializer, '', this._validatorToWireContext());
|
||||
this.onmessage({
|
||||
guid: parent._guid,
|
||||
method: '__create__',
|
||||
@@ -215,6 +211,20 @@ class DispatcherConnection {
|
||||
}
|
||||
});
|
||||
}
|
||||
_validatorToWireContext() {
|
||||
return {
|
||||
tChannelImpl: this._tChannelImplToWire.bind(this),
|
||||
binary: this._isLocal ? 'buffer' : 'toBase64',
|
||||
isUnderTest: _debug.isUnderTest
|
||||
};
|
||||
}
|
||||
_validatorFromWireContext() {
|
||||
return {
|
||||
tChannelImpl: this._tChannelImplFromWire.bind(this),
|
||||
binary: this._isLocal ? 'buffer' : 'fromBase64',
|
||||
isUnderTest: _debug.isUnderTest
|
||||
};
|
||||
}
|
||||
_tChannelImplFromWire(names, arg, path, context) {
|
||||
if (arg && typeof arg === 'object' && typeof arg.guid === 'string') {
|
||||
const guid = arg.guid;
|
||||
@@ -278,14 +288,9 @@ class DispatcherConnection {
|
||||
let validMetadata;
|
||||
try {
|
||||
const validator = (0, _validator.findValidator)(dispatcher._type, method, 'Params');
|
||||
validParams = validator(params, '', {
|
||||
tChannelImpl: this._tChannelImplFromWire.bind(this),
|
||||
binary: this._isLocal ? 'buffer' : 'fromBase64'
|
||||
});
|
||||
validMetadata = metadataValidator(metadata, '', {
|
||||
tChannelImpl: this._tChannelImplFromWire.bind(this),
|
||||
binary: this._isLocal ? 'buffer' : 'fromBase64'
|
||||
});
|
||||
const validatorContext = this._validatorFromWireContext();
|
||||
validParams = validator(params, '', validatorContext);
|
||||
validMetadata = metadataValidator(metadata, '', validatorContext);
|
||||
if (typeof dispatcher[method] !== 'function') throw new Error(`Mismatching dispatcher: "${dispatcher._type}" does not implement "${method}"`);
|
||||
} catch (e) {
|
||||
this.onmessage({
|
||||
@@ -360,10 +365,7 @@ class DispatcherConnection {
|
||||
try {
|
||||
const result = await dispatcher._handleCommand(callMetadata, method, validParams);
|
||||
const validator = (0, _validator.findValidator)(dispatcher._type, method, 'Result');
|
||||
response.result = validator(result, '', {
|
||||
tChannelImpl: this._tChannelImplToWire.bind(this),
|
||||
binary: this._isLocal ? 'buffer' : 'toBase64'
|
||||
});
|
||||
response.result = validator(result, '', this._validatorToWireContext());
|
||||
callMetadata.result = result;
|
||||
} catch (e) {
|
||||
if ((0, _errors.isTargetClosedError)(e) && sdkObject) {
|
||||
@@ -384,7 +386,7 @@ class DispatcherConnection {
|
||||
callMetadata.endTime = (0, _utils.monotonicTime)();
|
||||
await (sdkObject === null || sdkObject === void 0 ? void 0 : sdkObject.instrumentation.onAfterCall(sdkObject, callMetadata));
|
||||
}
|
||||
if (response.error) response.log = (0, _utils.compressCallLog)(callMetadata.log);
|
||||
if (response.error) response.log = (0, _callLog.compressCallLog)(callMetadata.log);
|
||||
this.onmessage(response);
|
||||
}
|
||||
}
|
||||
|
||||
6
tvapp2/node_modules/playwright-core/lib/server/dispatchers/electronDispatcher.js
generated
vendored
6
tvapp2/node_modules/playwright-core/lib/server/dispatchers/electronDispatcher.js
generated
vendored
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ElectronDispatcher = exports.ElectronApplicationDispatcher = void 0;
|
||||
var _dispatcher = require("./dispatcher");
|
||||
var _electron = require("../electron/electron");
|
||||
var _browserContextDispatcher = require("./browserContextDispatcher");
|
||||
var _jsHandleDispatcher = require("./jsHandleDispatcher");
|
||||
var _dispatcher = require("./dispatcher");
|
||||
var _elementHandlerDispatcher = require("./elementHandlerDispatcher");
|
||||
var _jsHandleDispatcher = require("./jsHandleDispatcher");
|
||||
var _electron = require("../electron/electron");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
|
||||
11
tvapp2/node_modules/playwright-core/lib/server/dispatchers/elementHandlerDispatcher.js
generated
vendored
11
tvapp2/node_modules/playwright-core/lib/server/dispatchers/elementHandlerDispatcher.js
generated
vendored
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ElementHandleDispatcher = void 0;
|
||||
var _dispatcher = require("./dispatcher");
|
||||
var _jsHandleDispatcher = require("./jsHandleDispatcher");
|
||||
var _frameDispatcher = require("./frameDispatcher");
|
||||
var _browserContextDispatcher = require("./browserContextDispatcher");
|
||||
var _dispatcher = require("./dispatcher");
|
||||
var _frameDispatcher = require("./frameDispatcher");
|
||||
var _jsHandleDispatcher = require("./jsHandleDispatcher");
|
||||
var _pageDispatcher = require("./pageDispatcher");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
@@ -56,6 +56,11 @@ class ElementHandleDispatcher extends _jsHandleDispatcher.JSHandleDispatcher {
|
||||
frame: frame ? _frameDispatcher.FrameDispatcher.from(this._browserContextDispatcher(), frame) : undefined
|
||||
};
|
||||
}
|
||||
async generateLocatorString(params, metadata) {
|
||||
return {
|
||||
value: await this._elementHandle.generateLocatorString()
|
||||
};
|
||||
}
|
||||
async getAttribute(params, metadata) {
|
||||
const value = await this._elementHandle.getAttribute(metadata, params.name);
|
||||
return {
|
||||
|
||||
2
tvapp2/node_modules/playwright-core/lib/server/dispatchers/frameDispatcher.js
generated
vendored
2
tvapp2/node_modules/playwright-core/lib/server/dispatchers/frameDispatcher.js
generated
vendored
@@ -9,7 +9,6 @@ var _dispatcher = require("./dispatcher");
|
||||
var _elementHandlerDispatcher = require("./elementHandlerDispatcher");
|
||||
var _jsHandleDispatcher = require("./jsHandleDispatcher");
|
||||
var _networkDispatchers = require("./networkDispatchers");
|
||||
var _utils = require("../../utils");
|
||||
var _ariaSnapshot = require("../../utils/isomorphic/ariaSnapshot");
|
||||
var _utilsBundle = require("../../utilsBundle");
|
||||
/**
|
||||
@@ -41,7 +40,6 @@ class FrameDispatcher extends _dispatcher.Dispatcher {
|
||||
// Main frames are gc'ed separately from any other frames, so that
|
||||
// methods on Page that redirect to the main frame remain operational.
|
||||
// Note: we cannot check parentFrame() here because it may be null after the frame has been detached.
|
||||
(0, _utils.debugAssert)(frame._page.mainFrame(), 'Cannot determine whether the frame is a main frame');
|
||||
const gcBucket = frame._page.mainFrame() === frame ? 'MainFrame' : 'Frame';
|
||||
const pageDispatcher = (0, _dispatcher.existingDispatcher)(frame._page);
|
||||
super(pageDispatcher || scope, frame, 'Frame', {
|
||||
|
||||
4
tvapp2/node_modules/playwright-core/lib/server/dispatchers/jsonPipeDispatcher.js
generated
vendored
4
tvapp2/node_modules/playwright-core/lib/server/dispatchers/jsonPipeDispatcher.js
generated
vendored
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.JsonPipeDispatcher = void 0;
|
||||
var _dispatcher = require("./dispatcher");
|
||||
var _utils = require("../../utils");
|
||||
var _crypto = require("../utils/crypto");
|
||||
/**
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
@@ -25,7 +25,7 @@ var _utils = require("../../utils");
|
||||
class JsonPipeDispatcher extends _dispatcher.Dispatcher {
|
||||
constructor(scope) {
|
||||
super(scope, {
|
||||
guid: 'jsonPipe@' + (0, _utils.createGuid)()
|
||||
guid: 'jsonPipe@' + (0, _crypto.createGuid)()
|
||||
}, 'JsonPipe', {});
|
||||
this._type_JsonPipe = true;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user