Bug 1036054 - Convert Sync pane dialog to be in-content. r=mattn
authorRichard Marti <richard.marti@gmail.com>
Tue, 15 Jul 2014 23:05:55 +0200
changeset 194243 c12579b0b8561454443c5bbdb560c18ffa65ccd8
parent 194242 b6ca88f40b7964d62ca2f2d91cc9998c4914c60f
child 194244 acf444215f8d167082b6612b6e58667cc6ac0258
push id7755
push usercbook@mozilla.com
push dateWed, 16 Jul 2014 11:48:26 +0000
treeherderfx-team@c12579b0b856 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattn
bugs1036054
milestone33.0a1
Bug 1036054 - Convert Sync pane dialog to be in-content. r=mattn
browser/components/preferences/in-content/sync.js
--- a/browser/components/preferences/in-content/sync.js
+++ b/browser/components/preferences/in-content/sync.js
@@ -273,23 +273,29 @@ let gSyncPane = {
     fxAccounts.resendVerificationEmail().then(() => {
       fxAccounts.getSignedInUser().then(data => {
         let sb = this._stringBundle;
         let title = sb.GetStringFromName("firefoxAccountsVerificationSentTitle");
         let heading = sb.formatStringFromName("firefoxAccountsVerificationSentHeading",
                                               [data.email], 1);
         let description = sb.GetStringFromName("firefoxAccountVerificationSentDescription");
 
-        Services.prompt.alert(window, title, heading + "\n\n" + description);
+        let factory = Cc["@mozilla.org/prompter;1"]
+                        .getService(Ci.nsIPromptFactory);
+        let prompt = factory.getPrompt(window, Ci.nsIPrompt);
+        let bag = prompt.QueryInterface(Ci.nsIWritablePropertyBag2);
+        bag.setPropertyAsBool("allowTabModal", true);
+
+        prompt.alert(title, heading + "\n\n" + description);
       });
     });
   },
 
   openOldSyncSupportPage: function() {
-    let url = Services.urlFormatter.formatURLPref('app.support.baseURL') + "old-sync"
+    let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "old-sync";
     this.openContentInBrowser(url);
   },
 
   unlinkFirefoxAccount: function(confirm) {
     if (confirm) {
       // We use a string bundle shared with aboutAccounts.
       let sb = Services.strings.createBundle("chrome://browser/locale/syncSetup.properties");
       let continueLabel = sb.GetStringFromName("continue.label");
@@ -299,23 +305,31 @@ let gSyncPane = {
       let body = sb.GetStringFromName("disconnect.verify.heading") +
                  "\n\n" +
                  sb.formatStringFromName("disconnect.verify.description",
                                          [brandShortName], 1);
       let ps = Services.prompt;
       let buttonFlags = (ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING) +
                         (ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL) +
                         ps.BUTTON_POS_1_DEFAULT;
-      let pressed = Services.prompt.confirmEx(window, title, body, buttonFlags,
-                                              continueLabel, null, null, null, {});
+
+      let factory = Cc["@mozilla.org/prompter;1"]
+                      .getService(Ci.nsIPromptFactory);
+      let prompt = factory.getPrompt(window, Ci.nsIPrompt);
+      let bag = prompt.QueryInterface(Ci.nsIWritablePropertyBag2);
+      bag.setPropertyAsBool("allowTabModal", true);
+
+      let pressed = prompt.confirmEx(title, body, buttonFlags,
+                                     continueLabel, null, null, null, {});
+
       if (pressed != 0) { // 0 is the "continue" button
         return;
       }
     }
-    Components.utils.import('resource://gre/modules/FxAccounts.jsm');
+    Cu.import("resource://gre/modules/FxAccounts.jsm");
     fxAccounts.signOut().then(() => {
       this.updateWeavePrefs();
     });
   },
 
   openQuotaDialog: function () {
     let win = Services.wm.getMostRecentWindow("Sync:ViewQuota");
     if (win)