Skip to content

Commit 370a082

Browse files
committed
Merge branch 'master' into fei-firestore-no-sideeffect
2 parents 7c5bec3 + 36be62a commit 370a082

File tree

78 files changed

+2152
-1100
lines changed

Some content is hidden

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

78 files changed

+2152
-1100
lines changed

.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/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.

config/functions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dependencies": {
55
"cors": "2.8.5",
66
"firebase-admin": "9.0.0",
7-
"firebase-functions": "3.8.0"
7+
"firebase-functions": "3.9.0"
88
},
99
"private": true,
1010
"engines": {

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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
},
1010
"devDependencies": {
1111
"firebase": "7.17.1",
12-
"@babel/core": "7.10.5",
13-
"@babel/preset-env": "7.10.4",
12+
"@babel/core": "7.11.0",
13+
"@babel/preset-env": "7.11.0",
1414
"browserify": "16.5.1",
1515
"chai": "4.2.0",
16-
"karma": "5.1.0",
16+
"karma": "5.1.1",
1717
"karma-babel-preprocessor": "8.0.1",
1818
"karma-chrome-launcher": "3.1.0",
1919
"karma-firefox-launcher": "1.3.0",

integration/firestore/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
"gulp": "4.0.2",
2323
"gulp-filter": "6.0.0",
2424
"gulp-replace": "1.0.0",
25-
"karma": "5.1.0",
25+
"karma": "5.1.1",
2626
"karma-chrome-launcher": "3.1.0",
2727
"karma-firefox-launcher": "1.3.0",
2828
"karma-mocha": "2.0.1",
2929
"karma-spec-reporter": "0.0.32",
3030
"mocha": "7.2.0",
3131
"ts-loader": "6.2.2",
3232
"typescript": "3.9.7",
33-
"webpack": "4.44.0",
33+
"webpack": "4.44.1",
3434
"webpack-stream": "5.2.1"
3535
}
3636
}

integration/messaging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"chai": "4.2.0",
1313
"chromedriver": "84.0.1",
1414
"express": "4.17.1",
15-
"geckodriver": "1.19.1",
15+
"geckodriver": "1.20.0",
1616
"mocha": "7.2.0",
1717
"node-fetch": "2.6.0",
1818
"selenium-assistant": "6.1.0"

integration/typescript/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
},
99
"devDependencies": {
1010
"firebase": "7.17.1",
11-
"@babel/core": "7.10.5",
12-
"@babel/preset-env": "7.10.4",
11+
"@babel/core": "7.11.0",
12+
"@babel/preset-env": "7.11.0",
1313
"@types/chai": "4.2.12",
1414
"@types/mocha": "7.0.2",
1515
"chai": "4.2.0",
16-
"karma": "5.1.0",
16+
"karma": "5.1.1",
1717
"karma-babel-preprocessor": "8.0.1",
1818
"karma-chrome-launcher": "3.1.0",
1919
"karma-firefox-launcher": "1.3.0",

integration/webpack/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
},
1010
"devDependencies": {
1111
"firebase": "7.17.1",
12-
"@babel/core": "7.10.5",
13-
"@babel/preset-env": "7.10.4",
12+
"@babel/core": "7.11.0",
13+
"@babel/preset-env": "7.11.0",
1414
"chai": "4.2.0",
15-
"karma": "5.1.0",
15+
"karma": "5.1.1",
1616
"karma-babel-preprocessor": "8.0.1",
1717
"karma-chrome-launcher": "3.1.0",
1818
"karma-firefox-launcher": "1.3.0",
1919
"karma-mocha": "2.0.1",
2020
"karma-sauce-launcher": "1.2.0",
2121
"karma-spec-reporter": "0.0.32",
2222
"mocha": "7.2.0",
23-
"webpack": "4.44.0",
23+
"webpack": "4.44.1",
2424
"webpack-cli": "3.3.12"
2525
}
2626
}

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@
9191
"coveralls": "3.1.0",
9292
"del": "5.1.0",
9393
"dependency-graph": "0.9.0",
94-
"eslint": "7.5.0",
94+
"eslint": "7.6.0",
9595
"eslint-plugin-import": "2.22.0",
9696
"express": "4.17.1",
9797
"find-free-port": "2.0.0",
98-
"firebase-functions": "3.8.0",
98+
"firebase-functions": "3.9.0",
9999
"firebase-tools": "8.6.0",
100100
"git-rev-sync": "2.0.0",
101101
"glob": "7.1.6",
@@ -105,7 +105,7 @@
105105
"inquirer": "7.3.3",
106106
"istanbul-instrumenter-loader": "3.0.1",
107107
"js-yaml": "3.14.0",
108-
"karma": "5.1.0",
108+
"karma": "5.1.1",
109109
"karma-chrome-launcher": "3.1.0",
110110
"karma-cli": "2.0.0",
111111
"karma-coverage-istanbul-reporter": "2.1.1",
@@ -133,7 +133,7 @@
133133
"ora": "4.0.5",
134134
"prettier": "2.0.5",
135135
"protractor": "5.4.2",
136-
"rxjs": "6.6.0",
136+
"rxjs": "6.6.2",
137137
"semver": "7.3.2",
138138
"simple-git": "1.132.0",
139139
"sinon": "9.0.2",
@@ -142,11 +142,11 @@
142142
"terser": "4.8.0",
143143
"ts-loader": "6.2.2",
144144
"ts-node": "8.10.2",
145-
"tslint": "6.1.2",
145+
"tslint": "6.1.3",
146146
"typedoc": "0.16.11",
147147
"typescript": "3.9.7",
148148
"watch": "1.0.2",
149-
"webpack": "4.44.0",
149+
"webpack": "4.44.1",
150150
"yargs": "15.4.1"
151151
},
152152
"husky": {

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/auth/demo/functions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"dependencies": {
1212
"firebase-admin": "9.0.0",
13-
"firebase-functions": "3.8.0"
13+
"firebase-functions": "3.9.0"
1414
},
1515
"private": true
1616
}

packages/auth/demo/functions/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,10 @@ [email protected]:
605605
"@google-cloud/firestore" "^4.0.0"
606606
"@google-cloud/storage" "^5.0.0"
607607

608-
firebase-functions@3.8.0:
609-
version "3.8.0"
610-
resolved "https://registry.npmjs.org/firebase-functions/-/firebase-functions-3.8.0.tgz#ac53c615ef365cd9a19604f84ec9835a340c7b76"
611-
integrity sha512-RFvoS7ZcXrk2sQ918czsjv94p4hnSoD0/e4cZ86XFpa1HbNZBI7ZuSgBCzRvlv6dJ1ArytAL13NpB1Bp2tJ6Yg==
608+
firebase-functions@3.9.0:
609+
version "3.9.0"
610+
resolved "https://registry.npmjs.org/firebase-functions/-/firebase-functions-3.9.0.tgz#b010c0d48cb78e80bf454b6b4ac065bfd5ccb029"
611+
integrity sha512-PHwEvm/c0CNWFxfilmhyZBu5pZlQ2EJk/W4G2yKUm2yHGuh2ZZcga0s4Tj52vllX2eE+NkAsDsJpGdnjljA6+Q==
612612
dependencies:
613613
"@types/express" "4.17.3"
614614
cors "^2.8.5"

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.

0 commit comments

Comments
 (0)