File tree 5 files changed +26
-1
lines changed
firestore/src/platform/browser
5 files changed +26
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @firebase/firestore ' : minor
3
+ ' @firebase/firestore-compat ' : minor
4
+ ' @firebase/webchannel-wrapper ' : minor
5
+ ' firebase ' : minor
6
+ ---
7
+
8
+ Set withCredentials=true when making requests via non-streaming RPCs, like is done for streaming RPCs.
Original file line number Diff line number Diff line change @@ -22,8 +22,11 @@ import {
22
22
Firestore as FirestoreExp ,
23
23
FirestoreError ,
24
24
_EmptyAuthCredentialsProvider ,
25
- _EmptyAppCheckTokenProvider
25
+ _EmptyAppCheckTokenProvider ,
26
+ Query as ExpQuery ,
27
+ getCountFromServer
26
28
} from '@firebase/firestore' ;
29
+ import { Compat } from '@firebase/util' ;
27
30
28
31
import {
29
32
Firestore as FirestoreCompat ,
@@ -98,6 +101,15 @@ export class Firestore extends FirestoreCompat {
98
101
new MemoryPersistenceProvider ( )
99
102
) ;
100
103
}
104
+
105
+ INTERNAL = {
106
+ delete : ( ) => this . terminate ( ) ,
107
+ count : ( query : Compat < ExpQuery < unknown > > ) => {
108
+ return getCountFromServer ( query . _delegate ) . then ( response => {
109
+ return response . data ( ) . count ;
110
+ } ) ;
111
+ }
112
+ } ;
101
113
}
102
114
103
115
function databaseIdFromFirestoreDatabase (
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ export class WebChannelConnection extends RestConnection {
72
72
) : Promise < Resp > {
73
73
return new Promise ( ( resolve : Resolver < Resp > , reject : Rejecter ) => {
74
74
const xhr = new XhrIo ( ) ;
75
+ xhr . setWithCredentials ( true ) ;
75
76
xhr . listenOnce ( EventType . COMPLETE , ( ) => {
76
77
try {
77
78
switch ( xhr . getLastErrorCode ( ) ) {
Original file line number Diff line number Diff line change @@ -74,6 +74,8 @@ export class XhrIo {
74
74
getResponseJson ( ) : WebChannelError | object ;
75
75
76
76
listenOnce ( type : string , cb : ( param : unknown ) => void ) : void ;
77
+
78
+ setWithCredentials ( withCredentials : boolean ) : void ;
77
79
}
78
80
79
81
export interface WebChannelOptions {
Original file line number Diff line number Diff line change @@ -75,6 +75,8 @@ goog.net.XhrIo.prototype['getResponseJson'] =
75
75
goog . net . XhrIo . prototype [ 'getResponseText' ] =
76
76
goog . net . XhrIo . prototype . getResponseText ;
77
77
goog . net . XhrIo . prototype [ 'send' ] = goog . net . XhrIo . prototype . send ;
78
+ goog . net . XhrIo . prototype [ 'setWithCredentials' ] =
79
+ goog . net . XhrIo . prototype . setWithCredentials ;
78
80
79
81
module [ 'exports' ] [ 'createWebChannelTransport' ] =
80
82
goog . net . createWebChannelTransport ;
You can’t perform that action at this time.
0 commit comments