@@ -586,12 +586,40 @@ tabutils._tabOpeningOptions = function() {
586
586
&& aStatus == 0
587
587
&& TU_getPref ( "extensions.tabutils.removeUnintentionalBlank" , true ) ) {
588
588
let win = aWebProgress . DOMWindow ;
589
- win . _closeTimer = win . setTimeout ( function ( self ) {
590
- self . mTabBrowser . isBlankTab ( self . mTab ) && self . mTabBrowser . removeTab ( self . mTab ) ;
591
- } , 250 , this ) ;
589
+ win . _closeTimer = win . setTimeout ( function ( ) {
590
+ this . mTabBrowser . isBlankTab ( this . mTab ) && this . mTabBrowser . removeTab ( this . mTab ) ;
591
+ } . bind ( this ) , 750 ) ;
592
592
}
593
593
} ) ;
594
594
595
+ let tmp = { } ;
596
+ Cu . import ( "resource://gre/modules/DownloadLastDir.jsm" , tmp ) ;
597
+
598
+ if ( tmp . DownloadLastDir && // Bug 722995 [Fx19]
599
+ tmp . DownloadLastDir . prototype . getFileAsync && // Bug 854299 [Fx23]
600
+ tmp . DownloadLastDir . prototype . getFileAsync . name != "TU_getFileAsync" )
601
+ tmp . DownloadLastDir . prototype . getFileAsync = ( function ( ) {
602
+ let getFileAsync = tmp . DownloadLastDir . prototype . getFileAsync ;
603
+ return function TU_getFileAsync ( aURI , aCallback ) {
604
+ let win = this . window ;
605
+ if ( win . _closeTimer ) {
606
+ win . clearTimeout ( win . _closeTimer ) ;
607
+ win . _closeTimer = null ;
608
+
609
+ aCallback = ( function ( ) {
610
+ let lastDirCallback = aCallback ;
611
+ return function TU_LastDirCallback ( lastDir ) {
612
+ lastDirCallback ( lastDir ) ;
613
+ if ( ! win . closed ) {
614
+ win . setTimeout ( win . close , 250 ) ;
615
+ }
616
+ } ;
617
+ } ) ( ) ;
618
+ }
619
+ getFileAsync . apply ( this , arguments ) ;
620
+ } ;
621
+ } ) ( ) ;
622
+
595
623
//在当前标签页的右侧打开新标签页
596
624
//连续打开后台标签时保持原有顺序
597
625
TU_hookCode ( "gBrowser.addTab" ,
0 commit comments