Bug 957229 - Don't show about:accounts with FxA disabled r=markh
authorTim Taubert <ttaubert@mozilla.com>
Tue, 28 Jan 2014 14:36:00 -0800
changeset 165640 c338f5d414b695c20bf2060d026081a843805722
parent 165639 1c9aee5533209e111afe7940edc87886f0d13d6d
child 165641 e6012841cb57f8081d960b394cc59697028e7362
push id4630
push userttaubert@mozilla.com
push dateTue, 28 Jan 2014 23:26:26 +0000
treeherderfx-team@e6012841cb57 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs957229
milestone29.0a1
Bug 957229 - Don't show about:accounts with FxA disabled r=markh
browser/base/content/aboutaccounts/aboutaccounts.js
browser/base/content/test/general/browser_aboutAccounts.js
--- a/browser/base/content/aboutaccounts/aboutaccounts.js
+++ b/browser/base/content/aboutaccounts/aboutaccounts.js
@@ -16,16 +16,26 @@ function log(msg) {
 function error(msg) {
   console.log("Firefox Account Error: " + msg + "\n");
 };
 
 let wrapper = {
   iframe: null,
 
   init: function () {
+    let weave = Cc["@mozilla.org/weave/service;1"]
+                  .getService(Ci.nsISupports)
+                  .wrappedJSObject;
+
+    // Don't show about:accounts with FxA disabled.
+    if (!weave.fxAccountsEnabled) {
+      document.body.remove();
+      return;
+    }
+
     let iframe = document.getElementById("remote");
     this.iframe = iframe;
     iframe.addEventListener("load", this);
 
     try {
       iframe.src = fxAccounts.getAccountsURI();
     } catch (e) {
       error("Couldn't init Firefox Account wrapper: " + e.message);
--- a/browser/base/content/test/general/browser_aboutAccounts.js
+++ b/browser/base/content/test/general/browser_aboutAccounts.js
@@ -4,25 +4,27 @@
 
 XPCOMUtils.defineLazyModuleGetter(this, "Promise",
   "resource://gre/modules/Promise.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Task",
   "resource://gre/modules/Task.jsm");
 
 registerCleanupFunction(function() {
   // Ensure we don't pollute prefs for next tests.
+  Services.prefs.clearUserPref("identity.fxaccounts.enabled");
   Services.prefs.clearUserPref("identity.fxaccounts.remote.uri");
 });
 
 let gTests = [
 
 {
   desc: "Test the remote commands",
   setup: function ()
   {
+    Services.prefs.setBoolPref("identity.fxaccounts.enabled", true);
     Services.prefs.setCharPref("identity.fxaccounts.remote.uri",
                                "https://example.com/browser/browser/base/content/test/general/accounts_testRemoteCommands.html");
   },
   run: function ()
   {
     let deferred = Promise.defer();
 
     let results = 0;