Skip to content

Commit dd98632

Browse files
Don't use process when not available
This breaks a compile test I am doing with the google-clousre-compiler
1 parent b21b946 commit dd98632

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/firestore/src/local/indexeddb_mutation_queue.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,8 @@ function convertStreamToken(token: ProtoByteString): string {
675675
if (token instanceof Uint8Array) {
676676
// TODO(b/78771403): Convert tokens to strings during deserialization
677677
assert(
678-
process.env.USE_MOCK_PERSISTENCE === 'YES',
678+
typeof process !== 'undefined' &&
679+
process.env.USE_MOCK_PERSISTENCE === 'YES',
679680
'Persisting non-string stream tokens is only supported with mock persistence.'
680681
);
681682
return token.toString();

packages/firestore/src/local/local_serializer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ export class LocalSerializer {
251251
if (queryData.resumeToken instanceof Uint8Array) {
252252
// TODO(b/78771403): Convert tokens to strings during deserialization
253253
assert(
254-
process.env.USE_MOCK_PERSISTENCE === 'YES',
254+
typeof process !== 'undefined' &&
255+
process.env.USE_MOCK_PERSISTENCE === 'YES',
255256
'Persisting non-string stream tokens is only supported with mock persistence .'
256257
);
257258
resumeToken = queryData.resumeToken.toString();

packages/firestore/src/local/simple_db.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export class SimpleDb {
159159
// If we are running in Node using the IndexedDBShim, `window` is defined,
160160
// but `window.navigator` is not. In this case, we support IndexedDB and
161161
// return `true`.
162-
if (window.navigator === undefined) {
162+
if (window.navigator === undefined && typeof process !== undefined) {
163163
return process.env.USE_MOCK_PERSISTENCE === 'YES';
164164
}
165165

0 commit comments

Comments
 (0)