@@ -50,11 +50,16 @@ ExtensionApi.runtime.onMessage.addListener( ( request, sender, callback ) =>
50
50
return false ;
51
51
}
52
52
53
+ /** @type {browser.tabs.Tab } */
54
+ // @ts -ignore - cookieStoreId is only available in Firefox
55
+ const firefoxTab = sender . tab ;
56
+ const cookieStoreId = firefoxTab ?. cookieStoreId ;
57
+
53
58
switch ( request . contentScriptQuery )
54
59
{
55
60
case 'InvalidateCache' : InvalidateCache ( ) ; callback ( ) ; return true ;
56
- case 'FetchSteamUserData' : FetchSteamUserData ( callback ) ; return true ;
57
- case 'FetchSteamUserFamilyData' : FetchSteamUserFamilyData ( callback ) ; return true ;
61
+ case 'FetchSteamUserData' : FetchSteamUserData ( callback , cookieStoreId ) ; return true ;
62
+ case 'FetchSteamUserFamilyData' : FetchSteamUserFamilyData ( callback , cookieStoreId ) ; return true ;
58
63
case 'GetApp' : GetApp ( request . appid , callback ) ; return true ;
59
64
case 'GetAppPrice' : GetAppPrice ( request , callback ) ; return true ;
60
65
case 'GetAchievementsGroups' : GetAchievementsGroups ( request . appid , callback ) ; return true ;
@@ -85,8 +90,9 @@ function InvalidateCache()
85
90
86
91
/**
87
92
* @param {(obj: {data: Record<string, any>}|{error: string, data?: Record<string, any>}) => void } callback
93
+ * @param {string|undefined } cookieStoreId
88
94
*/
89
- async function FetchSteamUserData ( callback )
95
+ async function FetchSteamUserData ( callback , cookieStoreId )
90
96
{
91
97
if ( userDataCache !== null )
92
98
{
@@ -118,6 +124,9 @@ async function FetchSteamUserData( callback )
118
124
// This will trigger login.steampowered.com redirect flow if user has expired cookies.
119
125
Accept : 'text/html' ,
120
126
} ,
127
+
128
+ // @ts -ignore - only available in Firefox
129
+ cookieStoreId,
121
130
}
122
131
) ;
123
132
const response = await responseFetch . json ( ) ;
@@ -170,8 +179,9 @@ async function FetchSteamUserData( callback )
170
179
171
180
/**
172
181
* @param {(obj: {data: Record<string, any>}|{error: string, data?: Record<string, any>}) => void } callback
182
+ * @param {string|undefined } cookieStoreId
173
183
*/
174
- async function FetchSteamUserFamilyData ( callback )
184
+ async function FetchSteamUserFamilyData ( callback , cookieStoreId )
175
185
{
176
186
if ( userFamilyDataCache !== null )
177
187
{
@@ -212,6 +222,9 @@ async function FetchSteamUserFamilyData( callback )
212
222
headers : {
213
223
Accept : 'application/json' ,
214
224
} ,
225
+
226
+ // @ts -ignore - only available in Firefox
227
+ cookieStoreId,
215
228
}
216
229
) ;
217
230
const token = await tokenResponseFetch . json ( ) ;
@@ -237,7 +250,10 @@ async function FetchSteamUserFamilyData( callback )
237
250
{
238
251
headers : {
239
252
Accept : 'application/json' ,
240
- }
253
+ } ,
254
+
255
+ // @ts -ignore - only available in Firefox
256
+ cookieStoreId,
241
257
}
242
258
) ;
243
259
const response = await responseFetch . json ( ) ;
0 commit comments