mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 873380 - Part 3: RIL changes for icc card lock error. r=allstars.chh
This commit is contained in:
parent
61a4797b38
commit
d8f1e059f7
@ -38,33 +38,14 @@ function testPinChangeFailed() {
|
||||
|
||||
request.onerror = function onerror() {
|
||||
is(request.error.name, "IncorrectPassword");
|
||||
is(request.error.lockType, "pin");
|
||||
// The default pin retries is 3, failed once becomes to 2
|
||||
is(request.error.retryCount, 2);
|
||||
|
||||
resetPinRetries("0000", runNextTest);
|
||||
};
|
||||
}
|
||||
|
||||
/* Test PIN code changes fail notification */
|
||||
function testPinChangeFailedNotification() {
|
||||
icc.addEventListener("icccardlockerror", function onicccardlockerror(result) {
|
||||
icc.removeEventListener("icccardlockerror", onicccardlockerror);
|
||||
|
||||
is(result.lockType, "pin");
|
||||
// The default pin retries is 3, failed once becomes to 2
|
||||
is(result.retryCount, 2);
|
||||
|
||||
resetPinRetries("0000", runNextTest);
|
||||
});
|
||||
|
||||
// The default pin is '0000' in emulator
|
||||
let request = icc.setCardLock(
|
||||
{lockType: "pin",
|
||||
pin: "1111",
|
||||
newPin: "0000"});
|
||||
|
||||
ok(request instanceof DOMRequest,
|
||||
"request instanceof " + request.constructor);
|
||||
}
|
||||
|
||||
/* Test PIN code changes success */
|
||||
function testPinChangeSuccess() {
|
||||
// The default pin is '0000' in emulator
|
||||
@ -159,7 +140,6 @@ function testInvalidCardLockRetryCount() {
|
||||
|
||||
let tests = [
|
||||
testPinChangeFailed,
|
||||
testPinChangeFailedNotification,
|
||||
testPinChangeSuccess,
|
||||
testPinCardLockRetryCount,
|
||||
testPukCardLockRetryCount,
|
||||
|
@ -65,6 +65,8 @@ const CELLBROADCASTETWSINFO_CID =
|
||||
Components.ID("{59f176ee-9dcd-4005-9d47-f6be0cd08e17}");
|
||||
const DOMMMIERROR_CID =
|
||||
Components.ID("{6b204c42-7928-4e71-89ad-f90cd82aff96}");
|
||||
const ICCCARDLOCKERROR_CID =
|
||||
Components.ID("{08a71987-408c-44ff-93fd-177c0a85c3dd}");
|
||||
|
||||
const RIL_IPC_MSG_NAMES = [
|
||||
"RIL:CardStateChanged",
|
||||
@ -432,6 +434,20 @@ DOMMMIError.prototype = {
|
||||
},
|
||||
};
|
||||
|
||||
function IccCardLockError() {
|
||||
}
|
||||
IccCardLockError.prototype = {
|
||||
classDescription: "IccCardLockError",
|
||||
classID: ICCCARDLOCKERROR_CID,
|
||||
contractID: "@mozilla.org/dom/icccardlock-error;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
|
||||
__init: function(lockType, errorMsg, retryCount) {
|
||||
this.__DOM_IMPL__.init(errorMsg);
|
||||
this.lockType = lockType;
|
||||
this.retryCount = retryCount;
|
||||
},
|
||||
};
|
||||
|
||||
function RILContentHelper() {
|
||||
this.rilContext = {
|
||||
cardState: RIL.GECKO_CARDSTATE_UNKNOWN,
|
||||
@ -774,6 +790,8 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
let requestId = this.getRequestId(request);
|
||||
this._windowsMap[requestId] = window;
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:GetCardLockState", {
|
||||
clientId: 0,
|
||||
data: {
|
||||
@ -791,6 +809,8 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
info.requestId = this.getRequestId(request);
|
||||
this._windowsMap[info.requestId] = window;
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:UnlockCardLock", {
|
||||
clientId: 0,
|
||||
data: info
|
||||
@ -805,6 +825,8 @@ RILContentHelper.prototype = {
|
||||
}
|
||||
let request = Services.DOMRequest.createRequest(window);
|
||||
info.requestId = this.getRequestId(request);
|
||||
this._windowsMap[info.requestId] = window;
|
||||
|
||||
cpmm.sendAsyncMessage("RIL:SetCardLock", {
|
||||
clientId: 0,
|
||||
data: info
|
||||
@ -1438,6 +1460,19 @@ RILContentHelper.prototype = {
|
||||
Ci.nsIThread.DISPATCH_NORMAL);
|
||||
},
|
||||
|
||||
fireRequestDetailedError: function fireRequestDetailedError(requestId, detailedError) {
|
||||
let request = this.takeRequest(requestId);
|
||||
if (!request) {
|
||||
if (DEBUG) {
|
||||
debug("not firing detailed error for id: " + requestId +
|
||||
", detailedError: " + JSON.stringify(detailedError));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Services.DOMRequest.fireDetailedError(request, detailedError);
|
||||
},
|
||||
|
||||
receiveMessage: function receiveMessage(msg) {
|
||||
let request;
|
||||
debug("Received message '" + msg.name + "': " + JSON.stringify(msg.json));
|
||||
@ -1495,20 +1530,27 @@ RILContentHelper.prototype = {
|
||||
case "RIL:VoicemailInfoChanged":
|
||||
this.updateInfo(data, this.voicemailInfo);
|
||||
break;
|
||||
case "RIL:CardLockResult":
|
||||
case "RIL:CardLockResult": {
|
||||
let requestId = data.requestId;
|
||||
let requestWindow = this._windowsMap[requestId];
|
||||
delete this._windowsMap[requestId];
|
||||
|
||||
if (data.success) {
|
||||
let result = new MobileIccCardLockResult(data);
|
||||
this.fireRequestSuccess(data.requestId, result);
|
||||
this.fireRequestSuccess(requestId, result);
|
||||
} else {
|
||||
if (data.rilMessageType == "iccSetCardLock" ||
|
||||
data.rilMessageType == "iccUnlockCardLock") {
|
||||
this._deliverEvent("_iccListeners",
|
||||
"notifyIccCardLockError",
|
||||
[data.lockType, data.retryCount]);
|
||||
let cardLockError = new requestWindow.IccCardLockError(data.lockType,
|
||||
data.errorMsg,
|
||||
data.retryCount);
|
||||
this.fireRequestDetailedError(requestId, cardLockError);
|
||||
} else {
|
||||
this.fireRequestError(requestId, data.errorMsg);
|
||||
}
|
||||
this.fireRequestError(data.requestId, data.errorMsg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "RIL:CardLockRetryCount":
|
||||
if (data.success) {
|
||||
let result = new MobileIccCardLockRetryCount(data);
|
||||
@ -1926,5 +1968,6 @@ RILContentHelper.prototype = {
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RILContentHelper,
|
||||
DOMMMIError]);
|
||||
DOMMMIError,
|
||||
IccCardLockError]);
|
||||
|
||||
|
@ -20,6 +20,8 @@ category profile-after-change RadioInterfaceLayer @mozilla.org/ril;1
|
||||
# RILContentHelper.js
|
||||
component {472816e1-1fd6-4405-996c-806f9ea68174} RILContentHelper.js
|
||||
component {6b204c42-7928-4e71-89ad-f90cd82aff96} RILContentHelper.js
|
||||
component {08a71987-408c-44ff-93fd-177c0a85c3dd} RILContentHelper.js
|
||||
contract @mozilla.org/ril/content-helper;1 {472816e1-1fd6-4405-996c-806f9ea68174}
|
||||
contract @mozilla.org/dom/mmi-error;1 {6b204c42-7928-4e71-89ad-f90cd82aff96}
|
||||
contract @mozilla.org/dom/icccardlock-error;1 {08a71987-408c-44ff-93fd-177c0a85c3dd}
|
||||
category profile-after-change RILContentHelper @mozilla.org/ril/content-helper;1
|
||||
|
Loading…
Reference in New Issue
Block a user