Skip to content

fix(app): fix issue with FirebaseApp extending INTERNAL #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 7, 2017

Conversation

bojeil-google
Copy link
Contributor

@bojeil-google bojeil-google commented Jun 7, 2017

FirebaseAppImpl should not extend prototype.INTERNAL as this will apply to
all Firebase app instances.
To reproduce, do the following:

var app1 = firebase.initializeApp(config);
var app2 = firebase.initializeApp(config, 'app2');
console.log(app1.INTERNAL === app2.internal);

The above incorrectly resolves to true.
This means that if I sign in with app1.auth() and then call app1.INTERNAL.getToken(),
it will resolve with null as it is getting app2.INTERNAL.getToken.
The last initialized instance will basically overwrite all existing ones.

This is currently breaking all FirebaseUI-web single page applications
using Firebase real-time database with JS version >= 4.1.0:
firebase/firebaseui-web#47 (comment)
This should also be breaking any application using Auth and Database with
multiple app instances.

Hey there! So you want to contribute to a Firebase SDK?
Before you file this pull request, please read these guidelines:

FirebaseAppImpl should not extend prototype.INTERNAL as this will apply to
all Firebase app instances.
To reproduce, do the following:
var app1 = firebase.initializeApp(config);
var app2 = firebase.initializeApp(config, 'app2');
console.log(app1.INTERNAL === app2.internal);
The above incorrectly resolves to true.
This means that if I sign in with app1.auth() and then call app1.INTERNAL.getToken(),
it will resolve with null as it is getting app2.INTERNAL.getToken.
The last initialized instance will basically overwrite all existing ones.

This is currently breaking all FirebaseUI-web single page applications
using Firebase real-time database with JS version >= 4.1.0:
firebase/firebaseui-web#47 (comment)
This should also be breaking any application using Auth and Database with
multiple app instances.
@bojeil-google bojeil-google requested a review from jshcrowthe June 7, 2017 04:56
@jshcrowthe jshcrowthe merged commit cb46f75 into master Jun 7, 2017
@jshcrowthe jshcrowthe deleted the extend_internal branch June 7, 2017 06:32
@firebase firebase locked and limited conversation to collaborators Oct 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants