Skip to content

Commit 03a0985

Browse files
Merge branch 'master' into mrschmidt/smallererrors
2 parents 23cc7c4 + 437c404 commit 03a0985

File tree

34 files changed

+191
-212
lines changed

34 files changed

+191
-212
lines changed

.github/workflows/cross-browser-test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ jobs:
99
cross-browser-test:
1010
name: Cross-Browser (Saucelabs) Tests
1111
runs-on: ubuntu-latest
12-
if: github.event.pull_request.merged
1312
env:
1413
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
1514
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}

config/karma.saucelabs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2017 Google Inc.
3+
* Copyright 2017 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -201,7 +201,7 @@ module.exports = function(config) {
201201
maxLogLines: 5,
202202
suppressErrorSummary: false,
203203
suppressFailed: false,
204-
suppressPassed: true,
204+
suppressPassed: false,
205205
suppressSkipped: true,
206206
showSpecTiming: true,
207207
failFast: false

integration/browserify/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "karma start --single-run"
88
},
99
"dependencies": {
10-
"firebase": "7.13.1"
10+
"firebase": "7.13.2"
1111
},
1212
"devDependencies": {
1313
"@babel/core": "7.8.7",

integration/firebase-typings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"test": "tsc"
77
},
88
"dependencies": {
9-
"firebase": "7.13.1"
9+
"firebase": "7.13.2"
1010
},
1111
"devDependencies": {
1212
"typescript": "3.8.3"

integration/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"test:manual": "mocha --exit"
99
},
1010
"dependencies": {
11-
"firebase": "7.13.1"
11+
"firebase": "7.13.2"
1212
},
1313
"devDependencies": {
1414
"chai": "4.2.0",

integration/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"test": "karma start --single-run"
77
},
88
"dependencies": {
9-
"firebase": "7.13.1"
9+
"firebase": "7.13.2"
1010
},
1111
"devDependencies": {
1212
"@babel/core": "7.8.7",

integration/webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "karma start --single-run"
88
},
99
"dependencies": {
10-
"firebase": "7.13.1"
10+
"firebase": "7.13.2"
1111
},
1212
"devDependencies": {
1313
"@babel/core": "7.8.7",

packages-exp/app-exp/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
},
2525
"dependencies": {
2626
"@firebase/app-types-exp": "0.800.0",
27-
"@firebase/util": "0.2.43",
28-
"@firebase/logger": "0.2.0",
29-
"@firebase/component": "0.1.8",
27+
"@firebase/util": "0.2.44",
28+
"@firebase/logger": "0.2.1",
29+
"@firebase/component": "0.1.9",
3030
"tslib": "1.11.1"
3131
},
3232
"license": "Apache-2.0",

packages/analytics/index.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2019 Google Inc.
3+
* Copyright 2019 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -88,7 +88,9 @@ describe('FirebaseAnalytics instance tests', () => {
8888
currency: 'USD'
8989
});
9090
// Clear event stack of async FID call.
91-
await fidDeferred.promise;
91+
// For IE: Need then() or else "expect" runs immediately on FID resolve
92+
// before the other statements in initializeGAId.
93+
await fidDeferred.promise.then();
9294
expect(gtagStub).to.have.been.calledWith('js');
9395
expect(gtagStub).to.have.been.calledWith(
9496
GtagCommand.CONFIG,
@@ -158,7 +160,9 @@ describe('FirebaseAnalytics instance tests', () => {
158160
currency: 'USD'
159161
});
160162
// Clear event stack of async FID call.
161-
await fidDeferred.promise;
163+
// For IE: Need then() or else "expect" runs immediately on FID resolve
164+
// before the other statements in initializeGAId.
165+
await fidDeferred.promise.then();
162166
expect(gtagStub).to.have.been.calledWith('js');
163167
expect(gtagStub).to.have.been.calledWith(
164168
GtagCommand.CONFIG,
@@ -195,8 +199,12 @@ describe('FirebaseAnalytics instance tests', () => {
195199
delete window['dataLayer'];
196200
removeGtagScript();
197201
});
198-
it('Adds the script tag to the page', () => {
202+
it('Adds the script tag to the page', async () => {
203+
const { initializedIdPromisesMap } = getGlobalVars();
204+
await initializedIdPromisesMap[analyticsId];
199205
expect(findGtagScriptOnPage()).to.not.be.null;
206+
expect(typeof window['gtag']).to.equal('function');
207+
expect(Array.isArray(window['dataLayer'])).to.be.true;
200208
});
201209
});
202210
});

packages/analytics/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/analytics",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "A analytics package for new firebase packages",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.cjs.js",
@@ -26,10 +26,10 @@
2626
},
2727
"dependencies": {
2828
"@firebase/analytics-types": "0.3.0",
29-
"@firebase/installations": "0.4.6",
30-
"@firebase/logger": "0.2.0",
31-
"@firebase/util": "0.2.43",
32-
"@firebase/component": "0.1.8",
29+
"@firebase/installations": "0.4.7",
30+
"@firebase/logger": "0.2.1",
31+
"@firebase/util": "0.2.44",
32+
"@firebase/component": "0.1.9",
3333
"tslib": "1.11.1"
3434
},
3535
"license": "Apache-2.0",

