Bug 1078261 - Don't fetch Loop call data for the FxA session if we aren't logged in. r=pkerr

--HG--
extra : rebase_source : e9dc9ddfa4c62254801889275c3fe46121036655
This commit is contained in:
Matthew Noorenberghe 2014-10-06 15:36:07 -07:00
parent 9cfbfb5d19
commit e5afb90247
2 changed files with 10 additions and 1 deletions

View File

@ -677,7 +677,9 @@ let MozLoopServiceInternal = {
// Make the call to get the GUEST session regardless of whether the FXA
// request fails.
this._getCalls(LOOP_SESSION_TYPE.FXA, version).catch(() => {});
if (MozLoopService.userProfile) {
this._getCalls(LOOP_SESSION_TYPE.FXA, version).catch(() => {});
}
this._getCalls(LOOP_SESSION_TYPE.GUEST, version).catch(
error => {this._hawkRequestError(error);});
},

View File

@ -52,6 +52,10 @@ function run_test()
{
setupFakeLoopServer();
// Setup fake login (profile) state so we get FxA requests.
const serviceGlobal = Cu.import("resource:///modules/loop/MozLoopService.jsm", {});
serviceGlobal.gFxAOAuthProfile = {email: "test@example.com", uid: "abcd1234"};
// For each notification received from the PushServer, MozLoopService will first query
// for any pending calls on the FxA hawk session and then again using the guest session.
// A pair of response objects in the callsResponses array will be consumed for each
@ -97,6 +101,9 @@ function run_test()
// Revert original Chat.open implementation
Chat.open = openChatOrig;
// Revert fake login state
serviceGlobal.gFxAOAuthProfile = null;
// clear test pref
Services.prefs.clearUserPref("loop.seenToS");
});