Bug 1037030 - Fix ContactManager.js permission prompting. r=gwagner
authorFabrice Desré <fabrice@mozilla.com>
Mon, 14 Jul 2014 10:31:15 -0700
changeset 195028 8d70f13112e26ea9a8ccf47146e8507bf68df638
parent 195027 0144a56aef7037e542af87713465bffa1d91a4e5
child 195029 4b9d6d6bb0acbeefc2db4503272399fddf22c78b
push id9056
push userfdesre@mozilla.com
push dateSat, 19 Jul 2014 21:41:51 +0000
treeherderb2g-inbound@8d70f13112e2 [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
@@ -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);