Skip to content

Commit e80a027

Browse files
committed
Merge branch 'ss-fork-testing' into ss-restore-testing
2 parents 5961e83 + f9d9898 commit e80a027

File tree

93 files changed

+2253
-684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2253
-684
lines changed

.changeset/calm-apes-collect.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

.changeset/cold-bats-hammer.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@firebase/rules-unit-testing': major
3+
---
4+
5+
Release `@firebase/rules-unit-testing` to replace the `@firebase/testing` package. The new
6+
package is API compatible but has the following breaking behavior changes:
7+
8+
* `assertFails()` will now only fail on `PERMISSION DENIED` errors, not any error.
9+
* `initializeAdminApp()` now relies on `firebase-admin` rather than imitating the Admin SDK.

.changeset/quick-drinks-cheat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": patch
3+
---
4+
5+
The SDK no longer crashes with the error "The database connection is closing". Instead, the individual operations that cause this error may be rejected.

.changeset/spicy-masks-sort.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"firebase": patch
3+
"@firebase/analytics": patch
4+
---
5+
6+
Added Browser Extension check for Firebase Analytics. analytics.isSupported() will now return Promise<false> for extension environments.

.changeset/thirty-flies-flow.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

.changeset/tidy-elephants-beam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": patch
3+
---
4+
5+
Fixed a bug that caused slow retries for IndexedDB operations even when a webpage re-entered the foreground.

.github/workflows/test-changed.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ jobs:
88
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v2
12-
- name: Checkout
13-
run: |
14-
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
11+
- name: Checkout Repo
12+
uses: actions/checkout@master
13+
with:
14+
# This makes Actions fetch all Git history so run-changed script can diff properly.
15+
fetch-depth: 0
1516
- name: Set up Node (10)
1617
uses: actions/setup-node@v1
1718
with:

config/webpack.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ module.exports = {
8686
new webpack.NormalModuleReplacementPlugin(
8787
FIRESTORE_PLATFORM_RE,
8888
resource => {
89+
const targetPlatform = process.env.TEST_PLATFORM || 'browser';
8990
resource.request = resource.request.replace(
9091
FIRESTORE_PLATFORM_RE,
91-
'$1/platform/browser/$2.ts'
92+
`$1/platform/${targetPlatform}/$2.ts`
9293
);
9394
}
9495
),

integration/browserify/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"test:ci": "node ../../scripts/run_tests_in_ci.js"
99
},
1010
"devDependencies": {
11-
"firebase": "7.17.1",
11+
"firebase": "7.17.2",
1212
"@babel/core": "7.11.0",
1313
"@babel/preset-env": "7.11.0",
1414
"browserify": "16.5.1",

integration/firebase-typings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test:ci": "node ../../scripts/run_tests_in_ci.js"
88
},
99
"devDependencies": {
10-
"firebase": "7.17.1",
10+
"firebase": "7.17.2",
1111
"typescript": "3.9.7"
1212
}
1313
}

