@@ -68,14 +68,14 @@ function listener(details) {
6868
6969 let filter = browser . webRequest . filterResponseData ( details . requestId ) ;
7070
71- let queryString = new URLSearchParams ( details . url . split ( "?" ) [ 1 ] ) ;
71+ const queryString = new URL ( details . url ) . searchParams ;
7272 // Parse some params for container name
7373 let accountRole = queryString . get ( "role_name" ) ;
7474 let accountNumber = queryString . get ( "account_id" ) ;
7575
7676 // pull subdomain for folks that might have multiple SSO
7777 // portals that have access to the same account and role names
78- let host = / : \/ \/ ( [ ^ \/ ] + ) / . exec ( details . originUrl ) [ 1 ] ;
78+ const host = new URL ( details . originUrl ) . host ;
7979 let subdomain = host . split ( "." ) [ 0 ] ;
8080
8181 let params = {
@@ -123,19 +123,19 @@ function listener(details) {
123123
124124 const container = await prepareContainer ( { name } ) ;
125125
126+ // get index of tab we're about to remove, put ours at that spot
127+ const tab = await browser . tabs . get ( details . tabId ) ;
128+
126129 const createTabParams = {
127130 cookieStoreId : container . cookieStoreId ,
128131 url : url ,
129- pinned : false
132+ pinned : false ,
133+ index : tab . index ,
130134 } ;
131135
132- // get index of tab we're about to remove, put ours at that spot
133- const tab = await browser . tabs . get ( details . tabId ) ;
134-
135- createTabParams . index = tab . index ;
136- browser . tabs . create ( createTabParams ) ;
136+ await browser . tabs . create ( createTabParams ) ;
137137
138- browser . tabs . remove ( details . tabId ) ;
138+ await browser . tabs . remove ( details . tabId ) ;
139139 } else {
140140 filter . write ( encoder . encode ( str ) ) ;
141141 }
@@ -281,9 +281,9 @@ async function samlListener(details) {
281281 index : tab . index ,
282282 } ;
283283
284- browser . tabs . create ( createTabParams ) ;
284+ await browser . tabs . create ( createTabParams ) ;
285285
286- browser . tabs . remove ( details . tabId ) ;
286+ await browser . tabs . remove ( details . tabId ) ;
287287
288288 return { cancel : true } ;
289289}
0 commit comments