Bug 1119078 - only pre-fetch the sync migration sentinel if using a legacy identity. r=rnewman

This commit is contained in:
Mark Hammond 2015-01-08 15:47:51 +11:00
parent 17047d173f
commit a8155ea572
3 changed files with 30 additions and 4 deletions

View File

@ -399,6 +399,16 @@ this.BrowserIDManager.prototype = {
this._shouldHaveSyncKeyBundle = false;
},
/**
* Pre-fetches any information that might help with migration away from this
* identity. Called after every sync and is really just an optimization that
* allows us to avoid a network request for when we actually need the
* migration info.
*/
prefetchMigrationSentinel: function(service) {
// nothing to do here until we decide to migrate away from FxA.
},
/**
* Return credentials hosts for this identity only.
*/

View File

@ -446,6 +446,22 @@ IdentityManager.prototype = {
return this.username && this.basicPassword && true;
},
/**
* Pre-fetches any information that might help with migration away from this
* identity. Called after every sync and is really just an optimization that
* allows us to avoid a network request for when we actually need the
* migration info.
*/
prefetchMigrationSentinel: function(service) {
// Try and fetch the migration sentinel - it will end up in the recordManager
// cache.
try {
service.recordManager.get(service.storageURL + "meta/fxa_credentials");
} catch (ex) {
this._log.warn("Failed to pre-fetch the migration sentinel", ex);
}
},
/**
* Obtains the array of basic logins from nsiPasswordManager.
*/

View File

@ -1281,12 +1281,12 @@ Sync11Service.prototype = {
histogram.add(1);
// We successfully synchronized.
// Try and fetch the migration sentinel - it will end up in the recordManager
// cache, so a sync migration doesn't need a server round-trip.
// Check if the identity wants to pre-fetch a migration sentinel from
// the server.
// If we have no clusterURL, we are probably doing a node reassignment
// do don't attempt to get the credentials.
// so don't attempt to get it in that case.
if (this.clusterURL) {
this.recordManager.get(this.storageURL + "meta/fxa_credentials");
this.identity.prefetchMigrationSentinel(this);
}
// Now let's update our declined engines.