Bug 1079656 - Make the Loop Account menu item work after a restart. r=jaws
This commit is contained in:
@@ -1605,11 +1605,21 @@ this.MozLoopService = {
|
|||||||
MozLoopServiceInternal.clearError("profile");
|
MozLoopServiceInternal.clearError("profile");
|
||||||
}),
|
}),
|
||||||
|
|
||||||
openFxASettings: function() {
|
openFxASettings: Task.async(function() {
|
||||||
let url = new URL("/settings", gFxAOAuthClient.parameters.content_uri);
|
try {
|
||||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
let fxAOAuthClient = yield MozLoopServiceInternal.promiseFxAOAuthClient();
|
||||||
win.switchToTabHavingURI(url.toString(), true);
|
if (!fxAOAuthClient) {
|
||||||
},
|
log.error("Could not get the OAuth client");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let url = new URL("/settings", fxAOAuthClient.parameters.content_uri);
|
||||||
|
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||||
|
win.switchToTabHavingURI(url.toString(), true);
|
||||||
|
} catch (ex) {
|
||||||
|
log.error("Error opening FxA settings", ex);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a hawk based request to the loop server.
|
* Performs a hawk based request to the loop server.
|
||||||
|
|||||||
@@ -391,3 +391,41 @@ add_task(function* loginWithRegistration401() {
|
|||||||
|
|
||||||
yield checkFxA401();
|
yield checkFxA401();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
add_task(function* openFxASettings() {
|
||||||
|
yield resetFxA();
|
||||||
|
|
||||||
|
// Since the default b-c window has a blank tab, open a new non-blank tab to
|
||||||
|
// force switchToTabHavingURI to open a new tab instead of reusing the current
|
||||||
|
// blank tab.
|
||||||
|
gBrowser.selectedTab = gBrowser.addTab(BASE_URL);
|
||||||
|
|
||||||
|
let params = {
|
||||||
|
client_id: "client_id",
|
||||||
|
content_uri: BASE_URL + "/content",
|
||||||
|
oauth_uri: BASE_URL + "/oauth",
|
||||||
|
profile_uri: BASE_URL + "/profile",
|
||||||
|
state: "state",
|
||||||
|
test_error: "token_401",
|
||||||
|
};
|
||||||
|
yield promiseOAuthParamsSetup(BASE_URL, params);
|
||||||
|
|
||||||
|
let deferredTab = Promise.defer();
|
||||||
|
let progressListener = {
|
||||||
|
onLocationChange: function onLocationChange(aBrowser) {
|
||||||
|
gBrowser.removeTabsProgressListener(progressListener);
|
||||||
|
let contentURI = Services.io.newURI(params.content_uri, null, null);
|
||||||
|
is(aBrowser.currentURI.spec, Services.io.newURI("/settings", null, contentURI).spec,
|
||||||
|
"Check settings tab URL");
|
||||||
|
deferredTab.resolve();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
gBrowser.addTabsProgressListener(progressListener);
|
||||||
|
|
||||||
|
MozLoopService.openFxASettings();
|
||||||
|
|
||||||
|
yield deferredTab.promise;
|
||||||
|
while (gBrowser.tabs.length > 1) {
|
||||||
|
gBrowser.removeTab(gBrowser.tabs[1]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user