From 7d651c7b78691d3c790e226933c0e28a422b720a Mon Sep 17 00:00:00 2001 From: Edgar Chen Date: Wed, 29 Oct 2014 11:42:13 +0800 Subject: [PATCH] Bug 1083745 - Part 3: Remove the redundant information carried in request result of icc.{set|get|unlock}CardLock API. r=hsinyi --- dom/system/gonk/RILContentHelper.js | 26 ++++--------- dom/webidl/MozIcc.webidl | 60 +++++++---------------------- 2 files changed, 21 insertions(+), 65 deletions(-) diff --git a/dom/system/gonk/RILContentHelper.js b/dom/system/gonk/RILContentHelper.js index 77c05af3e430..c9388edabcd7 100644 --- a/dom/system/gonk/RILContentHelper.js +++ b/dom/system/gonk/RILContentHelper.js @@ -75,19 +75,6 @@ XPCOMUtils.defineLazyGetter(this, "gNumRadioInterfaces", function() { return Services.prefs.getIntPref(kPrefRilNumRadioInterfaces); }); -function MobileIccCardLockResult(options) { - this.lockType = options.lockType; - this.enabled = options.enabled; - this.retryCount = options.retryCount; - this.success = options.success; -} - -function MobileIccCardLockRetryCount(options) { - this.lockType = options.lockType; - this.retryCount = options.retryCount; - this.success = options.success; -} - function IccInfo() {} IccInfo.prototype = { QueryInterface: XPCOMUtils.generateQI([Ci.nsIIccInfo]), @@ -674,8 +661,9 @@ RILContentHelper.prototype = { break; } - let result = new MobileIccCardLockResult(data); - this.fireRequestSuccess(requestId, Cu.cloneInto(result, requestWindow)); + this.fireRequestSuccess(requestId, + Cu.cloneInto({ enabled: data.enabled }, + requestWindow)); break; } case "RIL:SetUnlockCardLockResult": { @@ -690,8 +678,7 @@ RILContentHelper.prototype = { break; } - let result = new MobileIccCardLockResult(data); - this.fireRequestSuccess(requestId, Cu.cloneInto(result, requestWindow)); + this.fireRequestSuccess(requestId, null); break; } case "RIL:CardLockRetryCount": { @@ -704,8 +691,9 @@ RILContentHelper.prototype = { break; } - let result = new MobileIccCardLockRetryCount(data); - this.fireRequestSuccess(data.requestId, Cu.cloneInto(result, requestWindow)); + this.fireRequestSuccess(data.requestId, + Cu.cloneInto({ retryCount: data.retryCount }, + requestWindow)); break; } case "RIL:StkCommand": diff --git a/dom/webidl/MozIcc.webidl b/dom/webidl/MozIcc.webidl index 82df3d972671..5ee5958d7da9 100644 --- a/dom/webidl/MozIcc.webidl +++ b/dom/webidl/MozIcc.webidl @@ -164,8 +164,8 @@ interface MozIcc : EventTarget * * @return a DOMRequest. * The request's result will be an object containing - * information about the specified lock's status, - * e.g. {lockType: "pin", enabled: true}. + * information about the specified lock's status. + * e.g. {enabled: true}. */ [Throws] DOMRequest getCardLock(DOMString lockType); @@ -248,19 +248,19 @@ interface MozIcc : EventTarget * control key (NCK1). * * unlockCardLock({lockType: "nck1Puk", - * pin: "..."}); + * puk: "..."}); * * (13) Network type 2 PUK depersonalization. Unlocking the Network type 2 * control key (NCK2). * * unlockCardLock({lockType: "nck2Puk", - * pin: "..."}); + * puk: "..."}); * * (14) HRPD network PUK depersonalization. Unlocking the HRPD network control * key (HNCK). * * unlockCardLock({lockType: "hnckPuk", - * pin: "..."}); + * puk: "..."}); * * (15) Corporate PUK depersonalization. Unlocking the corporate control key * (CCK). @@ -287,25 +287,9 @@ interface MozIcc : EventTarget * puk: "..."}); * * @return a DOMRequest. - * The request's result will be an object containing - * information about the unlock operation. - * - * Examples: - * - * (1) Unlocking failed: - * - * { - * lockType: "pin", - * success: false, - * retryCount: 2 - * } - * - * (2) Unlocking succeeded: - * - * { - * lockType: "pin", - * success: true - * } + * The request's error will be an object containing the number of + * remaining retries + * @see IccCardLockError. */ [Throws] DOMRequest unlockCardLock(any info); @@ -341,25 +325,9 @@ interface MozIcc : EventTarget * newPin: "..."}); * * @return a DOMRequest. - * The request's result will be an object containing - * information about the operation. - * - * Examples: - * - * (1) Enabling/Disabling card lock failed or change card lock failed. - * - * { - * lockType: "pin", - * success: false, - * retryCount: 2 - * } - * - * (2) Enabling/Disabling card lock succeed or change card lock succeed. - * - * { - * lockType: "pin", - * success: true - * } + * The request's error will be an object containing the number of + * remaining retries. + * @see IccCardLockError. */ [Throws] DOMRequest setCardLock(any info); @@ -372,9 +340,9 @@ interface MozIcc : EventTarget * the PUK lock. * * @return a DOMRequest. - * If the lock type is "pin", or "puk", the request's result will be - * an object containing the number of retries for the specified - * lock. For any other lock type, the result is undefined. + * The request's result will be an object containing the number of + * remaining retries. + * e.g. {retryCount: 3}. */ [Throws] DOMRequest getCardLockRetryCount(DOMString lockType);