-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - Deprecated signInSuccess callback. - Refactored and replaced deprecated/removed methods for compatibility with firebase-js-sdk v5.0.0. PiperOrigin-RevId: 195502634 Change-Id: I186cc5e9091c44a97c85dd73f75e130561f97128 * updated changelog and readme, bumped core sdk dependency to 5.0 * bump core sdk version in demo app
- Loading branch information
1 parent
dc57287
commit cac4047
Showing
27 changed files
with
4,166 additions
and
3,640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
deprecated - Deprecated signInSuccess callback. | ||
fixed - Refactored and replaced deprecated/removed methods for compatibility with firebase-js-sdk v5.0.0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -872,6 +872,10 @@ function assertConfigEquals(config, widgetConfig) { | |
|
||
|
||
function testConfig() { | ||
testStubs.set( | ||
firebaseui.auth.log, | ||
'warning', | ||
goog.testing.recordFunction()); | ||
createAndInstallTestInstances(); | ||
// Check configuration set correctly for each app. | ||
assertConfigEquals( | ||
|
@@ -883,10 +887,55 @@ function testConfig() { | |
assertConfigEquals( | ||
config3, | ||
app3.getConfig()); | ||
app1.setConfig(config1); | ||
/** @suppress {missingRequire} */ | ||
assertEquals(0, firebaseui.auth.log.warning.getCallCount()); | ||
// Verifies that signInSuccess callback throws deprecation warning. | ||
var callbacks = { | ||
'signInSuccess': function(currentUser, credential, redirectUrl) { | ||
return true; | ||
} | ||
}; | ||
app1.setConfig({ | ||
'callbacks': callbacks | ||
}); | ||
assertConfigEquals( | ||
{ | ||
'signInSuccessUrl': 'http://localhost/home1', | ||
'widgetUrl': 'http://localhost/firebase1', | ||
'callbacks': callbacks | ||
}, | ||
app1.getConfig()); | ||
var deprecateWarning = 'signInSuccess callback is deprecated. Please use ' + | ||
'signInSuccessWithAuthResult callback instead.'; | ||
/** @suppress {missingRequire} */ | ||
assertEquals(1, firebaseui.auth.log.warning.getCallCount()); | ||
/** @suppress {missingRequire} */ | ||
assertEquals(deprecateWarning, | ||
firebaseui.auth.log.warning.getLastCall().getArgument(0)); | ||
app1.setConfig({ | ||
'callbacks': callbacks | ||
}); | ||
// Deprecation warning should be only shown once. | ||
/** @suppress {missingRequire} */ | ||
assertEquals(1, firebaseui.auth.log.warning.getCallCount()); | ||
// Verifies that warning is shown for new instance. | ||
app2.setConfig({ | ||
'callbacks': callbacks | ||
}); | ||
/** @suppress {missingRequire} */ | ||
assertEquals(2, firebaseui.auth.log.warning.getCallCount()); | ||
/** @suppress {missingRequire} */ | ||
assertEquals(deprecateWarning, | ||
firebaseui.auth.log.warning.getLastCall().getArgument(0)); | ||
} | ||
|
||
|
||
function testUpdateConfig() { | ||
testStubs.set( | ||
firebaseui.auth.log, | ||
'warning', | ||
goog.testing.recordFunction()); | ||
createAndInstallTestInstances(); | ||
// Original config. | ||
var config = { | ||
|
@@ -915,6 +964,34 @@ function testUpdateConfig() { | |
assertConfigEquals( | ||
expectedConfig, | ||
app1.getConfig()); | ||
/** @suppress {missingRequire} */ | ||
assertEquals(0, firebaseui.auth.log.warning.getCallCount()); | ||
// Verifies that signInSuccess callback throws deprecation warning. | ||
var callbacks = { | ||
'signInSuccess': function(currentUser, credential, redirectUrl) { | ||
return true; | ||
} | ||
}; | ||
app1.updateConfig('callbacks', callbacks); | ||
assertConfigEquals( | ||
{ | ||
'signInSuccessUrl': 'http://localhost/home1', | ||
'widgetUrl': 'http://localhost/firebase1', | ||
'siteName': 'Other_Site_Name', | ||
'callbacks': callbacks | ||
}, | ||
app1.getConfig()); | ||
var deprecateWarning = 'signInSuccess callback is deprecated. Please use ' + | ||
'signInSuccessWithAuthResult callback instead.'; | ||
/** @suppress {missingRequire} */ | ||
assertEquals(1, firebaseui.auth.log.warning.getCallCount()); | ||
/** @suppress {missingRequire} */ | ||
assertEquals(deprecateWarning, | ||
firebaseui.auth.log.warning.getLastCall().getArgument(0)); | ||
// Deprecation warning should be only shown once. | ||
app1.updateConfig('callbacks', callbacks); | ||
/** @suppress {missingRequire} */ | ||
assertEquals(1, firebaseui.auth.log.warning.getCallCount()); | ||
} | ||
|
||
|
||
|
@@ -1350,7 +1427,7 @@ function testStartSignInWithEmailAndPassword_success() { | |
assertObjectEquals(expectedUserCredential, userCredential); | ||
asyncTestCase.signal(); | ||
}); | ||
app.getAuth().assertSignInAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertSignInWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
function() { | ||
app.getAuth().setUser(expectedUser); | ||
|
@@ -1380,7 +1457,7 @@ function testStartSignInWithEmailAndPassword_error() { | |
assertEquals(expectedError, error); | ||
asyncTestCase.signal(); | ||
}); | ||
app.getAuth().assertSignInAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertSignInWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
null, | ||
expectedError); | ||
|
@@ -1427,7 +1504,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_isAnonymous_success() { | |
}); | ||
// Simulate anonymous user logged in on external instance. | ||
testAuth.setUser(anonymousUser); | ||
app.getAuth().assertSignInAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertSignInWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
function() { | ||
app.getAuth().setUser(expectedUser); | ||
|
@@ -1480,7 +1557,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_isAnon_error() { | |
asyncTestCase.signal(); | ||
}); | ||
// Simulate wrong password error on sign-in. | ||
app.getAuth().assertSignInAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertSignInWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
null, | ||
expectedError); | ||
|
@@ -1511,7 +1588,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnon_nonAnon_success() { | |
assertObjectEquals(expectedUserCredential, userCredential); | ||
asyncTestCase.signal(); | ||
}); | ||
app.getAuth().assertSignInAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertSignInWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
function() { | ||
app.getAuth().setUser(expectedUser); | ||
|
@@ -1551,7 +1628,7 @@ function testStartSignInWithEmailAndPassword_upgradeAnonymous_noUser_success() { | |
assertObjectEquals(expectedUserCredential, userCredential); | ||
asyncTestCase.signal(); | ||
}); | ||
app.getAuth().assertSignInAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertSignInWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
function() { | ||
app.getAuth().setUser(expectedUser); | ||
|
@@ -1587,7 +1664,7 @@ function testStartCreateUserWithEmailAndPassword_success() { | |
assertObjectEquals(expectedUserCredential, userCredential); | ||
asyncTestCase.signal(); | ||
}); | ||
app.getAuth().assertCreateUserAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertCreateUserWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
function() { | ||
app.getAuth().setUser(expectedUser); | ||
|
@@ -1617,7 +1694,7 @@ function testStartCreateUserWithEmailAndPassword_error() { | |
assertEquals(expectedError, error); | ||
asyncTestCase.signal(); | ||
}); | ||
app.getAuth().assertCreateUserAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertCreateUserWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
null, | ||
expectedError); | ||
|
@@ -1694,7 +1771,7 @@ function testStartCreateUserWithEmailAndPassword__upgradeAnon_noUser_success() { | |
app.getExternalAuth().runAuthChangeHandler(); | ||
// createUserWithEmailAndPassword called on internal Auth instance as no user | ||
// available. | ||
app.getAuth().assertCreateUserAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertCreateUserWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
function() { | ||
app.getAuth().setUser(expectedUser); | ||
|
@@ -1780,7 +1857,7 @@ function testStartCreateUserWithEmailAndPassword_upgradeAnon_nonAnon_success() { | |
}); | ||
// Trigger initial onAuthStateChanged listener. | ||
app.getExternalAuth().runAuthChangeHandler(); | ||
app.getAuth().assertCreateUserAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertCreateUserWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
function() { | ||
app.getAuth().setUser(expectedUser); | ||
|
@@ -3812,7 +3889,7 @@ function testSignInWithExistingEmailAndPasswordForLinking_success() { | |
assertObjectEquals(expectedUserCredential, userCredential); | ||
asyncTestCase.signal(); | ||
}); | ||
app.getAuth().assertSignInAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertSignInWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
function() { | ||
app.getAuth().setUser(expectedUser); | ||
|
@@ -3843,7 +3920,7 @@ function testSignInWithExistingEmailAndPasswordForLinking_error() { | |
assertEquals(expectedError, error); | ||
asyncTestCase.signal(); | ||
}); | ||
app.getAuth().assertSignInAndRetrieveDataWithEmailAndPassword( | ||
app.getAuth().assertSignInWithEmailAndPassword( | ||
['[email protected]', 'password'], | ||
null, | ||
expectedError); | ||
|
Oops, something went wrong.