Bug 998934 - add a showFirefoxAccounts command to the UITour. r=Unfocused

This commit is contained in:
Mark Hammond 2014-06-12 15:10:23 +10:00
Родитель 0664322217
Коммит 5adb5a7c3a
4 изменённых файлов: 43 добавлений и 1 удалений

Просмотреть файл

@ -418,6 +418,14 @@ this.UITour = {
this.getConfiguration(contentDocument, data.configuration, data.callbackID);
break;
}
case "showFirefoxAccounts": {
// 'signup' is the only action that makes sense currently, so we don't
// accept arbitrary actions just to be safe...
// We want to replace the current tab.
contentDocument.location.href = "about:accounts?action=signup";
break;
}
}
if (!this.originTabs.has(window))

Просмотреть файл

@ -35,4 +35,33 @@ let tests = [
Services.prefs.setCharPref("services.sync.username", "uitour@tests.mozilla.org");
gContentAPI.getConfiguration("sync", callback);
},
// The showFirefoxAccounts API is sync related, so we test that here too...
function test_firefoxAccounts(done) {
// This test will load about:accounts, and we don't want that to hit the
// network.
Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri",
"https://example.com/");
loadUITourTestPage(function(contentWindow) {
let tabBrowser = gBrowser.selectedTab.linkedBrowser;
// This command will replace the current tab - so add a load event
// handler which will fire when that happens.
tabBrowser.addEventListener("load", function onload(evt) {
tabBrowser.removeEventListener("load", onload, true);
ise(tabBrowser.contentDocument.location.href,
"about:accounts?action=signup",
"about:accounts should have replaced the tab");
// the iframe in about:accounts will still be loading, so we stop
// that before resetting the pref.
tabBrowser.contentDocument.location.href = "about:blank";
Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri");
done();
}, true);
gContentAPI.showFirefoxAccounts();
});
},
];

Просмотреть файл

@ -108,7 +108,7 @@ function loadUITourTestPage(callback, host = "https://example.com/") {
gBrowser.selectedTab = gTestTab;
gTestTab.linkedBrowser.addEventListener("load", function onLoad() {
gTestTab.linkedBrowser.removeEventListener("load", onLoad);
gTestTab.linkedBrowser.removeEventListener("load", onLoad, true);
gContentWindow = Components.utils.waiveXrays(gTestTab.linkedBrowser.contentDocument.defaultView);
gContentAPI = gContentWindow.Mozilla.UITour;

Просмотреть файл

@ -174,4 +174,9 @@ if (typeof Mozilla == 'undefined') {
configuration: configName,
});
};
Mozilla.UITour.showFirefoxAccounts = function() {
_sendEvent('showFirefoxAccounts');
};
})();