packages/app/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/app",
3-
"version": "0.6.0",
3+
"version": "0.6.1",
44
"description": "The primary entrypoint to the Firebase JS SDK",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.node.cjs.js",
@@ -29,9 +29,9 @@
2929
"license": "Apache-2.0",
3030
"dependencies": {
3131
"@firebase/app-types": "0.6.0",
32-
"@firebase/util": "0.2.43",
33-
"@firebase/logger": "0.2.0",
34-
"@firebase/component": "0.1.8",
32+
"@firebase/util": "0.2.44",
33+
"@firebase/logger": "0.2.1",
34+
"@firebase/component": "0.1.9",
3535
"tslib": "1.11.1",
3636
"dom-storage": "2.1.0",
3737
"xmlhttprequest": "1.8.0"

packages/auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/auth",
3-
"version": "0.14.1",
3+
"version": "0.14.2",
44
"main": "dist/auth.js",
55
"module": "dist/auth.esm.js",
66
"description": "Javascript library for Firebase Auth SDK",

packages/component/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/component",
3-
"version": "0.1.8",
3+
"version": "0.1.9",
44
"description": "Firebase Component Platform",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.cjs.js",
@@ -23,7 +23,7 @@
2323
"prepare": "yarn build"
2424
},
2525
"dependencies": {
26-
"@firebase/util": "0.2.43",
26+
"@firebase/util": "0.2.44",
2727
"tslib": "1.11.1"
2828
},
2929
"license": "Apache-2.0",

