@remotion/renderer 3.0.19 → 3.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/get-audio-channels.d.ts +4 -2
- package/dist/assets/get-audio-channels.js +14 -3
- package/dist/browser/Browser.d.ts +209 -0
- package/dist/browser/Browser.js +402 -0
- package/dist/browser/BrowserConnector.d.ts +19 -0
- package/dist/browser/BrowserConnector.js +17 -0
- package/dist/browser/BrowserFetcher.d.ts +89 -0
- package/dist/browser/BrowserFetcher.js +492 -0
- package/dist/browser/BrowserRunner.d.ts +39 -0
- package/dist/browser/BrowserRunner.js +308 -0
- package/dist/browser/Connection.d.ts +49 -0
- package/dist/browser/Connection.js +262 -0
- package/dist/browser/ConnectionTransport.d.ts +21 -0
- package/dist/browser/ConnectionTransport.js +17 -0
- package/dist/browser/ConsoleMessage.d.ts +31 -0
- package/dist/browser/ConsoleMessage.js +48 -0
- package/dist/browser/DOMWorld.d.ts +50 -0
- package/dist/browser/DOMWorld.js +280 -0
- package/dist/browser/EmulationManager.d.ts +7 -0
- package/dist/browser/EmulationManager.js +40 -0
- package/dist/browser/Errors.d.ts +25 -0
- package/dist/browser/Errors.js +35 -0
- package/dist/browser/EvalTypes.d.ts +27 -0
- package/dist/browser/EvalTypes.js +17 -0
- package/dist/browser/EventEmitter.d.ts +70 -0
- package/dist/browser/EventEmitter.js +102 -0
- package/dist/browser/ExecutionContext.d.ts +33 -0
- package/dist/browser/ExecutionContext.js +174 -0
- package/dist/browser/FrameManager.d.ts +96 -0
- package/dist/browser/FrameManager.js +512 -0
- package/dist/browser/HTTPRequest.d.ts +28 -0
- package/dist/browser/HTTPRequest.js +37 -0
- package/dist/browser/HTTPResponse.d.ts +22 -0
- package/dist/browser/HTTPResponse.js +33 -0
- package/dist/browser/JSHandle.d.ts +36 -0
- package/dist/browser/JSHandle.js +93 -0
- package/dist/browser/LaunchOptions.d.ts +117 -0
- package/dist/browser/LaunchOptions.js +17 -0
- package/dist/browser/Launcher.d.ts +9 -0
- package/dist/browser/Launcher.js +602 -0
- package/dist/browser/LifecycleWatcher.d.ts +29 -0
- package/dist/browser/LifecycleWatcher.js +193 -0
- package/dist/browser/NetworkEventManager.d.ts +35 -0
- package/dist/browser/NetworkEventManager.js +128 -0
- package/dist/browser/NetworkManager.d.ts +36 -0
- package/dist/browser/NetworkManager.js +280 -0
- package/dist/browser/NodeWebSocketTransport.d.ts +17 -0
- package/dist/browser/NodeWebSocketTransport.js +90 -0
- package/dist/browser/Page.d.ts +74 -0
- package/dist/browser/Page.js +282 -0
- package/dist/browser/Product.d.ts +16 -0
- package/dist/browser/Product.js +17 -0
- package/dist/browser/PuppeteerNode.d.ts +89 -0
- package/dist/browser/PuppeteerNode.js +135 -0
- package/dist/browser/PuppeteerViewport.d.ts +5 -0
- package/dist/browser/PuppeteerViewport.js +2 -0
- package/dist/browser/ScreenshotOptions.d.ts +14 -0
- package/dist/browser/ScreenshotOptions.js +2 -0
- package/dist/browser/Target.d.ts +61 -0
- package/dist/browser/Target.js +146 -0
- package/dist/browser/TaskQueue.d.ts +20 -0
- package/dist/browser/TaskQueue.js +47 -0
- package/dist/browser/TimeoutSettings.d.ts +23 -0
- package/dist/browser/TimeoutSettings.js +62 -0
- package/dist/browser/assert.d.ts +21 -0
- package/dist/browser/assert.js +29 -0
- package/dist/browser/compat.d.ts +2 -0
- package/dist/browser/compat.js +17 -0
- package/dist/browser/create-browser-fetcher.d.ts +17 -0
- package/dist/browser/create-browser-fetcher.js +127 -0
- package/dist/browser/environment.d.ts +16 -0
- package/dist/browser/environment.js +19 -0
- package/dist/browser/get-download-destination.d.ts +1 -0
- package/dist/browser/get-download-destination.js +38 -0
- package/dist/browser/mitt/index.d.ts +22 -0
- package/dist/browser/mitt/index.js +49 -0
- package/dist/browser/node.d.ts +2 -0
- package/dist/browser/node.js +9 -0
- package/dist/browser/revisions.d.ts +21 -0
- package/dist/browser/revisions.js +22 -0
- package/dist/browser/util.d.ts +46 -0
- package/dist/browser/util.js +161 -0
- package/dist/ensure-presentation-timestamp.d.ts +1 -0
- package/dist/ensure-presentation-timestamp.js +57 -0
- package/dist/extract-frame-from-video.d.ts +4 -5
- package/dist/extract-frame-from-video.js +58 -27
- package/dist/index.d.ts +24 -0
- package/dist/index.js +11 -0
- package/dist/is-vp9-video.d.ts +3 -0
- package/dist/is-vp9-video.js +24 -0
- package/dist/last-frame-from-video-cache.d.ts +4 -3
- package/dist/last-frame-from-video-cache.js +9 -6
- package/dist/offthread-video-server.d.ts +2 -1
- package/dist/offthread-video-server.js +14 -3
- package/dist/open-browser.js +1 -2
- package/dist/prepare-server.js +11 -0
- package/dist/serve-handler/index.js +1 -8
- package/dist/should-use-vp9-decoder.d.ts +0 -0
- package/dist/should-use-vp9-decoder.js +1 -0
- package/dist/validate-offthreadvideo-image-format.d.ts +1 -0
- package/dist/validate-offthreadvideo-image-format.js +15 -0
- package/package.json +3 -3
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EventEmitter = void 0;
|
|
7
|
+
const mitt_1 = __importDefault(require("./mitt"));
|
|
8
|
+
class EventEmitter {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.eventsMap = new Map();
|
|
11
|
+
this.emitter = (0, mitt_1.default)(this.eventsMap);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Bind an event listener to fire when an event occurs.
|
|
15
|
+
* @param event - the event type you'd like to listen to. Can be a string or symbol.
|
|
16
|
+
* @param handler - the function to be called when the event occurs.
|
|
17
|
+
* @returns `this` to enable you to chain method calls.
|
|
18
|
+
*/
|
|
19
|
+
on(event, handler) {
|
|
20
|
+
this.emitter.on(event, handler);
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Remove an event listener from firing.
|
|
25
|
+
* @param event - the event type you'd like to stop listening to.
|
|
26
|
+
* @param handler - the function that should be removed.
|
|
27
|
+
* @returns `this` to enable you to chain method calls.
|
|
28
|
+
*/
|
|
29
|
+
off(event, handler) {
|
|
30
|
+
this.emitter.off(event, handler);
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Remove an event listener.
|
|
35
|
+
* @deprecated please use {@link EventEmitter.off} instead.
|
|
36
|
+
*/
|
|
37
|
+
removeListener(event, handler) {
|
|
38
|
+
this.off(event, handler);
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Add an event listener.
|
|
43
|
+
* @deprecated please use {@link EventEmitter.on} instead.
|
|
44
|
+
*/
|
|
45
|
+
addListener(event, handler) {
|
|
46
|
+
this.on(event, handler);
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Emit an event and call any associated listeners.
|
|
51
|
+
*
|
|
52
|
+
* @param event - the event you'd like to emit
|
|
53
|
+
* @param eventData - any data you'd like to emit with the event
|
|
54
|
+
* @returns `true` if there are any listeners, `false` if there are not.
|
|
55
|
+
*/
|
|
56
|
+
emit(event, eventData) {
|
|
57
|
+
this.emitter.emit(event, eventData);
|
|
58
|
+
return this.eventListenersCount(event) > 0;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Like `on` but the listener will only be fired once and then it will be removed.
|
|
62
|
+
* @param event - the event you'd like to listen to
|
|
63
|
+
* @param handler - the handler function to run when the event occurs
|
|
64
|
+
* @returns `this` to enable you to chain method calls.
|
|
65
|
+
*/
|
|
66
|
+
once(event, handler) {
|
|
67
|
+
const onceHandler = (eventData) => {
|
|
68
|
+
handler(eventData);
|
|
69
|
+
this.off(event, onceHandler);
|
|
70
|
+
};
|
|
71
|
+
return this.on(event, onceHandler);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Gets the number of listeners for a given event.
|
|
75
|
+
*
|
|
76
|
+
* @param event - the event to get the listener count for
|
|
77
|
+
* @returns the number of listeners bound to the given event
|
|
78
|
+
*/
|
|
79
|
+
listenerCount(event) {
|
|
80
|
+
return this.eventListenersCount(event);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Removes all listeners. If given an event argument, it will remove only
|
|
84
|
+
* listeners for that event.
|
|
85
|
+
* @param event - the event to remove listeners for.
|
|
86
|
+
* @returns `this` to enable you to chain method calls.
|
|
87
|
+
*/
|
|
88
|
+
removeAllListeners(event) {
|
|
89
|
+
if (event) {
|
|
90
|
+
this.eventsMap.delete(event);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this.eventsMap.clear();
|
|
94
|
+
}
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
eventListenersCount(event) {
|
|
98
|
+
var _a;
|
|
99
|
+
return ((_a = this.eventsMap.get(event)) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.EventEmitter = EventEmitter;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2017 Google Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { Protocol } from 'devtools-protocol';
|
|
17
|
+
import { CDPSession } from './Connection';
|
|
18
|
+
import { DOMWorld } from './DOMWorld';
|
|
19
|
+
import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes';
|
|
20
|
+
import { Frame } from './FrameManager';
|
|
21
|
+
import { ElementHandle, JSHandle } from './JSHandle';
|
|
22
|
+
export declare const EVALUATION_SCRIPT_URL = "pptr://__puppeteer_evaluation_script__";
|
|
23
|
+
export declare class ExecutionContext {
|
|
24
|
+
#private;
|
|
25
|
+
_client: CDPSession;
|
|
26
|
+
_world: DOMWorld;
|
|
27
|
+
_contextId: number;
|
|
28
|
+
_contextName: string;
|
|
29
|
+
constructor(client: CDPSession, contextPayload: Protocol.Runtime.ExecutionContextDescription, world: DOMWorld);
|
|
30
|
+
frame(): Frame | null;
|
|
31
|
+
evaluate<ReturnType>(pageFunction: Function | string, ...args: unknown[]): Promise<ReturnType>;
|
|
32
|
+
evaluateHandle<HandleType extends JSHandle | ElementHandle = JSHandle>(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise<HandleType>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable no-new-func */
|
|
3
|
+
/* eslint-disable no-new */
|
|
4
|
+
/**
|
|
5
|
+
* Copyright 2017 Google Inc. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License.
|
|
9
|
+
* You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
20
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
21
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
22
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
23
|
+
};
|
|
24
|
+
var _ExecutionContext_instances, _ExecutionContext_evaluate;
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ExecutionContext = exports.EVALUATION_SCRIPT_URL = void 0;
|
|
27
|
+
const JSHandle_1 = require("./JSHandle");
|
|
28
|
+
const util_1 = require("./util");
|
|
29
|
+
exports.EVALUATION_SCRIPT_URL = 'pptr://__puppeteer_evaluation_script__';
|
|
30
|
+
const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m;
|
|
31
|
+
class ExecutionContext {
|
|
32
|
+
constructor(client, contextPayload, world) {
|
|
33
|
+
_ExecutionContext_instances.add(this);
|
|
34
|
+
this._client = client;
|
|
35
|
+
this._world = world;
|
|
36
|
+
this._contextId = contextPayload.id;
|
|
37
|
+
this._contextName = contextPayload.name;
|
|
38
|
+
}
|
|
39
|
+
frame() {
|
|
40
|
+
return this._world ? this._world.frame() : null;
|
|
41
|
+
}
|
|
42
|
+
evaluate(pageFunction, ...args) {
|
|
43
|
+
return __classPrivateFieldGet(this, _ExecutionContext_instances, "m", _ExecutionContext_evaluate).call(this, true, pageFunction, ...args);
|
|
44
|
+
}
|
|
45
|
+
evaluateHandle(pageFunction, ...args) {
|
|
46
|
+
return __classPrivateFieldGet(this, _ExecutionContext_instances, "m", _ExecutionContext_evaluate).call(this, false, pageFunction, ...args);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.ExecutionContext = ExecutionContext;
|
|
50
|
+
_ExecutionContext_instances = new WeakSet(), _ExecutionContext_evaluate = async function _ExecutionContext_evaluate(returnByValue, pageFunction, ...args) {
|
|
51
|
+
const suffix = `//# sourceURL=${exports.EVALUATION_SCRIPT_URL}`;
|
|
52
|
+
if ((0, util_1.isString)(pageFunction)) {
|
|
53
|
+
const contextId = this._contextId;
|
|
54
|
+
const expression = pageFunction;
|
|
55
|
+
const expressionWithSourceUrl = SOURCE_URL_REGEX.test(expression)
|
|
56
|
+
? expression
|
|
57
|
+
: expression + '\n' + suffix;
|
|
58
|
+
const { exceptionDetails: _details, result: _remoteObject } = await this._client
|
|
59
|
+
.send('Runtime.evaluate', {
|
|
60
|
+
expression: expressionWithSourceUrl,
|
|
61
|
+
contextId,
|
|
62
|
+
returnByValue,
|
|
63
|
+
awaitPromise: true,
|
|
64
|
+
userGesture: true,
|
|
65
|
+
})
|
|
66
|
+
.catch(rewriteError);
|
|
67
|
+
if (_details) {
|
|
68
|
+
throw new Error('Evaluation failed: ' + (0, util_1.getExceptionMessage)(_details));
|
|
69
|
+
}
|
|
70
|
+
return returnByValue
|
|
71
|
+
? (0, util_1.valueFromRemoteObject)(_remoteObject)
|
|
72
|
+
: (0, JSHandle_1._createJSHandle)(this, _remoteObject);
|
|
73
|
+
}
|
|
74
|
+
if (typeof pageFunction !== 'function') {
|
|
75
|
+
throw new Error(`Expected to get |string| or |function| as the first argument, but got "${pageFunction}" instead.`);
|
|
76
|
+
}
|
|
77
|
+
let functionText = pageFunction.toString();
|
|
78
|
+
try {
|
|
79
|
+
new Function('(' + functionText + ')');
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
// This means we might have a function shorthand. Try another
|
|
83
|
+
// time prefixing 'function '.
|
|
84
|
+
if (functionText.startsWith('async ')) {
|
|
85
|
+
functionText =
|
|
86
|
+
'async function ' + functionText.substring('async '.length);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
functionText = 'function ' + functionText;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
new Function('(' + functionText + ')');
|
|
93
|
+
}
|
|
94
|
+
catch (_error) {
|
|
95
|
+
// We tried hard to serialize, but there's a weird beast here.
|
|
96
|
+
throw new Error('Passed function is not well-serializable!');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
let callFunctionOnPromise;
|
|
100
|
+
try {
|
|
101
|
+
callFunctionOnPromise = this._client.send('Runtime.callFunctionOn', {
|
|
102
|
+
functionDeclaration: functionText + '\n' + suffix + '\n',
|
|
103
|
+
executionContextId: this._contextId,
|
|
104
|
+
arguments: args.map(convertArgument.bind(this)),
|
|
105
|
+
returnByValue,
|
|
106
|
+
awaitPromise: true,
|
|
107
|
+
userGesture: true,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (error instanceof TypeError &&
|
|
112
|
+
error.message.startsWith('Converting circular structure to JSON')) {
|
|
113
|
+
error.message += ' Recursive objects are not allowed.';
|
|
114
|
+
}
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
const { exceptionDetails, result: remoteObject } = await callFunctionOnPromise.catch(rewriteError);
|
|
118
|
+
if (exceptionDetails) {
|
|
119
|
+
throw new Error('Evaluation failed: ' + (0, util_1.getExceptionMessage)(exceptionDetails));
|
|
120
|
+
}
|
|
121
|
+
return returnByValue
|
|
122
|
+
? (0, util_1.valueFromRemoteObject)(remoteObject)
|
|
123
|
+
: (0, JSHandle_1._createJSHandle)(this, remoteObject);
|
|
124
|
+
function convertArgument(arg) {
|
|
125
|
+
if (typeof arg === 'bigint') {
|
|
126
|
+
// eslint-disable-line valid-typeof
|
|
127
|
+
return { unserializableValue: `${arg.toString()}n` };
|
|
128
|
+
}
|
|
129
|
+
if (Object.is(arg, -0)) {
|
|
130
|
+
return { unserializableValue: '-0' };
|
|
131
|
+
}
|
|
132
|
+
if (Object.is(arg, Infinity)) {
|
|
133
|
+
return { unserializableValue: 'Infinity' };
|
|
134
|
+
}
|
|
135
|
+
if (Object.is(arg, -Infinity)) {
|
|
136
|
+
return { unserializableValue: '-Infinity' };
|
|
137
|
+
}
|
|
138
|
+
if (Object.is(arg, NaN)) {
|
|
139
|
+
return { unserializableValue: 'NaN' };
|
|
140
|
+
}
|
|
141
|
+
const objectHandle = arg && arg instanceof JSHandle_1.JSHandle ? arg : null;
|
|
142
|
+
if (objectHandle) {
|
|
143
|
+
if (objectHandle._context !== this) {
|
|
144
|
+
throw new Error('JSHandles can be evaluated only in the context they were created!');
|
|
145
|
+
}
|
|
146
|
+
if (objectHandle._disposed) {
|
|
147
|
+
throw new Error('JSHandle is disposed!');
|
|
148
|
+
}
|
|
149
|
+
if (objectHandle._remoteObject.unserializableValue) {
|
|
150
|
+
return {
|
|
151
|
+
unserializableValue: objectHandle._remoteObject.unserializableValue,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if (!objectHandle._remoteObject.objectId) {
|
|
155
|
+
return { value: objectHandle._remoteObject.value };
|
|
156
|
+
}
|
|
157
|
+
return { objectId: objectHandle._remoteObject.objectId };
|
|
158
|
+
}
|
|
159
|
+
return { value: arg };
|
|
160
|
+
}
|
|
161
|
+
function rewriteError(error) {
|
|
162
|
+
if (error.message.includes('Object reference chain is too long')) {
|
|
163
|
+
return { result: { type: 'undefined' } };
|
|
164
|
+
}
|
|
165
|
+
if (error.message.includes("Object couldn't be returned by value")) {
|
|
166
|
+
return { result: { type: 'undefined' } };
|
|
167
|
+
}
|
|
168
|
+
if (error.message.endsWith('Cannot find context with specified id') ||
|
|
169
|
+
error.message.endsWith('Inspected target navigated or closed')) {
|
|
170
|
+
throw new Error('Execution context was destroyed, most likely because of a navigation.');
|
|
171
|
+
}
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2017 Google Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { Protocol } from 'devtools-protocol';
|
|
17
|
+
import { CDPSession } from './Connection';
|
|
18
|
+
import { DOMWorld } from './DOMWorld';
|
|
19
|
+
import { EvaluateFn, EvaluateFnReturnType, EvaluateHandleFn, SerializableOrJSHandle, UnwrapPromiseLike } from './EvalTypes';
|
|
20
|
+
import { EventEmitter } from './EventEmitter';
|
|
21
|
+
import { ExecutionContext } from './ExecutionContext';
|
|
22
|
+
import { HTTPResponse } from './HTTPResponse';
|
|
23
|
+
import { JSHandle } from './JSHandle';
|
|
24
|
+
import { PuppeteerLifeCycleEvent } from './LifecycleWatcher';
|
|
25
|
+
import { NetworkManager } from './NetworkManager';
|
|
26
|
+
import { Page } from './Page';
|
|
27
|
+
import { TimeoutSettings } from './TimeoutSettings';
|
|
28
|
+
export declare const FrameManagerEmittedEvents: {
|
|
29
|
+
FrameNavigated: symbol;
|
|
30
|
+
FrameDetached: symbol;
|
|
31
|
+
FrameSwapped: symbol;
|
|
32
|
+
LifecycleEvent: symbol;
|
|
33
|
+
FrameNavigatedWithinDocument: symbol;
|
|
34
|
+
ExecutionContextCreated: symbol;
|
|
35
|
+
ExecutionContextDestroyed: symbol;
|
|
36
|
+
};
|
|
37
|
+
export declare class FrameManager extends EventEmitter {
|
|
38
|
+
#private;
|
|
39
|
+
get _timeoutSettings(): TimeoutSettings;
|
|
40
|
+
get _client(): CDPSession;
|
|
41
|
+
constructor(client: CDPSession, page: Page, timeoutSettings: TimeoutSettings);
|
|
42
|
+
private setupEventListeners;
|
|
43
|
+
initialize(client?: CDPSession): Promise<void>;
|
|
44
|
+
networkManager(): NetworkManager;
|
|
45
|
+
navigateFrame(frame: Frame, url: string, options?: {
|
|
46
|
+
referer?: string;
|
|
47
|
+
timeout?: number;
|
|
48
|
+
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
|
49
|
+
}): Promise<HTTPResponse | null>;
|
|
50
|
+
page(): Page;
|
|
51
|
+
mainFrame(): Frame;
|
|
52
|
+
frames(): Frame[];
|
|
53
|
+
frame(frameId: string): Frame | null;
|
|
54
|
+
_ensureIsolatedWorld(session: CDPSession, name: string): Promise<void>;
|
|
55
|
+
executionContextById(contextId: number, session?: CDPSession): ExecutionContext;
|
|
56
|
+
}
|
|
57
|
+
export declare class Frame {
|
|
58
|
+
#private;
|
|
59
|
+
_frameManager: FrameManager;
|
|
60
|
+
_id: string;
|
|
61
|
+
_loaderId: string;
|
|
62
|
+
_name?: string;
|
|
63
|
+
_hasStartedLoading: boolean;
|
|
64
|
+
_lifecycleEvents: Set<string>;
|
|
65
|
+
_mainWorld: DOMWorld;
|
|
66
|
+
_secondaryWorld: DOMWorld;
|
|
67
|
+
_childFrames: Set<Frame>;
|
|
68
|
+
constructor(frameManager: FrameManager, parentFrame: Frame | null, frameId: string, client: CDPSession);
|
|
69
|
+
_updateClient(client: CDPSession): void;
|
|
70
|
+
isOOPFrame(): boolean;
|
|
71
|
+
goto(url: string, options?: {
|
|
72
|
+
referer?: string;
|
|
73
|
+
timeout?: number;
|
|
74
|
+
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
|
75
|
+
}): Promise<HTTPResponse | null>;
|
|
76
|
+
_client(): CDPSession;
|
|
77
|
+
/**
|
|
78
|
+
* @returns a promise that resolves to the frame's default execution context.
|
|
79
|
+
*/
|
|
80
|
+
executionContext(): Promise<ExecutionContext>;
|
|
81
|
+
evaluateHandle<HandlerType extends JSHandle = JSHandle>(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise<HandlerType>;
|
|
82
|
+
evaluate<T extends EvaluateFn>(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise<UnwrapPromiseLike<EvaluateFnReturnType<T>>>;
|
|
83
|
+
name(): string;
|
|
84
|
+
url(): string;
|
|
85
|
+
parentFrame(): Frame | null;
|
|
86
|
+
childFrames(): Frame[];
|
|
87
|
+
isDetached(): boolean;
|
|
88
|
+
waitForFunction(pageFunction: Function | string, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
|
|
89
|
+
title(): Promise<string>;
|
|
90
|
+
_navigated(framePayload: Protocol.Page.Frame): void;
|
|
91
|
+
_navigatedWithinDocument(url: string): void;
|
|
92
|
+
_onLifecycleEvent(loaderId: string, name: string): void;
|
|
93
|
+
_onLoadingStopped(): void;
|
|
94
|
+
_onLoadingStarted(): void;
|
|
95
|
+
_detach(): void;
|
|
96
|
+
}
|