Bug 1037030 - Fix ContactManager.js permission prompting. r=gwagner
☠☠ backed out by ae4192ba2824 ☠ ☠
authorFabrice Desré <fabrice@mozilla.com>
Mon, 14 Jul 2014 10:31:15 -0700
changeset 193829 bd68bbc99e5d5d190e834a3f7046172e04b24032
parent 193828 f8c2c10aa168db73bc40eab58986f30641849b20
child 193830 1a9546b1b79d6b65b038e3329942281ccf89a467
push id8875
push userfdesre@mozilla.com
push dateMon, 14 Jul 2014 17:31:28 +0000
treeherderb2g-inbound@1a9546b1b79d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgwagner
bugs1037030
milestone33.0a1
Bug 1037030 - Fix ContactManager.js permission prompting. r=gwagner
dom/contacts/ContactManager.js
--- a/dom/contacts/ContactManager.js
+++ b/dom/contacts/ContactManager.js
@@ -253,29 +253,37 @@ ContactManager.prototype = {
     } else if (permValue == Ci.nsIPermissionManager.DENY_ACTION) {
       aCancelCallback();
     }
 
     // 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);