Skip to content

Commit

Permalink
Bug 847741 - Part 4: Remove getSimContacts impl. r=gwagner
Browse files Browse the repository at this point in the history
  • Loading branch information
allstarschh committed Mar 6, 2013
1 parent f3c12bc commit 1ff5ff6
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 161 deletions.
52 changes: 0 additions & 52 deletions dom/contacts/ContactManager.js
Expand Up @@ -14,7 +14,6 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
Cu.import("resource://gre/modules/ObjectWrapper.jsm");

XPCOMUtils.defineLazyGetter(Services, "DOMRequest", function() {
return Cc["@mozilla.org/dom/dom-request-service;1"].getService(Ci.nsIDOMRequestService);
Expand Down Expand Up @@ -477,34 +476,6 @@ ContactManager.prototype = {
this._pushArray(data.cachedContacts, result);
}
break;
case "Contacts:GetSimContacts:Return:OK":
req = this.getRequest(msg.requestID);
if (req) {
let result = contacts.map(function(c) {
let contact = new Contact();
let prop = {name: [c.alphaId], tel: [ { value: c.number } ]};

if (c.email) {
prop.email = [{value: c.email}];
}

// ANR - Additional Number
if (c.anr) {
for (let i = 0; i < c.anr.length; i++) {
prop.tel.push({value: c.anr[i]});
}
}

contact.init(prop);
return contact;
});
if (DEBUG) debug("result: " + JSON.stringify(result));
Services.DOMRequest.fireSuccess(req.request,
ObjectWrapper.wrap(result, this._window));
} else {
if (DEBUG) debug("no request stored!" + msg.requestID);
}
break;
case "Contact:Save:Return:OK":
case "Contacts:Clear:Return:OK":
case "Contact:Remove:Return:OK":
Expand All @@ -516,7 +487,6 @@ ContactManager.prototype = {
case "Contact:Save:Return:KO":
case "Contact:Remove:Return:KO":
case "Contacts:Clear:Return:KO":
case "Contacts:GetSimContacts:Return:KO":
req = this.getRequest(msg.requestID);
if (req)
Services.DOMRequest.fireError(req.request, msg.errorMsg);
Expand Down Expand Up @@ -570,7 +540,6 @@ ContactManager.prototype = {
access = "write";
break;
case "find":
case "getSimContacts":
case "listen":
case "revision":
access = "read";
Expand Down Expand Up @@ -743,25 +712,6 @@ ContactManager.prototype = {
return request;
},

getSimContacts: function(aContactType) {
let request;
request = this.createRequest();
let options = {contactType: aContactType};

let allowCallback = function() {
if (DEBUG) debug("getSimContacts " + aContactType);
cpmm.sendAsyncMessage("Contacts:GetSimContacts",
{requestID: this.getRequestId({request: request, reason: "getSimContacts"}),
options: options});
}.bind(this);

let cancelCallback = function() {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
}
this.askPermission("getSimContacts", request, allowCallback, cancelCallback);
return request;
},

getRevision: function() {
let request = this.createRequest();

Expand All @@ -784,8 +734,6 @@ ContactManager.prototype = {
"Contacts:Clear:Return:OK", "Contacts:Clear:Return:KO",
"Contact:Save:Return:OK", "Contact:Save:Return:KO",
"Contact:Remove:Return:OK", "Contact:Remove:Return:KO",
"Contacts:GetSimContacts:Return:OK",
"Contacts:GetSimContacts:Return:KO",
"Contact:Changed",
"PermissionPromptHelper:AskPermission:OK",
"Contacts:GetAll:Next",
Expand Down
36 changes: 2 additions & 34 deletions dom/contacts/fallback/ContactService.jsm
Expand Up @@ -21,29 +21,15 @@ XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
"@mozilla.org/parentprocessmessagemanager;1",
"nsIMessageListenerManager");

XPCOMUtils.defineLazyGetter(this, "mRIL", function () {
let telephony = Cc["@mozilla.org/ril;1"];
if (!telephony) {
// Return a mock RIL because B2G Desktop build does not support telephony.
return {
getICCContacts: function(aContactType, aCallback) {
aCallback("!telephony", null, null);
}
};
}
return telephony.getService(Ci.nsIRadioInterfaceLayer);
});

let myGlobal = this;

let ContactService = {
init: function() {
if (DEBUG) debug("Init");
this._messages = ["Contacts:Find", "Contacts:GetAll", "Contacts:GetAll:SendNow",
"Contacts:Clear", "Contact:Save",
"Contact:Remove", "Contacts:GetSimContacts",
"Contacts:RegisterForMessages", "child-process-shutdown",
"Contacts:GetRevision"];
"Contact:Remove", "Contacts:RegisterForMessages",
"child-process-shutdown", "Contacts:GetRevision"];
this._children = [];
this._messages.forEach(function(msgName) {
ppmm.addMessageListener(msgName, this);
Expand Down Expand Up @@ -173,24 +159,6 @@ let ContactService = {
function(aErrorMsg) { mm.sendAsyncMessage("Contacts:Clear:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }); }.bind(this)
);
break;
case "Contacts:GetSimContacts":
if (!this.assertPermission(aMessage, "contacts-read")) {
return null;
}
mRIL.getICCContacts(
msg.options.contactType,
function (aErrorMsg, aType, aContacts) {
if (aErrorMsg !== 'undefined') {
mm.sendAsyncMessage("Contacts:GetSimContacts:Return:KO",
{requestID: msg.requestID,
errorMsg: aErrorMsg});
} else {
mm.sendAsyncMessage("Contacts:GetSimContacts:Return:OK",
{requestID: msg.requestID,
contacts: aContacts});
}
}.bind(this));
break;
case "Contacts:GetRevision":
if (!this.assertPermission(aMessage, "contacts-read")) {
return null;
Expand Down
6 changes: 0 additions & 6 deletions dom/contacts/tests/marionette/manifest.ini

This file was deleted.

68 changes: 0 additions & 68 deletions dom/contacts/tests/marionette/test_sim_contacts.js

This file was deleted.

1 change: 0 additions & 1 deletion testing/marionette/client/marionette/tests/unit-tests.ini
Expand Up @@ -23,4 +23,3 @@ skip = false
[include:../../../../../dom/system/gonk/tests/marionette/manifest.ini]
[include:../../../../../dom/icc/tests/marionette/manifest.ini]
[include:../../../../../dom/system/tests/marionette/manifest.ini]
[include:../../../../../dom/contacts/tests/marionette/manifest.ini]

0 comments on commit 1ff5ff6

Please sign in to comment.