mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1071469 - Part 4: don't use 'jsval' in nsITelephonyService.idl (gonk). r=echen
This commit is contained in:
parent
c51495e67c
commit
44e56b580a
@ -290,47 +290,33 @@ TelephonyDialCallback.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyDialCallback]),
|
||||
classID: TELEPHONYDIALCALLBACK_CID,
|
||||
|
||||
_notifySendCancelMmiSuccess: function(aResult) {
|
||||
// No additional information.
|
||||
if (aResult.additionalInformation === undefined) {
|
||||
this.callback.notifySendCancelMmiSuccess(aResult.serviceCode,
|
||||
aResult.statusMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
// Additional information is an integer.
|
||||
if (!isNaN(parseInt(aResult.additionalInformation, 10))) {
|
||||
this.callback.notifySendCancelMmiSuccessWithInteger(
|
||||
aResult.serviceCode, aResult.statusMessage, aResult.additionalInformation);
|
||||
return;
|
||||
}
|
||||
|
||||
// Additional information should be an array.
|
||||
let array = aResult.additionalInformation;
|
||||
if (Array.isArray(array) && array.length > 0) {
|
||||
let item = array[0];
|
||||
if (typeof item === "string" || item instanceof String) {
|
||||
this.callback.notifySendCancelMmiSuccessWithStrings(
|
||||
aResult.serviceCode, aResult.statusMessage,
|
||||
aResult.additionalInformation.length, aResult.additionalInformation);
|
||||
return;
|
||||
}
|
||||
|
||||
this.callback.notifySendCancelMmiSuccessWithCallForwardingOptions(
|
||||
aResult.serviceCode, aResult.statusMessage,
|
||||
aResult.additionalInformation.length, aResult.additionalInformation);
|
||||
return;
|
||||
}
|
||||
|
||||
throw Cr.NS_ERROR_UNEXPECTED;
|
||||
},
|
||||
|
||||
notifyDialMMI: function(mmiServiceCode) {
|
||||
this.serviceCode = mmiServiceCode;
|
||||
},
|
||||
|
||||
notifyDialMMISuccess: function(result) {
|
||||
this._notifySendCancelMmiSuccess(result);
|
||||
notifyDialMMISuccess: function(statusMessage) {
|
||||
this.callback.notifySendCancelMmiSuccess(this.serviceCode, statusMessage);
|
||||
},
|
||||
|
||||
notifyDialMMISuccessWithInteger: function(statusMessage, additionalInfo) {
|
||||
this.callback.notifySendCancelMmiSuccessWithInteger(this.serviceCode,
|
||||
statusMessage,
|
||||
additionalInfo);
|
||||
},
|
||||
|
||||
notifyDialMMISuccessWithStrings: function(statusMessage, count, additionalInfo) {
|
||||
this.callback.notifySendCancelMmiSuccessWithStrings(this.serviceCode,
|
||||
statusMessage,
|
||||
count,
|
||||
additionalInfo);
|
||||
},
|
||||
|
||||
notifyDialMMISuccessWithCallForwardingOptions: function(statusMessage, count, additionalInfo) {
|
||||
this.callback.notifySendCancelMmiSuccessWithCallForwardingOptions(
|
||||
this.serviceCode,
|
||||
statusMessage,
|
||||
count,
|
||||
additionalInfo);
|
||||
},
|
||||
|
||||
notifyDialMMIError: function(error) {
|
||||
|
@ -22,6 +22,8 @@ const GONK_TELEPHONYSERVICE_CONTRACTID =
|
||||
"@mozilla.org/telephony/gonktelephonyservice;1";
|
||||
const GONK_TELEPHONYSERVICE_CID =
|
||||
Components.ID("{67d26434-d063-4d28-9f48-5b3189788155}");
|
||||
const MOBILECALLFORWARDINGOPTIONS_CID =
|
||||
Components.ID("{79b5988b-9436-48d8-a652-88fa033f146c}");
|
||||
|
||||
const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
|
||||
|
||||
@ -116,32 +118,28 @@ XPCOMUtils.defineLazyGetter(this, "gPhoneNumberUtils", function() {
|
||||
return ns.PhoneNumberUtils;
|
||||
});
|
||||
|
||||
function MMIResult(aMmiServiceCode, aOptions) {
|
||||
this.serviceCode = aMmiServiceCode;
|
||||
this.statusMessage = aOptions.statusMessage;
|
||||
this.additionalInformation = aOptions.additionalInformation;
|
||||
function MobileCallForwardingOptions(aOptions) {
|
||||
for (let key in aOptions) {
|
||||
this[key] = aOptions[key];
|
||||
}
|
||||
}
|
||||
MMIResult.prototype = {
|
||||
__exposedProps__ : {serviceCode: 'r',
|
||||
statusMessage: 'r',
|
||||
additionalInformation: 'r'},
|
||||
};
|
||||
MobileCallForwardingOptions.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileCallForwardingOptions]),
|
||||
classID: MOBILECALLFORWARDINGOPTIONS_CID,
|
||||
classInfo: XPCOMUtils.generateCI({
|
||||
classID: MOBILECALLFORWARDINGOPTIONS_CID,
|
||||
classDescription: "MobileCallForwardingOptions",
|
||||
interfaces: [Ci.nsIMobileCallForwardingOptions]
|
||||
}),
|
||||
|
||||
function CallForwardingOptions(aOptions) {
|
||||
this.active = aOptions.active;
|
||||
this.action = aOptions.action;
|
||||
this.reason = aOptions.reason;
|
||||
this.number = aOptions.number;
|
||||
this.timeSeconds = aOptions.timeSeconds;
|
||||
this.serviceClass = aOptions.serviceClass;
|
||||
}
|
||||
CallForwardingOptions.prototype = {
|
||||
__exposedProps__ : {active: 'r',
|
||||
action: 'r',
|
||||
reason: 'r',
|
||||
number: 'r',
|
||||
timeSeconds: 'r',
|
||||
serviceClass: 'r'},
|
||||
// nsIMobileForwardingOptions
|
||||
|
||||
active: false,
|
||||
action: Ci.nsIMobileConnection.CALL_FORWARD_ACTION_UNKNOWN,
|
||||
reason: Ci.nsIMobileConnection.CALL_FORWARD_REASON_UNKNOWN,
|
||||
number: null,
|
||||
timeSeconds: -1,
|
||||
serviceClass: Ci.nsIMobileConnection.ICC_SERVICE_CLASS_NONE
|
||||
};
|
||||
|
||||
function TelephonyService() {
|
||||
@ -338,7 +336,7 @@ TelephonyService.prototype = {
|
||||
},
|
||||
|
||||
_rulesToCallForwardingOptions: function(aRules) {
|
||||
return aRules.map(rule => new CallForwardingOptions(rule));
|
||||
return aRules.map(rule => new MobileCallForwardingOptions(rule));
|
||||
},
|
||||
|
||||
_updateDebugFlag: function() {
|
||||
@ -716,13 +714,36 @@ TelephonyService.prototype = {
|
||||
}
|
||||
|
||||
if (response.additionalInformation != null) {
|
||||
response.additionalInformation =
|
||||
let callForwardingOptions =
|
||||
this._rulesToCallForwardingOptions(response.additionalInformation);
|
||||
aCallback.notifyDialMMISuccessWithCallForwardingOptions(
|
||||
response.statusMessage, callForwardingOptions.length, callForwardingOptions);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let result = new MMIResult(mmiServiceCode, response);
|
||||
aCallback.notifyDialMMISuccess(result);
|
||||
// No additional information
|
||||
if (response.additionalInformation == undefined) {
|
||||
aCallback.notifyDialMMISuccess(response.statusMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
// Additional information is an integer.
|
||||
if (!isNaN(parseInt(response.additionalInformation, 10))) {
|
||||
aCallback.notifyDialMMISuccessWithInteger(
|
||||
response.statusMessage, response.additionalInformation);
|
||||
return;
|
||||
}
|
||||
|
||||
// Additional information is an array of strings.
|
||||
let array = response.additionalInformation;
|
||||
if (Array.isArray(array) && array.length > 0 && typeof array[0] === "string") {
|
||||
aCallback.notifyDialMMISuccessWithStrings(response.statusMessage,
|
||||
array.length, array);
|
||||
return;
|
||||
}
|
||||
|
||||
aCallback.notifyDialMMISuccess(response.statusMessage);
|
||||
});
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user