Bug 1037030 - Fix ContactManager.js permission prompting. r=gwagner, a=2.0+
authorFabrice Desré <fabrice@mozilla.com>
Mon, 14 Jul 2014 10:31:15 -0700
changeset 209218 69030cc2f1783b6d7454cffc80f6f75be21bea3c
parent 209217 9779e1a3c05b253138ff0a508e752fdd47698faa
child 209219 2334c50994889e87a126d5c22bcab61d190a77ea
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgwagner, 2
bugs1037030
milestone32.0a2
Bug 1037030 - Fix ContactManager.js permission prompting. r=gwagner, a=2.0+
dom/contacts/ContactManager.js
--- a/dom/contacts/ContactManager.js
+++ b/dom/contacts/ContactManager.js
@@ -259,29 +259,37 @@ ContactManager.prototype = {
       }
       return;
     }
 
     // Create an array with a single nsIContentPermissionType element.
     let type = {
       type: "contacts",
       access: access,
-      options: null,
+      options: [],
       QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionType])
     };
     let typeArray = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
     typeArray.appendElement(type, false);
 
     // create a nsIContentPermissionRequest
     let request = {
       types: typeArray,
       principal: principal,
       QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]),
-      allow: aAllowCallback,
-      cancel: aCancelCallback,
+      allow: aAllowCallback ||
+             function() {
+               if (DEBUG)
+                 debug("Default allow contacts callback. " + access +"\n");
+             },
+      cancel: aCancelCallback ||
+              function() {
+                if (DEBUG)
+                  debug("Default cancel contacts callback. " + access +"\n");
+              },
       window: this._window
     };
 
     // Using askPermission from nsIDOMWindowUtils that takes care of the
     // remoting if needed.
     let windowUtils = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
                           .getInterface(Ci.nsIDOMWindowUtils);
     windowUtils.askPermission(request);