packages/database/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/database",
3-
"version": "0.5.24",
3+
"version": "0.5.25",
44
"description": "",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.node.cjs.js",
@@ -27,15 +27,15 @@
2727
"peerDependencies": {},
2828
"dependencies": {
2929
"@firebase/database-types": "0.4.14",
30-
"@firebase/logger": "0.2.0",
31-
"@firebase/util": "0.2.43",
32-
"@firebase/component": "0.1.8",
30+
"@firebase/logger": "0.2.1",
31+
"@firebase/util": "0.2.44",
32+
"@firebase/component": "0.1.9",
3333
"@firebase/auth-interop-types": "0.1.4",
3434
"faye-websocket": "0.11.3",
3535
"tslib": "1.11.1"
3636
},
3737
"devDependencies": {
38-
"@firebase/app": "0.6.0",
38+
"@firebase/app": "0.6.1",
3939
"@firebase/app-types": "0.6.0",
4040
"rollup": "2.0.6",
4141
"rollup-plugin-typescript2": "0.26.0",

packages/firebase/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebase",
3-
"version": "7.13.1",
3+
"version": "7.13.2",
44
"description": "Firebase JavaScript library for web and Node.js",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"license": "Apache-2.0",
@@ -39,20 +39,20 @@
3939
"module": "dist/index.esm.js",
4040
"react-native": "dist/index.rn.cjs.js",
4141
"dependencies": {
42-
"@firebase/app": "0.6.0",
42+
"@firebase/app": "0.6.1",
4343
"@firebase/app-types": "0.6.0",
44-
"@firebase/auth": "0.14.1",
45-
"@firebase/database": "0.5.24",
46-
"@firebase/firestore": "1.13.0",
47-
"@firebase/functions": "0.4.38",
48-
"@firebase/installations": "0.4.6",
49-
"@firebase/messaging": "0.6.10",
44+
"@firebase/auth": "0.14.2",
45+
"@firebase/database": "0.5.25",
46+
"@firebase/firestore": "1.13.1",
47+
"@firebase/functions": "0.4.39",
48+
"@firebase/installations": "0.4.7",
49+
"@firebase/messaging": "0.6.11",
5050
"@firebase/polyfill": "0.3.33",
51-
"@firebase/storage": "0.3.30",
52-
"@firebase/performance": "0.2.36",
53-
"@firebase/remote-config": "0.1.17",
54-
"@firebase/analytics": "0.3.0",
55-
"@firebase/util": "0.2.43"
51+
"@firebase/storage": "0.3.31",
52+
"@firebase/performance": "0.2.37",
53+
"@firebase/remote-config": "0.1.18",
54+
"@firebase/analytics": "0.3.1",
55+
"@firebase/util": "0.2.44"
5656
},
5757
"devDependencies": {
5858
"rollup": "2.0.6",

packages/firestore/package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/firestore",
3-
"version": "1.13.0",
3+
"version": "1.13.1",
44
"description": "The Cloud Firestore component of the Firebase JS SDK.",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"scripts": {
@@ -36,10 +36,10 @@
3636
"memory/package.json"
3737
],
3838
"dependencies": {
39-
"@firebase/component": "0.1.8",
39+
"@firebase/component": "0.1.9",
4040
"@firebase/firestore-types": "1.10.1",
41-
"@firebase/logger": "0.2.0",
42-
"@firebase/util": "0.2.43",
41+
"@firebase/logger": "0.2.1",
42+
"@firebase/util": "0.2.44",
4343
"@firebase/webchannel-wrapper": "0.2.38",
4444
"@grpc/proto-loader": "^0.5.0",
4545
"grpc": "1.24.2",
@@ -50,6 +50,8 @@
5050
"@firebase/app-types": "0.x"
5151
},
5252
"devDependencies": {
53+
"@types/json-stable-stringify": "1.0.32",
54+
"json-stable-stringify": "1.0.1",
5355
"protobufjs": "6.8.9",
5456
"rollup": "2.0.6",
5557
"rollup-plugin-copy-assets": "1.1.0",

packages/firestore/src/core/target_id_generator.ts

Lines changed: 14 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -15,83 +15,43 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { assert } from '../util/assert';
1918
import { TargetId } from './types';
2019

21-
const RESERVED_BITS = 1;
22-
23-
const enum GeneratorIds {
24-
QueryCache = 0, // The target IDs for user-issued queries are even (end in 0).
25-
SyncEngine = 1 // The target IDs for limbo detection are odd (end in 1).
26-
}
20+
/** Offset to ensure non-overlapping target ids. */
21+
const OFFSET = 2;
2722

2823
/**
2924
* Generates monotonically increasing target IDs for sending targets to the
3025
* watch stream.
3126
*
32-
* The client constructs two generators, one for the query cache (via
33-
* forQueryCache()), and one for limbo documents (via forSyncEngine()). These
34-
* two generators produce non-overlapping IDs (by using even and odd IDs
27+
* The client constructs two generators, one for the target cache, and one for
28+
* for the sync engine (to generate limbo documents targets). These
29+
* generators produce non-overlapping IDs (by using even and odd IDs
3530
* respectively).
3631
*
3732
* By separating the target ID space, the query cache can generate target IDs
3833
* that persist across client restarts, while sync engine can independently
3934
* generate in-memory target IDs that are transient and can be reused after a
4035
* restart.
4136
*/
42-
// TODO(mrschmidt): Explore removing this class in favor of generating these IDs
43-
// directly in SyncEngine and LocalStore.
4437
export class TargetIdGenerator {
45-
// Initialized in the constructor via call to seek().
46-
private nextId!: TargetId;
47-
48-
/**
49-
* Instantiates a new TargetIdGenerator. If a seed is provided, the generator
50-
* will use the seed value as the next target ID.
51-
*/
52-
constructor(private generatorId: number, seed?: number) {
53-
assert(
54-
(generatorId & RESERVED_BITS) === generatorId,
55-
`Generator ID ${generatorId} contains more than ${RESERVED_BITS} reserved bits`
56-
);
57-
this.seek(seed !== undefined ? seed : this.generatorId);
58-
}
38+
constructor(private lastId: number) {}
5939

6040
next(): TargetId {
61-
const nextId = this.nextId;
62-
this.nextId += 1 << RESERVED_BITS;
63-
return nextId;
64-
}
65-
66-
/**
67-
* Returns the ID that follows the given ID. Subsequent calls to `next()`
68-
* use the newly returned target ID as their base.
69-
*/
70-
// PORTING NOTE: Multi-tab only.
71-
after(targetId: TargetId): TargetId {
72-
this.seek(targetId + (1 << RESERVED_BITS));
73-
return this.next();
74-
}
75-
76-
private seek(targetId: TargetId): void {
77-
assert(
78-
(targetId & RESERVED_BITS) === this.generatorId,
79-
'Cannot supply target ID from different generator ID'
80-
);
81-
this.nextId = targetId;
41+
this.lastId += OFFSET;
42+
return this.lastId;
8243
}
8344

8445
static forTargetCache(): TargetIdGenerator {
85-
// We seed the query cache generator to return '2' as its first ID, as there
86-
// is no differentiation in the protocol layer between an unset number and
87-
// the number '0'. If we were to sent a target with target ID '0', the
88-
// backend would consider it unset and replace it with its own ID.
89-
const targetIdGenerator = new TargetIdGenerator(GeneratorIds.QueryCache, 2);
90-
return targetIdGenerator;
46+
// The target cache generator must return '2' in its first call to `next()`
47+
// as there is no differentiation in the protocol layer between an unset
48+
// number and the number '0'. If we were to sent a target with target ID
49+
// '0', the backend would consider it unset and replace it with its own ID.
50+
return new TargetIdGenerator(2 - OFFSET);
9151
}
9252

9353
static forSyncEngine(): TargetIdGenerator {
9454
// Sync engine assigns target IDs for limbo document detection.
95-
return new TargetIdGenerator(GeneratorIds.SyncEngine);
55+
return new TargetIdGenerator(1 - OFFSET);
9656
}
9757
}

0 commit comments

Comments
 (0)