Skip to content

Commit e471cf7

Browse files
committed
Merge remote-tracking branch 'origin/main' into mtewani/add-cookie-support-studio
2 parents d660fab + 0e12766 commit e471cf7

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

.changeset/nine-pugs-crash.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
"@firebase/app-check": patch
32
"@firebase/auth": patch
43
"@firebase/data-connect": patch
54
"@firebase/database-compat": patch

packages/firestore/src/platform/browser/webchannel_connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class WebChannelConnection extends RestConnection {
7272
url: string,
7373
headers: StringMap,
7474
body: Req,
75-
_isUsingEmulator: boolean
75+
_forwardCredentials: boolean
7676
): Promise<Resp> {
7777
const streamId = generateUniqueDebugId();
7878
return new Promise((resolve: Resolver<Resp>, reject: Rejecter) => {

packages/firestore/src/platform/browser_lite/fetch_connection.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { isCloudWorkstation } from '@firebase/util';
19-
2018
import { Token } from '../../api/credentials';
2119
import { Stream } from '../../remote/connection';
2220
import { RestConnection } from '../../remote/rest_connection';
@@ -41,7 +39,7 @@ export class FetchConnection extends RestConnection {
4139
url: string,
4240
headers: StringMap,
4341
body: Req,
44-
isUsingEmulator: boolean
42+
forwardCredentials: boolean
4543
): Promise<Resp> {
4644
const requestJson = JSON.stringify(body);
4745
let response: Response;
@@ -52,7 +50,7 @@ export class FetchConnection extends RestConnection {
5250
headers,
5351
body: requestJson
5452
};
55-
if (isCloudWorkstation(new URL(url).host) && isUsingEmulator) {
53+
if (forwardCredentials) {
5654
fetchArgs.credentials = 'include';
5755
}
5856
response = await fetch(url, fetchArgs);

packages/firestore/src/remote/rest_connection.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18+
import { isCloudWorkstation } from '@firebase/util';
19+
1820
import { SDK_VERSION } from '../../src/core/version';
1921
import { Token } from '../api/credentials';
2022
import {
@@ -98,12 +100,15 @@ export abstract class RestConnection implements Connection {
98100
};
99101
this.modifyHeadersForRequest(headers, authToken, appCheckToken);
100102

103+
const { host } = new URL(url);
104+
const forwardCredentials =
105+
isCloudWorkstation(host);
101106
return this.performRPCRequest<Req, Resp>(
102107
rpcName,
103108
url,
104109
headers,
105110
req,
106-
this.databaseInfo.isUsingEmulator
111+
forwardCredentials
107112
).then(
108113
response => {
109114
logDebug(LOG_TAG, `Received RPC '${rpcName}' ${streamId}: `, response);
@@ -186,7 +191,7 @@ export abstract class RestConnection implements Connection {
186191
url: string,
187192
headers: StringMap,
188193
body: Req,
189-
isUsingEmulator: boolean
194+
_forwardCredentials: boolean
190195
): Promise<Resp>;
191196

192197
private makeUrl(rpcName: string, path: string): string {

0 commit comments

Comments
 (0)