16
16
17
17
import { EventEmitter } from 'events' ;
18
18
import * as types from '../types' ;
19
+ import { SerializedValue } from '../common/utilityScriptSerializers' ;
19
20
20
21
export type Binary = string ;
22
+ export type SerializedArgument = { value : SerializedValue , handles : Channel [ ] } ;
23
+
21
24
export type BrowserContextOptions = {
22
25
viewport ?: types . Size | null ,
23
26
ignoreHTTPSErrors ?: boolean ,
@@ -215,17 +218,17 @@ export interface FrameChannel extends Channel {
215
218
on ( event : 'loadstate' , callback : ( params : { add ?: types . LifecycleEvent , remove ?: types . LifecycleEvent } ) => void ) : this;
216
219
on ( event : 'navigated' , callback : ( params : FrameNavigatedEvent ) => void ) : this;
217
220
218
- evalOnSelector ( params : { selector : string ; expression : string , isFunction : boolean , arg : any } ) : Promise < { value : any } > ;
219
- evalOnSelectorAll ( params : { selector : string ; expression : string , isFunction : boolean , arg : any } ) : Promise < { value : any } > ;
221
+ evalOnSelector ( params : { selector : string ; expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { value : SerializedValue } > ;
222
+ evalOnSelectorAll ( params : { selector : string ; expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { value : SerializedValue } > ;
220
223
addScriptTag ( params : { url ?: string , content ?: string , type ?: string } ) : Promise < { element : ElementHandleChannel } > ;
221
224
addStyleTag ( params : { url ?: string , content ?: string } ) : Promise < { element : ElementHandleChannel } > ;
222
225
check ( params : { selector : string , force ?: boolean , noWaitAfter ?: boolean } & types . TimeoutOptions ) : Promise < void > ;
223
226
click ( params : { selector : string , force ?: boolean , noWaitAfter ?: boolean } & types . PointerActionOptions & types . MouseClickOptions & types . TimeoutOptions ) : Promise < void > ;
224
227
content ( ) : Promise < { value : string } > ;
225
228
dblclick ( params : { selector : string , force ?: boolean } & types . PointerActionOptions & types . MouseMultiClickOptions & types . TimeoutOptions ) : Promise < void > ;
226
- dispatchEvent ( params : { selector : string , type : string , eventInit : any } & types . TimeoutOptions ) : Promise < void > ;
227
- evaluateExpression ( params : { expression : string , isFunction : boolean , arg : any } ) : Promise < { value : any } > ;
228
- evaluateExpressionHandle ( params : { expression : string , isFunction : boolean , arg : any } ) : Promise < { handle : JSHandleChannel } > ;
229
+ dispatchEvent ( params : { selector : string , type : string , eventInit : SerializedArgument } & types . TimeoutOptions ) : Promise < void > ;
230
+ evaluateExpression ( params : { expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { value : SerializedValue } > ;
231
+ evaluateExpressionHandle ( params : { expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { handle : JSHandleChannel } > ;
229
232
fill ( params : { selector : string , value : string } & types . NavigatingActionWaitOptions ) : Promise < void > ;
230
233
focus ( params : { selector : string } & types . TimeoutOptions ) : Promise < void > ;
231
234
frameElement ( ) : Promise < { element : ElementHandleChannel } > ;
@@ -244,7 +247,7 @@ export interface FrameChannel extends Channel {
244
247
title ( ) : Promise < { value : string } > ;
245
248
type ( params : { selector : string , text : string , delay ?: number , noWaitAfter ?: boolean } & types . TimeoutOptions ) : Promise < void > ;
246
249
uncheck ( params : { selector : string , force ?: boolean , noWaitAfter ?: boolean } & types . TimeoutOptions ) : Promise < void > ;
247
- waitForFunction ( params : { expression : string , isFunction : boolean , arg : any } & types . WaitForFunctionOptions ) : Promise < { handle : JSHandleChannel } > ;
250
+ waitForFunction ( params : { expression : string , isFunction : boolean , arg : SerializedArgument } & types . WaitForFunctionOptions ) : Promise < { handle : JSHandleChannel } > ;
248
251
waitForSelector ( params : { selector : string } & types . WaitForElementOptions ) : Promise < { element : ElementHandleChannel | null } > ;
249
252
}
250
253
export type FrameInitializer = {
@@ -256,8 +259,8 @@ export type FrameInitializer = {
256
259
257
260
258
261
export interface WorkerChannel extends Channel {
259
- evaluateExpression ( params : { expression : string , isFunction : boolean , arg : any } ) : Promise < { value : any } > ;
260
- evaluateExpressionHandle ( params : { expression : string , isFunction : boolean , arg : any } ) : Promise < { handle : JSHandleChannel } > ;
262
+ evaluateExpression ( params : { expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { value : SerializedValue } > ;
263
+ evaluateExpressionHandle ( params : { expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { handle : JSHandleChannel } > ;
261
264
}
262
265
export type WorkerInitializer = {
263
266
url : string ,
@@ -268,26 +271,26 @@ export interface JSHandleChannel extends Channel {
268
271
on ( event : 'previewUpdated' , callback : ( params : { preview : string } ) => void ) : this;
269
272
270
273
dispose ( ) : Promise < void > ;
271
- evaluateExpression ( params : { expression : string , isFunction : boolean , arg : any } ) : Promise < { value : any } > ;
272
- evaluateExpressionHandle ( params : { expression : string , isFunction : boolean , arg : any } ) : Promise < { handle : JSHandleChannel } > ;
274
+ evaluateExpression ( params : { expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { value : SerializedValue } > ;
275
+ evaluateExpressionHandle ( params : { expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { handle : JSHandleChannel } > ;
273
276
getPropertyList ( ) : Promise < { properties : { name : string , value : JSHandleChannel } [ ] } > ;
274
277
getProperty ( params : { name : string } ) : Promise < { handle : JSHandleChannel } > ;
275
- jsonValue ( ) : Promise < { value : any } > ;
278
+ jsonValue ( ) : Promise < { value : SerializedValue } > ;
276
279
}
277
280
export type JSHandleInitializer = {
278
281
preview : string ,
279
282
} ;
280
283
281
284
282
285
export interface ElementHandleChannel extends JSHandleChannel {
283
- evalOnSelector ( params : { selector : string ; expression : string , isFunction : boolean , arg : any } ) : Promise < { value : any } > ;
284
- evalOnSelectorAll ( params : { selector : string ; expression : string , isFunction : boolean , arg : any } ) : Promise < { value : any } > ;
286
+ evalOnSelector ( params : { selector : string ; expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { value : SerializedValue } > ;
287
+ evalOnSelectorAll ( params : { selector : string ; expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { value : SerializedValue } > ;
285
288
boundingBox ( ) : Promise < { value : types . Rect | null } > ;
286
289
check ( params : { force ?: boolean } & { noWaitAfter ?: boolean } & types . TimeoutOptions ) : Promise < void > ;
287
290
click ( params : { force ?: boolean , noWaitAfter ?: boolean } & types . PointerActionOptions & types . MouseClickOptions & types . TimeoutOptions ) : Promise < void > ;
288
291
contentFrame ( ) : Promise < { frame : FrameChannel | null } > ;
289
292
dblclick ( params : { force ?: boolean , noWaitAfter ?: boolean } & types . PointerActionOptions & types . MouseMultiClickOptions & types . TimeoutOptions ) : Promise < void > ;
290
- dispatchEvent ( params : { type : string , eventInit : any } ) : Promise < void > ;
293
+ dispatchEvent ( params : { type : string , eventInit : SerializedArgument } ) : Promise < void > ;
291
294
fill ( params : { value : string } & types . NavigatingActionWaitOptions ) : Promise < void > ;
292
295
focus ( ) : Promise < void > ;
293
296
getAttribute ( params : { name : string } ) : Promise < { value : string | null } > ;
@@ -359,11 +362,12 @@ export type ConsoleMessageInitializer = {
359
362
360
363
export interface BindingCallChannel extends Channel {
361
364
reject ( params : { error : types . Error } ) : void ;
362
- resolve ( params : { result : any } ) : void ;
365
+ resolve ( params : { result : SerializedArgument } ) : void ;
363
366
}
364
367
export type BindingCallInitializer = {
365
368
frame : FrameChannel ,
366
369
name : string ,
370
+ // TODO: migrate this to SerializedArgument.
367
371
args : any [ ]
368
372
} ;
369
373
@@ -443,9 +447,9 @@ export interface ElectronApplicationChannel extends Channel {
443
447
on ( event : 'close' , callback : ( ) => void ) : this;
444
448
on ( event : 'window' , callback : ( params : { page : PageChannel , browserWindow : JSHandleChannel } ) => void ) : this;
445
449
446
- newBrowserWindow ( params : { arg : any } ) : Promise < { page : PageChannel } > ;
447
- evaluateExpression ( params : { expression : string , isFunction : boolean , arg : any } ) : Promise < { value : any } > ;
448
- evaluateExpressionHandle ( params : { expression : string , isFunction : boolean , arg : any } ) : Promise < { handle : JSHandleChannel } > ;
450
+ newBrowserWindow ( params : { arg : SerializedArgument } ) : Promise < { page : PageChannel } > ;
451
+ evaluateExpression ( params : { expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { value : SerializedValue } > ;
452
+ evaluateExpressionHandle ( params : { expression : string , isFunction : boolean , arg : SerializedArgument } ) : Promise < { handle : JSHandleChannel } > ;
449
453
close ( ) : Promise < void > ;
450
454
}
451
455
export type ElectronApplicationInitializer = {
0 commit comments