Bug 934125 - 2.a/3: s/\(\w\+\): function \(\w\+\)(/\1: function(/ . r=gene

RILDIRS="dom/cellbroadcast/ dom/icc/ dom/mobilemessage/ dom/network/ dom/telephony/ dom/voicemail/ dom/system/gonk/";
for f in `find $RILDIRS -type f -name \*.js -o -name \*.jsm`; do
  sed -i $f -e '/\w\+:/ {N; s/\(\w\+\):\s*function \(\w\+\)(/\1: function(/g}';
done
grep -nRe '\w\+: function \w\+(' $RILDIRS
This commit is contained in:
Vicamo Yang 2014-01-13 10:44:40 +08:00
parent 95c21b2c67
commit 91e5172240
49 changed files with 1102 additions and 1117 deletions

View File

@ -63,7 +63,7 @@ RangedValue.prototype = {
*
* @throws CodeError if decoded value is not in the range [this.min, this.max].
*/
decode: function decode(data) {
decode: function(data) {
let value = WSP.Octet.decode(data);
if ((value >= this.min) && (value <= this.max)) {
return value;
@ -78,7 +78,7 @@ RangedValue.prototype = {
* @param value
* An integer value within thr range [this.min, this.max].
*/
encode: function encode(data, value) {
encode: function(data, value) {
if ((value < this.min) || (value > this.max)) {
throw new WSP.CodeError(this.name + ": invalid value " + value);
}
@ -103,7 +103,7 @@ this.BooleanValue = {
*
* @throws CodeError if read octet equals to neither 128 nor 129.
*/
decode: function decode(data) {
decode: function(data) {
let value = WSP.Octet.decode(data);
if ((value != 128) && (value != 129)) {
throw new WSP.CodeError("Boolean-value: invalid value " + value);
@ -118,7 +118,7 @@ this.BooleanValue = {
* @param value
* A boolean value to be encoded.
*/
encode: function encode(data, value) {
encode: function(data, value) {
WSP.Octet.encode(data, value ? 128 : 129);
},
};
@ -137,7 +137,7 @@ this.Address = {
*
* @return An object of two string-typed attributes: address and type.
*/
decode: function decode(data) {
decode: function(data) {
let str = EncodedStringValue.decode(data);
let result;
@ -171,7 +171,7 @@ this.Address = {
* @param value
* An object of two string-typed attributes: address and type.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (!value || !value.type || !value.address) {
throw new WSP.CodeError("Address: invalid value");
}
@ -229,7 +229,7 @@ this.Address = {
*
* @return Address type.
*/
resolveType: function resolveType(address) {
resolveType: function(address) {
if (address.match(this.REGEXP_EMAIL)) {
return "email";
}
@ -284,7 +284,7 @@ this.HeaderField = {
* but the `value` property can be many different types depending on
* `name`.
*/
decode: function decode(data, options) {
decode: function(data, options) {
return WSP.decodeAlternatives(data, options,
MmsHeader, WSP.ApplicationHeader);
},
@ -297,7 +297,7 @@ this.HeaderField = {
* @param options
* Extra context for encoding.
*/
encode: function encode(data, value, options) {
encode: function(data, value, options) {
WSP.encodeAlternatives(data, value, options,
MmsHeader, WSP.ApplicationHeader);
},
@ -324,7 +324,7 @@ this.MmsHeader = {
* @throws NotWellKnownEncodingError if decoded well-known header field
* number is not registered or supported.
*/
decode: function decode(data, options) {
decode: function(data, options) {
let index = WSP.ShortInteger.decode(data);
let entry = MMS_HEADER_FIELDS[index];
@ -363,7 +363,7 @@ this.MmsHeader = {
* @throws NotWellKnownEncodingError if the well-known header field number is
* not registered or supported.
*/
encode: function encode(data, header) {
encode: function(data, header) {
if (!header.name) {
throw new WSP.CodeError("MMS-header: empty header name");
}
@ -417,7 +417,7 @@ this.ContentLocationValue = {
* @return A decoded object containing `uri` and conditional `statusCount`
* properties.
*/
decode: function decode(data, options) {
decode: function(data, options) {
let type = WSP.ensureHeader(options, "x-mms-message-type");
let result = {};
@ -454,7 +454,7 @@ this.ElementDescriptorValue = {
* @return A decoded object containing a string property `contentReference`
* and an optinal `params` name-value map.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -494,7 +494,7 @@ this.Parameter = {
* @throws NotWellKnownEncodingError if decoded well-known parameter number
* is not registered or supported.
*/
decodeParameterName: function decodeParameterName(data) {
decodeParameterName: function(data) {
let begin = data.offset;
let number;
try {
@ -522,7 +522,7 @@ this.Parameter = {
* but the `value` property can be many different types depending on
* `name`.
*/
decode: function decode(data) {
decode: function(data) {
let name = this.decodeParameterName(data);
let value = WSP.decodeAlternatives(data, null,
WSP.ConstrainedEncoding, WSP.TextString);
@ -540,7 +540,7 @@ this.Parameter = {
*
* @return An array of decoded objects.
*/
decodeMultiple: function decodeMultiple(data, end) {
decodeMultiple: function(data, end) {
let params, param;
while (data.offset < end) {
@ -568,7 +568,7 @@ this.Parameter = {
* @param options
* Extra context for encoding.
*/
encode: function encode(data, param, options) {
encode: function(data, param, options) {
if (!param || !param.name) {
throw new WSP.CodeError("Parameter-name: empty param name");
}
@ -605,7 +605,7 @@ this.EncodedStringValue = {
* @throws NotWellKnownEncodingError if decoded well-known charset number is
* not registered or supported.
*/
decodeCharsetEncodedString: function decodeCharsetEncodedString(data) {
decodeCharsetEncodedString: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -657,7 +657,7 @@ this.EncodedStringValue = {
*
* @return Decoded string.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return WSP.TextString.decode(data);
@ -675,7 +675,7 @@ this.EncodedStringValue = {
* @param str
* A string.
*/
encodeCharsetEncodedString: function encodeCharsetEncodedString(data, str) {
encodeCharsetEncodedString: function(data, str) {
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Ci.nsIScriptableUnicodeConverter);
// `When the text string cannot be represented as us-ascii, the character
@ -714,7 +714,7 @@ this.EncodedStringValue = {
* @param str
* A string.
*/
encode: function encode(data, str) {
encode: function(data, str) {
let begin = data.offset;
try {
WSP.TextString.encode(data, str);
@ -741,7 +741,7 @@ this.ExpiryValue = {
*
* @throws CodeError if decoded token equals to neither 128 nor 129.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -770,7 +770,7 @@ this.ExpiryValue = {
* @param value
* A Date object for absolute expiry or an integer for relative one.
*/
encode: function encode(data, value) {
encode: function(data, value) {
let isDate, begin = data.offset;
if (value instanceof Date) {
isDate = true;
@ -815,7 +815,7 @@ this.FromValue = {
*
* @throws CodeError if decoded token equals to neither 128 nor 129.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -842,7 +842,7 @@ this.FromValue = {
* @param value
* A Address-value or null for MMS Proxy-Relay Insert-Address mode.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (!value) {
WSP.ValueLength.encode(data, 1);
WSP.Octet.encode(data, 129);
@ -876,7 +876,7 @@ this.PreviouslySentByValue = {
* @return Decoded object containing an integer `forwardedCount` and an
* string-typed `originator` attributes.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -906,7 +906,7 @@ this.PreviouslySentDateValue = {
* @return Decoded object containing an integer `forwardedCount` and an
* Date-typed `timestamp` attributes.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -943,7 +943,7 @@ this.MessageClassValue = {
*
* @throws CodeError if decoded value is not in the range 128..131.
*/
decodeClassIdentifier: function decodeClassIdentifier(data) {
decodeClassIdentifier: function(data) {
let value = WSP.Octet.decode(data);
if ((value >= 128) && (value < (128 + this.WELL_KNOWN_CLASSES.length))) {
return this.WELL_KNOWN_CLASSES[value - 128];
@ -958,7 +958,7 @@ this.MessageClassValue = {
*
* @return A decoded string.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return this.decodeClassIdentifier(data);
@ -973,7 +973,7 @@ this.MessageClassValue = {
* A wrapped object to store encoded raw data.
* @param klass
*/
encode: function encode(data, klass) {
encode: function(data, klass) {
let index = this.WELL_KNOWN_CLASSES.indexOf(klass.toLowerCase());
if (index >= 0) {
WSP.Octet.encode(data, index + 128);
@ -1008,7 +1008,7 @@ this.MmFlagsValue = {
*
* @throws CodeError if decoded value is not in the range 128..130.
*/
decode: function decode(data) {
decode: function(data) {
let length = WSP.ValueLength.decode(data);
let end = data.offset + length;
@ -1033,7 +1033,7 @@ this.MmFlagsValue = {
* An object containing an integer `type` and an string-typed
* `text` attributes.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if ((value.type < 128) || (value.type > 130)) {
throw new WSP.CodeError("MM-flags-value: invalid type " + value.type);
}
@ -1093,7 +1093,7 @@ this.RecommendedRetrievalModeValue = {
*
* @return A decoded integer.
*/
decode: function decode(data) {
decode: function(data) {
return WSP.Octet.decodeEqualTo(data, 128);
},
};
@ -1131,7 +1131,7 @@ this.ResponseText = {
* @return An object containing a string-typed `text` attribute and a
* integer-typed `statusCount` one.
*/
decode: function decode(data, options) {
decode: function(data, options) {
let type = WSP.ensureHeader(options, "x-mms-message-type");
let result = {};
@ -1180,7 +1180,7 @@ this.RetrieveStatusValue = {
*
* @return A decoded integer.
*/
decode: function decode(data) {
decode: function(data) {
let value = WSP.Octet.decode(data);
if (value == MMS_PDU_ERROR_OK) {
return value;
@ -1230,7 +1230,7 @@ this.PduHelper = {
*
* @return A boolean value indicating whether it's followed by message body.
*/
parseHeaders: function parseHeaders(data, headers) {
parseHeaders: function(data, headers) {
if (!headers) {
headers = {};
}
@ -1269,7 +1269,7 @@ this.PduHelper = {
* @param msg
* A message object to store decoded multipart or octet array content.
*/
parseContent: function parseContent(data, msg) {
parseContent: function(data, msg) {
let contentType = msg.headers["content-type"].media;
if ((contentType == "application/vnd.wap.multipart.related")
|| (contentType == "application/vnd.wap.multipart.mixed")) {
@ -1300,7 +1300,7 @@ this.PduHelper = {
*
* @throws FatalCodeError if the PDU type is not supported yet.
*/
checkMandatoryFields: function checkMandatoryFields(msg) {
checkMandatoryFields: function(msg) {
let type = WSP.ensureHeader(msg.headers, "x-mms-message-type");
let entry = MMS_PDU_TYPES[type];
if (!entry) {
@ -1326,7 +1326,7 @@ this.PduHelper = {
*
* @return A MMS message object or null in case of errors found.
*/
parse: function parse(data, msg) {
parse: function(data, msg) {
if (!msg) {
msg = {};
}
@ -1355,7 +1355,7 @@ this.PduHelper = {
* @param name
* Name of the header field to be encoded.
*/
encodeHeader: function encodeHeader(data, headers, name) {
encodeHeader: function(data, headers, name) {
let value = headers[name];
if (Array.isArray(value)) {
for (let i = 0; i < value.length; i++) {
@ -1372,7 +1372,7 @@ this.PduHelper = {
* @param headers
* A dictionary object containing multiple name/value mapping.
*/
encodeHeaderIfExists: function encodeHeaderIfExists(data, headers, name) {
encodeHeaderIfExists: function(data, headers, name) {
// Header value could be zero or null.
if (headers[name] !== undefined) {
this.encodeHeader(data, headers, name);
@ -1387,7 +1387,7 @@ this.PduHelper = {
*
* @return the passed data parameter or a created one.
*/
encodeHeaders: function encodeHeaders(data, headers) {
encodeHeaders: function(data, headers) {
if (!data) {
data = {array: [], offset: 0};
}
@ -1425,7 +1425,7 @@ this.PduHelper = {
*
* @return An instance of nsIMultiplexInputStream or null in case of errors.
*/
compose: function compose(multiStream, msg) {
compose: function(multiStream, msg) {
if (!multiStream) {
multiStream = Cc["@mozilla.org/io/multiplex-input-stream;1"]
.createInstance(Ci.nsIMultiplexInputStream);

View File

@ -163,7 +163,7 @@ MmsConnection.prototype = {
mmsProxy: "",
mmsPort: -1,
setApnSetting: function setApnSetting(network) {
setApnSetting: function(network) {
this.mmsc = network.mmsc;
this.mmsProxy = network.mmsProxy;
this.mmsPort = network.mmsPort;
@ -211,7 +211,7 @@ MmsConnection.prototype = {
/**
* Callback when |connectTimer| is timeout or cancelled by shutdown.
*/
flushPendingCallbacks: function flushPendingCallbacks(status) {
flushPendingCallbacks: function(status) {
if (DEBUG) debug("flushPendingCallbacks: " + this.pendingCallbacks.length
+ " pending callbacks with status: " + status);
while (this.pendingCallbacks.length) {
@ -224,14 +224,14 @@ MmsConnection.prototype = {
/**
* Callback when |disconnectTimer| is timeout or cancelled by shutdown.
*/
onDisconnectTimerTimeout: function onDisconnectTimerTimeout() {
onDisconnectTimerTimeout: function() {
if (DEBUG) debug("onDisconnectTimerTimeout: deactivate the MMS data call.");
if (this.connected) {
this.radioInterface.deactivateDataCallByType("mms");
}
},
init: function init() {
init: function() {
Services.obs.addObserver(this, kNetworkInterfaceStateChangedTopic,
false);
Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
@ -274,7 +274,7 @@ MmsConnection.prototype = {
*
* @return true if voice call is roaming.
*/
isVoiceRoaming: function isVoiceRoaming() {
isVoiceRoaming: function() {
let isRoaming = this.radioInterface.rilContext.voice.roaming;
if (DEBUG) debug("isVoiceRoaming = " + isRoaming);
return isRoaming;
@ -289,7 +289,7 @@ MmsConnection.prototype = {
* Otherwise, the phone number is in mdn.
* @see nsIDOMMozCdmaIccInfo
*/
getPhoneNumber: function getPhoneNumber() {
getPhoneNumber: function() {
let iccInfo = this.radioInterface.rilContext.iccInfo;
if (!iccInfo) {
@ -311,7 +311,7 @@ MmsConnection.prototype = {
/**
* A utility function to get the ICC ID of the SIM card (if installed).
*/
getIccId: function getIccId() {
getIccId: function() {
let iccInfo = this.radioInterface.rilContext.iccInfo;
if (!iccInfo || !(iccInfo instanceof Ci.nsIDOMMozGsmIccInfo)) {
@ -341,7 +341,7 @@ MmsConnection.prototype = {
* @return true if the callback for MMS network connection is done; false
* otherwise.
*/
acquire: function acquire(callback) {
acquire: function(callback) {
this.refCount++;
this.connectTimer.cancel();
this.disconnectTimer.cancel();
@ -383,7 +383,7 @@ MmsConnection.prototype = {
/**
* Release the MMS network connection.
*/
release: function release() {
release: function() {
this.refCount--;
if (this.refCount <= 0) {
this.refCount = 0;
@ -403,7 +403,7 @@ MmsConnection.prototype = {
}
},
shutdown: function shutdown() {
shutdown: function() {
Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
Services.obs.removeObserver(this, kNetworkInterfaceStateChangedTopic);
@ -415,7 +415,7 @@ MmsConnection.prototype = {
// nsIObserver
observe: function observe(subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case kNetworkInterfaceStateChangedTopic: {
// The network for MMS connection must be nsIRilNetworkInterface.
@ -505,7 +505,7 @@ MmsProxyFilter.prototype = {
// nsIProtocolProxyFilter
applyFilter: function applyFilter(proxyService, uri, proxyInfo) {
applyFilter: function(proxyService, uri, proxyInfo) {
if (!this.uri.equals(uri)) {
if (DEBUG) debug("applyFilter: content uri = " + JSON.stringify(this.uri) +
" is not matched with uri = " + JSON.stringify(uri) + " .");
@ -542,7 +542,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function() {
* A callback function that takes two arguments: one for http
* status, the other for wrapped PDU data for further parsing.
*/
sendRequest: function sendRequest(mmsConnection, method, url, istream,
sendRequest: function(mmsConnection, method, url, istream,
callback) {
// TODO: bug 810226 - Support GPRS bearer for MMS transmission and reception.
let cancellable = {
@ -551,7 +551,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function() {
isDone: false,
isCancelled: false,
cancel: function cancel() {
cancel: function() {
if (this.isDone) {
// It's too late to cancel.
return;
@ -569,7 +569,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function() {
}
},
done: function done(httpStatus, data) {
done: function(httpStatus, data) {
this.isDone = true;
if (!this.callback) {
return;
@ -615,7 +615,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function() {
return cancellable;
},
sendHttpRequest: function sendHttpRequest(mmsConnection, method, url,
sendHttpRequest: function(mmsConnection, method, url,
istream, proxyFilter, callback) {
let releaseMmsConnectionAndCallback = function(httpStatus, data) {
gpps.unregisterFilter(proxyFilter);
@ -696,7 +696,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function() {
* @return the number of recipients
* @see OMA-TS-MMS_CONF-V1_3-20110511-C section 10.2.5
*/
countRecipients: function countRecipients(recipients) {
countRecipients: function(recipients) {
if (recipients && recipients.address) {
return 1;
}
@ -729,7 +729,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function() {
* parameters.
* @see OMA-TS-MMS_CONF-V1_3-20110511-C section 10.2.5
*/
checkMaxValuesParameters: function checkMaxValuesParameters(msg) {
checkMaxValuesParameters: function(msg) {
let subject = msg.headers["subject"];
if (subject && subject.length > MMS.MMS_MAX_LENGTH_SUBJECT) {
return false;
@ -765,8 +765,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function() {
return true;
},
translateHttpStatusToMmsStatus:
function translateHttpStatusToMmsStatus(httpStatus,
translateHttpStatusToMmsStatus: function(httpStatus,
cancelledReason,
defaultStatus) {
switch(httpStatus) {
@ -821,7 +820,7 @@ NotifyResponseTransaction.prototype = {
* @param callback [optional]
* A callback function that takes one argument -- the http status.
*/
run: function run(callback) {
run: function(callback) {
let requestCallback;
if (callback) {
requestCallback = function(httpStatus, data) {
@ -862,7 +861,7 @@ CancellableTransaction.prototype = {
cancelledReason: _MMS_ERROR_USER_CANCELLED_NO_REASON,
registerRunCallback: function registerRunCallback(callback) {
registerRunCallback: function(callback) {
if (!this.isObserversAdded) {
Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
Services.obs.addObserver(this, kMobileMessageDeletedObserverTopic, false);
@ -874,7 +873,7 @@ CancellableTransaction.prototype = {
this.isCancelled = false;
},
removeObservers: function removeObservers() {
removeObservers: function() {
if (this.isObserversAdded) {
Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
Services.obs.removeObserver(this, kMobileMessageDeletedObserverTopic);
@ -883,7 +882,7 @@ CancellableTransaction.prototype = {
}
},
runCallbackIfValid: function runCallbackIfValid(mmsStatus, msg) {
runCallbackIfValid: function(mmsStatus, msg) {
this.removeObservers();
if (this.runCallback) {
@ -896,7 +895,7 @@ CancellableTransaction.prototype = {
// |gMmsTransactionHelper.sendRequest(...)|.
cancellable: null,
cancelRunning: function cancelRunning(reason) {
cancelRunning: function(reason) {
this.isCancelled = true;
this.cancelledReason = reason;
@ -919,7 +918,7 @@ CancellableTransaction.prototype = {
// nsIObserver
observe: function observe(subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case NS_XPCOM_SHUTDOWN_OBSERVER_ID: {
this.cancelRunning(_MMS_ERROR_SHUTDOWN);
@ -972,7 +971,7 @@ RetrieveTransaction.prototype = Object.create(CancellableTransaction.prototype,
* the other for the parsed M-Retrieve.conf message.
*/
run: {
value: function run(callback) {
value: function(callback) {
this.registerRunCallback(callback);
this.retryCount = 0;
@ -1007,7 +1006,7 @@ RetrieveTransaction.prototype = Object.create(CancellableTransaction.prototype,
* the other for the parsed M-Retrieve.conf message.
*/
retrieve: {
value: function retrieve(callback) {
value: function(callback) {
this.timer = null;
this.cancellable =
@ -1140,7 +1139,7 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
* A callback function that takes zero argument.
*/
loadBlobs: {
value: function loadBlobs(parts, callback) {
value: function(parts, callback) {
let callbackIfValid = function callbackIfValid() {
if (DEBUG) debug("All parts loaded: " + JSON.stringify(parts));
if (callback) {
@ -1188,7 +1187,7 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
* X-Mms-Response-Status, the other for the parsed M-Send.conf message.
*/
run: {
value: function run(callback) {
value: function(callback) {
this.registerRunCallback(callback);
if (!this.istreamComposed) {
@ -1255,7 +1254,7 @@ SendTransaction.prototype = Object.create(CancellableTransaction.prototype, {
* X-Mms-Response-Status, the other for the parsed M-Send.conf message.
*/
send: {
value: function send(callback) {
value: function(callback) {
this.timer = null;
this.cancellable =
@ -1325,7 +1324,7 @@ AcknowledgeTransaction.prototype = {
* @param callback [optional]
* A callback function that takes one argument -- the http status.
*/
run: function run(callback) {
run: function(callback) {
let requestCallback;
if (callback) {
requestCallback = function(httpStatus, data) {
@ -1430,7 +1429,7 @@ MmsService.prototype = {
* @param wish
* Sender wish. Could be undefined, false, or true.
*/
getReportAllowed: function getReportAllowed(config, wish) {
getReportAllowed: function(config, wish) {
if ((config == CONFIG_SEND_REPORT_DEFAULT_NO)
|| (config == CONFIG_SEND_REPORT_DEFAULT_YES)) {
if (wish != null) {
@ -1450,8 +1449,7 @@ MmsService.prototype = {
* @param intermediate
* Intermediate MMS message parsed from PDU.
*/
convertIntermediateToSavable:
function convertIntermediateToSavable(mmsConnection,
convertIntermediateToSavable: function(mmsConnection,
intermediate,
retrievalMode) {
intermediate.type = "mms";
@ -1501,7 +1499,7 @@ MmsService.prototype = {
* The indexedDB savable MMS message, which is going to be
* merged with the extra retrieval confirmation.
*/
mergeRetrievalConfirmation: function mergeRetrievalConfirmation(mmsConnection,
mergeRetrievalConfirmation: function(mmsConnection,
intermediate,
savable) {
// Prepare timestamp/sentTimestamp.
@ -1548,7 +1546,7 @@ MmsService.prototype = {
* @param aDomMessage
* The nsIDOMMozMmsMessage object.
*/
retrieveMessage: function retrieveMessage(aMmsConnection, aContentLocation,
retrieveMessage: function(aMmsConnection, aContentLocation,
aCallback, aDomMessage) {
// Notifying observers an MMS message is retrieving.
Services.obs.notifyObservers(aDomMessage, kSmsRetrievingObserverTopic, null);
@ -1568,7 +1566,7 @@ MmsService.prototype = {
* @param aDomMessage
* The nsIDOMMozMmsMessage object.
*/
broadcastMmsSystemMessage: function broadcastMmsSystemMessage(aName, aDomMessage) {
broadcastMmsSystemMessage: function(aName, aDomMessage) {
if (DEBUG) debug("Broadcasting the MMS system message: " + aName);
// Sadly we cannot directly broadcast the aDomMessage object
@ -1599,7 +1597,7 @@ MmsService.prototype = {
* @params aDomMessage
* The nsIDOMMozMmsMessage object.
*/
broadcastSentMessageEvent: function broadcastSentMessageEvent(aDomMessage) {
broadcastSentMessageEvent: function(aDomMessage) {
// Broadcasting a 'sms-sent' system message to open apps.
this.broadcastMmsSystemMessage(kSmsSentObserverTopic, aDomMessage);
@ -1625,7 +1623,7 @@ MmsService.prototype = {
/**
* Callback for retrieveMessage.
*/
retrieveMessageCallback: function retrieveMessageCallback(mmsConnection,
retrieveMessageCallback: function(mmsConnection,
wish,
savableMessage,
mmsStatus,
@ -1706,8 +1704,7 @@ MmsService.prototype = {
/**
* Callback for saveReceivedMessage.
*/
saveReceivedMessageCallback:
function saveReceivedMessageCallback(mmsConnection,
saveReceivedMessageCallback: function(mmsConnection,
retrievalMode,
savableMessage,
rv,
@ -1777,7 +1774,7 @@ MmsService.prototype = {
* @param notification
* The parsed MMS message object.
*/
handleNotificationIndication: function handleNotificationIndication(serviceId,
handleNotificationIndication: function(serviceId,
notification) {
let transactionId = notification.headers["x-mms-transaction-id"];
gMobileMessageDatabaseService.getMessageRecordByTransactionId(transactionId,
@ -1830,7 +1827,7 @@ MmsService.prototype = {
* @param aMsg
* The MMS message object.
*/
handleDeliveryIndication: function handleDeliveryIndication(aMsg) {
handleDeliveryIndication: function(aMsg) {
let headers = aMsg.headers;
let envelopeId = headers["message-id"];
let address = headers.to.address;
@ -1897,8 +1894,7 @@ MmsService.prototype = {
* @param aIndication
* The MMS message object.
*/
handleReadOriginateIndication:
function handleReadOriginateIndication(aIndication) {
handleReadOriginateIndication: function(aIndication) {
let headers = aIndication.headers;
let envelopeId = headers["message-id"];
@ -1965,7 +1961,7 @@ MmsService.prototype = {
* name-parameter of Content-Type header nor filename parameter of Content-Disposition
* header is available, Content-Location header SHALL be used if available.
*/
createSavableFromParams: function createSavableFromParams(aMmsConnection,
createSavableFromParams: function(aMmsConnection,
aParams, aMessage) {
if (DEBUG) debug("createSavableFromParams: aParams: " + JSON.stringify(aParams));
@ -2081,7 +2077,7 @@ MmsService.prototype = {
mmsDefaultServiceId: 0,
send: function send(aServiceId, aParams, aRequest) {
send: function(aServiceId, aParams, aRequest) {
if (DEBUG) debug("send: aParams: " + JSON.stringify(aParams));
// Note that the following sanity checks for |aParams| should be consistent
@ -2219,7 +2215,7 @@ MmsService.prototype = {
});
},
retrieve: function retrieve(aMessageId, aRequest) {
retrieve: function(aMessageId, aRequest) {
if (DEBUG) debug("Retrieving message with ID " + aMessageId);
gMobileMessageDatabaseService.getMessageRecordById(aMessageId,
(function notifyResult(aRv, aMessageRecord, aDomMessage) {
@ -2410,7 +2406,7 @@ MmsService.prototype = {
}).bind(this));
},
sendReadReport: function sendReadReport(messageID, toAddress, iccId) {
sendReadReport: function(messageID, toAddress, iccId) {
if (DEBUG) {
debug("messageID: " + messageID + " toAddress: " +
JSON.stringify(toAddress));
@ -2448,7 +2444,7 @@ MmsService.prototype = {
// nsIWapPushApplication
receiveWapPush: function receiveWapPush(array, length, offset, options) {
receiveWapPush: function(array, length, offset, options) {
let data = {array: array, offset: offset};
let msg = MMS.PduHelper.parse(data, null);
if (!msg) {
@ -2474,7 +2470,7 @@ MmsService.prototype = {
// nsIObserver
observe: function observe(aSubject, aTopic, aData) {
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case NS_PREFBRANCH_PREFCHANGE_TOPIC_ID:
if (aData === kPrefDefaultServiceId) {

View File

@ -104,7 +104,7 @@ MobileMessageDB.prototype = {
*
* @return (via callback) a database ready for use.
*/
ensureDB: function ensureDB(callback) {
ensureDB: function(callback) {
if (this.db) {
if (DEBUG) debug("ensureDB: already have a database, returning early.");
callback(null, this.db);
@ -254,7 +254,7 @@ MobileMessageDB.prototype = {
* @param storeNames
* Names of the stores to open.
*/
newTxn: function newTxn(txn_type, callback, storeNames) {
newTxn: function(txn_type, callback, storeNames) {
if (!storeNames) {
storeNames = [MESSAGE_STORE_NAME];
}
@ -304,7 +304,7 @@ MobileMessageDB.prototype = {
* or any error occurs. Should take only one argument -- null when
* initialized with success or the error object otherwise.
*/
init: function init(aDbName, aDbVersion, aCallback) {
init: function(aDbName, aDbVersion, aCallback) {
this.dbName = aDbName;
this.dbVersion = aDbVersion || DB_VERSION;
@ -347,7 +347,7 @@ MobileMessageDB.prototype = {
});
},
close: function close() {
close: function() {
if (!this.db) {
return;
}
@ -361,8 +361,7 @@ MobileMessageDB.prototype = {
* Sometimes user might reboot or remove battery while sending/receiving
* message. This is function set the status of message records to error.
*/
updatePendingTransactionToError:
function updatePendingTransactionToError(aError) {
updatePendingTransactionToError: function(aError) {
if (aError) {
return;
}
@ -440,7 +439,7 @@ MobileMessageDB.prototype = {
* TODO need to worry about number normalization somewhere...
* TODO full text search on body???
*/
createSchema: function createSchema(db, next) {
createSchema: function(db, next) {
// This messageStore holds the main mobile message data.
let messageStore = db.createObjectStore(MESSAGE_STORE_NAME, { keyPath: "id" });
messageStore.createIndex("timestamp", "timestamp", { unique: false });
@ -451,13 +450,13 @@ MobileMessageDB.prototype = {
/**
* Upgrade to the corresponding database schema version.
*/
upgradeSchema: function upgradeSchema(transaction, next) {
upgradeSchema: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.createIndex("read", "read", { unique: false });
next();
},
upgradeSchema2: function upgradeSchema2(transaction, next) {
upgradeSchema2: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
let cursor = event.target.result;
@ -474,7 +473,7 @@ MobileMessageDB.prototype = {
};
},
upgradeSchema3: function upgradeSchema3(db, transaction, next) {
upgradeSchema3: function(db, transaction, next) {
// Delete redundant "id" index.
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
if (messageStore.indexNames.contains("id")) {
@ -498,7 +497,7 @@ MobileMessageDB.prototype = {
next();
},
upgradeSchema4: function upgradeSchema4(transaction, next) {
upgradeSchema4: function(transaction, next) {
let threads = {};
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
let mostRecentStore = transaction.objectStore(MOST_RECENT_STORE_NAME);
@ -539,12 +538,12 @@ MobileMessageDB.prototype = {
};
},
upgradeSchema5: function upgradeSchema5(transaction, next) {
upgradeSchema5: function(transaction, next) {
// Don't perform any upgrade. See Bug 819560.
next();
},
upgradeSchema6: function upgradeSchema6(transaction, next) {
upgradeSchema6: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
// Delete "delivery" index.
@ -606,7 +605,7 @@ MobileMessageDB.prototype = {
* Fetching threads list is now simply walking through the thread sotre. The
* "mostRecentStore" is dropped.
*/
upgradeSchema7: function upgradeSchema7(db, transaction, next) {
upgradeSchema7: function(db, transaction, next) {
/**
* This "participant" object store keeps mappings of multiple phone numbers
* of the same recipient to an integer participant id. Each entry looks
@ -738,7 +737,7 @@ MobileMessageDB.prototype = {
/**
* Add transactionId index for MMS.
*/
upgradeSchema8: function upgradeSchema8(transaction, next) {
upgradeSchema8: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
// Delete "transactionId" index.
@ -769,7 +768,7 @@ MobileMessageDB.prototype = {
};
},
upgradeSchema9: function upgradeSchema9(transaction, next) {
upgradeSchema9: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
// Update type attributes.
@ -789,7 +788,7 @@ MobileMessageDB.prototype = {
};
},
upgradeSchema10: function upgradeSchema10(transaction, next) {
upgradeSchema10: function(transaction, next) {
let threadStore = transaction.objectStore(THREAD_STORE_NAME);
// Add 'lastMessageType' to each thread record.
@ -837,7 +836,7 @@ MobileMessageDB.prototype = {
/**
* Add envelopeId index for MMS.
*/
upgradeSchema11: function upgradeSchema11(transaction, next) {
upgradeSchema11: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
// Delete "envelopeId" index.
@ -869,7 +868,7 @@ MobileMessageDB.prototype = {
/**
* Replace deliveryStatus by deliveryInfo.
*/
upgradeSchema12: function upgradeSchema12(transaction, next) {
upgradeSchema12: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
@ -906,7 +905,7 @@ MobileMessageDB.prototype = {
/**
* Fix the wrong participants.
*/
upgradeSchema13: function upgradeSchema13(transaction, next) {
upgradeSchema13: function(transaction, next) {
let participantStore = transaction.objectStore(PARTICIPANT_STORE_NAME);
let threadStore = transaction.objectStore(THREAD_STORE_NAME);
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
@ -1086,7 +1085,7 @@ MobileMessageDB.prototype = {
/**
* Add deliveryTimestamp.
*/
upgradeSchema14: function upgradeSchema14(transaction, next) {
upgradeSchema14: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
@ -1113,7 +1112,7 @@ MobileMessageDB.prototype = {
/**
* Add ICC ID.
*/
upgradeSchema15: function upgradeSchema15(transaction, next) {
upgradeSchema15: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
let cursor = event.target.result;
@ -1132,7 +1131,7 @@ MobileMessageDB.prototype = {
/**
* Add isReadReportSent for incoming MMS.
*/
upgradeSchema16: function upgradeSchema16(transaction, next) {
upgradeSchema16: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
// Update type attributes.
@ -1152,7 +1151,7 @@ MobileMessageDB.prototype = {
};
},
upgradeSchema17: function upgradeSchema17(transaction, next) {
upgradeSchema17: function(transaction, next) {
let threadStore = transaction.objectStore(THREAD_STORE_NAME);
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
@ -1193,7 +1192,7 @@ MobileMessageDB.prototype = {
/**
* Add pid for incoming SMS.
*/
upgradeSchema18: function upgradeSchema18(transaction, next) {
upgradeSchema18: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
@ -1215,7 +1214,7 @@ MobileMessageDB.prototype = {
/**
* Add readStatus and readTimestamp.
*/
upgradeSchema19: function upgradeSchema19(transaction, next) {
upgradeSchema19: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
let cursor = event.target.result;
@ -1272,7 +1271,7 @@ MobileMessageDB.prototype = {
/**
* Add sentTimestamp.
*/
upgradeSchema20: function upgradeSchema20(transaction, next) {
upgradeSchema20: function(transaction, next) {
let messageStore = transaction.objectStore(MESSAGE_STORE_NAME);
messageStore.openCursor().onsuccess = function(event) {
let cursor = event.target.result;
@ -1295,7 +1294,7 @@ MobileMessageDB.prototype = {
};
},
matchParsedPhoneNumbers: function matchParsedPhoneNumbers(addr1, parsedAddr1,
matchParsedPhoneNumbers: function(addr1, parsedAddr1,
addr2, parsedAddr2) {
if ((parsedAddr1.internationalNumber &&
parsedAddr1.internationalNumber === parsedAddr2.internationalNumber) ||
@ -1319,7 +1318,7 @@ MobileMessageDB.prototype = {
addr1.slice(-val) === addr2.slice(-val);
},
matchPhoneNumbers: function matchPhoneNumbers(addr1, parsedAddr1, addr2, parsedAddr2) {
matchPhoneNumbers: function(addr1, parsedAddr1, addr2, parsedAddr2) {
if (parsedAddr1 && parsedAddr2) {
return this.matchParsedPhoneNumbers(addr1, parsedAddr1, addr2, parsedAddr2);
}
@ -1343,7 +1342,7 @@ MobileMessageDB.prototype = {
return false;
},
createDomMessageFromRecord: function createDomMessageFromRecord(aMessageRecord) {
createDomMessageFromRecord: function(aMessageRecord) {
if (DEBUG) {
debug("createDomMessageFromRecord: " + JSON.stringify(aMessageRecord));
}
@ -1424,7 +1423,7 @@ MobileMessageDB.prototype = {
}
},
findParticipantRecordByAddress: function findParticipantRecordByAddress(
findParticipantRecordByAddress: function(
aParticipantStore, aAddress, aCreate, aCallback) {
if (DEBUG) {
debug("findParticipantRecordByAddress("
@ -1529,7 +1528,7 @@ MobileMessageDB.prototype = {
}).bind(this);
},
findParticipantIdsByAddresses: function findParticipantIdsByAddresses(
findParticipantIdsByAddresses: function(
aParticipantStore, aAddresses, aCreate, aSkipNonexistent, aCallback) {
if (DEBUG) {
debug("findParticipantIdsByAddresses("
@ -1572,7 +1571,7 @@ MobileMessageDB.prototype = {
}) (0, []);
},
findThreadRecordByParticipants: function findThreadRecordByParticipants(
findThreadRecordByParticipants: function(
aThreadStore, aParticipantStore, aAddresses,
aCreateParticipants, aCallback) {
if (DEBUG) {
@ -1600,7 +1599,7 @@ MobileMessageDB.prototype = {
});
},
newTxnWithCallback: function newTxnWithCallback(aCallback, aFunc, aStoreNames) {
newTxnWithCallback: function(aCallback, aFunc, aStoreNames) {
let self = this;
this.newTxn(READ_WRITE, function(aError, aTransaction, aStores) {
let notifyResult = function(aRv, aMessageRecord) {
@ -1631,7 +1630,7 @@ MobileMessageDB.prototype = {
}, aStoreNames);
},
saveRecord: function saveRecord(aMessageRecord, aAddresses, aCallback) {
saveRecord: function(aMessageRecord, aAddresses, aCallback) {
if (DEBUG) debug("Going to store " + JSON.stringify(aMessageRecord));
let self = this;
@ -1670,8 +1669,7 @@ MobileMessageDB.prototype = {
}, [MESSAGE_STORE_NAME, PARTICIPANT_STORE_NAME, THREAD_STORE_NAME]);
},
replaceShortMessageOnSave:
function replaceShortMessageOnSave(aTransaction, aMessageStore,
replaceShortMessageOnSave: function(aTransaction, aMessageStore,
aParticipantStore, aThreadStore,
aMessageRecord, aAddresses) {
let isReplaceTypePid = (aMessageRecord.pid) &&
@ -1734,7 +1732,7 @@ MobileMessageDB.prototype = {
});
},
realSaveRecord: function realSaveRecord(aTransaction, aMessageStore,
realSaveRecord: function(aTransaction, aMessageStore,
aParticipantStore, aThreadStore,
aMessageRecord, aAddresses) {
let self = this;
@ -1837,8 +1835,7 @@ MobileMessageDB.prototype = {
});
},
forEachMatchedMmsDeliveryInfo:
function forEachMatchedMmsDeliveryInfo(aDeliveryInfo, aNeedle, aCallback) {
forEachMatchedMmsDeliveryInfo: function(aDeliveryInfo, aNeedle, aCallback) {
let typedAddress = {
type: MMS.Address.resolveType(aNeedle),
@ -1883,7 +1880,7 @@ MobileMessageDB.prototype = {
}
},
updateMessageDeliveryById: function updateMessageDeliveryById(
updateMessageDeliveryById: function(
id, type, receiver, delivery, deliveryStatus, envelopeId, callback) {
if (DEBUG) {
debug("Setting message's delivery by " + type + " = "+ id
@ -1985,7 +1982,7 @@ MobileMessageDB.prototype = {
});
},
fillReceivedMmsThreadParticipants: function fillReceivedMmsThreadParticipants(aMessage, threadParticipants) {
fillReceivedMmsThreadParticipants: function(aMessage, threadParticipants) {
let receivers = aMessage.receivers;
// If we don't want to disable the MMS grouping for receiving, we need to
// add the receivers (excluding the user's own number) to the participants
@ -2023,7 +2020,7 @@ MobileMessageDB.prototype = {
threadParticipants = threadParticipants.concat(slicedReceivers);
},
updateThreadByMessageChange: function updateThreadByMessageChange(messageStore,
updateThreadByMessageChange: function(messageStore,
threadStore,
threadId,
messageId,
@ -2084,7 +2081,7 @@ MobileMessageDB.prototype = {
* nsIRilMobileMessageDatabaseService API
*/
saveReceivedMessage: function saveReceivedMessage(aMessage, aCallback) {
saveReceivedMessage: function(aMessage, aCallback) {
if ((aMessage.type != "sms" && aMessage.type != "mms") ||
(aMessage.type == "sms" && (aMessage.messageClass == undefined ||
aMessage.sender == undefined)) ||
@ -2156,7 +2153,7 @@ MobileMessageDB.prototype = {
this.saveRecord(aMessage, threadParticipants, aCallback);
},
saveSendingMessage: function saveSendingMessage(aMessage, aCallback) {
saveSendingMessage: function(aMessage, aCallback) {
if ((aMessage.type != "sms" && aMessage.type != "mms") ||
(aMessage.type == "sms" && aMessage.receiver == undefined) ||
(aMessage.type == "mms" && !Array.isArray(aMessage.receivers)) ||
@ -2227,7 +2224,7 @@ MobileMessageDB.prototype = {
this.saveRecord(aMessage, addresses, aCallback);
},
setMessageDeliveryByMessageId: function setMessageDeliveryByMessageId(
setMessageDeliveryByMessageId: function(
messageId, receiver, delivery, deliveryStatus, envelopeId, callback) {
this.updateMessageDeliveryById(messageId, "messageId",
receiver, delivery, deliveryStatus,
@ -2235,15 +2232,13 @@ MobileMessageDB.prototype = {
},
setMessageDeliveryStatusByEnvelopeId:
function setMessageDeliveryStatusByEnvelopeId(aEnvelopeId, aReceiver,
setMessageDeliveryStatusByEnvelopeId: function(aEnvelopeId, aReceiver,
aDeliveryStatus, aCallback) {
this.updateMessageDeliveryById(aEnvelopeId, "envelopeId", aReceiver, null,
aDeliveryStatus, null, aCallback);
},
setMessageReadStatusByEnvelopeId:
function setMessageReadStatusByEnvelopeId(aEnvelopeId, aReceiver,
setMessageReadStatusByEnvelopeId: function(aEnvelopeId, aReceiver,
aReadStatus, aCallback) {
if (DEBUG) {
debug("Setting message's read status by envelopeId = " + aEnvelopeId +
@ -2293,7 +2288,7 @@ MobileMessageDB.prototype = {
});
},
getMessageRecordByTransactionId: function getMessageRecordByTransactionId(aTransactionId, aCallback) {
getMessageRecordByTransactionId: function(aTransactionId, aCallback) {
if (DEBUG) debug("Retrieving message with transaction ID " + aTransactionId);
let self = this;
this.newTxn(READ_ONLY, function(error, txn, messageStore) {
@ -2329,7 +2324,7 @@ MobileMessageDB.prototype = {
});
},
getMessageRecordById: function getMessageRecordById(aMessageId, aCallback) {
getMessageRecordById: function(aMessageId, aCallback) {
if (DEBUG) debug("Retrieving message with ID " + aMessageId);
let self = this;
this.newTxn(READ_ONLY, function(error, txn, messageStore) {
@ -2381,10 +2376,10 @@ MobileMessageDB.prototype = {
* nsIMobileMessageDatabaseService API
*/
getMessage: function getMessage(aMessageId, aRequest) {
getMessage: function(aMessageId, aRequest) {
if (DEBUG) debug("Retrieving message with ID " + aMessageId);
let notifyCallback = {
notify: function notify(aRv, aMessageRecord, aDomMessage) {
notify: function(aRv, aMessageRecord, aDomMessage) {
if (Ci.nsIMobileMessageCallback.SUCCESS_NO_ERROR == aRv) {
aRequest.notifyMessageGot(aDomMessage);
return;
@ -2395,7 +2390,7 @@ MobileMessageDB.prototype = {
this.getMessageRecordById(aMessageId, notifyCallback);
},
deleteMessage: function deleteMessage(messageIds, length, aRequest) {
deleteMessage: function(messageIds, length, aRequest) {
if (DEBUG) debug("deleteMessage: message ids " + JSON.stringify(messageIds));
let deleted = [];
let self = this;
@ -2452,7 +2447,7 @@ MobileMessageDB.prototype = {
}, [MESSAGE_STORE_NAME, THREAD_STORE_NAME]);
},
createMessageCursor: function createMessageCursor(filter, reverse, callback) {
createMessageCursor: function(filter, reverse, callback) {
if (DEBUG) {
debug("Creating a message cursor. Filters:" +
" startDate: " + filter.startDate +
@ -2476,7 +2471,7 @@ MobileMessageDB.prototype = {
return cursor;
},
markMessageRead: function markMessageRead(messageId, value, aSendReadReport, aRequest) {
markMessageRead: function(messageId, value, aSendReadReport, aRequest) {
if (DEBUG) debug("Setting message " + messageId + " read to " + value);
this.newTxn(READ_WRITE, function(error, txn, stores) {
if (error) {
@ -2566,7 +2561,7 @@ MobileMessageDB.prototype = {
}, [MESSAGE_STORE_NAME, THREAD_STORE_NAME]);
},
createThreadCursor: function createThreadCursor(callback) {
createThreadCursor: function(callback) {
if (DEBUG) debug("Getting thread list");
let cursor = new GetThreadsCursor(this, callback);
@ -2613,7 +2608,7 @@ let FilterSearcherHelper = {
* Result colletor function. It takes three parameters -- txn, message
* id, and message timestamp.
*/
filterIndex: function filterIndex(index, range, direction, txn, collect) {
filterIndex: function(index, range, direction, txn, collect) {
let messageStore = txn.objectStore(MESSAGE_STORE_NAME);
let request = messageStore.index(index).openKeyCursor(range, direction);
request.onsuccess = function onsuccess(event) {
@ -2650,7 +2645,7 @@ let FilterSearcherHelper = {
* Result colletor function. It takes three parameters -- txn, message
* id, and message timestamp.
*/
filterTimestamp: function filterTimestamp(startDate, endDate, direction, txn,
filterTimestamp: function(startDate, endDate, direction, txn,
collect) {
let range = null;
if (startDate != null && endDate != null) {
@ -2681,7 +2676,7 @@ let FilterSearcherHelper = {
* Result colletor function. It takes three parameters -- txn, message
* id, and message timestamp.
*/
transact: function transact(mmdb, txn, error, filter, reverse, collect) {
transact: function(mmdb, txn, error, filter, reverse, collect) {
if (error) {
//TODO look at event.target.errorCode, pick appropriate error constant.
if (DEBUG) debug("IDBRequest error " + error.target.errorCode);
@ -2827,7 +2822,7 @@ ResultsCollector.prototype = {
*
* @return true if expects more. false otherwise.
*/
collect: function collect(txn, id, timestamp) {
collect: function(txn, id, timestamp) {
if (this.done) {
return false;
}
@ -2868,7 +2863,7 @@ ResultsCollector.prototype = {
* @param callback
* A callback function that accepts a numeric id.
*/
squeeze: function squeeze(callback) {
squeeze: function(callback) {
if (this.requestWaiting) {
throw new Error("Already waiting for another request!");
}
@ -2889,7 +2884,7 @@ ResultsCollector.prototype = {
* @param callback
* A callback function that accepts a numeric id.
*/
drip: function drip(txn, callback) {
drip: function(txn, callback) {
if (!this.results.length) {
if (DEBUG) debug("No messages matching the filter criteria");
callback(txn, COLLECT_ID_END);
@ -2923,7 +2918,7 @@ IntersectionResultsCollector.prototype = {
* Queue up {id, timestamp} pairs, find out intersections and report to
* |cascadedCollect|. Return true if it is still possible to have another match.
*/
collect: function collect(contextIndex, txn, id, timestamp) {
collect: function(contextIndex, txn, id, timestamp) {
if (DEBUG) {
debug("IntersectionResultsCollector: "
+ contextIndex + ", " + id + ", " + timestamp);
@ -3013,7 +3008,7 @@ IntersectionResultsCollector.prototype = {
return this.cascadedCollect(txn, id, timestamp);
},
newContext: function newContext() {
newContext: function() {
let contextIndex = this.contexts.length;
this.contexts.push({
results: [],
@ -3038,7 +3033,7 @@ UnionResultsCollector.prototype = {
cascadedCollect: null,
contexts: null,
collect: function collect(contextIndex, txn, id, timestamp) {
collect: function(contextIndex, txn, id, timestamp) {
if (DEBUG) {
debug("UnionResultsCollector: "
+ contextIndex + ", " + id + ", " + timestamp);
@ -3086,11 +3081,11 @@ UnionResultsCollector.prototype = {
return false;
},
newTimestampContext: function newTimestampContext() {
newTimestampContext: function() {
return this.collect.bind(this, 0);
},
newContext: function newContext() {
newContext: function() {
this.contexts[1].processing++;
return this.collect.bind(this, 1);
}
@ -3111,7 +3106,7 @@ GetMessagesCursor.prototype = {
callback: null,
collector: null,
getMessageTxn: function getMessageTxn(messageStore, messageId) {
getMessageTxn: function(messageStore, messageId) {
if (DEBUG) debug ("Fetching message " + messageId);
let getRequest = messageStore.get(messageId);
@ -3132,7 +3127,7 @@ GetMessagesCursor.prototype = {
};
},
notify: function notify(txn, messageId) {
notify: function(txn, messageId) {
if (!messageId) {
this.callback.notifyCursorDone();
return;
@ -3164,7 +3159,7 @@ GetMessagesCursor.prototype = {
// nsICursorContinueCallback
handleContinue: function handleContinue() {
handleContinue: function() {
if (DEBUG) debug("Getting next message in list");
this.collector.squeeze(this.notify.bind(this));
}
@ -3185,7 +3180,7 @@ GetThreadsCursor.prototype = {
callback: null,
collector: null,
getThreadTxn: function getThreadTxn(threadStore, threadId) {
getThreadTxn: function(threadStore, threadId) {
if (DEBUG) debug ("Fetching thread " + threadId);
let getRequest = threadStore.get(threadId);
@ -3213,7 +3208,7 @@ GetThreadsCursor.prototype = {
};
},
notify: function notify(txn, threadId) {
notify: function(txn, threadId) {
if (!threadId) {
this.callback.notifyCursorDone();
return;
@ -3245,7 +3240,7 @@ GetThreadsCursor.prototype = {
// nsICursorContinueCallback
handleContinue: function handleContinue() {
handleContinue: function() {
if (DEBUG) debug("Getting next thread in list");
this.collector.squeeze(this.notify.bind(this));
}

View File

@ -46,7 +46,7 @@ MobileMessageDatabaseService.prototype = {
/**
* nsIObserver
*/
observe: function observe() {},
observe: function() {},
/**
* nsIRilMobileMessageDatabaseService API

View File

@ -215,7 +215,7 @@ this.Octet = {
*
* @throws RangeError if no more data is available.
*/
decode: function decode(data) {
decode: function(data) {
if (data.offset >= data.array.length) {
throw new RangeError();
}
@ -234,7 +234,7 @@ this.Octet = {
* @throws RangeError if no enough data to read.
* @throws TypeError if `data` has neither subarray() nor slice() method.
*/
decodeMultiple: function decodeMultiple(data, end) {
decodeMultiple: function(data, end) {
if ((end < data.offset) || (end > data.array.length)) {
throw new RangeError();
}
@ -267,7 +267,7 @@ this.Octet = {
*
* @throws CodeError if read octet is not equal to expected one.
*/
decodeEqualTo: function decodeEqualTo(data, expected) {
decodeEqualTo: function(data, expected) {
if (this.decode(data) != expected) {
throw new CodeError("Octet - decodeEqualTo: doesn't match " + expected);
}
@ -281,7 +281,7 @@ this.Octet = {
* @param octet
* Octet value to be encoded.
*/
encode: function encode(data, octet) {
encode: function(data, octet) {
if (data.offset >= data.array.length) {
data.array.push(octet);
data.offset++;
@ -296,7 +296,7 @@ this.Octet = {
* @param octet
* An octet array object.
*/
encodeMultiple: function encodeMultiple(data, array) {
encodeMultiple: function(data, array) {
for (let i = 0; i < array.length; i++) {
this.encode(data, array[i]);
}
@ -325,7 +325,7 @@ this.Text = {
* @throws NullCharError if a NUL character read.
* @throws CodeError if a control character read.
*/
decode: function decode(data) {
decode: function(data) {
let code = Octet.decode(data);
if ((code >= CTLS) && (code != DEL)) {
return String.fromCharCode(code);
@ -386,7 +386,7 @@ this.Text = {
*
* @throws CodeError if a control character got.
*/
encode: function encode(data, text) {
encode: function(data, text) {
if (!text) {
throw new CodeError("Text: empty string");
}
@ -408,7 +408,7 @@ this.NullTerminatedTexts = {
*
* @return Decoded string.
*/
decode: function decode(data) {
decode: function(data) {
let str = "";
try {
// A End-of-string is also a CTL, which should cause a error.
@ -426,7 +426,7 @@ this.NullTerminatedTexts = {
* @param str
* A String to be encoded.
*/
encode: function encode(data, str) {
encode: function(data, str) {
if (str) {
for (let i = 0; i < str.length; i++) {
Text.encode(data, str.charAt(i));
@ -453,7 +453,7 @@ this.Token = {
* @throws NullCharError if a NUL character read.
* @throws CodeError if an invalid character read.
*/
decode: function decode(data) {
decode: function(data) {
let code = Octet.decode(data);
if ((code < ASCIIS) && (code >= CTLS)) {
if ((code == HT) || (code == SP)
@ -483,7 +483,7 @@ this.Token = {
*
* @throws CodeError if an invalid character got.
*/
encode: function encode(data, token) {
encode: function(data, token) {
if (!token) {
throw new CodeError("Token: empty string");
}
@ -529,7 +529,7 @@ this.URIC = {
* @throws NullCharError if a NUL character read.
* @throws CodeError if an invalid character read.
*/
decode: function decode(data) {
decode: function(data) {
let code = Octet.decode(data);
if (code == NUL) {
throw new NullCharError();
@ -562,7 +562,7 @@ this.TextString = {
*
* @return Decoded string.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
let firstCode = Octet.decode(data);
if (firstCode == 127) {
@ -591,7 +591,7 @@ this.TextString = {
* @param str
* A String to be encoded.
*/
encode: function encode(data, str) {
encode: function(data, str) {
if (!str) {
Octet.encode(data, 0);
return;
@ -618,7 +618,7 @@ this.TokenText = {
*
* @return Decoded string.
*/
decode: function decode(data) {
decode: function(data) {
let str = "";
try {
// A End-of-string is also a CTL, which should cause a error.
@ -636,7 +636,7 @@ this.TokenText = {
* @param str
* A String to be encoded.
*/
encode: function encode(data, str) {
encode: function(data, str) {
if (str) {
for (let i = 0; i < str.length; i++) {
Token.encode(data, str.charAt(i));
@ -663,7 +663,7 @@ this.QuotedString = {
*
* @throws CodeError if first octet read is not 0x34.
*/
decode: function decode(data) {
decode: function(data) {
let value = Octet.decode(data);
if (value != 34) {
throw new CodeError("Quoted-string: not quote " + value);
@ -678,7 +678,7 @@ this.QuotedString = {
* @param str
* A String to be encoded.
*/
encode: function encode(data, str) {
encode: function(data, str) {
Octet.encode(data, 34);
NullTerminatedTexts.encode(data, str);
},
@ -702,7 +702,7 @@ this.ShortInteger = {
*
* @throws CodeError if the octet read is less than 0x80.
*/
decode: function decode(data) {
decode: function(data) {
let value = Octet.decode(data);
if (!(value & 0x80)) {
throw new CodeError("Short-integer: invalid value " + value);
@ -719,7 +719,7 @@ this.ShortInteger = {
*
* @throws CodeError if the octet read is larger-equal than 0x80.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (value >= 0x80) {
throw new CodeError("Short-integer: invalid value " + value);
}
@ -748,7 +748,7 @@ this.LongInteger = {
*
* @return A decoded integer value or an octets array of max 30 elements.
*/
decodeMultiOctetInteger: function decodeMultiOctetInteger(data, length) {
decodeMultiOctetInteger: function(data, length) {
if (length < 7) {
// Return a integer instead of an array as possible. For a multi-octet
// integer, there are only maximum 53 bits for integer in javascript. We
@ -772,7 +772,7 @@ this.LongInteger = {
*
* @throws CodeError if the length read is not in 1..30.
*/
decode: function decode(data) {
decode: function(data) {
let length = Octet.decode(data);
if ((length < 1) || (length > 30)) {
throw new CodeError("Long-integer: invalid length " + length);
@ -788,7 +788,7 @@ this.LongInteger = {
* An octet array of less-equal than 30 elements or an integer
* greater-equal than 128.
*/
encode: function encode(data, numOrArray) {
encode: function(data, numOrArray) {
if (typeof numOrArray === "number") {
let num = numOrArray;
if (num >= 0x1000000000000) {
@ -828,7 +828,7 @@ this.UintVar = {
*
* @return Decoded integer value.
*/
decode: function decode(data) {
decode: function(data) {
let value = Octet.decode(data);
let result = value & 0x7F;
while (value & 0x80) {
@ -845,7 +845,7 @@ this.UintVar = {
* @param value
* An integer value.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (value < 0) {
throw new CodeError("UintVar: invalid value " + value);
}
@ -883,7 +883,7 @@ this.ConstrainedEncoding = {
*
* @return Decode integer value or string.
*/
decode: function decode(data) {
decode: function(data) {
return decodeAlternatives(data, null, TextString, ShortInteger);
},
@ -893,7 +893,7 @@ this.ConstrainedEncoding = {
* @param value
* An integer or a string value.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (typeof value == "number") {
ShortInteger.encode(data, value);
} else {
@ -919,7 +919,7 @@ this.ValueLength = {
*
* @throws CodeError if the first octet read is larger than 31.
*/
decode: function decode(data) {
decode: function(data) {
let value = Octet.decode(data);
if (value <= 30) {
return value;
@ -937,7 +937,7 @@ this.ValueLength = {
* A wrapped object to store encoded raw data.
* @param value
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (value <= 30) {
Octet.encode(data, value);
} else {
@ -959,7 +959,7 @@ this.NoValue = {
*
* @return Always returns null.
*/
decode: function decode(data) {
decode: function(data) {
Octet.decodeEqualTo(data, 0);
return null;
},
@ -970,7 +970,7 @@ this.NoValue = {
* @param value
* A null or undefined value.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (value != null) {
throw new CodeError("No-value: invalid value " + value);
}
@ -990,7 +990,7 @@ this.TextValue = {
*
* @return Decoded string or null for No-value.
*/
decode: function decode(data) {
decode: function(data) {
return decodeAlternatives(data, null, NoValue, TokenText, QuotedString);
},
@ -1000,7 +1000,7 @@ this.TextValue = {
* @param text
* A null or undefined or text string.
*/
encode: function encode(data, text) {
encode: function(data, text) {
encodeAlternatives(data, text, null, NoValue, TokenText, QuotedString);
},
};
@ -1017,7 +1017,7 @@ this.IntegerValue = {
*
* @return Decoded integer value or array of octets.
*/
decode: function decode(data) {
decode: function(data) {
return decodeAlternatives(data, null, ShortInteger, LongInteger);
},
@ -1027,7 +1027,7 @@ this.IntegerValue = {
* @param value
* An integer value or an octet array of less-equal than 31 elements.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if (typeof value === "number") {
encodeAlternatives(data, value, null, ShortInteger, LongInteger);
} else if (Array.isArray(value) || (value instanceof Uint8Array)) {
@ -1053,7 +1053,7 @@ this.DateValue = {
*
* @return A Date object.
*/
decode: function decode(data) {
decode: function(data) {
let numOrArray = LongInteger.decode(data);
let seconds;
if (typeof numOrArray == "number") {
@ -1074,7 +1074,7 @@ this.DateValue = {
* @param date
* A Date object.
*/
encode: function encode(data, date) {
encode: function(data, date) {
let seconds = date.getTime() / 1000;
if (seconds < 0) {
throw new CodeError("Date-value: negative seconds " + seconds);
@ -1108,7 +1108,7 @@ this.QValue = {
*
* @throws CodeError if decoded UintVar is not in range 1..1099.
*/
decode: function decode(data) {
decode: function(data) {
let value = UintVar.decode(data);
if (value > 0) {
if (value <= 100) {
@ -1128,7 +1128,7 @@ this.QValue = {
* @param value
* An integer within the range 1..1099.
*/
encode: function encode(data, value) {
encode: function(data, value) {
if ((value < 0) || (value >= 1)) {
throw new CodeError("Q-value: invalid value " + value);
}
@ -1162,7 +1162,7 @@ this.VersionValue = {
*
* @return Binary encoded version number.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
let value;
try {
@ -1202,7 +1202,7 @@ this.VersionValue = {
* @param version
* A binary encoded version number.
*/
encode: function encode(data, version) {
encode: function(data, version) {
if ((version < 0x10) || (version >= 0x80)) {
throw new CodeError("Version-value: invalid version " + version);
}
@ -1227,7 +1227,7 @@ this.UriValue = {
*
* @return Decoded uri string.
*/
decode: function decode(data) {
decode: function(data) {
let str = "";
try {
// A End-of-string is also a CTL, which should cause a error.
@ -1254,7 +1254,7 @@ this.TypeValue = {
*
* @return Decoded content type string.
*/
decode: function decode(data) {
decode: function(data) {
let numOrStr = ConstrainedEncoding.decode(data);
if (typeof numOrStr == "string") {
return numOrStr.toLowerCase();
@ -1276,7 +1276,7 @@ this.TypeValue = {
* @param type
* A content type string.
*/
encode: function encode(data, type) {
encode: function(data, type) {
let entry = WSP_WELL_KNOWN_CONTENT_TYPES[type.toLowerCase()];
if (entry) {
ConstrainedEncoding.encode(data, entry.number);
@ -1321,7 +1321,7 @@ this.Parameter = {
* @throws NotWellKnownEncodingError if decoded well-known parameter number
* is not registered or supported.
*/
decodeTypedParameter: function decodeTypedParameter(data) {
decodeTypedParameter: function(data) {
let numOrArray = IntegerValue.decode(data);
// `decodeIntegerValue` can return a array, which doesn't apply here.
if (typeof numOrArray != "number") {
@ -1369,7 +1369,7 @@ this.Parameter = {
* if something wrong. The `name` property must be a string, but the
* `value` property can be many different types depending on `name`.
*/
decodeUntypedParameter: function decodeUntypedParameter(data) {
decodeUntypedParameter: function(data) {
let name = TokenText.decode(data);
let begin = data.offset, value;
@ -1400,7 +1400,7 @@ this.Parameter = {
* if something wrong. The `name` property must be a string, but the
* `value` property can be many different types depending on `name`.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return this.decodeTypedParameter(data);
@ -1418,7 +1418,7 @@ this.Parameter = {
*
* @return An array of decoded objects.
*/
decodeMultiple: function decodeMultiple(data, end) {
decodeMultiple: function(data, end) {
let params = null, param;
while (data.offset < end) {
@ -1444,7 +1444,7 @@ this.Parameter = {
* @param param
* An object containing `name` and `value` properties.
*/
encodeTypedParameter: function decodeTypedParameter(data, param) {
encodeTypedParameter: function(data, param) {
let entry = WSP_WELL_KNOWN_PARAMS[param.name.toLowerCase()];
if (!entry) {
throw new NotWellKnownEncodingError(
@ -1462,7 +1462,7 @@ this.Parameter = {
* @param param
* An object containing `name` and `value` properties.
*/
encodeUntypedParameter: function encodeUntypedParameter(data, param) {
encodeUntypedParameter: function(data, param) {
TokenText.encode(data, param.name);
encodeAlternatives(data, param.value, null, IntegerValue, TextValue);
},
@ -1473,7 +1473,7 @@ this.Parameter = {
* @param param
* An array of parameter objects.
*/
encodeMultiple: function encodeMultiple(data, params) {
encodeMultiple: function(data, params) {
for (let name in params) {
this.encode(data, {name: name, value: params[name]});
}
@ -1485,7 +1485,7 @@ this.Parameter = {
* @param param
* An object containing `name` and `value` properties.
*/
encode: function encode(data, param) {
encode: function(data, param) {
let begin = data.offset;
try {
this.encodeTypedParameter(data, param);
@ -1512,7 +1512,7 @@ this.Header = {
* but the `value` property can be many different types depending on
* `name`.
*/
decodeMessageHeader: function decodeMessageHeader(data) {
decodeMessageHeader: function(data) {
return decodeAlternatives(data, null, WellKnownHeader, ApplicationHeader);
},
@ -1525,12 +1525,12 @@ this.Header = {
* but the `value` property can be many different types depending on
* `name`.
*/
decode: function decode(data) {
decode: function(data) {
// TODO: support header code page shift-sequence
return this.decodeMessageHeader(data);
},
encodeMessageHeader: function encodeMessageHeader(data, header) {
encodeMessageHeader: function(data, header) {
encodeAlternatives(data, header, null, WellKnownHeader, ApplicationHeader);
},
@ -1541,7 +1541,7 @@ this.Header = {
* An object containing two attributes: a string-typed `name` and a
* `value` of arbitrary type.
*/
encode: function encode(data, header) {
encode: function(data, header) {
// TODO: support header code page shift-sequence
this.encodeMessageHeader(data, header);
},
@ -1566,7 +1566,7 @@ this.WellKnownHeader = {
* @throws NotWellKnownEncodingError if decoded well-known header field
* number is not registered or supported.
*/
decode: function decode(data) {
decode: function(data) {
let index = ShortInteger.decode(data);
let entry = WSP_HEADER_FIELDS[index];
@ -1601,7 +1601,7 @@ this.WellKnownHeader = {
* An object containing two attributes: a string-typed `name` and a
* `value` of arbitrary type.
*/
encode: function encode(data, header) {
encode: function(data, header) {
let entry = WSP_HEADER_FIELDS[header.name.toLowerCase()];
if (!entry) {
throw new NotWellKnownEncodingError(
@ -1629,7 +1629,7 @@ this.ApplicationHeader = {
* but the `value` property can be many different types depending on
* `name`.
*/
decode: function decode(data) {
decode: function(data) {
let name = TokenText.decode(data);
let begin = data.offset, value;
@ -1660,7 +1660,7 @@ this.ApplicationHeader = {
*
* @throws CodeError if got an empty header name.
*/
encode: function encode(data, header) {
encode: function(data, header) {
if (!header.name) {
throw new CodeError("Application-header: empty header name");
}
@ -1686,7 +1686,7 @@ this.FieldName = {
* @throws NotWellKnownEncodingError if decoded well-known header field
* number is not registered or supported.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return TokenText.decode(data).toLowerCase();
@ -1710,7 +1710,7 @@ this.FieldName = {
* @param name
* A field name string.
*/
encode: function encode(data, name) {
encode: function(data, name) {
let entry = WSP_HEADER_FIELDS[name.toLowerCase()];
if (entry) {
ShortInteger.encode(data, entry.number);
@ -1735,7 +1735,7 @@ this.AcceptCharsetValue = {
*
* @return A object with a property `charset` of string "*".
*/
decodeAnyCharset: function decodeAnyCharset(data) {
decodeAnyCharset: function(data) {
Octet.decodeEqualTo(data, 128);
return {charset: "*"};
},
@ -1750,7 +1750,7 @@ this.AcceptCharsetValue = {
* @throws NotWellKnownEncodingError if decoded well-known charset number is
* not registered or supported.
*/
decodeConstrainedCharset: function decodeConstrainedCharset(data) {
decodeConstrainedCharset: function(data) {
let begin = data.offset;
try {
return this.decodeAnyCharset(data);
@ -1780,7 +1780,7 @@ this.AcceptCharsetValue = {
* @return A object with a string property `charset` and a optional integer
* property `q`.
*/
decodeAcceptCharsetGeneralForm: function decodeAcceptCharsetGeneralForm(data) {
decodeAcceptCharsetGeneralForm: function(data) {
let length = ValueLength.decode(data);
let begin = data.offset;
@ -1812,7 +1812,7 @@ this.AcceptCharsetValue = {
* @return A object with a string property `charset` and a optional integer
* property `q`.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return this.decodeConstrainedCharset(data);
@ -1828,7 +1828,7 @@ this.AcceptCharsetValue = {
* @param value
* An object with a string property `charset`.
*/
encodeAnyCharset: function encodeAnyCharset(data, value) {
encodeAnyCharset: function(data, value) {
if (!value || !value.charset || (value.charset === "*")) {
Octet.encode(data, 128);
return;
@ -1854,7 +1854,7 @@ this.WellKnownCharset = {
* @throws NotWellKnownEncodingError if decoded well-known charset number
* is not registered or supported.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
@ -1884,7 +1884,7 @@ this.WellKnownCharset = {
* A wrapped object to store encoded raw data.
* @param value
*/
encode: function encode(data, value) {
encode: function(data, value) {
let begin = data.offset;
try {
AcceptCharsetValue.encodeAnyCharset(data, value);
@ -1929,7 +1929,7 @@ this.ContentTypeValue = {
* @throws NotWellKnownEncodingError if decoded well-known content type number
* is not registered or supported.
*/
decodeConstrainedMedia: function decodeConstrainedMedia(data) {
decodeConstrainedMedia: function(data) {
return {
media: TypeValue.decode(data),
params: null,
@ -1946,7 +1946,7 @@ this.ContentTypeValue = {
* @throws NotWellKnownEncodingError if decoded well-known content type
* number is not registered or supported.
*/
decodeMedia: function decodeMedia(data) {
decodeMedia: function(data) {
let begin = data.offset, number;
try {
number = IntegerValue.decode(data);
@ -1979,7 +1979,7 @@ this.ContentTypeValue = {
* string, and the `params` property is a hash map from a string to
* an value of unspecified type.
*/
decodeMediaType: function decodeMediaType(data, end) {
decodeMediaType: function(data, end) {
let media = this.decodeMedia(data);
let params = Parameter.decodeMultiple(data, end);
@ -1998,7 +1998,7 @@ this.ContentTypeValue = {
* string, and the `params` property is null or a hash map from a
* string to an value of unspecified type.
*/
decodeContentGeneralForm: function decodeContentGeneralForm(data) {
decodeContentGeneralForm: function(data) {
let length = ValueLength.decode(data);
let end = data.offset + length;
@ -2020,7 +2020,7 @@ this.ContentTypeValue = {
* string, and the `params` property is null or a hash map from a
* string to an value of unspecified type.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
@ -2037,7 +2037,7 @@ this.ContentTypeValue = {
* @param value
* An object containing `media` and `params` properties.
*/
encodeConstrainedMedia: function encodeConstrainedMedia(data, value) {
encodeConstrainedMedia: function(data, value) {
if (value.params) {
throw new CodeError("Constrained-media: should use general form instead");
}
@ -2051,7 +2051,7 @@ this.ContentTypeValue = {
* @param value
* An object containing `media` and `params` properties.
*/
encodeMediaType: function encodeMediaType(data, value) {
encodeMediaType: function(data, value) {
let entry = WSP_WELL_KNOWN_CONTENT_TYPES[value.media.toLowerCase()];
if (entry) {
IntegerValue.encode(data, entry.number);
@ -2068,7 +2068,7 @@ this.ContentTypeValue = {
* @param value
* An object containing `media` and `params` properties.
*/
encodeContentGeneralForm: function encodeContentGeneralForm(data, value) {
encodeContentGeneralForm: function(data, value) {
let begin = data.offset;
this.encodeMediaType(data, value);
@ -2087,7 +2087,7 @@ this.ContentTypeValue = {
* @param value
* An object containing `media` and `params` properties.
*/
encode: function encode(data, value) {
encode: function(data, value) {
let begin = data.offset;
try {
@ -2116,7 +2116,7 @@ this.ApplicationIdValue = {
* @throws NotWellKnownEncodingError if decoded well-known application id
* number is not registered or supported.
*/
decode: function decode(data) {
decode: function(data) {
let begin = data.offset;
try {
return UriValue.decode(data);
@ -2150,7 +2150,7 @@ this.PduHelper = {
*
* @return Decoded string.
*/
decodeStringContent: function decodeStringContent(data, charset) {
decodeStringContent: function(data, charset) {
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Ci.nsIScriptableUnicodeConverter);
@ -2176,7 +2176,7 @@ this.PduHelper = {
*
* @return An encoded UInt8Array of string content.
*/
encodeStringContent: function encodeStringContent(strContent, charset) {
encodeStringContent: function(strContent, charset) {
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
.createInstance(Ci.nsIScriptableUnicodeConverter);
@ -2207,7 +2207,7 @@ this.PduHelper = {
*
* @return A object containing decoded header fields as its attributes.
*/
parseHeaders: function parseHeaders(data, end, headers) {
parseHeaders: function(data, end, headers) {
if (!headers) {
headers = {};
}
@ -2241,7 +2241,7 @@ this.PduHelper = {
*
* @see WAP-230-WSP-20010705-a clause 8.2.4
*/
parsePushHeaders: function parsePushHeaders(data, msg) {
parsePushHeaders: function(data, msg) {
if (!msg.headers) {
msg.headers = {};
}
@ -2264,7 +2264,7 @@ this.PduHelper = {
*
* @see WAP-230-WSP-20010705-a section 8.5
*/
parseMultiPart: function parseMultiPart(data) {
parseMultiPart: function(data) {
let nEntries = UintVar.decode(data);
if (!nEntries) {
return null;
@ -2355,7 +2355,7 @@ this.PduHelper = {
*
* @return Parsed WSP PDU object or null in case of errors found.
*/
parse: function parse(data, isSessionless, msg) {
parse: function(data, isSessionless, msg) {
if (!msg) {
msg = {
type: null,
@ -2391,7 +2391,7 @@ this.PduHelper = {
* @param length
* Max number of octets to be coverted into an input stream.
*/
appendArrayToMultiStream: function appendArrayToMultiStream(multiStream, array, length) {
appendArrayToMultiStream: function(multiStream, array, length) {
let storageStream = Cc["@mozilla.org/storagestream;1"]
.createInstance(Ci.nsIStorageStream);
storageStream.init(4096, length, null);
@ -2413,7 +2413,7 @@ this.PduHelper = {
*
* @see WAP-230-WSP-20010705-a section 8.5
*/
composeMultiPart: function composeMultiPart(multiStream, parts) {
composeMultiPart: function(multiStream, parts) {
// Encode multipart header
{
let data = {array: [], offset: 0};

View File

@ -31,11 +31,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -49,11 +49,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -28,11 +28,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -46,11 +46,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -19,11 +19,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -37,11 +37,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -28,11 +28,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -46,11 +46,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -14,11 +14,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -32,11 +32,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -35,11 +35,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -53,11 +53,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -14,11 +14,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -32,11 +32,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -24,11 +24,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -42,11 +42,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -30,11 +30,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -48,11 +48,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -16,11 +16,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -34,11 +34,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -137,11 +137,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -155,11 +155,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -32,11 +32,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -50,11 +50,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -39,11 +39,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -57,11 +57,11 @@ let tasks = {
}
},
finish: function finish() {
finish: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -22,11 +22,11 @@ let tasks = {
_tasks: [],
_nextTaskIndex: 0,
push: function push(func) {
push: function(func) {
this._tasks.push(func);
},
next: function next() {
next: function() {
let index = this._nextTaskIndex++;
let task = this._tasks[index];
try {
@ -40,11 +40,11 @@ let tasks = {
}
},
abort: function abort() {
abort: function() {
this._tasks[this._tasks.length - 1]();
},
run: function run() {
run: function() {
this.next();
}
};

View File

@ -183,7 +183,7 @@ NetworkManager.prototype = {
// nsIObserver
observe: function observe(subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case TOPIC_INTERFACE_STATE_CHANGED:
let network = subject.QueryInterface(Ci.nsINetworkInterface);
@ -288,7 +288,7 @@ NetworkManager.prototype = {
}
},
receiveMessage: function receiveMessage(aMsg) {
receiveMessage: function(aMsg) {
switch (aMsg.name) {
case "NetworkInterfaceList:ListInterface": {
#ifdef MOZ_B2G_RIL
@ -325,7 +325,7 @@ NetworkManager.prototype = {
// nsINetworkManager
registerNetworkInterface: function registerNetworkInterface(network) {
registerNetworkInterface: function(network) {
if (!(network instanceof Ci.nsINetworkInterface)) {
throw Components.Exception("Argument must be nsINetworkInterface.",
Cr.NS_ERROR_INVALID_ARG);
@ -351,7 +351,7 @@ NetworkManager.prototype = {
debug("Network '" + network.name + "' registered.");
},
unregisterNetworkInterface: function unregisterNetworkInterface(network) {
unregisterNetworkInterface: function(network) {
if (!(network instanceof Ci.nsINetworkInterface)) {
throw Components.Exception("Argument must be nsINetworkInterface.",
Cr.NS_ERROR_INVALID_ARG);
@ -400,7 +400,7 @@ NetworkManager.prototype = {
// Clone network info so we can still get information when network is disconnected
_activeInfo: null,
overrideActive: function overrideActive(network) {
overrideActive: function(network) {
#ifdef MOZ_B2G_RIL
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
@ -412,7 +412,7 @@ NetworkManager.prototype = {
},
#ifdef MOZ_B2G_RIL
setExtraHostRoute: function setExtraHostRoute(network) {
setExtraHostRoute: function(network) {
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS) {
if (!(network instanceof Ci.nsIRilNetworkInterface)) {
debug("Network for MMS must be an instance of nsIRilNetworkInterface");
@ -434,7 +434,7 @@ NetworkManager.prototype = {
}
},
removeExtraHostRoute: function removeExtraHostRoute(network) {
removeExtraHostRoute: function(network) {
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS) {
if (!(network instanceof Ci.nsIRilNetworkInterface)) {
debug("Network for MMS must be an instance of nsIRilNetworkInterface");
@ -460,7 +460,7 @@ NetworkManager.prototype = {
/**
* Determine the active interface and configure it.
*/
setAndConfigureActive: function setAndConfigureActive() {
setAndConfigureActive: function() {
debug("Evaluating whether active network needs to be changed.");
let oldActive = this.active;
@ -539,7 +539,7 @@ NetworkManager.prototype = {
},
#ifdef MOZ_B2G_RIL
resolveHostname: function resolveHostname(hosts) {
resolveHostname: function(hosts) {
let retval = [];
for (let hostname of hosts) {
@ -578,7 +578,7 @@ NetworkManager.prototype = {
tetheringSettings: {},
initTetheringSettings: function initTetheringSettings() {
initTetheringSettings: function() {
this.tetheringSettings[SETTINGS_USB_ENABLED] = false;
this.tetheringSettings[SETTINGS_USB_IP] = DEFAULT_USB_IP;
this.tetheringSettings[SETTINGS_USB_PREFIX] = DEFAULT_USB_PREFIX;
@ -593,7 +593,7 @@ NetworkManager.prototype = {
_requestCount: 0,
handle: function handle(aName, aResult) {
handle: function(aName, aResult) {
switch(aName) {
case SETTINGS_USB_ENABLED:
this._oldUsbTetheringEnabledState = this.tetheringSettings[SETTINGS_USB_ENABLED];
@ -633,13 +633,13 @@ NetworkManager.prototype = {
};
},
handleError: function handleError(aErrorMessage) {
handleError: function(aErrorMessage) {
debug("There was an error while reading Tethering settings.");
this.tetheringSettings = {};
this.tetheringSettings[SETTINGS_USB_ENABLED] = false;
},
getNetworkInterface: function getNetworkInterface(type) {
getNetworkInterface: function(type) {
for each (let network in this.networkInterfaces) {
if (network.type == type) {
return network;
@ -657,7 +657,7 @@ NetworkManager.prototype = {
// External and internal interface name.
_tetheringInterface: null,
handleLastRequest: function handleLastRequest() {
handleLastRequest: function() {
let count = this._requestCount;
this._requestCount = 0;
@ -677,7 +677,7 @@ NetworkManager.prototype = {
}
},
handleUSBTetheringToggle: function handleUSBTetheringToggle(enable) {
handleUSBTetheringToggle: function(enable) {
if (!enable) {
this.tetheringSettings[SETTINGS_USB_ENABLED] = false;
gNetworkService.enableUsbRndis(false, this.enableUsbRndisResult.bind(this));
@ -696,7 +696,7 @@ NetworkManager.prototype = {
gNetworkService.enableUsbRndis(true, this.enableUsbRndisResult.bind(this));
},
getUSBTetheringParameters: function getUSBTetheringParameters(enable, tetheringinterface) {
getUSBTetheringParameters: function(enable, tetheringinterface) {
let interfaceIp;
let prefix;
let wifiDhcpStartIp;
@ -742,7 +742,7 @@ NetworkManager.prototype = {
};
},
notifyError: function notifyError(resetSettings, callback, msg) {
notifyError: function(resetSettings, callback, msg) {
if (resetSettings) {
let settingsLock = gSettingsService.createLock();
// Disable wifi tethering with a useful error message for the user.
@ -757,7 +757,7 @@ NetworkManager.prototype = {
},
// Enable/disable WiFi tethering by sending commands to netd.
setWifiTethering: function setWifiTethering(enable, network, config, callback) {
setWifiTethering: function(enable, network, config, callback) {
if (!network) {
this.notifyError(true, callback, "invalid network information");
return;
@ -787,7 +787,7 @@ NetworkManager.prototype = {
},
// Enable/disable USB tethering by sending commands to netd.
setUSBTethering: function setUSBTethering(enable,
setUSBTethering: function(enable,
tetheringInterface,
callback) {
let params = this.getUSBTetheringParameters(enable, tetheringInterface);
@ -802,7 +802,7 @@ NetworkManager.prototype = {
gNetworkService.setUSBTethering(enable, params, callback);
},
getUsbInterface: function getUsbInterface() {
getUsbInterface: function() {
// Find the rndis interface.
for (let i = 0; i < this.possibleInterface.length; i++) {
try {
@ -819,7 +819,7 @@ NetworkManager.prototype = {
return DEFAULT_USB_INTERFACE_NAME;
},
enableUsbRndisResult: function enableUsbRndisResult(success, enable) {
enableUsbRndisResult: function(success, enable) {
if (success) {
this._tetheringInterface[TETHERING_TYPE_USB].internalInterface = this.getUsbInterface();
this.setUSBTethering(enable,
@ -831,7 +831,7 @@ NetworkManager.prototype = {
}
},
usbTetheringResultReport: function usbTetheringResultReport(error) {
usbTetheringResultReport: function(error) {
let settingsLock = gSettingsService.createLock();
this._usbTetheringAction = TETHERING_STATE_IDLE;
@ -846,7 +846,7 @@ NetworkManager.prototype = {
}
},
onConnectionChangedReport: function onConnectionChangedReport(success, externalIfname) {
onConnectionChangedReport: function(success, externalIfname) {
debug("onConnectionChangedReport result: success " + success);
if (success) {
@ -856,7 +856,7 @@ NetworkManager.prototype = {
}
},
onConnectionChanged: function onConnectionChanged(network) {
onConnectionChanged: function(network) {
if (network.state != Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED) {
debug("We are only interested in CONNECTED event");
return;
@ -915,10 +915,10 @@ let CaptivePortalDetectionHelper = (function() {
let capService = getService();
let capCallback = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsICaptivePortalCallback]),
prepare: function prepare() {
prepare: function() {
capService.finishPreparation(interfaceName);
},
complete: function complete(success) {
complete: function(success) {
_ongoingInterface = null;
callback(success);
}
@ -950,7 +950,7 @@ let CaptivePortalDetectionHelper = (function() {
return {
EVENT_CONNECT: EVENT_CONNECT,
EVENT_DISCONNECT: EVENT_DISCONNECT,
notify: function notify(eventType, network) {
notify: function(eventType, network) {
switch (eventType) {
case EVENT_CONNECT:
// perform captive portal detection on wifi interface

View File

@ -79,7 +79,7 @@ NetworkService.prototype = {
// Helpers
idgen: 0,
controlMessage: function controlMessage(params, callback) {
controlMessage: function(params, callback) {
if (callback) {
let id = this.idgen++;
params.id = id;
@ -88,7 +88,7 @@ NetworkService.prototype = {
this.worker.postMessage(params);
},
handleWorkerMessage: function handleWorkerMessage(e) {
handleWorkerMessage: function(e) {
if(DEBUG) debug("NetworkManager received message from worker: " + JSON.stringify(e.data));
let response = e.data;
let id = response.id;
@ -105,7 +105,7 @@ NetworkService.prototype = {
// nsINetworkService
getNetworkInterfaceStats: function getNetworkInterfaceStats(networkName, callback) {
getNetworkInterfaceStats: function(networkName, callback) {
if(DEBUG) debug("getNetworkInterfaceStats for " + networkName);
let params = {
@ -123,7 +123,7 @@ NetworkService.prototype = {
});
},
setNetworkInterfaceAlarm: function setNetworkInterfaceAlarm(networkName, threshold, callback) {
setNetworkInterfaceAlarm: function(networkName, threshold, callback) {
if (!networkName) {
callback.networkUsageAlarmResult(-1);
return;
@ -137,7 +137,7 @@ NetworkService.prototype = {
this._setNetworkInterfaceAlarm(networkName, threshold, callback);
},
_setNetworkInterfaceAlarm: function _setNetworkInterfaceAlarm(networkName, threshold, callback) {
_setNetworkInterfaceAlarm: function(networkName, threshold, callback) {
debug("setNetworkInterfaceAlarm for " + networkName + " at " + threshold + "bytes");
let params = {
@ -159,7 +159,7 @@ NetworkService.prototype = {
});
},
_enableNetworkInterfaceAlarm: function _enableNetworkInterfaceAlarm(networkName, threshold, callback) {
_enableNetworkInterfaceAlarm: function(networkName, threshold, callback) {
debug("enableNetworkInterfaceAlarm for " + networkName + " at " + threshold + "bytes");
let params = {
@ -180,7 +180,7 @@ NetworkService.prototype = {
});
},
_disableNetworkInterfaceAlarm: function _disableNetworkInterfaceAlarm(networkName, callback) {
_disableNetworkInterfaceAlarm: function(networkName, callback) {
debug("disableNetworkInterfaceAlarm for " + networkName);
let params = {
@ -200,7 +200,7 @@ NetworkService.prototype = {
});
},
setWifiOperationMode: function setWifiOperationMode(interfaceName, mode, callback) {
setWifiOperationMode: function(interfaceName, mode, callback) {
if(DEBUG) debug("setWifiOperationMode on " + interfaceName + " to " + mode);
let params = {
@ -221,7 +221,7 @@ NetworkService.prototype = {
});
},
resetRoutingTable: function resetRoutingTable(network) {
resetRoutingTable: function(network) {
if (!network.ip || !network.netmask) {
if(DEBUG) debug("Either ip or netmask is null. Cannot reset routing table.");
return;
@ -235,7 +235,7 @@ NetworkService.prototype = {
this.worker.postMessage(options);
},
setDNS: function setDNS(networkInterface) {
setDNS: function(networkInterface) {
if(DEBUG) debug("Going DNS to " + networkInterface.name);
let options = {
cmd: "setDNS",
@ -246,7 +246,7 @@ NetworkService.prototype = {
this.worker.postMessage(options);
},
setDefaultRouteAndDNS: function setDefaultRouteAndDNS(network, oldInterface) {
setDefaultRouteAndDNS: function(network, oldInterface) {
if(DEBUG) debug("Going to change route and DNS to " + network.name);
let options = {
cmd: "setDefaultRouteAndDNS",
@ -260,7 +260,7 @@ NetworkService.prototype = {
this.setNetworkProxy(network);
},
removeDefaultRoute: function removeDefaultRoute(ifname) {
removeDefaultRoute: function(ifname) {
if(DEBUG) debug("Remove default route for " + ifname);
let options = {
cmd: "removeDefaultRoute",
@ -269,7 +269,7 @@ NetworkService.prototype = {
this.worker.postMessage(options);
},
addHostRoute: function addHostRoute(network) {
addHostRoute: function(network) {
if(DEBUG) debug("Going to add host route on " + network.name);
let options = {
cmd: "addHostRoute",
@ -280,7 +280,7 @@ NetworkService.prototype = {
this.worker.postMessage(options);
},
removeHostRoute: function removeHostRoute(network) {
removeHostRoute: function(network) {
if(DEBUG) debug("Going to remove host route on " + network.name);
let options = {
cmd: "removeHostRoute",
@ -291,7 +291,7 @@ NetworkService.prototype = {
this.worker.postMessage(options);
},
removeHostRoutes: function removeHostRoutes(ifname) {
removeHostRoutes: function(ifname) {
if(DEBUG) debug("Going to remove all host routes on " + ifname);
let options = {
cmd: "removeHostRoutes",
@ -300,7 +300,7 @@ NetworkService.prototype = {
this.worker.postMessage(options);
},
addHostRouteWithResolve: function addHostRouteWithResolve(network, hosts) {
addHostRouteWithResolve: function(network, hosts) {
if(DEBUG) debug("Going to add host route after dns resolution on " + network.name);
let options = {
cmd: "addHostRoute",
@ -311,7 +311,7 @@ NetworkService.prototype = {
this.worker.postMessage(options);
},
removeHostRouteWithResolve: function removeHostRouteWithResolve(network, hosts) {
removeHostRouteWithResolve: function(network, hosts) {
if(DEBUG) debug("Going to remove host route after dns resolution on " + network.name);
let options = {
cmd: "removeHostRoute",
@ -322,7 +322,7 @@ NetworkService.prototype = {
this.worker.postMessage(options);
},
setNetworkProxy: function setNetworkProxy(network) {
setNetworkProxy: function(network) {
try {
if (!network.httpProxyHost || network.httpProxyHost === "") {
// Sets direct connection to internet.
@ -353,7 +353,7 @@ NetworkService.prototype = {
},
// Enable/Disable DHCP server.
setDhcpServer: function setDhcpServer(enabled, config, callback) {
setDhcpServer: function(enabled, config, callback) {
if (null === config) {
config = {};
}
@ -372,7 +372,7 @@ NetworkService.prototype = {
},
// Enable/disable WiFi tethering by sending commands to netd.
setWifiTethering: function setWifiTethering(enable, config, callback) {
setWifiTethering: function(enable, config, callback) {
// config should've already contained:
// .ifname
// .internalIfname
@ -399,7 +399,7 @@ NetworkService.prototype = {
},
// Enable/disable USB tethering by sending commands to netd.
setUSBTethering: function setUSBTethering(enable, config, callback) {
setUSBTethering: function(enable, config, callback) {
config.cmd = "setUSBTethering";
// The callback function in controlMessage may not be fired immediately.
config.isAsync = true;
@ -420,7 +420,7 @@ NetworkService.prototype = {
},
// Switch usb function by modifying property of persist.sys.usb.config.
enableUsbRndis: function enableUsbRndis(enable, callback) {
enableUsbRndis: function(enable, callback) {
if(DEBUG) debug("enableUsbRndis: " + enable);
let params = {
@ -442,7 +442,7 @@ NetworkService.prototype = {
});
},
updateUpStream: function updateUpStream(previous, current, callback) {
updateUpStream: function(previous, current, callback) {
let params = {
cmd: "updateUpStream",
isAsync: true,

View File

@ -506,7 +506,7 @@ RILContentHelper.prototype = {
Ci.nsIVoicemailProvider,
Ci.nsIIccProvider]}),
updateDebugFlag: function updateDebugFlag() {
updateDebugFlag: function() {
try {
DEBUG = RIL.DEBUG_CONTENT_HELPER ||
Services.prefs.getBoolPref(kPrefRilDebuggingEnabled);
@ -514,13 +514,13 @@ RILContentHelper.prototype = {
},
// An utility function to copy objects.
updateInfo: function updateInfo(srcInfo, destInfo) {
updateInfo: function(srcInfo, destInfo) {
for (let key in srcInfo) {
destInfo[key] = srcInfo[key];
}
},
updateConnectionInfo: function updateConnectionInfo(srcInfo, destInfo) {
updateConnectionInfo: function(srcInfo, destInfo) {
for (let key in srcInfo) {
if ((key != "network") && (key != "cell")) {
destInfo[key] = srcInfo[key];
@ -558,7 +558,7 @@ RILContentHelper.prototype = {
* 1. Should clear iccInfo to null if there is no card detected.
* 2. Need to create corresponding object based on iccType.
*/
updateIccInfo: function updateIccInfo(clientId, newInfo) {
updateIccInfo: function(clientId, newInfo) {
let rilContext = this.rilContexts[clientId];
// Card is not detected, clear iccInfo to null.
@ -599,7 +599,7 @@ RILContentHelper.prototype = {
rilContexts: null,
getRilContext: function getRilContext(clientId) {
getRilContext: function(clientId) {
// Update ril contexts by sending IPC message to chrome only when the first
// time we require it. The information will be updated by following info
// changed messages.
@ -629,12 +629,12 @@ RILContentHelper.prototype = {
* nsIIccProvider
*/
getIccInfo: function getIccInfo(clientId) {
getIccInfo: function(clientId) {
let context = this.getRilContext(clientId);
return context && context.iccInfo;
},
getCardState: function getIccInfo(clientId) {
getCardState: function(clientId) {
let context = this.getRilContext(clientId);
return context && context.cardState;
},
@ -643,39 +643,39 @@ RILContentHelper.prototype = {
* nsIMobileConnectionProvider
*/
getLastKnownNetwork: function getLastKnownNetwork(clientId) {
getLastKnownNetwork: function(clientId) {
return cpmm.sendSyncMessage("RIL:GetLastKnownNetwork", {
clientId: clientId
})[0];
},
getLastKnownHomeNetwork: function getLastKnownHomeNetwork(clientId) {
getLastKnownHomeNetwork: function(clientId) {
return cpmm.sendSyncMessage("RIL:GetLastKnownHomeNetwork", {
clientId: clientId
})[0];
},
getVoiceConnectionInfo: function getVoiceConnectionInfo(clientId) {
getVoiceConnectionInfo: function(clientId) {
let context = this.getRilContext(clientId);
return context && context.voiceConnectionInfo;
},
getDataConnectionInfo: function getDataConnectionInfo(clientId) {
getDataConnectionInfo: function(clientId) {
let context = this.getRilContext(clientId);
return context && context.dataConnectionInfo;
},
getIccId: function getIccId(clientId) {
getIccId: function(clientId) {
let context = this.getRilContext(clientId);
return context && context.iccInfo && context.iccInfo.iccid;
},
getNetworkSelectionMode: function getNetworkSelectionMode(clientId) {
getNetworkSelectionMode: function(clientId) {
let context = this.getRilContext(clientId);
return context && context.networkSelectionMode;
},
getRadioState: function getRadioState(clientId) {
getRadioState: function(clientId) {
let context = this.getRilContext(clientId);
return context && context.radioState;
},
@ -686,7 +686,7 @@ RILContentHelper.prototype = {
*/
_selectingNetworks: null,
getNetworks: function getNetworks(clientId, window) {
getNetworks: function(clientId, window) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -704,7 +704,7 @@ RILContentHelper.prototype = {
return request;
},
selectNetwork: function selectNetwork(clientId, window, network) {
selectNetwork: function(clientId, window, network) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -752,7 +752,7 @@ RILContentHelper.prototype = {
return request;
},
selectNetworkAutomatically: function selectNetworkAutomatically(clientId, window) {
selectNetworkAutomatically: function(clientId, window) {
if (window == null) {
throw Components.Exception("Can't get window object",
@ -783,7 +783,7 @@ RILContentHelper.prototype = {
return request;
},
setPreferredNetworkType: function setPreferredNetworkType(clientId, window, type) {
setPreferredNetworkType: function(clientId, window, type) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -802,7 +802,7 @@ RILContentHelper.prototype = {
return request;
},
getPreferredNetworkType: function getPreferredNetworkType(clientId, window) {
getPreferredNetworkType: function(clientId, window) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -820,7 +820,7 @@ RILContentHelper.prototype = {
return request;
},
setRoamingPreference: function setRoamingPreference(clientId, window, mode) {
setRoamingPreference: function(clientId, window, mode) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -845,7 +845,7 @@ RILContentHelper.prototype = {
return request;
},
getRoamingPreference: function getRoamingPreference(clientId, window) {
getRoamingPreference: function(clientId, window) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -863,7 +863,7 @@ RILContentHelper.prototype = {
return request;
},
setVoicePrivacyMode: function setVoicePrivacyMode(clientId, window, enabled) {
setVoicePrivacyMode: function(clientId, window, enabled) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -882,7 +882,7 @@ RILContentHelper.prototype = {
return request;
},
getVoicePrivacyMode: function getVoicePrivacyMode(clientId, window) {
getVoicePrivacyMode: function(clientId, window) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -900,7 +900,7 @@ RILContentHelper.prototype = {
return request;
},
getCardLockState: function getCardLockState(clientId, window, lockType) {
getCardLockState: function(clientId, window, lockType) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -919,7 +919,7 @@ RILContentHelper.prototype = {
return request;
},
unlockCardLock: function unlockCardLock(clientId, window, info) {
unlockCardLock: function(clientId, window, info) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -935,7 +935,7 @@ RILContentHelper.prototype = {
return request;
},
setCardLock: function setCardLock(clientId, window, info) {
setCardLock: function(clientId, window, info) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -951,7 +951,7 @@ RILContentHelper.prototype = {
return request;
},
getCardLockRetryCount: function getCardLockRetryCount(clientId,
getCardLockRetryCount: function(clientId,
window,
lockType) {
if (window == null) {
@ -970,7 +970,7 @@ RILContentHelper.prototype = {
return request;
},
sendMMI: function sendMMI(clientId, window, mmi) {
sendMMI: function(clientId, window, mmi) {
if (DEBUG) debug("Sending MMI " + mmi);
if (!window) {
throw Components.Exception("Can't get window object",
@ -992,7 +992,7 @@ RILContentHelper.prototype = {
return request;
},
cancelMMI: function cancelMMI(clientId, window) {
cancelMMI: function(clientId, window) {
if (DEBUG) debug("Cancel MMI");
if (!window) {
throw Components.Exception("Can't get window object",
@ -1009,7 +1009,7 @@ RILContentHelper.prototype = {
return request;
},
sendStkResponse: function sendStkResponse(clientId, window, command, response) {
sendStkResponse: function(clientId, window, command, response) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1021,7 +1021,7 @@ RILContentHelper.prototype = {
});
},
sendStkMenuSelection: function sendStkMenuSelection(clientId,
sendStkMenuSelection: function(clientId,
window,
itemIdentifier,
helpRequested) {
@ -1038,7 +1038,7 @@ RILContentHelper.prototype = {
});
},
sendStkTimerExpiration: function sendStkTimerExpiration(clientId,
sendStkTimerExpiration: function(clientId,
window,
timer) {
if (window == null) {
@ -1053,7 +1053,7 @@ RILContentHelper.prototype = {
});
},
sendStkEventDownload: function sendStkEventDownload(clientId, window, event) {
sendStkEventDownload: function(clientId, window, event) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1066,7 +1066,7 @@ RILContentHelper.prototype = {
});
},
iccOpenChannel: function iccOpenChannel(clientId, window, aid) {
iccOpenChannel: function(clientId, window, aid) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1085,7 +1085,7 @@ RILContentHelper.prototype = {
return request;
},
iccExchangeAPDU: function iccExchangeAPDU(clientId, window, channel, apdu) {
iccExchangeAPDU: function(clientId, window, channel, apdu) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1106,7 +1106,7 @@ RILContentHelper.prototype = {
return request;
},
iccCloseChannel: function iccCloseChannel(clientId, window, channel) {
iccCloseChannel: function(clientId, window, channel) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1125,7 +1125,7 @@ RILContentHelper.prototype = {
return request;
},
readContacts: function readContacts(clientId, window, contactType) {
readContacts: function(clientId, window, contactType) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1145,7 +1145,7 @@ RILContentHelper.prototype = {
return request;
},
updateContact: function updateContact(clientId, window, contactType, contact, pin2) {
updateContact: function(clientId, window, contactType, contact, pin2) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1193,7 +1193,7 @@ RILContentHelper.prototype = {
return request;
},
getCallForwardingOption: function getCallForwardingOption(clientId, window, reason) {
getCallForwardingOption: function(clientId, window, reason) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1218,7 +1218,7 @@ RILContentHelper.prototype = {
return request;
},
setCallForwardingOption: function setCallForwardingOption(clientId, window, cfInfo) {
setCallForwardingOption: function(clientId, window, cfInfo) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1249,7 +1249,7 @@ RILContentHelper.prototype = {
return request;
},
getCallBarringOption: function getCallBarringOption(clientId, window, option) {
getCallBarringOption: function(clientId, window, option) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1276,7 +1276,7 @@ RILContentHelper.prototype = {
return request;
},
setCallBarringOption: function setCallBarringOption(clientId, window, option) {
setCallBarringOption: function(clientId, window, option) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1304,7 +1304,7 @@ RILContentHelper.prototype = {
return request;
},
changeCallBarringPassword: function changeCallBarringPassword(clientId, window, info) {
changeCallBarringPassword: function(clientId, window, info) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1329,7 +1329,7 @@ RILContentHelper.prototype = {
return request;
},
getCallWaitingOption: function getCallWaitingOption(clientId, window) {
getCallWaitingOption: function(clientId, window) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1347,7 +1347,7 @@ RILContentHelper.prototype = {
return request;
},
setCallWaitingOption: function setCallWaitingOption(clientId, window, enabled) {
setCallWaitingOption: function(clientId, window, enabled) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1366,7 +1366,7 @@ RILContentHelper.prototype = {
return request;
},
getCallingLineIdRestriction: function getCallingLineIdRestriction(clientId, window) {
getCallingLineIdRestriction: function(clientId, window) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1384,8 +1384,7 @@ RILContentHelper.prototype = {
return request;
},
setCallingLineIdRestriction:
function setCallingLineIdRestriction(clientId, window, clirMode) {
setCallingLineIdRestriction: function(clientId, window, clirMode) {
if (window == null) {
throw Components.Exception("Can't get window object",
@ -1405,7 +1404,7 @@ RILContentHelper.prototype = {
return request;
},
exitEmergencyCbMode: function exitEmergencyCbMode(clientId, window) {
exitEmergencyCbMode: function(clientId, window) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1423,7 +1422,7 @@ RILContentHelper.prototype = {
return request;
},
setRadioEnabled: function setRadioEnabled(clientId, window, enabled) {
setRadioEnabled: function(clientId, window, enabled) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
@ -1451,7 +1450,7 @@ RILContentHelper.prototype = {
voicemailStatuses: null,
voicemailDefaultServiceId: 0,
getVoicemailDefaultServiceId: function getVoicemailDefaultServiceId() {
getVoicemailDefaultServiceId: function() {
let id = Services.prefs.getIntPref(kPrefVoicemailDefaultServiceId);
if (id >= gNumRadioInterfaces || id < 0) {
@ -1461,7 +1460,7 @@ RILContentHelper.prototype = {
return id;
},
getVoicemailInfo: function getVoicemailInfo(clientId) {
getVoicemailInfo: function(clientId) {
// Get voicemail infomation by IPC only on first time.
this.getVoicemailInfo = function getVoicemailInfo(clientId) {
return this.voicemailInfos[clientId];
@ -1478,19 +1477,19 @@ RILContentHelper.prototype = {
return this.voicemailInfos[clientId];
},
getVoicemailNumber: function getVoicemailNumber(clientId) {
getVoicemailNumber: function(clientId) {
return this.getVoicemailInfo(clientId).number;
},
getVoicemailDisplayName: function getVoicemailDisplayName(clientId) {
getVoicemailDisplayName: function(clientId) {
return this.getVoicemailInfo(clientId).displayName;
},
getVoicemailStatus: function getVoicemailStatus(clientId) {
getVoicemailStatus: function(clientId) {
return this.voicemailStatuses[clientId];
},
registerListener: function registerListener(listenerType, clientId, listener) {
registerListener: function(listenerType, clientId, listener) {
if (!this[listenerType]) {
return;
}
@ -1507,7 +1506,7 @@ RILContentHelper.prototype = {
if (DEBUG) debug("Registered " + listenerType + " listener: " + listener);
},
unregisterListener: function unregisterListener(listenerType, clientId, listener) {
unregisterListener: function(listenerType, clientId, listener) {
if (!this[listenerType]) {
return;
}
@ -1523,17 +1522,17 @@ RILContentHelper.prototype = {
}
},
registerMobileConnectionMsg: function registerMobileConnectionMsg(clientId, listener) {
registerMobileConnectionMsg: function(clientId, listener) {
if (DEBUG) debug("Registering for mobile connection related messages");
this.registerListener("_mobileConnectionListeners", clientId, listener);
cpmm.sendAsyncMessage("RIL:RegisterMobileConnectionMsg");
},
unregisterMobileConnectionMsg: function unregisteMobileConnectionMsg(clientId, listener) {
unregisterMobileConnectionMsg: function(clientId, listener) {
this.unregisterListener("_mobileConnectionListeners", clientId, listener);
},
registerVoicemailMsg: function registerVoicemailMsg(listener) {
registerVoicemailMsg: function(listener) {
if (DEBUG) debug("Registering for voicemail-related messages");
// To follow the listener registration scheme, we add a dummy clientId 0.
// All voicemail events are routed to listener for client id 0.
@ -1542,38 +1541,38 @@ RILContentHelper.prototype = {
cpmm.sendAsyncMessage("RIL:RegisterVoicemailMsg");
},
unregisterVoicemailMsg: function unregisteVoicemailMsg(listener) {
unregisterVoicemailMsg: function(listener) {
// To follow the listener unregistration scheme, we add a dummy clientId 0.
// All voicemail events are routed to listener for client id 0.
// See |handleVoicemailNotification|.
this.unregisterListener("_voicemailListeners", 0, listener);
},
registerCellBroadcastMsg: function registerCellBroadcastMsg(listener) {
registerCellBroadcastMsg: function(listener) {
if (DEBUG) debug("Registering for Cell Broadcast related messages");
//TODO: Bug 921326 - Cellbroadcast API: support multiple sim cards
this.registerListener("_cellBroadcastListeners", 0, listener);
cpmm.sendAsyncMessage("RIL:RegisterCellBroadcastMsg");
},
unregisterCellBroadcastMsg: function unregisterCellBroadcastMsg(listener) {
unregisterCellBroadcastMsg: function(listener) {
//TODO: Bug 921326 - Cellbroadcast API: support multiple sim cards
this.unregisterListener("_cellBroadcastListeners", 0, listener);
},
registerIccMsg: function registerIccMsg(clientId, listener) {
registerIccMsg: function(clientId, listener) {
if (DEBUG) debug("Registering for ICC related messages");
this.registerListener("_iccListeners", clientId, listener);
cpmm.sendAsyncMessage("RIL:RegisterIccMsg");
},
unregisterIccMsg: function unregisterIccMsg(clientId, listener) {
unregisterIccMsg: function(clientId, listener) {
this.unregisterListener("_iccListeners", clientId, listener);
},
// nsIObserver
observe: function observe(subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case NS_PREFBRANCH_PREFCHANGE_TOPIC_ID:
if (data == kPrefRilDebuggingEnabled) {
@ -1592,7 +1591,7 @@ RILContentHelper.prototype = {
// nsIMessageListener
fireRequestSuccess: function fireRequestSuccess(requestId, result) {
fireRequestSuccess: function(requestId, result) {
let request = this.takeRequest(requestId);
if (!request) {
if (DEBUG) {
@ -1609,14 +1608,14 @@ RILContentHelper.prototype = {
Services.DOMRequest.fireSuccess(request, result);
},
dispatchFireRequestSuccess: function dispatchFireRequestSuccess(requestId, result) {
dispatchFireRequestSuccess: function(requestId, result) {
let currentThread = Services.tm.currentThread;
currentThread.dispatch(this.fireRequestSuccess.bind(this, requestId, result),
Ci.nsIThread.DISPATCH_NORMAL);
},
fireRequestError: function fireRequestError(requestId, error) {
fireRequestError: function(requestId, error) {
let request = this.takeRequest(requestId);
if (!request) {
if (DEBUG) {
@ -1633,14 +1632,14 @@ RILContentHelper.prototype = {
Services.DOMRequest.fireError(request, error);
},
dispatchFireRequestError: function dispatchFireRequestError(requestId, error) {
dispatchFireRequestError: function(requestId, error) {
let currentThread = Services.tm.currentThread;
currentThread.dispatch(this.fireRequestError.bind(this, requestId, error),
Ci.nsIThread.DISPATCH_NORMAL);
},
fireRequestDetailedError: function fireRequestDetailedError(requestId, detailedError) {
fireRequestDetailedError: function(requestId, detailedError) {
let request = this.takeRequest(requestId);
if (!request) {
if (DEBUG) {
@ -1653,7 +1652,7 @@ RILContentHelper.prototype = {
Services.DOMRequest.fireDetailedError(request, detailedError);
},
receiveMessage: function receiveMessage(msg) {
receiveMessage: function(msg) {
let request;
if (DEBUG) {
debug("Received message '" + msg.name + "': " + JSON.stringify(msg.json));
@ -1873,7 +1872,7 @@ RILContentHelper.prototype = {
}
},
handleSimpleRequest: function handleSimpleRequest(requestId, errorMsg, result) {
handleSimpleRequest: function(requestId, errorMsg, result) {
if (errorMsg) {
this.fireRequestError(requestId, errorMsg);
} else {
@ -1881,7 +1880,7 @@ RILContentHelper.prototype = {
}
},
handleGetAvailableNetworks: function handleGetAvailableNetworks(message) {
handleGetAvailableNetworks: function(message) {
if (DEBUG) debug("handleGetAvailableNetworks: " + JSON.stringify(message));
if (message.errorMsg) {
if (DEBUG) {
@ -1902,7 +1901,7 @@ RILContentHelper.prototype = {
this.fireRequestSuccess(message.requestId, networks);
},
handleSelectNetwork: function handleSelectNetwork(clientId, message, mode) {
handleSelectNetwork: function(clientId, message, mode) {
this._selectingNetworks[clientId] = null;
this.rilContexts[clientId].networkSelectionMode = mode;
@ -1913,7 +1912,7 @@ RILContentHelper.prototype = {
}
},
handleIccExchangeAPDU: function handleIccExchangeAPDU(message) {
handleIccExchangeAPDU: function(message) {
if (message.errorMsg) {
this.fireRequestError(message.requestId, message.errorMsg);
} else {
@ -1922,7 +1921,7 @@ RILContentHelper.prototype = {
}
},
handleReadIccContacts: function handleReadIccContacts(message) {
handleReadIccContacts: function(message) {
if (message.errorMsg) {
this.fireRequestError(message.requestId, message.errorMsg);
return;
@ -1952,7 +1951,7 @@ RILContentHelper.prototype = {
this.fireRequestSuccess(message.requestId, result);
},
handleUpdateIccContact: function handleUpdateIccContact(message) {
handleUpdateIccContact: function(message) {
if (message.errorMsg) {
this.fireRequestError(message.requestId, message.errorMsg);
return;
@ -1978,7 +1977,7 @@ RILContentHelper.prototype = {
this.fireRequestSuccess(message.requestId, contact);
},
handleVoicemailNotification: function handleVoicemailNotification(clientId,
handleVoicemailNotification: function(clientId,
message) {
let changed = false;
if (!this.voicemailStatuses[clientId]) {
@ -2019,7 +2018,7 @@ RILContentHelper.prototype = {
}
},
_cfRulesToMobileCfInfo: function _cfRulesToMobileCfInfo(rules) {
_cfRulesToMobileCfInfo: function(rules) {
for (let i = 0; i < rules.length; i++) {
let rule = rules[i];
let info = new MobileCFInfo();
@ -2028,7 +2027,7 @@ RILContentHelper.prototype = {
}
},
handleGetCallForwardingOptions: function handleGetCallForwardingOptions(message) {
handleGetCallForwardingOptions: function(message) {
if (message.errorMsg) {
this.fireRequestError(message.requestId, message.errorMsg);
return;
@ -2038,7 +2037,7 @@ RILContentHelper.prototype = {
this.fireRequestSuccess(message.requestId, message.rules);
},
handleGetCallBarringOptions: function handleGetCallBarringOptions(message) {
handleGetCallBarringOptions: function(message) {
if (!message.success) {
this.fireRequestError(message.requestId, message.errorMsg);
} else {
@ -2047,8 +2046,7 @@ RILContentHelper.prototype = {
}
},
handleGetCallingLineIdRestriction:
function handleGetCallingLineIdRestriction(message) {
handleGetCallingLineIdRestriction: function(message) {
if (message.errorMsg) {
this.fireRequestError(message.requestId, message.errorMsg);
return;
@ -2058,7 +2056,7 @@ RILContentHelper.prototype = {
this.fireRequestSuccess(message.requestId, status);
},
handleExitEmergencyCbMode: function handleExitEmergencyCbMode(message) {
handleExitEmergencyCbMode: function(message) {
let requestId = message.requestId;
let request = this.takeRequest(requestId);
if (!request) {
@ -2072,7 +2070,7 @@ RILContentHelper.prototype = {
Services.DOMRequest.fireSuccess(request, null);
},
handleSendCancelMMI: function handleSendCancelMMI(message) {
handleSendCancelMMI: function(message) {
if (DEBUG) debug("handleSendCancelMMI " + JSON.stringify(message));
let request = this.takeRequest(message.requestId);
let requestWindow = this._windowsMap[message.requestId];
@ -2119,7 +2117,7 @@ RILContentHelper.prototype = {
}
},
_deliverEvent: function _deliverEvent(clientId, listenerType, name, args) {
_deliverEvent: function(clientId, listenerType, name, args) {
if (!this[listenerType]) {
return;
}
@ -2148,7 +2146,7 @@ RILContentHelper.prototype = {
/**
* Helper for guarding us again invalid reason values for call forwarding.
*/
_isValidCFReason: function _isValidCFReason(reason) {
_isValidCFReason: function(reason) {
switch (reason) {
case Ci.nsIDOMMozMobileCFInfo.CALL_FORWARD_REASON_UNCONDITIONAL:
case Ci.nsIDOMMozMobileCFInfo.CALL_FORWARD_REASON_MOBILE_BUSY:
@ -2165,7 +2163,7 @@ RILContentHelper.prototype = {
/**
* Helper for guarding us again invalid action values for call forwarding.
*/
_isValidCFAction: function _isValidCFAction(action) {
_isValidCFAction: function(action) {
switch (action) {
case Ci.nsIDOMMozMobileCFInfo.CALL_FORWARD_ACTION_DISABLE:
case Ci.nsIDOMMozMobileCFInfo.CALL_FORWARD_ACTION_ENABLE:
@ -2180,7 +2178,7 @@ RILContentHelper.prototype = {
/**
* Helper for guarding us against invalid program values for call barring.
*/
_isValidCallBarringProgram: function _isValidCallBarringProgram(program) {
_isValidCallBarringProgram: function(program) {
switch (program) {
case Ci.nsIDOMMozMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING:
case Ci.nsIDOMMozMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL:
@ -2196,8 +2194,7 @@ RILContentHelper.prototype = {
/**
* Helper for guarding us against invalid options for call barring.
*/
_isValidCallBarringOptions:
function _isValidCallBarringOptions(options, usedForSetting) {
_isValidCallBarringOptions: function(options, usedForSetting) {
if (!options ||
options.serviceClass == null ||
!this._isValidCallBarringProgram(options.program)) {

View File

@ -220,7 +220,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
targetMessageQueue: [],
ready: false,
init: function init(ril) {
init: function(ril) {
this.ril = ril;
Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
@ -228,14 +228,14 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
this._registerMessageListeners();
},
_shutdown: function _shutdown() {
_shutdown: function() {
this.ril = null;
Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
this._unregisterMessageListeners();
},
_registerMessageListeners: function _registerMessageListeners() {
_registerMessageListeners: function() {
ppmm.addMessageListener("child-process-shutdown", this);
for (let msgname of RIL_IPC_MOBILECONNECTION_MSG_NAMES) {
ppmm.addMessageListener(msgname, this);
@ -254,7 +254,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
}
},
_unregisterMessageListeners: function _unregisterMessageListeners() {
_unregisterMessageListeners: function() {
ppmm.removeMessageListener("child-process-shutdown", this);
for (let msgname of RIL_IPC_MOBILECONNECTION_MSG_NAMES) {
ppmm.removeMessageListener(msgname, this);
@ -274,7 +274,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
ppmm = null;
},
_registerMessageTarget: function _registerMessageTarget(topic, target) {
_registerMessageTarget: function(topic, target) {
let targets = this.targetsByTopic[topic];
if (!targets) {
targets = this.targetsByTopic[topic] = [];
@ -293,7 +293,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
if (DEBUG) debug("Registered " + topic + " target: " + target);
},
_unregisterMessageTarget: function _unregisterMessageTarget(topic, target) {
_unregisterMessageTarget: function(topic, target) {
if (topic == null) {
// Unregister the target for every topic when no topic is specified.
for (let type of this.topics) {
@ -315,7 +315,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
}
},
_enqueueTargetMessage: function _enqueueTargetMessage(topic, message, options) {
_enqueueTargetMessage: function(topic, message, options) {
let msg = { topic : topic,
message : message,
options : options };
@ -333,7 +333,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
messageQueue.push(msg);
},
_sendTargetMessage: function _sendTargetMessage(topic, message, options) {
_sendTargetMessage: function(topic, message, options) {
if (!this.ready) {
this._enqueueTargetMessage(topic, message, options);
return;
@ -349,7 +349,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
}
},
_resendQueuedTargetMessage: function _resendQueuedTargetMessage() {
_resendQueuedTargetMessage: function() {
this.ready = true;
// Here uses this._sendTargetMessage() to resend message, which will
@ -368,7 +368,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
* nsIMessageListener interface methods.
*/
receiveMessage: function receiveMessage(msg) {
receiveMessage: function(msg) {
if (DEBUG) debug("Received '" + msg.name + "' message from content process");
if (msg.name == "child-process-shutdown") {
// By the time we receive child-process-shutdown, the child process has
@ -457,7 +457,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
* nsIObserver interface methods.
*/
observe: function observe(subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case kSysMsgListenerReadyObserverTopic:
Services.obs.removeObserver(this, kSysMsgListenerReadyObserverTopic);
@ -469,28 +469,28 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
}
},
sendMobileConnectionMessage: function sendMobileConnectionMessage(message, clientId, data) {
sendMobileConnectionMessage: function(message, clientId, data) {
this._sendTargetMessage("mobileconnection", message, {
clientId: clientId,
data: data
});
},
sendVoicemailMessage: function sendVoicemailMessage(message, clientId, data) {
sendVoicemailMessage: function(message, clientId, data) {
this._sendTargetMessage("voicemail", message, {
clientId: clientId,
data: data
});
},
sendCellBroadcastMessage: function sendCellBroadcastMessage(message, clientId, data) {
sendCellBroadcastMessage: function(message, clientId, data) {
this._sendTargetMessage("cellbroadcast", message, {
clientId: clientId,
data: data
});
},
sendIccMessage: function sendIccMessage(message, clientId, data) {
sendIccMessage: function(message, clientId, data) {
this._sendTargetMessage("icc", message, {
clientId: clientId,
data: data
@ -507,7 +507,7 @@ XPCOMUtils.defineLazyGetter(this, "gRadioEnabledController", function() {
request: null,
deactivatingDeferred: {},
init: function init(ril) {
init: function(ril) {
this.ril = ril;
},
@ -757,7 +757,7 @@ RadioInterfaceLayer.prototype = {
* nsIObserver interface methods.
*/
observe: function observe(subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case kMozSettingsChangedObserverTopic:
let setting = JSON.parse(data);
@ -793,7 +793,7 @@ RadioInterfaceLayer.prototype = {
// nsISettingsServiceCallback
handle: function handle(name, result) {
handle: function(name, result) {
switch(name) {
// TODO: Move 'ril.data.*' settings handler to DataConnectionManager,
// see bug 905568.
@ -827,13 +827,13 @@ RadioInterfaceLayer.prototype = {
}
},
handleError: function handleError(errorMessage) {
handleError: function(errorMessage) {
if (DEBUG) {
debug("There was an error while reading RIL settings: " + errorMessage);
}
},
handleDataClientIdChange: function handleDataClientIdChange() {
handleDataClientIdChange: function() {
if (this._currentDataClientId == -1) {
// This is to handle boot up stage.
this._currentDataClientId = this._dataDefaultClientId;
@ -907,11 +907,11 @@ RadioInterfaceLayer.prototype = {
* nsIRadioInterfaceLayer interface methods.
*/
getRadioInterface: function getRadioInterface(clientId) {
getRadioInterface: function(clientId) {
return this.radioInterfaces[clientId];
},
getClientIdByIccId: function getClientIdByIccId(iccId) {
getClientIdByIccId: function(iccId) {
if (!iccId) {
throw Cr.NS_ERROR_INVALID_ARG;
}
@ -926,7 +926,7 @@ RadioInterfaceLayer.prototype = {
throw Cr.NS_ERROR_NOT_AVAILABLE;
},
setMicrophoneMuted: function setMicrophoneMuted(muted) {
setMicrophoneMuted: function(muted) {
for (let clientId = 0; clientId < this.numRadioInterfaces; clientId++) {
let radioInterface = this.radioInterfaces[clientId];
radioInterface.workerMessenger.send("setMute", { muted: muted });
@ -970,7 +970,7 @@ WorkerMessenger.prototype = {
// Maps tokens we send out with messages to the message callback.
tokenCallbackMap: null,
onerror: function onerror(event) {
onerror: function(event) {
if (DEBUG) {
this.debug("Got an error: " + event.filename + ":" +
event.lineno + ": " + event.message + "\n");
@ -981,7 +981,7 @@ WorkerMessenger.prototype = {
/**
* Process the incoming message from the RIL worker.
*/
onmessage: function onmessage(event) {
onmessage: function(event) {
let message = event.data;
if (DEBUG) {
this.debug("Received message from worker: " + JSON.stringify(message));
@ -1027,7 +1027,7 @@ WorkerMessenger.prototype = {
* value true to keep current token-callback mapping and wait for
* another worker reply, or false to remove the mapping.
*/
send: function send(rilMessageType, message, callback) {
send: function(rilMessageType, message, callback) {
message = message || {};
message.rilMessageToken = this.token;
@ -1060,7 +1060,7 @@ WorkerMessenger.prototype = {
*
* @TODO: Bug 815526 - deprecate RILContentHelper.
*/
sendWithIPCMessage: function sendWithIPCMessage(msg, rilMessageType, ipcType) {
sendWithIPCMessage: function(msg, rilMessageType, ipcType) {
this.send(rilMessageType, msg.json.data, (function(reply) {
ipcType = ipcType || msg.name;
msg.target.sendAsyncMessage(ipcType, {
@ -1190,7 +1190,7 @@ RadioInterface.prototype = {
// A private WorkerMessenger instance.
workerMessenger: null,
debug: function debug(s) {
debug: function(s) {
dump("-*- RadioInterface[" + this.clientId + "]: " + s + "\n");
},
@ -1198,7 +1198,7 @@ RadioInterface.prototype = {
* A utility function to copy objects. The srcInfo may contain
* "rilMessageType", should ignore it.
*/
updateInfo: function updateInfo(srcInfo, destInfo) {
updateInfo: function(srcInfo, destInfo) {
for (let key in srcInfo) {
if (key === "rilMessageType") {
continue;
@ -1211,7 +1211,7 @@ RadioInterface.prototype = {
* A utility function to compare objects. The srcInfo may contain
* "rilMessageType", should ignore it.
*/
isInfoChanged: function isInfoChanged(srcInfo, destInfo) {
isInfoChanged: function(srcInfo, destInfo) {
if (!destInfo) {
return true;
}
@ -1231,7 +1231,7 @@ RadioInterface.prototype = {
/**
* Process a message from the content process.
*/
receiveMessage: function receiveMessage(msg) {
receiveMessage: function(msg) {
switch (msg.name) {
case "RIL:GetRilContext":
// This message is sync.
@ -1358,7 +1358,7 @@ RadioInterface.prototype = {
return null;
},
handleUnsolicitedWorkerMessage: function handleUnsolicitedWorkerMessage(message) {
handleUnsolicitedWorkerMessage: function(message) {
switch (message.rilMessageType) {
case "callRing":
gTelephonyProvider.notifyCallRing();
@ -1490,7 +1490,7 @@ RadioInterface.prototype = {
* Otherwise, the phone number is in mdn.
* @see nsIDOMMozCdmaIccInfo
*/
getPhoneNumber: function getPhoneNumber() {
getPhoneNumber: function() {
let iccInfo = this.rilContext.iccInfo;
if (!iccInfo) {
@ -1515,7 +1515,7 @@ RadioInterface.prototype = {
/**
* A utility function to get the ICC ID of the SIM card (if installed).
*/
getIccId: function getIccId() {
getIccId: function() {
let iccInfo = this.rilContext.iccInfo;
if (!iccInfo || !(iccInfo instanceof GsmIccInfo)) {
@ -1533,7 +1533,7 @@ RadioInterface.prototype = {
return iccId;
},
updateNetworkInfo: function updateNetworkInfo(message) {
updateNetworkInfo: function(message) {
let voiceMessage = message[RIL.NETWORK_INFO_VOICE_REGISTRATION_STATE];
let dataMessage = message[RIL.NETWORK_INFO_DATA_REGISTRATION_STATE];
let operatorMessage = message[RIL.NETWORK_INFO_OPERATOR];
@ -1584,7 +1584,7 @@ RadioInterface.prototype = {
* @param registration The voiceMessage or dataMessage from which the
* roaming state will be changed (maybe, if needed).
*/
checkRoamingBetweenOperators: function checkRoamingBetweenOperators(registration) {
checkRoamingBetweenOperators: function(registration) {
let iccInfo = this.rilContext.iccInfo;
if (!iccInfo || !registration.connected) {
return;
@ -1610,7 +1610,7 @@ RadioInterface.prototype = {
* @param batch When batch is true, the RIL:VoiceInfoChanged message will
* not be sent.
*/
updateVoiceConnection: function updateVoiceConnection(newInfo, batch) {
updateVoiceConnection: function(newInfo, batch) {
let voiceInfo = this.rilContext.voice;
voiceInfo.state = newInfo.state;
voiceInfo.connected = newInfo.connected;
@ -1643,7 +1643,7 @@ RadioInterface.prototype = {
* @param batch When batch is true, the RIL:DataInfoChanged message will
* not be sent.
*/
updateDataConnection: function updateDataConnection(newInfo, batch) {
updateDataConnection: function(newInfo, batch) {
let dataInfo = this.rilContext.data;
dataInfo.state = newInfo.state;
dataInfo.roaming = newInfo.roaming;
@ -1680,7 +1680,7 @@ RadioInterface.prototype = {
/**
* Handle data errors
*/
handleDataCallError: function handleDataCallError(message) {
handleDataCallError: function(message) {
// Notify data call error only for data APN
if (this.apnSettings.byType.default) {
let apnSetting = this.apnSettings.byType.default;
@ -1695,7 +1695,7 @@ RadioInterface.prototype = {
},
_preferredNetworkType: null,
getPreferredNetworkType: function getPreferredNetworkType(target, message) {
getPreferredNetworkType: function(target, message) {
this.workerMessenger.send("getPreferredNetworkType", message, (function(response) {
if (response.success) {
this._preferredNetworkType = response.networkType;
@ -1714,7 +1714,7 @@ RadioInterface.prototype = {
}).bind(this));
},
setPreferredNetworkType: function setPreferredNetworkType(target, message) {
setPreferredNetworkType: function(target, message) {
if (DEBUG) this.debug("setPreferredNetworkType: " + JSON.stringify(message));
let networkType = RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO.indexOf(message.type);
if (networkType < 0) {
@ -1746,7 +1746,7 @@ RadioInterface.prototype = {
// TODO: Bug 946589 - B2G RIL: follow-up to bug 944225 - remove
// 'ril.radio.preferredNetworkType' setting handler
setPreferredNetworkTypeBySetting: function setPreferredNetworkTypeBySetting(value) {
setPreferredNetworkTypeBySetting: function(value) {
let networkType = RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO.indexOf(value);
if (networkType < 0) {
networkType = (this._preferredNetworkType != null)
@ -1781,7 +1781,7 @@ RadioInterface.prototype = {
}).bind(this));
},
setCellBroadcastSearchList: function setCellBroadcastSearchList(newSearchListStr) {
setCellBroadcastSearchList: function(newSearchListStr) {
if (newSearchListStr == this._cellBroadcastSearchListStr) {
return;
}
@ -1808,7 +1808,7 @@ RadioInterface.prototype = {
* @param batch When batch is true, the RIL:VoiceInfoChanged and
* RIL:DataInfoChanged message will not be sent.
*/
handleSignalStrengthChange: function handleSignalStrengthChange(message, batch) {
handleSignalStrengthChange: function(message, batch) {
let voiceInfo = this.rilContext.voice;
// If the voice is not registered, need not to update signal information.
if (voiceInfo.state === RIL.GECKO_MOBILE_CONNECTION_STATE_REGISTERED &&
@ -1839,7 +1839,7 @@ RadioInterface.prototype = {
* @param batch When batch is true, the RIL:VoiceInfoChanged and
* RIL:DataInfoChanged message will not be sent.
*/
handleOperatorChange: function handleOperatorChange(message, batch) {
handleOperatorChange: function(message, batch) {
let operatorInfo = this.operatorInfo;
let voice = this.rilContext.voice;
let data = this.rilContext.data;
@ -1867,7 +1867,7 @@ RadioInterface.prototype = {
}
},
handleOtaStatus: function handleOtaStatus(message) {
handleOtaStatus: function(message) {
if (message.status < 0 ||
RIL.CDMA_OTA_PROVISION_STATUS_TO_GECKO.length <= message.status) {
return;
@ -1879,7 +1879,7 @@ RadioInterface.prototype = {
this.clientId, status);
},
_convertRadioState: function _converRadioState(state) {
_convertRadioState: function(state) {
switch (state) {
case RIL.GECKO_RADIOSTATE_OFF:
return RIL.GECKO_DETAILED_RADIOSTATE_DISABLED;
@ -1890,7 +1890,7 @@ RadioInterface.prototype = {
}
},
handleRadioStateChange: function handleRadioStateChange(message) {
handleRadioStateChange: function(message) {
let newState = message.radioState;
if (this.rilContext.radioState == newState) {
return;
@ -1901,7 +1901,7 @@ RadioInterface.prototype = {
//TODO Should we notify this change as a card state change?
},
handleDetailedRadioStateChanged: function handleDetailedRadioStateChanged(state) {
handleDetailedRadioStateChanged: function(state) {
if (this.rilContext.detailedRadioState == state) {
return;
}
@ -1910,7 +1910,7 @@ RadioInterface.prototype = {
this.clientId, state);
},
deactivateDataCalls: function deactivateDataCalls() {
deactivateDataCalls: function() {
let dataDisconnecting = false;
for each (let apnSetting in this.apnSettings.byApn) {
for each (let type in apnSetting.types) {
@ -1938,7 +1938,7 @@ RadioInterface.prototype = {
* corresponding APN setting.
* 4. Create RilNetworkInterface for each APN setting created at step 2.
*/
updateApnSettings: function updateApnSettings(allApnSettings) {
updateApnSettings: function(allApnSettings) {
let simApnSettings = allApnSettings[this.clientId];
if (!simApnSettings) {
return;
@ -1995,7 +1995,7 @@ RadioInterface.prototype = {
}
},
anyDataConnected: function anyDataConnected() {
anyDataConnected: function() {
for each (let apnSetting in this.apnSettings.byApn) {
for each (let type in apnSetting.types) {
if (this.getDataCallStateByType(type) ==
@ -2010,18 +2010,18 @@ RadioInterface.prototype = {
/**
* Check if we get all necessary APN data.
*/
validateApnSetting: function validateApnSetting(apnSetting) {
validateApnSetting: function(apnSetting) {
return (apnSetting &&
apnSetting.apn &&
apnSetting.types &&
apnSetting.types.length);
},
setDataRegistration: function setDataRegistration(attach) {
setDataRegistration: function(attach) {
this.workerMessenger.send("setDataRegistration", {attach: attach});
},
updateRILNetworkInterface: function updateRILNetworkInterface() {
updateRILNetworkInterface: function() {
let apnSetting = this.apnSettings.byType.default;
if (!this.validateApnSetting(apnSetting)) {
if (DEBUG) {
@ -2122,7 +2122,7 @@ RadioInterface.prototype = {
/**
* Update network selection mode
*/
updateNetworkSelectionMode: function updateNetworkSelectionMode(message) {
updateNetworkSelectionMode: function(message) {
if (DEBUG) this.debug("updateNetworkSelectionMode: " + JSON.stringify(message));
this.rilContext.networkSelectionMode = message.mode;
gMessageManager.sendMobileConnectionMessage("RIL:NetworkSelectionModeChanged",
@ -2132,7 +2132,7 @@ RadioInterface.prototype = {
/**
* Handle emergency callback mode change.
*/
handleEmergencyCbModeChange: function handleEmergencyCbModeChange(message) {
handleEmergencyCbModeChange: function(message) {
if (DEBUG) this.debug("handleEmergencyCbModeChange: " + JSON.stringify(message));
gMessageManager.sendMobileConnectionMessage("RIL:EmergencyCbModeChanged",
this.clientId, message);
@ -2145,7 +2145,7 @@ RadioInterface.prototype = {
* @param message
* A SMS message.
*/
handleSmsWdpPortPush: function handleSmsWdpPortPush(message) {
handleSmsWdpPortPush: function(message) {
if (message.encoding != RIL.PDU_DCS_MSG_CODING_8BITS_ALPHABET) {
if (DEBUG) {
this.debug("Got port addressed SMS but not encoded in 8-bit alphabet." +
@ -2175,7 +2175,7 @@ RadioInterface.prototype = {
* @param aDomMessage
* The nsIDOMMozSmsMessage object.
*/
broadcastSmsSystemMessage: function broadcastSmsSystemMessage(aName, aDomMessage) {
broadcastSmsSystemMessage: function(aName, aDomMessage) {
if (DEBUG) this.debug("Broadcasting the SMS system message: " + aName);
// Sadly we cannot directly broadcast the aDomMessage object
@ -2204,7 +2204,7 @@ RadioInterface.prototype = {
_smsHandledWakeLock: null,
_smsHandledWakeLockTimer: null,
_releaseSmsHandledWakeLock: function _releaseSmsHandledWakeLock() {
_releaseSmsHandledWakeLock: function() {
if (DEBUG) this.debug("Releasing the CPU wake lock for handling SMS.");
if (this._smsHandledWakeLockTimer) {
this._smsHandledWakeLockTimer.cancel();
@ -2216,7 +2216,7 @@ RadioInterface.prototype = {
},
portAddressedSmsApps: null,
handleSmsReceived: function handleSmsReceived(message) {
handleSmsReceived: function(message) {
if (DEBUG) this.debug("handleSmsReceived: " + JSON.stringify(message));
// We need to acquire a CPU wake lock to avoid the system falling into
@ -2366,7 +2366,7 @@ RadioInterface.prototype = {
/**
* Handle data call state changes.
*/
handleDataCallState: function handleDataCallState(datacall) {
handleDataCallState: function(datacall) {
let data = this.rilContext.data;
let apnSetting = this.apnSettings.byType.default;
let dataCallConnected =
@ -2415,7 +2415,7 @@ RadioInterface.prototype = {
/**
* Handle data call list.
*/
handleDataCallList: function handleDataCallList(message) {
handleDataCallList: function(message) {
this._deliverDataCallCallback("receiveDataCallList",
[message.datacalls, message.datacalls.length]);
},
@ -2423,7 +2423,7 @@ RadioInterface.prototype = {
/**
* Set the setting value of "time.clock.automatic-update.available".
*/
setClockAutoUpdateAvailable: function setClockAutoUpdateAvailable(value) {
setClockAutoUpdateAvailable: function(value) {
gSettingsService.createLock().set(kSettingsClockAutoUpdateAvailable, value, null,
"fromInternalSetting");
},
@ -2431,7 +2431,7 @@ RadioInterface.prototype = {
/**
* Set the setting value of "time.timezone.automatic-update.available".
*/
setTimezoneAutoUpdateAvailable: function setTimezoneAutoUpdateAvailable(value) {
setTimezoneAutoUpdateAvailable: function(value) {
gSettingsService.createLock().set(kSettingsTimezoneAutoUpdateAvailable, value, null,
"fromInternalSetting");
},
@ -2439,7 +2439,7 @@ RadioInterface.prototype = {
/**
* Set the system clock by NITZ.
*/
setClockByNitz: function setClockByNitz(message) {
setClockByNitz: function(message) {
// To set the system clock time. Note that there could be a time diff
// between when the NITZ was received and when the time is actually set.
gTimeService.set(
@ -2449,7 +2449,7 @@ RadioInterface.prototype = {
/**
* Set the system time zone by NITZ.
*/
setTimezoneByNitz: function setTimezoneByNitz(message) {
setTimezoneByNitz: function(message) {
// To set the sytem timezone. Note that we need to convert the time zone
// value to a UTC repesentation string in the format of "UTC(+/-)hh:mm".
// Ex, time zone -480 is "UTC+08:00"; time zone 630 is "UTC-10:30".
@ -2470,7 +2470,7 @@ RadioInterface.prototype = {
/**
* Handle the NITZ message.
*/
handleNitzTime: function handleNitzTime(message) {
handleNitzTime: function(message) {
// Got the NITZ info received from the ril_worker.
this.setClockAutoUpdateAvailable(true);
this.setTimezoneAutoUpdateAvailable(true);
@ -2491,7 +2491,7 @@ RadioInterface.prototype = {
/**
* Set the system clock by SNTP.
*/
setClockBySntp: function setClockBySntp(offset) {
setClockBySntp: function(offset) {
// Got the SNTP info.
this.setClockAutoUpdateAvailable(true);
if (!this._clockAutoUpdateEnabled) {
@ -2504,7 +2504,7 @@ RadioInterface.prototype = {
gTimeService.set(Date.now() + offset);
},
handleIccMbdn: function handleIccMbdn(message) {
handleIccMbdn: function(message) {
let voicemailInfo = this.voicemailInfo;
voicemailInfo.number = message.number;
@ -2514,7 +2514,7 @@ RadioInterface.prototype = {
this.clientId, voicemailInfo);
},
handleIccInfoChange: function handleIccInfoChange(message) {
handleIccInfoChange: function(message) {
let oldSpn = this.rilContext.iccInfo ? this.rilContext.iccInfo.spn : null;
if (!message || !message.iccType) {
@ -2575,14 +2575,14 @@ RadioInterface.prototype = {
}
},
handleUSSDReceived: function handleUSSDReceived(ussd) {
handleUSSDReceived: function(ussd) {
if (DEBUG) this.debug("handleUSSDReceived " + JSON.stringify(ussd));
gSystemMessenger.broadcastMessage("ussd-received", ussd);
gMessageManager.sendMobileConnectionMessage("RIL:USSDReceived",
this.clientId, ussd);
},
handleStkProactiveCommand: function handleStkProactiveCommand(message) {
handleStkProactiveCommand: function(message) {
if (DEBUG) this.debug("handleStkProactiveCommand " + JSON.stringify(message));
let iccId = this.rilContext.iccInfo && this.rilContext.iccInfo.iccid;
if (iccId) {
@ -2593,14 +2593,14 @@ RadioInterface.prototype = {
gMessageManager.sendIccMessage("RIL:StkCommand", this.clientId, message);
},
handleExitEmergencyCbMode: function handleExitEmergencyCbMode(message) {
handleExitEmergencyCbMode: function(message) {
if (DEBUG) this.debug("handleExitEmergencyCbMode: " + JSON.stringify(message));
gMessageManager.sendRequestResults("RIL:ExitEmergencyCbMode", message);
},
// nsIObserver
observe: function observe(subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case kSysMsgListenerReadyObserverTopic:
this.setRadioEnabledInternal({enabled: true}, null);
@ -2687,7 +2687,7 @@ RadioInterface.prototype = {
// ICC's mcc-mnc.
_lastKnownHomeNetwork: null,
handleSettingsChange: function handleSettingsChange(aName, aResult, aMessage) {
handleSettingsChange: function(aName, aResult, aMessage) {
// Don't allow any content processes to modify the setting
// "time.clock.automatic-update.available" except for the chrome process.
if (aName === kSettingsClockAutoUpdateAvailable &&
@ -2720,7 +2720,7 @@ RadioInterface.prototype = {
},
// nsISettingsServiceCallback
handle: function handle(aName, aResult) {
handle: function(aName, aResult) {
switch(aName) {
// TODO: Bug 946589 - B2G RIL: follow-up to bug 944225 - remove
// 'ril.radio.preferredNetworkType' setting handler
@ -2779,7 +2779,7 @@ RadioInterface.prototype = {
}
},
handleError: function handleError(aErrorMessage) {
handleError: function(aErrorMessage) {
if (DEBUG) this.debug("There was an error while reading RIL settings.");
// Clean data call setting.
@ -2798,13 +2798,12 @@ RadioInterface.prototype = {
// Handle phone functions of nsIRILContentHelper
_sendCfStateChanged: function _sendCfStateChanged(message) {
_sendCfStateChanged: function(message) {
gMessageManager.sendMobileConnectionMessage("RIL:CfStateChanged",
this.clientId, message);
},
_updateCallingLineIdRestrictionPref:
function _updateCallingLineIdRestrictionPref(mode) {
_updateCallingLineIdRestrictionPref: function(mode) {
try {
Services.prefs.setIntPref(kPrefClirModePreference, mode);
Services.prefs.savePrefFile(null);
@ -2814,7 +2813,7 @@ RadioInterface.prototype = {
} catch (e) {}
},
sendMMI: function sendMMI(target, message) {
sendMMI: function(target, message) {
if (DEBUG) this.debug("SendMMI " + JSON.stringify(message));
this.workerMessenger.send("sendMMI", message, (function(response) {
if (response.isSetCallForward) {
@ -2831,7 +2830,7 @@ RadioInterface.prototype = {
}).bind(this));
},
setCallForwardingOptions: function setCallForwardingOptions(target, message) {
setCallForwardingOptions: function(target, message) {
if (DEBUG) this.debug("setCallForwardingOptions: " + JSON.stringify(message));
message.serviceClass = RIL.ICC_SERVICE_CLASS_VOICE;
this.workerMessenger.send("setCallForward", message, (function(response) {
@ -2844,7 +2843,7 @@ RadioInterface.prototype = {
}).bind(this));
},
setCallingLineIdRestriction: function setCallingLineIdRestriction(target,
setCallingLineIdRestriction: function(target,
message) {
if (DEBUG) {
this.debug("setCallingLineIdRestriction: " + JSON.stringify(message));
@ -2884,7 +2883,7 @@ RadioInterface.prototype = {
});
},
setRadioEnabled: function setRadioEnabled(target, message) {
setRadioEnabled: function(target, message) {
if (DEBUG) {
this.debug("setRadioEnabled: " + JSON.stringify(message));
}
@ -2913,7 +2912,7 @@ RadioInterface.prototype = {
this.setRadioEnabledInternal(message, callback);
},
setRadioEnabledInternal: function setRadioEnabledInternal(message, callback) {
setRadioEnabledInternal: function(message, callback) {
let state = message.enabled ? RIL.GECKO_DETAILED_RADIOSTATE_ENABLING
: RIL.GECKO_DETAILED_RADIOSTATE_DISABLING;
this.handleDetailedRadioStateChanged(state);
@ -2967,7 +2966,7 @@ RadioInterface.prototype = {
* @note that the algorithm used in this function must match exactly with
* GsmPDUHelper#writeStringAsSeptets.
*/
_countGsm7BitSeptets: function _countGsm7BitSeptets(message, langTable, langShiftTable, strict7BitEncoding) {
_countGsm7BitSeptets: function(message, langTable, langShiftTable, strict7BitEncoding) {
let length = 0;
for (let msgIndex = 0; msgIndex < message.length; msgIndex++) {
let c = message.charAt(msgIndex);
@ -3043,7 +3042,7 @@ RadioInterface.prototype = {
*
* @see #_calculateUserDataLength().
*/
_calculateUserDataLength7Bit: function _calculateUserDataLength7Bit(message, strict7BitEncoding) {
_calculateUserDataLength7Bit: function(message, strict7BitEncoding) {
let options = null;
let minUserDataSeptets = Number.MAX_VALUE;
for (let i = 0; i < this.enabledGsmTableTuples.length; i++) {
@ -3110,7 +3109,7 @@ RadioInterface.prototype = {
*
* @see #_calculateUserDataLength().
*/
_calculateUserDataLengthUCS2: function _calculateUserDataLengthUCS2(message) {
_calculateUserDataLengthUCS2: function(message) {
let bodyChars = message.length;
let headerLen = 0;
let headerChars = Math.ceil((headerLen ? headerLen + 1 : 0) / 2);
@ -3161,7 +3160,7 @@ RadioInterface.prototype = {
* This number might not be accurate for a multi-part message until
* it's processed by #_fragmentText() again.
*/
_calculateUserDataLength: function _calculateUserDataLength(message, strict7BitEncoding) {
_calculateUserDataLength: function(message, strict7BitEncoding) {
let options = this._calculateUserDataLength7Bit(message, strict7BitEncoding);
if (!options) {
options = this._calculateUserDataLengthUCS2(message);
@ -3188,7 +3187,7 @@ RadioInterface.prototype = {
*
* @return an array of objects. See #_fragmentText() for detailed definition.
*/
_fragmentText7Bit: function _fragmentText7Bit(text, langTable, langShiftTable, segmentSeptets, strict7BitEncoding) {
_fragmentText7Bit: function(text, langTable, langShiftTable, segmentSeptets, strict7BitEncoding) {
let ret = [];
let body = "", len = 0;
for (let i = 0, inc = 0; i < text.length; i++) {
@ -3258,7 +3257,7 @@ RadioInterface.prototype = {
*
* @return an array of objects. See #_fragmentText() for detailed definition.
*/
_fragmentTextUCS2: function _fragmentTextUCS2(text, segmentChars) {
_fragmentTextUCS2: function(text, segmentChars) {
let ret = [];
for (let offset = 0; offset < text.length; offset += segmentChars) {
let str = text.substr(offset, segmentChars);
@ -3289,7 +3288,7 @@ RadioInterface.prototype = {
*
* @return Populated options object.
*/
_fragmentText: function _fragmentText(text, options, strict7BitEncoding) {
_fragmentText: function(text, options, strict7BitEncoding) {
if (!options) {
options = this._calculateUserDataLength(text, strict7BitEncoding);
}
@ -3312,7 +3311,7 @@ RadioInterface.prototype = {
return options;
},
getSegmentInfoForText: function getSegmentInfoForText(text, request) {
getSegmentInfoForText: function(text, request) {
let strict7BitEncoding;
try {
strict7BitEncoding = Services.prefs.getBoolPref("dom.sms.strict7BitEncoding");
@ -3340,7 +3339,7 @@ RadioInterface.prototype = {
request.notifySegmentInfoForTextGot(result);
},
getSmscAddress: function getSmscAddress(request) {
getSmscAddress: function(request) {
this.workerMessenger.send("getSmscAddress",
null,
(function(response) {
@ -3352,7 +3351,7 @@ RadioInterface.prototype = {
}).bind(this));
},
sendSMS: function sendSMS(number, message, silent, request) {
sendSMS: function(number, message, silent, request) {
let strict7BitEncoding;
try {
strict7BitEncoding = Services.prefs.getBoolPref("dom.sms.strict7BitEncoding");
@ -3569,7 +3568,7 @@ RadioInterface.prototype = {
sendingMessage, notifyResult);
},
registerDataCallCallback: function registerDataCallCallback(callback) {
registerDataCallCallback: function(callback) {
if (this._datacall_callbacks) {
if (this._datacall_callbacks.indexOf(callback) != -1) {
throw new Error("Already registered this callback!");
@ -3581,7 +3580,7 @@ RadioInterface.prototype = {
if (DEBUG) this.debug("Registering callback: " + callback);
},
unregisterDataCallCallback: function unregisterDataCallCallback(callback) {
unregisterDataCallCallback: function(callback) {
if (!this._datacall_callbacks) {
return;
}
@ -3592,7 +3591,7 @@ RadioInterface.prototype = {
}
},
_deliverDataCallCallback: function _deliverDataCallCallback(name, args) {
_deliverDataCallCallback: function(name, args) {
// We need to worry about callback registration state mutations during the
// callback firing. The behaviour we want is to *not* call any callbacks
// that are added during the firing and to *not* call any callbacks that are
@ -3621,7 +3620,7 @@ RadioInterface.prototype = {
}
},
setupDataCallByType: function setupDataCallByType(apntype) {
setupDataCallByType: function(apntype) {
let apnSetting = this.apnSettings.byType[apntype];
if (!apnSetting) {
return;
@ -3661,7 +3660,7 @@ RadioInterface.prototype = {
}
},
deactivateDataCallByType: function deactivateDataCallByType(apntype) {
deactivateDataCallByType: function(apntype) {
let apnSetting = this.apnSettings.byType[apntype];
if (!apnSetting) {
return;
@ -3695,7 +3694,7 @@ RadioInterface.prototype = {
}
},
getDataCallStateByType: function getDataCallStateByType(apntype) {
getDataCallStateByType: function(apntype) {
let apnSetting = this.apnSettings.byType[apntype];
if (!apnSetting) {
return RIL.GECKO_NETWORK_STATE_UNKNOWN;
@ -3706,7 +3705,7 @@ RadioInterface.prototype = {
return apnSetting.iface.state;
},
setupDataCall: function setupDataCall(radioTech, apn, user, passwd, chappap, pdptype) {
setupDataCall: function(radioTech, apn, user, passwd, chappap, pdptype) {
this.workerMessenger.send("setupDataCall", { radioTech: radioTech,
apn: apn,
user: user,
@ -3715,12 +3714,12 @@ RadioInterface.prototype = {
pdptype: pdptype });
},
deactivateDataCall: function deactivateDataCall(cid, reason) {
deactivateDataCall: function(cid, reason) {
this.workerMessenger.send("deactivateDataCall", { cid: cid,
reason: reason });
},
sendWorkerMessage: function sendWorkerMessage(rilMessageType, message,
sendWorkerMessage: function(rilMessageType, message,
callback) {
this.workerMessenger.send(rilMessageType, message, function(response) {
return callback.handleResponse(response);
@ -3880,14 +3879,14 @@ RILNetworkInterface.prototype = {
return port;
},
debug: function debug(s) {
debug: function(s) {
dump("-*- RILNetworkInterface[" + this.radioInterface.clientId + ":" +
this.type + "]: " + s + "\n");
},
// nsIRILDataCallback
dataCallError: function dataCallError(message) {
dataCallError: function(message) {
if (message.apn != this.apnSetting.apn) {
return;
}
@ -3895,7 +3894,7 @@ RILNetworkInterface.prototype = {
this.reset();
},
dataCallStateChanged: function dataCallStateChanged(datacall) {
dataCallStateChanged: function(datacall) {
if (this.cid && this.cid != datacall.cid) {
// If data call for this connection existed but cid mismatched,
// it means this datacall state change is not for us.
@ -3987,7 +3986,7 @@ RILNetworkInterface.prototype = {
}
},
receiveDataCallList: function receiveDataCallList(dataCalls, length) {
receiveDataCallList: function(dataCalls, length) {
},
// Helpers
@ -4003,7 +4002,7 @@ RILNetworkInterface.prototype = {
connectedTypes: null,
inConnectedTypes: function inConnectedTypes(type) {
inConnectedTypes: function(type) {
return this.connectedTypes.indexOf(type) != -1;
},
@ -4011,7 +4010,7 @@ RILNetworkInterface.prototype = {
return this.state == RIL.GECKO_NETWORK_STATE_CONNECTED;
},
connect: function connect(apntype) {
connect: function(apntype) {
if (apntype && !this.inConnectedTypes(apntype)) {
this.connectedTypes.push(apntype);
}
@ -4060,7 +4059,7 @@ RILNetworkInterface.prototype = {
this.connecting = true;
},
reset: function reset() {
reset: function() {
let apnRetryTimer;
this.connecting = false;
// We will retry the connection in increasing times
@ -4090,7 +4089,7 @@ RILNetworkInterface.prototype = {
Ci.nsITimer.TYPE_ONE_SHOT);
},
disconnect: function disconnect(apntype) {
disconnect: function(apntype) {
let index = this.connectedTypes.indexOf(apntype);
if (index != -1) {
this.connectedTypes.splice(index, 1);

File diff suppressed because it is too large Load Diff

View File

@ -42,13 +42,13 @@ this.libcutils = (function() {
}
let fake_propdb = Object.create(null);
return {
property_get: function fake_property_get(key, defaultValue) {
property_get: function(key, defaultValue) {
if (key in fake_propdb) {
return fake_propdb[key];
}
return defaultValue === undefined ? null : defaultValue;
},
property_set: function fake_property_set(key, value) {
property_set: function(key, value) {
fake_propdb[key] = value;
}
};
@ -75,7 +75,7 @@ this.libcutils = (function() {
* @param defaultValue [optional]
* Default value to return if the property isn't set (default: null)
*/
property_get: function property_get(key, defaultValue) {
property_get: function(key, defaultValue) {
if (defaultValue === undefined) {
defaultValue = null;
}
@ -91,7 +91,7 @@ this.libcutils = (function() {
* @param value
* Value to set the property to.
*/
property_set: function property_set(key, value) {
property_set: function(key, value) {
let rv = c_property_set(key, value);
if (rv) {
throw Error('libcutils.property_set("' + key + '", "' + value +
@ -116,7 +116,7 @@ this.libnetutils = (function() {
// For now we just fake the ctypes library interfacer to return
// no-op functions when library.declare() is called.
library = {
declare: function fake_declare() {
declare: function() {
return function fake_libnetutils_function() {};
}
};
@ -409,7 +409,7 @@ this.netHelpers = {
/**
* Swap byte orders for 32-bit value
*/
swap32: function swap32(n) {
swap32: function(n) {
return (((n >> 24) & 0xFF) << 0) |
(((n >> 16) & 0xFF) << 8) |
(((n >> 8) & 0xFF) << 16) |
@ -420,7 +420,7 @@ this.netHelpers = {
* Convert network byte order to host byte order
* Note: Assume that the system is little endian
*/
ntohl: function ntohl(n) {
ntohl: function(n) {
return this.swap32(n);
},
@ -428,7 +428,7 @@ this.netHelpers = {
* Convert host byte order to network byte order
* Note: Assume that the system is little endian
*/
htonl: function htonl(n) {
htonl: function(n) {
return this.swap32(n);
},
@ -439,7 +439,7 @@ this.netHelpers = {
* @param ip
* IP address in number format.
*/
ipToString: function ipToString(ip) {
ipToString: function(ip) {
return ((ip >> 0) & 0xFF) + "." +
((ip >> 8) & 0xFF) + "." +
((ip >> 16) & 0xFF) + "." +
@ -453,7 +453,7 @@ this.netHelpers = {
* @param string
* String containing the IP address.
*/
stringToIP: function stringToIP(string) {
stringToIP: function(string) {
if (!string) {
return null;
}
@ -477,7 +477,7 @@ this.netHelpers = {
/**
* Make a subnet mask.
*/
makeMask: function makeMask(len) {
makeMask: function(len) {
let mask = 0;
for (let i = 0; i < len; ++i) {
mask |= (0x80000000 >> i);
@ -488,7 +488,7 @@ this.netHelpers = {
/**
* Get Mask length from given mask address
*/
getMaskLength: function getMaskLength(mask) {
getMaskLength: function(mask) {
let len = 0;
let netmask = this.ntohl(mask);
while (netmask & 0x80000000) {

View File

@ -23,7 +23,7 @@ let subscriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
*/
function newWorker(custom_ns) {
let worker_ns = {
importScripts: function fakeImportScripts() {
importScripts: function() {
Array.slice(arguments).forEach(function(script) {
if (!script.startsWith("resource:")) {
script = "resource://gre/modules/" + script;
@ -32,10 +32,10 @@ function newWorker(custom_ns) {
}, this);
},
postRILMessage: function fakePostRILMessage(message) {
postRILMessage: function(message) {
},
postMessage: function fakepostMessage(message) {
postMessage: function(message) {
},
// Define these variables inside the worker scope so ES5 strict mode

View File

@ -66,7 +66,7 @@ add_test(function test_change_call_barring_password() {
add_test(function test_check_change_call_barring_password_result() {
let barringPasswordOptions;
let worker = newWorker({
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
do_check_eq(barringPasswordOptions.pin, PIN);
do_check_eq(barringPasswordOptions.newPin, NEW_PIN);
do_check_eq(message.errorMsg, GECKO_ERROR_SUCCESS);

View File

@ -16,10 +16,10 @@ function run_test() {
function add_test_incoming_parcel(parcel, handler) {
add_test(function test_incoming_parcel() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// do nothing
}
});
@ -86,10 +86,10 @@ add_test_incoming_parcel(null,
// Test Bug 814761: buffer overwritten
add_test(function test_incoming_parcel_buffer_overwritten() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// do nothing
}
});

View File

@ -12,10 +12,10 @@ function run_test() {
*/
function newWorkerWithParcel(parcelBuf) {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});

View File

@ -25,10 +25,10 @@ add_test(function test_ril_consts_cellbroadcast_misc() {
add_test(function test_ril_worker_GsmPDUHelper_readCbDataCodingScheme() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});
@ -134,10 +134,10 @@ add_test(function test_ril_worker_GsmPDUHelper_readCbDataCodingScheme() {
add_test(function test_ril_worker_GsmPDUHelper_readGsmCbData() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});
@ -210,10 +210,10 @@ add_test(function test_ril_worker_GsmPDUHelper_readGsmCbData() {
add_test(function test_ril_worker__checkCellBroadcastMMISettable() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});
@ -260,10 +260,10 @@ add_test(function test_ril_worker__checkCellBroadcastMMISettable() {
add_test(function test_ril_worker__mergeCellBroadcastConfigs() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});

View File

@ -9,10 +9,10 @@ function run_test() {
add_test(function test_ril_worker_cellbroadcast_activate() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(id, parcel) {
postRILMessage: function(id, parcel) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});
@ -48,10 +48,10 @@ add_test(function test_ril_worker_cellbroadcast_activate() {
add_test(function test_ril_worker_cellbroadcast_config() {
let currentParcel;
let worker = newWorker({
postRILMessage: function fakePostRILMessage(id, parcel) {
postRILMessage: function(id, parcel) {
currentParcel = parcel;
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});
@ -106,10 +106,10 @@ add_test(function test_ril_worker_cellbroadcast_config() {
add_test(function test_ril_worker_cellbroadcast_merge_config() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(id, parcel) {
postRILMessage: function(id, parcel) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});

View File

@ -9,10 +9,10 @@ function run_test() {
function toaFromString(number) {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});
@ -54,9 +54,9 @@ add_test(function test_toaFromString_international() {
function _getWorker() {
let _postedMessage;
let _worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
_postedMessage = message;
}
});

View File

@ -10,9 +10,9 @@ function run_test() {
function _getWorker() {
let _postedMessage;
let _worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
_postedMessage = message;
}
});

View File

@ -19,9 +19,9 @@ function run_test() {
function _getWorker() {
let _postedMessage;
let _worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
_postedMessage = message;
}
});

View File

@ -10,9 +10,9 @@ function run_test() {
function _getWorker() {
let _postedMessage;
let _worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
_postedMessage = message;
}
});

View File

@ -10,9 +10,9 @@ function run_test() {
function _getWorker() {
let _postedMessage;
let _worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
_postedMessage = message;
}
});

View File

@ -766,10 +766,10 @@ add_test(function test_get_network_name_from_icc() {
add_test(function test_path_id_for_spid_and_spn() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}});
let RIL = worker.RIL;
@ -2629,9 +2629,9 @@ add_test(function test_read_new_sms_on_sim() {
function newSmsOnSimWorkerHelper() {
let _postedMessage;
let _worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
_postedMessage = message;
}
});
@ -2645,7 +2645,7 @@ add_test(function test_read_new_sms_on_sim() {
get worker() {
return _worker;
},
fakeWokerBuffer: function fakeWokerBuffer() {
fakeWokerBuffer: function() {
let index = 0; // index for read
let buf = [];
_worker.Buf.writeUint8 = function(value) {

View File

@ -9,10 +9,10 @@ function run_test() {
function parseMMI(mmi) {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});
@ -22,9 +22,9 @@ function parseMMI(mmi) {
function getWorker() {
let _postedMessage;
let _worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
_postedMessage = message;
},
});

View File

@ -290,10 +290,10 @@ add_test(function test_read_cdmaspn() {
*/
add_test(function test_cdma_spn_display_condition() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});

View File

@ -110,10 +110,10 @@ function removeSpecialChar(str, needle) {
function newWriteHexOctetAsUint8Worker() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});
@ -128,10 +128,10 @@ function newWriteHexOctetAsUint8Worker() {
function add_test_receiving_sms(expected, pdu) {
add_test(function test_receiving_sms() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
do_print("fullBody: " + message.fullBody);
do_check_eq(expected, message.fullBody)
}

View File

@ -10,9 +10,9 @@ function run_test() {
function _getWorker() {
let _postedMessage;
let _worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
_postedMessage = message;
}
});

View File

@ -12,10 +12,10 @@ function run_test() {
*/
add_test(function test_CdmaPDUHelper_encodeUserDataReplyOption() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});
@ -42,10 +42,10 @@ add_test(function test_CdmaPDUHelper_encodeUserDataReplyOption() {
*/
add_test(function test_CdmaPDUHelper_decodeUserDataMsgStatus() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});

View File

@ -12,10 +12,10 @@ function run_test() {
*/
add_test(function test_GsmPDUHelper_readDataCodingScheme() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});
@ -151,10 +151,10 @@ add_test(function test_GsmPDUHelper_readDataCodingScheme() {
*/
add_test(function test_GsmPDUHelper_writeStringAsSeptets() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});
@ -190,10 +190,10 @@ add_test(function test_GsmPDUHelper_writeStringAsSeptets() {
*/
add_test(function test_GsmPDUHelper_readAddress() {
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}

View File

@ -19,10 +19,10 @@ add_test(function test_RadioInterface__countGsm7BitSeptets() {
let ril = newRadioInterface();
let worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
// Do nothing
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
// Do nothing
}
});

View File

@ -10,9 +10,9 @@ function run_test() {
function _getWorker() {
let _postedMessage;
let _worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
_postedMessage = message;
}
});

View File

@ -10,9 +10,9 @@ function run_test() {
function _getWorker() {
let _postedMessage;
let _worker = newWorker({
postRILMessage: function fakePostRILMessage(data) {
postRILMessage: function(data) {
},
postMessage: function fakePostMessage(message) {
postMessage: function(message) {
_postedMessage = message;
}
});

View File

@ -39,7 +39,7 @@ let Buf = {
outgoingIndex: 0,
outgoingBufferCalSizeQueue: null,
_init: function _init() {
_init: function() {
this.incomingBuffer = new ArrayBuffer(this.incomingBufferLength);
this.outgoingBuffer = new ArrayBuffer(this.outgoingBufferLength);
@ -79,7 +79,7 @@ let Buf = {
* If raw data size is not in proper unit for writing, user can adjust
* the length value in writeFunction before writing.
**/
startCalOutgoingSize: function startCalOutgoingSize(writeFunction) {
startCalOutgoingSize: function(writeFunction) {
let sizeInfo = {index: this.outgoingIndex,
write: writeFunction};
@ -96,7 +96,7 @@ let Buf = {
/**
* Calculate data length since last mark, and write it into mark position.
**/
stopCalOutgoingSize: function stopCalOutgoingSize() {
stopCalOutgoingSize: function() {
let sizeInfo = this.outgoingBufferCalSizeQueue.pop();
// Remember current outgoingIndex.
@ -120,7 +120,7 @@ let Buf = {
* Minimum new size. The actual new size will be the the smallest
* power of 2 that's larger than this number.
*/
growIncomingBuffer: function growIncomingBuffer(min_size) {
growIncomingBuffer: function(min_size) {
if (DEBUG) {
debug("Current buffer of " + this.incomingBufferLength +
" can't handle incoming " + min_size + " bytes.");
@ -160,7 +160,7 @@ let Buf = {
* Minimum new size. The actual new size will be the the smallest
* power of 2 that's larger than this number.
*/
growOutgoingBuffer: function growOutgoingBuffer(min_size) {
growOutgoingBuffer: function(min_size) {
if (DEBUG) {
debug("Current buffer of " + this.outgoingBufferLength +
" is too small.");
@ -189,7 +189,7 @@ let Buf = {
* Data position in incoming parcel, valid from 0 to
* currentParcelSize.
*/
ensureIncomingAvailable: function ensureIncomingAvailable(index) {
ensureIncomingAvailable: function(index) {
if (index >= this.currentParcelSize) {
throw new Error("Trying to read data beyond the parcel end!");
} else if (index < 0) {
@ -203,7 +203,7 @@ let Buf = {
* @param offset
* Seek offset in relative to current position.
*/
seekIncoming: function seekIncoming(offset) {
seekIncoming: function(offset) {
// Translate to 0..currentParcelSize
let cur = this.currentParcelSize - this.readAvailable;
@ -227,14 +227,14 @@ let Buf = {
this.incomingReadIndex = newIndex;
},
readUint8Unchecked: function readUint8Unchecked() {
readUint8Unchecked: function() {
let value = this.incomingBytes[this.incomingReadIndex];
this.incomingReadIndex = (this.incomingReadIndex + 1) %
this.incomingBufferLength;
return value;
},
readUint8: function readUint8() {
readUint8: function() {
// Translate to 0..currentParcelSize
let cur = this.currentParcelSize - this.readAvailable;
this.ensureIncomingAvailable(cur);
@ -243,7 +243,7 @@ let Buf = {
return this.readUint8Unchecked();
},
readUint8Array: function readUint8Array(length) {
readUint8Array: function(length) {
// Translate to 0..currentParcelSize
let last = this.currentParcelSize - this.readAvailable;
last += (length - 1);
@ -258,16 +258,16 @@ let Buf = {
return array;
},
readUint16: function readUint16() {
readUint16: function() {
return this.readUint8() | this.readUint8() << 8;
},
readInt32: function readInt32() {
readInt32: function() {
return this.readUint8() | this.readUint8() << 8 |
this.readUint8() << 16 | this.readUint8() << 24;
},
readInt32List: function readInt32List() {
readInt32List: function() {
let length = this.readInt32();
let ints = [];
for (let i = 0; i < length; i++) {
@ -276,7 +276,7 @@ let Buf = {
return ints;
},
readString: function readString() {
readString: function() {
let string_len = this.readInt32();
if (string_len < 0 || string_len >= this.INT32_MAX) {
return null;
@ -292,7 +292,7 @@ let Buf = {
return s;
},
readStringList: function readStringList() {
readStringList: function() {
let num_strings = this.readInt32();
let strings = [];
for (let i = 0; i < num_strings; i++) {
@ -301,7 +301,7 @@ let Buf = {
return strings;
},
readStringDelimiter: function readStringDelimiter(length) {
readStringDelimiter: function(length) {
let delimiter = this.readUint16();
if (!(length & 1)) {
delimiter |= this.readUint16();
@ -313,7 +313,7 @@ let Buf = {
}
},
readParcelSize: function readParcelSize() {
readParcelSize: function() {
return this.readUint8Unchecked() << 24 |
this.readUint8Unchecked() << 16 |
this.readUint8Unchecked() << 8 |
@ -331,32 +331,32 @@ let Buf = {
* Data position in outgoing parcel, valid from 0 to
* outgoingBufferLength.
*/
ensureOutgoingAvailable: function ensureOutgoingAvailable(index) {
ensureOutgoingAvailable: function(index) {
if (index >= this.outgoingBufferLength) {
this.growOutgoingBuffer(index + 1);
}
},
writeUint8: function writeUint8(value) {
writeUint8: function(value) {
this.ensureOutgoingAvailable(this.outgoingIndex);
this.outgoingBytes[this.outgoingIndex] = value;
this.outgoingIndex++;
},
writeUint16: function writeUint16(value) {
writeUint16: function(value) {
this.writeUint8(value & 0xff);
this.writeUint8((value >> 8) & 0xff);
},
writeInt32: function writeInt32(value) {
writeInt32: function(value) {
this.writeUint8(value & 0xff);
this.writeUint8((value >> 8) & 0xff);
this.writeUint8((value >> 16) & 0xff);
this.writeUint8((value >> 24) & 0xff);
},
writeString: function writeString(value) {
writeString: function(value) {
if (value == null) {
this.writeInt32(-1);
return;
@ -371,21 +371,21 @@ let Buf = {
this.writeStringDelimiter(value.length);
},
writeStringList: function writeStringList(strings) {
writeStringList: function(strings) {
this.writeInt32(strings.length);
for (let i = 0; i < strings.length; i++) {
this.writeString(strings[i]);
}
},
writeStringDelimiter: function writeStringDelimiter(length) {
writeStringDelimiter: function(length) {
this.writeUint16(0);
if (!(length & 1)) {
this.writeUint16(0);
}
},
writeParcelSize: function writeParcelSize(value) {
writeParcelSize: function(value) {
/**
* Parcel size will always be the first thing in the parcel byte
* array, but the last thing written. Store the current index off
@ -400,7 +400,7 @@ let Buf = {
this.outgoingIndex = currentIndex;
},
copyIncomingToOutgoing: function copyIncomingToOutgoing(length) {
copyIncomingToOutgoing: function(length) {
if (!length || (length < 0)) {
return;
}
@ -448,7 +448,7 @@ let Buf = {
* @param incoming
* Uint8Array containing the incoming data.
*/
writeToIncoming: function writeToIncoming(incoming) {
writeToIncoming: function(incoming) {
// We don't have to worry about the head catching the tail since
// we process any backlog in parcels immediately, before writing
// new data to the buffer. So the only edge case we need to handle
@ -480,7 +480,7 @@ let Buf = {
* @param incoming
* Uint8Array containing the incoming data.
*/
processIncoming: function processIncoming(incoming) {
processIncoming: function(incoming) {
if (DEBUG) {
debug("Received " + incoming.length + " bytes.");
debug("Already read " + this.readIncoming);
@ -556,7 +556,7 @@ let Buf = {
/**
* Communicate with the IPC thread.
*/
sendParcel: function sendParcel() {
sendParcel: function() {
// Compute the size of the parcel and write it to the front of the parcel
// where we left room for it. Note that he parcel size does not include
// the size itself.
@ -571,11 +571,11 @@ let Buf = {
this.outgoingIndex = this.PARCEL_SIZE_SIZE;
},
getCurrentParcelSize: function getCurrentParcelSize() {
getCurrentParcelSize: function() {
return this.currentParcelSize;
},
getReadAvailable: function getReadAvailable() {
getReadAvailable: function() {
return this.readAvailable;
}
@ -586,7 +586,7 @@ let Buf = {
* function invoked when we have received a complete parcel. Implementation
* may call multiple read functions to extract data from the incoming buffer.
*/
//processParcel: function processParcel() {
//processParcel: function() {
// let something = this.readInt32();
// ...
//},
@ -602,7 +602,7 @@ let Buf = {
* @param parcel
* An array of numeric octet data.
*/
//onSendParcel: function onSendParcel(parcel) {
//onSendParcel: function(parcel) {
// ...
//}
};

View File

@ -54,11 +54,11 @@ XPCOMUtils.defineLazyGetter(this, "gAudioManager", function getAudioManager() {
phoneState: nsIAudioManager.PHONE_STATE_CURRENT,
_forceForUse: {},
setForceForUse: function setForceForUse(usage, force) {
setForceForUse: function(usage, force) {
this._forceForUse[usage] = force;
},
getForceForUse: function setForceForUse(usage) {
getForceForUse: function(usage) {
return this._forceForUse[usage] || nsIAudioManager.FORCE_NONE;
}
};
@ -138,7 +138,7 @@ TelephonyProvider.prototype = {
_callRingWakeLock: null,
_callRingWakeLockTimer: null,
_acquireCallRingWakeLock: function _acquireCallRingWakeLock() {
_acquireCallRingWakeLock: function() {
if (!this._callRingWakeLock) {
if (DEBUG) debug("Acquiring a CPU wake lock for handling incoming call.");
this._callRingWakeLock = gPowerManagerService.newWakeLock("cpu");
@ -154,7 +154,7 @@ TelephonyProvider.prototype = {
CALL_WAKELOCK_TIMEOUT, Ci.nsITimer.TYPE_ONE_SHOT);
},
_releaseCallRingWakeLock: function _releaseCallRingWakeLock() {
_releaseCallRingWakeLock: function() {
if (DEBUG) debug("Releasing the CPU wake lock for handling incoming call.");
if (this._callRingWakeLockTimer) {
this._callRingWakeLockTimer.cancel();
@ -165,13 +165,13 @@ TelephonyProvider.prototype = {
}
},
_getClient: function _getClient(aClientId) {
_getClient: function(aClientId) {
return gRadioInterfaceLayer.getRadioInterface(aClientId);
},
// An array of nsITelephonyListener instances.
_listeners: null,
_notifyAllListeners: function _notifyAllListeners(aMethodName, aArgs) {
_notifyAllListeners: function(aMethodName, aArgs) {
let listeners = this._listeners.slice();
for (let listener of listeners) {
if (this._listeners.indexOf(listener) == -1) {
@ -188,7 +188,7 @@ TelephonyProvider.prototype = {
}
},
_matchActiveSingleCall: function _matchActiveSingleCall(aCall) {
_matchActiveSingleCall: function(aCall) {
return this._activeCall &&
this._activeCall instanceof SingleCall &&
this._activeCall.clientId === aCall.clientId &&
@ -199,7 +199,7 @@ TelephonyProvider.prototype = {
* Track the active call and update the audio system as its state changes.
*/
_activeCall: null,
_updateCallAudioState: function _updateCallAudioState(aCall,
_updateCallAudioState: function(aCall,
aConferenceState) {
if (aConferenceState === nsITelephonyProvider.CALL_STATE_CONNECTED) {
this._activeCall = new ConferenceCall(aConferenceState);
@ -289,7 +289,7 @@ TelephonyProvider.prototype = {
}
},
_convertRILCallState: function _convertRILCallState(aState) {
_convertRILCallState: function(aState) {
switch (aState) {
case RIL.CALL_STATE_UNKNOWN:
return nsITelephonyProvider.CALL_STATE_UNKNOWN;
@ -309,7 +309,7 @@ TelephonyProvider.prototype = {
}
},
_convertRILSuppSvcNotification: function _convertRILSuppSvcNotification(aNotification) {
_convertRILSuppSvcNotification: function(aNotification) {
switch (aNotification) {
case RIL.GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD:
return nsITelephonyProvider.NOTIFICATION_REMOTE_HELD;
@ -320,7 +320,7 @@ TelephonyProvider.prototype = {
}
},
_validateNumber: function _validateNumber(aNumber) {
_validateNumber: function(aNumber) {
// note: isPlainPhoneNumber also accepts USSD and SS numbers
if (gPhoneNumberUtils.isPlainPhoneNumber(aNumber)) {
return true;
@ -337,14 +337,14 @@ TelephonyProvider.prototype = {
return false;
},
_updateDebugFlag: function _updateDebugFlag() {
_updateDebugFlag: function() {
try {
DEBUG = RIL.DEBUG_RIL ||
Services.prefs.getBoolPref(kPrefRilDebuggingEnabled);
} catch (e) {}
},
_getDefaultServiceId: function _getDefaultServiceId() {
_getDefaultServiceId: function() {
let id = Services.prefs.getIntPref(kPrefDefaultServiceId);
let numRil = Services.prefs.getIntPref(kPrefRilNumRadioInterfaces);
@ -378,7 +378,7 @@ TelephonyProvider.prototype = {
this._listeners.splice(index, 1);
},
_enumerateCallsForClient: function _enumerateCallsForClient(aClientId,
_enumerateCallsForClient: function(aClientId,
aListener) {
if (DEBUG) debug("Enumeration of calls for client " + aClientId);
@ -459,19 +459,19 @@ TelephonyProvider.prototype = {
this._getClient(aClientId).sendWorkerMessage("resumeCall", { callIndex: aCallIndex });
},
conferenceCall: function conferenceCall(aClientId) {
conferenceCall: function(aClientId) {
this._getClient(aClientId).sendWorkerMessage("conferenceCall");
},
separateCall: function separateCall(aClientId, aCallIndex) {
separateCall: function(aClientId, aCallIndex) {
this._getClient(aClientId).sendWorkerMessage("separateCall", { callIndex: aCallIndex });
},
holdConference: function holdConference(aClientId) {
holdConference: function(aClientId) {
this._getClient(aClientId).sendWorkerMessage("holdConference");
},
resumeConference: function resumeConference(aClientId) {
resumeConference: function(aClientId) {
this._getClient(aClientId).sendWorkerMessage("resumeConference");
},
@ -515,7 +515,7 @@ TelephonyProvider.prototype = {
/**
* Handle call disconnects by updating our current state and the audio system.
*/
notifyCallDisconnected: function notifyCallDisconnected(aClientId, aCall) {
notifyCallDisconnected: function(aClientId, aCall) {
if (DEBUG) debug("handleCallDisconnected: " + JSON.stringify(aCall));
aCall.state = nsITelephonyProvider.CALL_STATE_DISCONNECTED;
@ -550,7 +550,7 @@ TelephonyProvider.prototype = {
/**
* Handle call error.
*/
notifyCallError: function notifyCallError(aClientId, aCallIndex, aErrorMsg) {
notifyCallError: function(aClientId, aCallIndex, aErrorMsg) {
this._notifyAllListeners("notifyError", [aClientId, aCallIndex, aErrorMsg]);
},
@ -560,7 +560,7 @@ TelephonyProvider.prototype = {
* Not much is known about this call at this point, but it's enough
* to start bringing up the Phone app already.
*/
notifyCallRing: function notifyCallRing() {
notifyCallRing: function() {
// We need to acquire a CPU wake lock to avoid the system falling into
// the sleep mode when the RIL handles the incoming call.
this._acquireCallRingWakeLock();
@ -572,7 +572,7 @@ TelephonyProvider.prototype = {
* Handle call state changes by updating our current state and the audio
* system.
*/
notifyCallStateChanged: function notifyCallStateChanged(aClientId, aCall) {
notifyCallStateChanged: function(aClientId, aCall) {
if (DEBUG) debug("handleCallStateChange: " + JSON.stringify(aCall));
aCall.state = this._convertRILCallState(aCall.state);
@ -593,7 +593,7 @@ TelephonyProvider.prototype = {
aCall.isConference]);
},
notifyCdmaCallWaiting: function notifyCdmaCallWaiting(aClientId, aNumber) {
notifyCdmaCallWaiting: function(aClientId, aNumber) {
// We need to acquire a CPU wake lock to avoid the system falling into
// the sleep mode when the RIL handles the incoming call.
this._acquireCallRingWakeLock();
@ -601,14 +601,13 @@ TelephonyProvider.prototype = {
this._notifyAllListeners("notifyCdmaCallWaiting", [aClientId, aNumber]);
},
notifySupplementaryService:
function notifySupplementaryService(aClientId, aCallIndex, aNotification) {
notifySupplementaryService: function(aClientId, aCallIndex, aNotification) {
let notification = this._convertRILSuppSvcNotification(aNotification);
this._notifyAllListeners("supplementaryServiceNotification",
[aClientId, aCallIndex, notification]);
},
notifyConferenceCallStateChanged: function notifyConferenceCallStateChanged(aState) {
notifyConferenceCallStateChanged: function(aState) {
if (DEBUG) debug("handleConferenceCallStateChanged: " + aState);
aState = this._convertRILCallState(aState);
this._updateCallAudioState(null, aState);
@ -616,7 +615,7 @@ TelephonyProvider.prototype = {
this._notifyAllListeners("conferenceCallStateChanged", [aState]);
},
notifyConferenceError: function notifyConferenceError(aName, aMessage) {
notifyConferenceError: function(aName, aMessage) {
if (DEBUG) debug("handleConferenceError: " + aName + "." +
" Error details: " + aMessage);
this._notifyAllListeners("notifyConferenceError", [aName, aMessage]);
@ -626,7 +625,7 @@ TelephonyProvider.prototype = {
* nsIObserver interface.
*/
observe: function observe(aSubject, aTopic, aData) {
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case NS_PREFBRANCH_PREFCHANGE_TOPIC_ID:
if (aData === kPrefRilDebuggingEnabled) {

View File

@ -8,7 +8,7 @@ SpecialPowers.Cu.import("resource://gre/modules/ril_consts.js", RIL);
// Only bring in what we need from ril_worker/RadioInterfaceLayer here. Reusing
// that code turns out to be a nightmare, so there is some code duplication.
let PDUBuilder = {
toHexString: function toHexString(n, length) {
toHexString: function(n, length) {
let str = n.toString(16);
if (str.length < length) {
for (let i = 0; i < length - str.length; i++) {
@ -18,16 +18,16 @@ let PDUBuilder = {
return str.toUpperCase();
},
writeUint16: function writeUint16(value) {
writeUint16: function(value) {
this.buf += (value & 0xff).toString(16).toUpperCase();
this.buf += ((value >> 8) & 0xff).toString(16).toUpperCase();
},
writeHexOctet: function writeHexOctet(octet) {
writeHexOctet: function(octet) {
this.buf += this.toHexString(octet, 2);
},
writeSwappedNibbleBCD: function writeSwappedNibbleBCD(data) {
writeSwappedNibbleBCD: function(data) {
data = data.toString();
let zeroCharCode = '0'.charCodeAt(0);
@ -44,7 +44,7 @@ let PDUBuilder = {
}
},
writeStringAsSeptets: function writeStringAsSeptets(message,
writeStringAsSeptets: function(message,
paddingBits,
langIndex,
langShiftIndex)
@ -91,7 +91,7 @@ let PDUBuilder = {
}
},
buildAddress: function buildAddress(address) {
buildAddress: function(address) {
let addressFormat = RIL.PDU_TOA_ISDN; // 81
if (address[0] == '+') {
addressFormat = RIL.PDU_TOA_INTERNATIONAL | RIL.PDU_TOA_ISDN; // 91
@ -107,7 +107,7 @@ let PDUBuilder = {
},
// assumes 7 bit encoding
buildUserData: function buildUserData(options) {
buildUserData: function(options) {
let headerLength = 0;
this.buf = "";
if (options.headers) {