File tree Expand file tree Collapse file tree 4 files changed +1
-32
lines changed
Expand file tree Collapse file tree 4 files changed +1
-32
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,6 @@ export class Download {
3939 this . _url = url ;
4040 this . _finishedCallback = ( ) => { } ;
4141 this . _finishedPromise = new Promise ( f => this . _finishedCallback = f ) ;
42- for ( const barrier of this . _page . _frameManager . _signalBarriers )
43- barrier . addDownload ( ) ;
4442 this . _page . emit ( Events . Page . Download , this ) ;
4543 page . _browserContext . _downloads . add ( this ) ;
4644 this . _acceptDownloads = ! ! this . _page . _browserContext . _options . acceptDownloads ;
Original file line number Diff line number Diff line change @@ -147,10 +147,6 @@ export class FFPage implements PageDelegate {
147147
148148 _onNavigationAborted ( params : Protocol . Page . navigationAbortedPayload ) {
149149 const frame = this . _page . _frameManager . frame ( params . frameId ) ! ;
150- if ( params . errorText === 'Will download to file' ) {
151- for ( const barrier of this . _page . _frameManager . _signalBarriers )
152- barrier . expectDownload ( ) ;
153- }
154150 for ( const task of frame . _frameTasks )
155151 task . onNewDocument ( params . navigationId , new Error ( params . errorText ) ) ;
156152 }
Original file line number Diff line number Diff line change @@ -948,7 +948,6 @@ export class SignalBarrier {
948948 private _options : types . NavigatingActionWaitOptions ;
949949 private _protectCount = 0 ;
950950 private _expectedPopups = 0 ;
951- private _expectedDownloads = 0 ;
952951 private _promise : Promise < void > ;
953952 private _promiseCallback = ( ) => { } ;
954953 private _deadline : number ;
@@ -989,16 +988,6 @@ export class SignalBarrier {
989988 this . release ( ) ;
990989 }
991990
992- async expectDownload ( ) {
993- ++ this . _expectedDownloads ;
994- }
995-
996- async addDownload ( ) {
997- if ( this . _expectedDownloads )
998- -- this . _expectedDownloads ;
999- this . _maybeResolve ( ) ;
1000- }
1001-
1002991 retain ( ) {
1003992 ++ this . _protectCount ;
1004993 }
@@ -1009,7 +998,7 @@ export class SignalBarrier {
1009998 }
1010999
10111000 private async _maybeResolve ( ) {
1012- if ( ! this . _protectCount && ! this . _expectedPopups && ! this . _expectedDownloads && ! this . _frameIds . size )
1001+ if ( ! this . _protectCount && ! this . _expectedPopups && ! this . _frameIds . size )
10131002 this . _promiseCallback ( ) ;
10141003 }
10151004}
Original file line number Diff line number Diff line change @@ -54,20 +54,6 @@ describe('Auto waiting', () => {
5454 ] ) ;
5555 expect ( messages . join ( '|' ) ) . toBe ( 'popup|click' ) ;
5656 } ) ;
57- it . fail ( CHROMIUM ) ( 'should await download when clicking anchor' , async function ( { page, server} ) {
58- server . setRoute ( '/download' , ( req , res ) => {
59- res . setHeader ( 'Content-Type' , 'application/octet-stream' ) ;
60- res . setHeader ( 'Content-Disposition' , 'attachment' ) ;
61- res . end ( `Hello world` ) ;
62- } ) ;
63- await page . setContent ( `<a download=true href="${ server . PREFIX } /download">download</a>` ) ;
64- const messages = [ ] ;
65- await Promise . all ( [
66- page . waitForEvent ( 'download' ) . then ( ( ) => messages . push ( 'download' ) ) ,
67- page . click ( 'a' ) . then ( ( ) => messages . push ( 'click' ) ) ,
68- ] ) ;
69- expect ( messages . join ( '|' ) ) . toBe ( 'download|click' ) ;
70- } ) ;
7157 it ( 'should await cross-process navigation when clicking anchor' , async ( { page, server} ) => {
7258 const messages = [ ] ;
7359 server . setRoute ( '/empty.html' , async ( req , res ) => {
You can’t perform that action at this time.
0 commit comments