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 215798 bd68bbc99e5d5d190e834a3f7046172e04b24032
parent 215797 f8c2c10aa168db73bc40eab58986f30641849b20
child 215799 1a9546b1b79d6b65b038e3329942281ccf89a467
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgwagner
bugs1037030
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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);