File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -47,20 +47,20 @@ Example with arguments: \`(el) => {
4747 handler : async ( request , response , context ) => {
4848 const args : Array < JSHandle < unknown > > = [ ] ;
4949 try {
50- const frames : Frame [ ] = [ ] ;
50+ const frames = new Set < Frame > ( ) ;
5151 for ( const el of request . params . args ?? [ ] ) {
5252 const handle = await context . getElementByUid ( el . uid ) ;
53- frames . push ( handle . frame ) ;
53+ frames . add ( handle . frame ) ;
5454 args . push ( handle ) ;
5555 }
5656 let pageOrFrame : Page | Frame ;
5757 // We can't evaluate the element handle across frames
58- if ( frames . length > 1 ) {
58+ if ( frames . size > 1 ) {
5959 throw new Error (
6060 "Elements from different frames can't be evaluated together." ,
6161 ) ;
6262 } else {
63- pageOrFrame = frames [ 0 ] ?? context . getSelectedPage ( ) ;
63+ pageOrFrame = [ ... frames . values ( ) ] [ 0 ] ?? context . getSelectedPage ( ) ;
6464 }
6565 const fn = await pageOrFrame . evaluateHandle (
6666 `(${ request . params . function } )` ,
You can’t perform that action at this time.
0 commit comments