|
17 | 17 |
|
18 | 18 | import * as dom from './dom';
|
19 | 19 | import * as frames from './frames';
|
20 |
| -import { assert, helper, Listener } from './helper'; |
| 20 | +import { assert, helper, Listener, assertMaxArguments } from './helper'; |
21 | 21 | import * as input from './input';
|
22 | 22 | import * as js from './javascript';
|
23 | 23 | import * as network from './network';
|
@@ -228,18 +228,21 @@ export class Page extends ExtendedEventEmitter implements InnerLogger {
|
228 | 228 | async evaluateHandle<R, Arg>(pageFunction: types.Func1<Arg, R>, arg: Arg): Promise<types.SmartHandle<R>>;
|
229 | 229 | async evaluateHandle<R>(pageFunction: types.Func1<void, R>, arg?: any): Promise<types.SmartHandle<R>>;
|
230 | 230 | async evaluateHandle<R, Arg>(pageFunction: types.Func1<Arg, R>, arg: Arg): Promise<types.SmartHandle<R>> {
|
| 231 | + assertMaxArguments(arguments.length, 2); |
231 | 232 | return this.mainFrame().evaluateHandle(pageFunction, arg);
|
232 | 233 | }
|
233 | 234 |
|
234 | 235 | async $eval<R, Arg>(selector: string, pageFunction: types.FuncOn<Element, Arg, R>, arg: Arg): Promise<R>;
|
235 | 236 | async $eval<R>(selector: string, pageFunction: types.FuncOn<Element, void, R>, arg?: any): Promise<R>;
|
236 | 237 | async $eval<R, Arg>(selector: string, pageFunction: types.FuncOn<Element, Arg, R>, arg: Arg): Promise<R> {
|
| 238 | + assertMaxArguments(arguments.length, 3); |
237 | 239 | return this.mainFrame().$eval(selector, pageFunction, arg);
|
238 | 240 | }
|
239 | 241 |
|
240 | 242 | async $$eval<R, Arg>(selector: string, pageFunction: types.FuncOn<Element[], Arg, R>, arg: Arg): Promise<R>;
|
241 | 243 | async $$eval<R>(selector: string, pageFunction: types.FuncOn<Element[], void, R>, arg?: any): Promise<R>;
|
242 | 244 | async $$eval<R, Arg>(selector: string, pageFunction: types.FuncOn<Element[], Arg, R>, arg: Arg): Promise<R> {
|
| 245 | + assertMaxArguments(arguments.length, 3); |
243 | 246 | return this.mainFrame().$$eval(selector, pageFunction, arg);
|
244 | 247 | }
|
245 | 248 |
|
@@ -373,6 +376,7 @@ export class Page extends ExtendedEventEmitter implements InnerLogger {
|
373 | 376 | async evaluate<R, Arg>(pageFunction: types.Func1<Arg, R>, arg: Arg): Promise<R>;
|
374 | 377 | async evaluate<R>(pageFunction: types.Func1<void, R>, arg?: any): Promise<R>;
|
375 | 378 | async evaluate<R, Arg>(pageFunction: types.Func1<Arg, R>, arg: Arg): Promise<R> {
|
| 379 | + assertMaxArguments(arguments.length, 2); |
376 | 380 | return this.mainFrame().evaluate(pageFunction, arg);
|
377 | 381 | }
|
378 | 382 |
|
@@ -568,12 +572,14 @@ export class Worker extends EventEmitter {
|
568 | 572 | async evaluate<R, Arg>(pageFunction: types.Func1<Arg, R>, arg: Arg): Promise<R>;
|
569 | 573 | async evaluate<R>(pageFunction: types.Func1<void, R>, arg?: any): Promise<R>;
|
570 | 574 | async evaluate<R, Arg>(pageFunction: types.Func1<Arg, R>, arg: Arg): Promise<R> {
|
| 575 | + assertMaxArguments(arguments.length, 2); |
571 | 576 | return (await this._executionContextPromise).evaluateInternal(pageFunction, arg);
|
572 | 577 | }
|
573 | 578 |
|
574 | 579 | async evaluateHandle<R, Arg>(pageFunction: types.Func1<Arg, R>, arg: Arg): Promise<types.SmartHandle<R>>;
|
575 | 580 | async evaluateHandle<R>(pageFunction: types.Func1<void, R>, arg?: any): Promise<types.SmartHandle<R>>;
|
576 | 581 | async evaluateHandle<R, Arg>(pageFunction: types.Func1<Arg, R>, arg: Arg): Promise<types.SmartHandle<R>> {
|
| 582 | + assertMaxArguments(arguments.length, 2); |
577 | 583 | return (await this._executionContextPromise).evaluateHandleInternal(pageFunction, arg);
|
578 | 584 | }
|
579 | 585 | }
|
|
0 commit comments