integration/firestore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"peerDependencies": {
1717
"@firebase/app": "0.x",
18-
"@firebase/firestore": "1.16.2"
18+
"@firebase/firestore": "1.16.3"
1919
},
2020
"devDependencies": {
2121
"@types/mocha": "7.0.2",

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
"devDependencies": {
11-
"firebase": "7.17.1",
11+
"firebase": "7.17.2",
1212
"chai": "4.2.0",
1313
"chromedriver": "84.0.1",
1414
"express": "4.17.1",

integration/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test:ci": "node ../../scripts/run_tests_in_ci.js"
88
},
99
"devDependencies": {
10-
"firebase": "7.17.1",
10+
"firebase": "7.17.2",
1111
"@babel/core": "7.11.0",
1212
"@babel/preset-env": "7.11.0",
1313
"@types/chai": "4.2.12",

integration/webpack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"test:ci": "node ../../scripts/run_tests_in_ci.js"
99
},
1010
"devDependencies": {
11-
"firebase": "7.17.1",
11+
"firebase": "7.17.2",
1212
"@babel/core": "7.11.0",
1313
"@babel/preset-env": "7.11.0",
1414
"chai": "4.2.0",

packages-exp/firebase-exp/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebase-exp",
3-
"version": "0.800.3",
3+
"version": "0.800.4",
44
"private": true,
55
"description": "Firebase JavaScript library for web and Node.js",
66
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
@@ -37,7 +37,7 @@
3737
"dependencies": {
3838
"@firebase/app-exp": "0.0.800",
3939
"@firebase/functions-exp": "0.0.800",
40-
"@firebase/firestore": "1.16.2"
40+
"@firebase/firestore": "1.16.3"
4141
},
4242
"devDependencies": {
4343
"rollup": "2.23.0",

packages/analytics/index.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ import { ERROR_FACTORY, AnalyticsError } from './src/errors';
3535
import {
3636
isIndexedDBAvailable,
3737
validateIndexedDBOpenable,
38-
areCookiesEnabled
38+
areCookiesEnabled,
39+
isBrowserExtension
3940
} from '@firebase/util';
4041
import { name, version } from './package.json';
4142

@@ -109,19 +110,25 @@ declare module '@firebase/app-types' {
109110
}
110111

111112
/**
112-
* this is a public static method provided to users that wraps three different checks:
113+
* this is a public static method provided to users that wraps four different checks:
113114
*
115+
* 1. check if it's not a browser extension environment.
114116
* 1. check if cookie is enabled in current browser.
115-
* 2. check if IndexedDB is supported by the browser environment.
116-
* 3. check if the current browser context is valid for using IndexedDB.
117+
* 3. check if IndexedDB is supported by the browser environment.
118+
* 4. check if the current browser context is valid for using IndexedDB.
119+
*
117120
*/
118121
async function isSupported(): Promise<boolean> {
122+
if (isBrowserExtension()) {
123+
return false;
124+
}
119125
if (!areCookiesEnabled()) {
120126
return false;
121127
}
122128
if (!isIndexedDBAvailable()) {
123129
return false;
124130
}
131+
125132
try {
126133
const isDBOpenable: boolean = await validateIndexedDBOpenable();
127134
return isDBOpenable;

packages/analytics/src/errors.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export const enum AnalyticsError {
2525
INTEROP_COMPONENT_REG_FAILED = 'interop-component-reg-failed',
2626
INDEXED_DB_UNSUPPORTED = 'indexedDB-unsupported',
2727
INVALID_INDEXED_DB_CONTEXT = 'invalid-indexedDB-context',
28-
COOKIES_NOT_ENABLED = 'cookies-not-enabled'
28+
COOKIES_NOT_ENABLED = 'cookies-not-enabled',
29+
INVALID_ANALYTICS_CONTEXT = 'invalid-analytics-context'
2930
}
3031

3132
const ERRORS: ErrorMap<AnalyticsError> = {
@@ -50,7 +51,9 @@ const ERRORS: ErrorMap<AnalyticsError> = {
5051
'Wrap initialization of analytics in analytics.isSupported() ' +
5152
'to prevent initialization in unsupported environments',
5253
[AnalyticsError.COOKIES_NOT_ENABLED]:
53-
'Cookies are not enabled in this browser environment. Analytics requires cookies to be enabled.'
54+
'Cookies are not enabled in this browser environment. Analytics requires cookies to be enabled.',
55+
[AnalyticsError.INVALID_ANALYTICS_CONTEXT]:
56+
'Firebase Analytics is not supported in browser extensions.'
5457
};
5558

5659
interface ErrorParams {

packages/analytics/src/factory.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ import { FirebaseInstallations } from '@firebase/installations-types';
4141
import {
4242
isIndexedDBAvailable,
4343
validateIndexedDBOpenable,
44-
areCookiesEnabled
44+
areCookiesEnabled,
45+
isBrowserExtension
4546
} from '@firebase/util';
4647

4748
/**
@@ -122,6 +123,9 @@ export function factory(
122123
app: FirebaseApp,
123124
installations: FirebaseInstallations
124125
): FirebaseAnalytics {
126+
if (isBrowserExtension()) {
127+
throw ERROR_FACTORY.create(AnalyticsError.INVALID_ANALYTICS_CONTEXT);
128+
}
125129
if (!areCookiesEnabled()) {
126130
throw ERROR_FACTORY.create(AnalyticsError.COOKIES_NOT_ENABLED);
127131
}

packages/database-types/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# @firebase/database-types
2+
3+
## 0.5.2
4+
### Patch Changes
5+
6+
7+
8+
- [`ef348fed`](https://github.com/firebase/firebase-js-sdk/commit/ef348fed291338351706a697cbb9fb17a9d06ff4) [#3511](https://github.com/firebase/firebase-js-sdk/pull/3511) - Added interface `Database` which is implemented by `FirebaseDatabase`. This allows consumer SDKs (such as the Firebase Admin SDK) to export the database types as an interface.

packages/database-types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/database-types",
3-
"version": "0.5.1",
3+
"version": "0.5.2",
44
"description": "@firebase/database Types",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"license": "Apache-2.0",

packages/database/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Unreleased
22

3+
## 0.6.10
4+
5+
### Patch Changes
6+
7+
- [`ef348fed`](https://github.com/firebase/firebase-js-sdk/commit/ef348fed291338351706a697cbb9fb17a9d06ff4) [#3511](https://github.com/firebase/firebase-js-sdk/pull/3511) - Added interface `Database` which is implemented by `FirebaseDatabase`. This allows consumer SDKs (such as the Firebase Admin SDK) to export the database types as an interface.
8+
9+
- Updated dependencies [[`ef348fed`](https://github.com/firebase/firebase-js-sdk/commit/ef348fed291338351706a697cbb9fb17a9d06ff4)]:
10+
- @firebase/database-types@0.5.2
11+
312
## 0.6.9
413

514
### Patch Changes

packages/database/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@firebase/database",
3-
"version": "0.6.9",
3+
"version": "0.6.10",
44
"description": "",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.node.cjs.js",
@@ -25,7 +25,7 @@
2525
"license": "Apache-2.0",
2626
"peerDependencies": {},
2727
"dependencies": {
28-
"@firebase/database-types": "0.5.1",
28+
"@firebase/database-types": "0.5.2",
2929
"@firebase/logger": "0.2.6",
3030
"@firebase/util": "0.3.0",
3131
"@firebase/component": "0.1.17",

packages/firebase/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# firebase
22

3+
## 7.17.2
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`ef348fed`](https://github.com/firebase/firebase-js-sdk/commit/ef348fed291338351706a697cbb9fb17a9d06ff4)]:
8+
- @firebase/database@0.6.10
9+
- @firebase/firestore@1.16.3
10+
311
## 7.17.1
412

513
### Patch Changes

packages/firebase/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firebase",
3-
"version": "7.17.1",
3+
"version": "7.17.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",
@@ -48,8 +48,8 @@
4848
"@firebase/app": "0.6.9",
4949
"@firebase/app-types": "0.6.1",
5050
"@firebase/auth": "0.14.9",
51-
"@firebase/database": "0.6.9",
52-
"@firebase/firestore": "1.16.2",
51+
"@firebase/database": "0.6.10",
52+
"@firebase/firestore": "1.16.3",
5353
"@firebase/functions": "0.4.49",
5454
"@firebase/installations": "0.4.15",
5555
"@firebase/messaging": "0.6.21",

packages/firestore/.idea/runConfigurations/firestore_lite_Tests__Emulator_.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/firestore/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @firebase/firestore
22

3+
## 1.16.3
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`7f0860a4`](https://github.com/firebase/firebase-js-sdk/commit/7f0860a4ced76da8492ae44d2267a2f1cc58eccb)]:
8+
- @firebase/webchannel-wrapper@0.3.0
9+
310
## 1.16.2
411

512
### Patch Changes

packages/firestore/exp/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
import './register';
18+
import { registerFirestore } from './register';
19+
20+
registerFirestore();
1921

2022
export { FieldPath, documentId } from '../lite/src/api/field_path';
2123

packages/firestore/exp/register.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,3 @@ export function registerFirestore(): void {
3737
);
3838
registerVersion('firestore-exp', version, 'node');
3939
}
40-
41-
registerFirestore();

packages/firestore/exp/test/bootstrap.ts

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

18-
import '../register';
19-
18+
import { registerFirestore } from '../register';
19+
registerFirestore();
2020
/**
2121
* This will include all of the test files and compile them as needed
2222
*

packages/firestore/karma.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ function getTestFiles(argv) {
5555
} else if (argv.integration) {
5656
return [legcayIntegrationTests];
5757
} else if (argv.lite) {
58+
process.env.TEST_PLATFORM = 'browser_lite';
5859
return [liteIntegrationTests];
5960
} else if (argv.exp) {
6061
return [expIntegrationTests];

packages/firestore/lite/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* limitations under the License.
1616
*/
1717

18-
import './register';
18+
import { registerFirestore } from './register';
19+
20+
registerFirestore();
1921

2022
export {
2123
Firestore as FirebaseFirestore,

packages/firestore/lite/register.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,3 @@ export function registerFirestore(): void {
3737
);
3838
registerVersion('firestore-lite', version, 'node');
3939
}
40-
41-
registerFirestore();

packages/firestore/lite/test/bootstrap.ts

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

18-
import '../register';
19-
18+
import { registerFirestore } from '../register';
19+
registerFirestore();
2020
/**
2121
* This will include all of the test files and compile them as needed
2222
*

0 commit comments

Comments
 (0)