@@ -3,6 +3,7 @@ const messageHandler = {
33 // We use this to catch redirected tabs that have just opened
44 // If this were in platform we would change how the tab opens based on "new tab" link navigations such as ctrl+click
55 LAST_CREATED_TAB_TIMER : 2000 ,
6+ unhideQueue : [ ] ,
67
78 init ( ) {
89 // Handles messages from webextension code
@@ -87,20 +88,6 @@ const messageHandler = {
8788 }
8889 } ) ;
8990
90- browser . tabs . onCreated . addListener ( ( tab ) => {
91- // This works at capturing the tabs as they are created
92- // However we need onFocusChanged and onActivated to capture the initial tab
93- if ( tab . id === - 1 ) {
94- return { } ;
95- }
96- } ) ;
97-
98- browser . tabs . onRemoved . addListener ( ( tabId ) => {
99- if ( tabId === - 1 ) {
100- return { } ;
101- }
102- } ) ;
103-
10491 browser . tabs . onActivated . addListener ( ( info ) => {
10592 assignManager . removeContextMenu ( ) ;
10693 browser . tabs . get ( info . tabId ) . then ( ( tab ) => {
@@ -127,14 +114,27 @@ const messageHandler = {
127114 } ) ;
128115 } , { urls : [ "<all_urls>" ] , types : [ "main_frame" ] } ) ;
129116
130- // lets remember the last tab created so we can close it if it looks like a redirect
131- browser . tabs . onCreated . addListener ( ( details ) => {
132- this . lastCreatedTab = details ;
117+ browser . tabs . onCreated . addListener ( ( tab ) => {
118+ // lets remember the last tab created so we can close it if it looks like a redirect
119+ this . lastCreatedTab = tab ;
120+ if ( tab . cookieStoreId ) {
121+ this . unhideContainer ( tab . cookieStoreId ) ;
122+ }
133123 setTimeout ( ( ) => {
134124 this . lastCreatedTab = null ;
135125 } , this . LAST_CREATED_TAB_TIMER ) ;
136126 } ) ;
127+ } ,
137128
129+ async unhideContainer ( cookieStoreId ) {
130+ if ( ! this . unhideQueue . includes ( cookieStoreId ) ) {
131+ this . unhideQueue . push ( cookieStoreId ) ;
132+ // Unhide all hidden tabs
133+ await backgroundLogic . showTabs ( {
134+ cookieStoreId
135+ } ) ;
136+ this . unhideQueue . splice ( this . unhideQueue . indexOf ( cookieStoreId ) , 1 ) ;
137+ }
138138 } ,
139139
140140 async onFocusChangedCallback ( windowId ) {
0 commit comments