diff --git a/browser/components/loop/MozLoopService.jsm b/browser/components/loop/MozLoopService.jsm index 161a8a8f2bb..52f9a834e46 100644 --- a/browser/components/loop/MozLoopService.jsm +++ b/browser/components/loop/MozLoopService.jsm @@ -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);}); }, diff --git a/browser/components/loop/test/xpcshell/test_loopservice_busy.js b/browser/components/loop/test/xpcshell/test_loopservice_busy.js index d0efa8204c7..3d067991cbd 100644 --- a/browser/components/loop/test/xpcshell/test_loopservice_busy.js +++ b/browser/components/loop/test/xpcshell/test_loopservice_busy.js @@ -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"); });