File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed
packages/puppeteer-core/src/cdp Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -322,12 +322,8 @@ export class CdpFrame extends Frame {
322322
323323 @throwIfDetached
324324 async addPreloadScript ( preloadScript : CdpPreloadScript ) : Promise < void > {
325- // TODO: this might be not correct and we might be adding a preload
326- // script multiple times to the nested frames.
327- if (
328- this . #client === this . _frameManager . client &&
329- this !== this . _frameManager . mainFrame ( )
330- ) {
325+ const parentFrame = this . parentFrame ( ) ;
326+ if ( parentFrame && this . #client === parentFrame . client ) {
331327 return ;
332328 }
333329 if ( preloadScript . getIdForFrame ( this ) ) {
Original file line number Diff line number Diff line change @@ -407,11 +407,10 @@ export class FrameManager extends EventEmitter<FrameManagerEvents> {
407407 ) : void {
408408 let frame = this . frame ( frameId ) ;
409409 if ( frame ) {
410- if ( session && frame . client !== this . #client) {
411- // TODO: check this condition. It might not be correct for
412- // nested frames.
410+ const parentFrame = this . frame ( parentFrameId ) ;
411+ if ( session && parentFrame && frame . client !== parentFrame ?. client ) {
413412 // If an OOP iframes becomes a normal iframe
414- // again it is first attached to the parent page before the
413+ // again it is first attached to the parent frame before the
415414 // target is removed.
416415 frame . updateClient ( session ) ;
417416 }
You can’t perform that action at this time.
0 commit comments