mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1075070 - [MobileID] First time an app requests a MobileID assertion for an already verified phone fails if it has no previous permission. r=spenrose
This commit is contained in:
parent
c4816f2f8b
commit
42a7c412d9
@ -280,8 +280,7 @@ this.MobileIdentityManager = {
|
|||||||
.then(
|
.then(
|
||||||
(creds) => {
|
(creds) => {
|
||||||
if (creds) {
|
if (creds) {
|
||||||
this.iccInfo[aServiceId].credentials = creds;
|
return creds;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
return this.credStore.getByMsisdn(this.iccInfo[aServiceId].msisdn);
|
return this.credStore.getByMsisdn(this.iccInfo[aServiceId].msisdn);
|
||||||
}
|
}
|
||||||
@ -306,10 +305,12 @@ this.MobileIdentityManager = {
|
|||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
(result) => {
|
(result) => {
|
||||||
log.debug("Discover result ${}", result);
|
// If we already have credentials for this ICC and no discover request
|
||||||
|
// is done, we just bail out.
|
||||||
if (!result || !result.verificationMethods) {
|
if (!result || !result.verificationMethods) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
log.debug("Discover result ${}", result);
|
||||||
this.iccInfo[aServiceId].verificationMethods = result.verificationMethods;
|
this.iccInfo[aServiceId].verificationMethods = result.verificationMethods;
|
||||||
this.iccInfo[aServiceId].verificationDetails = result.verificationDetails;
|
this.iccInfo[aServiceId].verificationDetails = result.verificationDetails;
|
||||||
this.iccInfo[aServiceId].canDoSilentVerification =
|
this.iccInfo[aServiceId].canDoSilentVerification =
|
||||||
@ -675,14 +676,16 @@ this.MobileIdentityManager = {
|
|||||||
let mcc;
|
let mcc;
|
||||||
|
|
||||||
// If the user selected one of the existing SIM cards we have to check
|
// If the user selected one of the existing SIM cards we have to check
|
||||||
// that we either have the MSISDN for that SIM or we can do a silent
|
// that we either have the MSISDN for that SIM, we have already existing
|
||||||
// verification that does not require us to have the MSISDN in advance.
|
// credentials or we can do a silent verification that does not require
|
||||||
|
// us to have the MSISDN in advance.
|
||||||
// result.serviceId can be "0".
|
// result.serviceId can be "0".
|
||||||
if (result.serviceId !== undefined &&
|
if (result.serviceId !== undefined &&
|
||||||
result.serviceId !== null) {
|
result.serviceId !== null) {
|
||||||
let icc = this.iccInfo[result.serviceId];
|
let icc = this.iccInfo[result.serviceId];
|
||||||
log.debug("icc ${}", icc);
|
log.debug("icc ${}", icc);
|
||||||
if (!icc || !icc.msisdn && !icc.canDoSilentVerification) {
|
if (!icc || !icc.msisdn && !icc.canDoSilentVerification &&
|
||||||
|
!icc.credentials) {
|
||||||
return Promise.reject(ERROR_INTERNAL_CANNOT_VERIFY_SELECTION);
|
return Promise.reject(ERROR_INTERNAL_CANNOT_VERIFY_SELECTION);
|
||||||
}
|
}
|
||||||
msisdn = icc.msisdn;
|
msisdn = icc.msisdn;
|
||||||
@ -972,7 +975,12 @@ this.MobileIdentityManager = {
|
|||||||
// before generating and sharing the assertion.
|
// before generating and sharing the assertion.
|
||||||
// If we've just prompted the user in the previous step, the permission
|
// If we've just prompted the user in the previous step, the permission
|
||||||
// is already granted and stored so we just progress the credentials.
|
// is already granted and stored so we just progress the credentials.
|
||||||
|
// But we have to refresh the cached permission before checking.
|
||||||
if (creds) {
|
if (creds) {
|
||||||
|
permission = permissionManager.testPermissionFromPrincipal(
|
||||||
|
principal,
|
||||||
|
MOBILEID_PERM
|
||||||
|
);
|
||||||
if (permission == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
if (permission == Ci.nsIPermissionManager.ALLOW_ACTION) {
|
||||||
return creds;
|
return creds;
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ add_test(function() {
|
|||||||
credStore._("add").call(1).arg(2, PHONE_NUMBER);
|
credStore._("add").call(1).arg(2, PHONE_NUMBER);
|
||||||
credStore._("add").call(1).arg(3, ORIGIN);
|
credStore._("add").call(1).arg(3, ORIGIN);
|
||||||
credStore._("add").call(1).arg(4, SESSION_TOKEN);
|
credStore._("add").call(1).arg(4, SESSION_TOKEN);
|
||||||
credStore._("add").call(1).arg(5, null);
|
credStore._("add").call(1).arg(5, []);
|
||||||
|
|
||||||
|
|
||||||
// MockUI.
|
// MockUI.
|
||||||
@ -960,10 +960,10 @@ add_test(function() {
|
|||||||
credStore._("add").call(1).arg(2, PHONE_NUMBER);
|
credStore._("add").call(1).arg(2, PHONE_NUMBER);
|
||||||
credStore._("add").call(1).arg(3, ORIGIN);
|
credStore._("add").call(1).arg(3, ORIGIN);
|
||||||
credStore._("add").call(1).arg(4, SESSION_TOKEN);
|
credStore._("add").call(1).arg(4, SESSION_TOKEN);
|
||||||
credStore._("add").call(1).arg(5, null);
|
credStore._("add").call(1).arg(5, []);
|
||||||
credStore._("setDeviceIccIds").callsLength(1);
|
credStore._("setDeviceIccIds").callsLength(1);
|
||||||
credStore._("setDeviceIccIds").call(1).arg(1, PHONE_NUMBER);
|
credStore._("setDeviceIccIds").call(1).arg(1, PHONE_NUMBER);
|
||||||
credStore._("setDeviceIccIds").call(1).arg(2, null);
|
credStore._("setDeviceIccIds").call(1).arg(2, []);
|
||||||
|
|
||||||
// MockUI.
|
// MockUI.
|
||||||
ui._("startFlow").callsLength(1);
|
ui._("startFlow").callsLength(1);
|
||||||
@ -1054,7 +1054,7 @@ add_test(function() {
|
|||||||
credStore._("add").call(1).arg(2, ANOTHER_PHONE_NUMBER);
|
credStore._("add").call(1).arg(2, ANOTHER_PHONE_NUMBER);
|
||||||
credStore._("add").call(1).arg(3, ORIGIN);
|
credStore._("add").call(1).arg(3, ORIGIN);
|
||||||
credStore._("add").call(1).arg(4, _sessionToken);
|
credStore._("add").call(1).arg(4, _sessionToken);
|
||||||
credStore._("add").call(1).arg(5, null);
|
credStore._("add").call(1).arg(5, []);
|
||||||
credStore._("setDeviceIccIds").callsLength(0);
|
credStore._("setDeviceIccIds").callsLength(0);
|
||||||
credStore._("removeOrigin").callsLength(1);
|
credStore._("removeOrigin").callsLength(1);
|
||||||
credStore._("removeOrigin").call(1).arg(1, PHONE_NUMBER);
|
credStore._("removeOrigin").call(1).arg(1, PHONE_NUMBER);
|
||||||
@ -1139,7 +1139,7 @@ add_test(function() {
|
|||||||
credStore._("add").call(1).arg(2, PHONE_NUMBER);
|
credStore._("add").call(1).arg(2, PHONE_NUMBER);
|
||||||
credStore._("add").call(1).arg(3, ORIGIN);
|
credStore._("add").call(1).arg(3, ORIGIN);
|
||||||
credStore._("add").call(1).arg(4, _sessionToken);
|
credStore._("add").call(1).arg(4, _sessionToken);
|
||||||
credStore._("add").call(1).arg(5, null);
|
credStore._("add").call(1).arg(5, []);
|
||||||
credStore._("setDeviceIccIds").callsLength(1);
|
credStore._("setDeviceIccIds").callsLength(1);
|
||||||
credStore._("removeOrigin").callsLength(0);
|
credStore._("removeOrigin").callsLength(0);
|
||||||
|
|
||||||
@ -1229,7 +1229,7 @@ add_test(function() {
|
|||||||
credStore._("add").call(1).arg(2, ANOTHER_PHONE_NUMBER);
|
credStore._("add").call(1).arg(2, ANOTHER_PHONE_NUMBER);
|
||||||
credStore._("add").call(1).arg(3, ORIGIN);
|
credStore._("add").call(1).arg(3, ORIGIN);
|
||||||
credStore._("add").call(1).arg(4, _sessionToken);
|
credStore._("add").call(1).arg(4, _sessionToken);
|
||||||
credStore._("add").call(1).arg(5, null);
|
credStore._("add").call(1).arg(5, []);
|
||||||
credStore._("setDeviceIccIds").callsLength(0);
|
credStore._("setDeviceIccIds").callsLength(0);
|
||||||
credStore._("removeOrigin").callsLength(1);
|
credStore._("removeOrigin").callsLength(1);
|
||||||
credStore._("removeOrigin").call(1).arg(1, PHONE_NUMBER);
|
credStore._("removeOrigin").call(1).arg(1, PHONE_NUMBER);
|
||||||
@ -1278,7 +1278,7 @@ add_test(function() {
|
|||||||
sessionToken: _sessionToken,
|
sessionToken: _sessionToken,
|
||||||
msisdn: PHONE_NUMBER,
|
msisdn: PHONE_NUMBER,
|
||||||
origin: ORIGIN,
|
origin: ORIGIN,
|
||||||
deviceIccIds: null
|
deviceIccIds: []
|
||||||
};
|
};
|
||||||
|
|
||||||
let ui = new MockUi({
|
let ui = new MockUi({
|
||||||
@ -1323,7 +1323,7 @@ add_test(function() {
|
|||||||
credStore._("add").call(1).arg(2, PHONE_NUMBER);
|
credStore._("add").call(1).arg(2, PHONE_NUMBER);
|
||||||
credStore._("add").call(1).arg(3, ORIGIN);
|
credStore._("add").call(1).arg(3, ORIGIN);
|
||||||
credStore._("add").call(1).arg(4, SESSION_TOKEN);
|
credStore._("add").call(1).arg(4, SESSION_TOKEN);
|
||||||
credStore._("add").call(1).arg(5, null);
|
credStore._("add").call(1).arg(5, []);
|
||||||
credStore._("setDeviceIccIds").callsLength(0);
|
credStore._("setDeviceIccIds").callsLength(0);
|
||||||
credStore._("delete").callsLength(1);
|
credStore._("delete").callsLength(1);
|
||||||
credStore._("delete").call(1).arg(1, PHONE_NUMBER);
|
credStore._("delete").call(1).arg(1, PHONE_NUMBER);
|
||||||
@ -1383,12 +1383,8 @@ add_test(function() {
|
|||||||
|
|
||||||
MobileIdentityManager._mobileConnectionService = {
|
MobileIdentityManager._mobileConnectionService = {
|
||||||
_interfaces: [RADIO_INTERFACE, ANOTHER_RADIO_INTERFACE],
|
_interfaces: [RADIO_INTERFACE, ANOTHER_RADIO_INTERFACE],
|
||||||
getVoiceConnectionInfo: function(aIndex) {
|
getItemByServiceId: function(aIndex) {
|
||||||
return this._interfaces[aIndex].voice;
|
return this._interfaces[aIndex];
|
||||||
},
|
|
||||||
|
|
||||||
getDataConnectionInfo: function(aIndex) {
|
|
||||||
return this._interfaces[aIndex].data;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user