This commit is contained in:
Ryan VanderMeulen 2013-06-18 19:10:23 -04:00
Родитель bf6512aa89 6519a0cc92
Коммит 41a2d6261a
20 изменённых файлов: 265 добавлений и 146 удалений

Просмотреть файл

@ -174,6 +174,11 @@ SettingsListener.observe('language.current', 'en-US', function(value) {
function(value) {
Services.prefs.setBoolPref('ril.cellbroadcast.disabled', value);
});
SettingsListener.observe('ril.radio.disabled', false,
function(value) {
Services.prefs.setBoolPref('ril.radio.disabled', value);
});
})();
//=================== DeviceInfo ====================

Просмотреть файл

@ -1,4 +1,4 @@
{
"revision": "123a4b7418cf70cee6862cc407572ab97ae570fd",
"revision": "fc8faac211332ebdbbea8bf11f3ca2deba541cee",
"repo_path": "/integration/gaia-central"
}

Просмотреть файл

@ -46,7 +46,7 @@ function sanitizeStringArray(aArray) {
}
const nsIClassInfo = Ci.nsIClassInfo;
const CONTACTPROPERTIES_CID = Components.ID("{6cb78b21-4218-414b-8a84-3b7bf0088b34}");
const CONTACTPROPERTIES_CID = Components.ID("{35ad8a4e-9486-44b6-883d-550f14635e49}");
const nsIContactProperties = Ci.nsIContactProperties;
// ContactProperties is not directly instantiated. It is used as interface.
@ -268,7 +268,8 @@ Contact.prototype = {
impp: 'rw',
anniversary: 'rw',
sex: 'rw',
genderIdentity: 'rw'
genderIdentity: 'rw',
key: 'rw',
},
set name(aName) {
@ -467,6 +468,14 @@ Contact.prototype = {
return this._genderIdentity;
},
set key(aKey) {
this._key = sanitizeStringArray(aKey);
},
get key() {
return this._key;
},
init: function init(aProp) {
this.name = aProp.name;
this.honorificPrefix = aProp.honorificPrefix;
@ -489,6 +498,7 @@ Contact.prototype = {
this.anniversary = aProp.anniversary;
this.sex = aProp.sex;
this.genderIdentity = aProp.genderIdentity;
this.key = aProp.key;
},
get published () {
@ -758,7 +768,8 @@ ContactManager.prototype = {
impp: [],
anniversary: null,
sex: null,
genderIdentity: null
genderIdentity: null,
key: [],
};
for (let field in newContact.properties) {
newContact.properties[field] = aContact[field];

Просмотреть файл

@ -1,5 +1,5 @@
component {6cb78b21-4218-414b-8a84-3b7bf0088b34} ContactManager.js
contract @mozilla.org/contactProperties;1 {6cb78b21-4218-414b-8a84-3b7bf0088b34}
component {35ad8a4e-9486-44b6-883d-550f14635e49} ContactManager.js
contract @mozilla.org/contactProperties;1 {35ad8a4e-9486-44b6-883d-550f14635e49}
component {9cbfa81c-bcab-4ca9-b0d2-f4318f295e33} ContactManager.js
contract @mozilla.org/contactAddress;1 {9cbfa81c-bcab-4ca9-b0d2-f4318f295e33}

Просмотреть файл

@ -438,7 +438,8 @@ ContactDB.prototype = {
impp: [],
anniversary: null,
sex: null,
genderIdentity: null
genderIdentity: null,
key: [],
};
contact.search = {
@ -448,7 +449,7 @@ ContactDB.prototype = {
category: [],
tel: [],
exactTel: [],
parsedTel: []
parsedTel: [],
};
for (let field in aContact.properties) {

Просмотреть файл

@ -84,7 +84,8 @@ var properties1 = {
nickname: "nicktest",
tel: [{type: ["work"], value: "123456", carrier: "testCarrier"} , {type: ["home", "fax"], value: "+55 (31) 9876-3456"}, {type: ["home"], value: "+49 451 491934"}],
adr: adr1,
email: [{type: ["work"], value: "x@y.com"}]
email: [{type: ["work"], value: "x@y.com"}],
key: "4343JEGJGERNBEGOI34G3WGVERBERB"
};
var properties2 = {
@ -107,7 +108,8 @@ var properties2 = {
url: [{type: ["work", "work2"], value: "www.1.com", pref: 1}, {value:"www2.com"}],
anniversary: new Date("2000, 12, 01"),
sex: "male",
genderIdentity: "test"
genderIdentity: "test",
key: "ERPJ394GJJWEVJ0349GJ09W3H4FG0WFW80VHW3408GH30WGH348G3H"
};
var sample_id1;
@ -208,6 +210,7 @@ function checkContacts(contact1, contact2) {
is(contact1.anniversary ? contact1.anniversary.valueOf() : null , contact2.anniversary ? contact2.anniversary.valueOf() : null, "Same anniversary");
checkStr(contact1.sex, contact2.sex, "Same sex");
checkStr(contact1.genderIdentity, contact2.genderIdentity, "Same genderIdentity");
checkStrArray(contact1.key, contact2.key, "Same key");
for (var i in contact1.email) {
checkField(contact1.email[i], contact2.email[i]);
@ -1373,6 +1376,7 @@ var steps = [
category: [15, 16],
sex: 17,
genderIdentity: 18,
key: 4,
email: input,
adr: input,
tel: input,

Просмотреть файл

@ -46,7 +46,7 @@ interface nsIContactFindOptions : nsIContactFindSortOptions
attribute unsigned long filterLimit;
};
[scriptable, uuid(6cb78b21-4218-414b-8a84-3b7bf0088b34)]
[scriptable, uuid(35ad8a4e-9486-44b6-883d-550f14635e49)]
interface nsIContactProperties : nsISupports
{
attribute jsval name; // DOMString[]
@ -68,6 +68,7 @@ interface nsIContactProperties : nsISupports
attribute jsval note; // DOMString[]
attribute jsval impp; // ContactField[]
attribute jsval anniversary; // Date
attribute DOMString sex;
attribute DOMString genderIdentity;
attribute DOMString sex; // DOMString
attribute DOMString genderIdentity; // DOMString
attribute jsval key; // DOMString[]
};

Просмотреть файл

@ -97,7 +97,10 @@ this.SystemMessagePermissionsTable = {
},
"ussd-received": {
"mobileconnection": []
}
},
"wappush-received": {
"sms": []
},
};
this.SystemMessagePermissionsChecker = {

Просмотреть файл

@ -11,7 +11,8 @@ dictionary MmsAttachment
{
DOMString? id;
DOMString? location;
nsIDOMBlob content;
nsIDOMBlob content; // If the content blob is a text/plain type, the encoding
// for text should always be "utf-8".
};
[scriptable, builtinclass, uuid(2e5e1c16-b7af-11e2-af04-8f4b1610a600)]

Просмотреть файл

@ -13,19 +13,21 @@ dictionary SmsThreadListItem
unsigned long long unreadCount;
};
[scriptable, builtinclass, uuid(6e20c451-8bae-4b36-be3c-da166fdd10ba)]
[scriptable, builtinclass, uuid(e73baef1-7a9f-48c1-8b04-20d9d16c4974)]
interface nsIMobileMessageCallback : nsISupports
{
/**
* All SMS related errors.
* Make sure to keep this list in sync with the list in:
* mobile/android/GeckoSmsManager.java
* embedding/android/GeckoSmsManager.java
*/
const unsigned short SUCCESS_NO_ERROR = 0;
const unsigned short NO_SIGNAL_ERROR = 1;
const unsigned short NOT_FOUND_ERROR = 2;
const unsigned short UNKNOWN_ERROR = 3;
const unsigned short INTERNAL_ERROR = 4;
const unsigned short SUCCESS_NO_ERROR = 0;
const unsigned short NO_SIGNAL_ERROR = 1;
const unsigned short NOT_FOUND_ERROR = 2;
const unsigned short UNKNOWN_ERROR = 3;
const unsigned short INTERNAL_ERROR = 4;
const unsigned short NO_SIM_CARD_ERROR = 5;
const unsigned short RADIO_DISABLED_ERROR = 6;
/**
* |message| can be nsIDOMMoz{Mms,Sms}Message.

Просмотреть файл

@ -85,6 +85,12 @@ MobileMessageCallback::NotifyError(int32_t aError)
case nsIMobileMessageCallback::INTERNAL_ERROR:
mDOMRequest->FireError(NS_LITERAL_STRING("InternalError"));
break;
case nsIMobileMessageCallback::NO_SIM_CARD_ERROR:
mDOMRequest->FireError(NS_LITERAL_STRING("NoSimCardError"));
break;
case nsIMobileMessageCallback::RADIO_DISABLED_ERROR:
mDOMRequest->FireError(NS_LITERAL_STRING("RadioDisabledError"));
break;
default: // SUCCESS_NO_ERROR is handled above.
MOZ_NOT_REACHED("Should never get here!");
return NS_ERROR_FAILURE;

Просмотреть файл

@ -129,10 +129,14 @@ XPCOMUtils.defineLazyGetter(this, "gMmsConnection", function () {
proxy: null,
port: null,
// For keeping track of the radio status.
radioDisabled: false,
proxyInfo: null,
settings: ["ril.mms.mmsc",
"ril.mms.mmsproxy",
"ril.mms.mmsport"],
"ril.mms.mmsport",
"ril.radio.disabled"],
connected: false,
//A queue to buffer the MMS HTTP requests when the MMS network
@ -186,11 +190,19 @@ XPCOMUtils.defineLazyGetter(this, "gMmsConnection", function () {
this.port = Services.prefs.getIntPref("ril.mms.mmsport");
this.updateProxyInfo();
} catch (e) {
if (DEBUG) debug("Unable to initialize the MMS proxy settings from the" +
"preference. This could happen at the first-run. Should be" +
"available later.");
if (DEBUG) debug("Unable to initialize the MMS proxy settings from " +
"the preference. This could happen at the first-run. " +
"Should be available later.");
this.clearMmsProxySettings();
}
try {
this.radioDisabled = Services.prefs.getBoolPref("ril.radio.disabled");
} catch (e) {
if (DEBUG) debug("Getting preference 'ril.radio.disabled' fails.");
this.radioDisabled = false;
}
this.connected = gRIL.getDataCallStateByType("mms") ==
Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
},
@ -319,6 +331,16 @@ XPCOMUtils.defineLazyGetter(this, "gMmsConnection", function () {
break;
}
case kPrefenceChangedObserverTopic: {
if (data == "ril.radio.disabled") {
try {
this.radioDisabled = Services.prefs.getBoolPref("ril.radio.disabled");
} catch (e) {
if (DEBUG) debug("Updating preference 'ril.radio.disabled' fails.");
this.radioDisabled = false;
}
return;
}
try {
switch (data) {
case "ril.mms.mmsc":
@ -1427,20 +1449,21 @@ MmsService.prototype = {
let self = this;
let sendTransactionCb = function sendTransactionCb(aRecordId, aIsSentSuccess) {
if (DEBUG) debug("The success status of sending transaction: " + aIsSentSuccess);
let sendTransactionCb = function sendTransactionCb(aRecordId, aErrorCode) {
if (DEBUG) debug("The error code of sending transaction: " + aErrorCode);
let isSentSuccess = (aErrorCode == Ci.nsIMobileMessageCallback.SUCCESS_NO_ERROR);
gMobileMessageDatabaseService
.setMessageDelivery(aRecordId,
null,
aIsSentSuccess ? DELIVERY_SENT : DELIVERY_ERROR,
aIsSentSuccess ? null : DELIVERY_STATUS_ERROR,
isSentSuccess ? DELIVERY_SENT : DELIVERY_ERROR,
isSentSuccess ? null : DELIVERY_STATUS_ERROR,
function notifySetDeliveryResult(aRv, aDomMessage) {
if (DEBUG) debug("Marking the delivery state/staus is done. Notify sent or failed.");
// TODO bug 832140 handle !Components.isSuccessCode(aRv)
if (!aIsSentSuccess) {
if (!isSentSuccess) {
if (DEBUG) debug("Send MMS fail. aParams.receivers = " +
JSON.stringify(aParams.receivers));
aRequest.notifySendMessageFailed(Ci.nsIMobileMessageCallback.INTERNAL_ERROR);
aRequest.notifySendMessageFailed(aErrorCode);
Services.obs.notifyObservers(aDomMessage, kSmsFailedObserverTopic, null);
return;
}
@ -1461,6 +1484,21 @@ MmsService.prototype = {
.saveSendingMessage(savableMessage,
function notifySendingResult(aRv, aDomMessage) {
if (DEBUG) debug("Saving sending message is done. Start to send.");
// For radio disabled error.
if(gMmsConnection.radioDisabled) {
if (DEBUG) debug("Error! Radio is disabled when sending MMS.");
sendTransactionCb(aDomMessage.id, Ci.nsIMobileMessageCallback.RADIO_DISABLED_ERROR);
return;
}
// For SIM card is not ready.
if(gRIL.rilContext.cardState != "ready") {
if (DEBUG) debug("Error! SIM card is not ready when sending MMS.");
sendTransactionCb(aDomMessage.id, Ci.nsIMobileMessageCallback.NO_SIM_CARD_ERROR);
return;
}
// TODO bug 832140 handle !Components.isSuccessCode(aRv)
Services.obs.notifyObservers(aDomMessage, kSmsSendingObserverTopic, null);
let sendTransaction;
@ -1468,13 +1506,15 @@ MmsService.prototype = {
sendTransaction = new SendTransaction(savableMessage);
} catch (e) {
if (DEBUG) debug("Exception: fail to create a SendTransaction instance.");
sendTransactionCb(aDomMessage.id, false);
sendTransactionCb(aDomMessage.id, Ci.nsIMobileMessageCallback.INTERNAL_ERROR);
return;
}
sendTransaction.run(function callback(aMmsStatus, aMsg) {
let isSentSuccess = (aMmsStatus == MMS.MMS_PDU_ERROR_OK);
if (DEBUG) debug("The sending status of sendTransaction.run(): " + aMmsStatus);
sendTransactionCb(aDomMessage.id, isSentSuccess);
sendTransactionCb(aDomMessage.id, isSentSuccess?
Ci.nsIMobileMessageCallback.SUCCESS_NO_ERROR:
Ci.nsIMobileMessageCallback.INTERNAL_ERROR);
});
});
},

Просмотреть файл

@ -2292,18 +2292,38 @@ this.PduHelper = {
let octetArray = Octet.decodeMultiple(data, contentEnd);
let content = null;
if (octetArray) {
// If the content is a SMIL type, convert it to a string.
// We hope to save and expose the SMIL content as a string way.
if (headers["content-type"].media == "application/smil") {
let charset = headers["content-type"].params &&
headers["content-type"].params.charset
? headers["content-type"].params.charset["charset"]
: null;
content = this.decodeStringContent(octetArray, charset);
let charset = headers["content-type"].params &&
headers["content-type"].params.charset
? headers["content-type"].params.charset.charset
: null;
let mimeType = headers["content-type"].media;
if (mimeType) {
if (mimeType == "application/smil") {
// If the content is a SMIL type, convert it to a string.
// We hope to save and expose the SMIL content in a string way.
content = this.decodeStringContent(octetArray, charset);
} else if (mimeType.indexOf("text/") == 0 && charset != "utf-8") {
// If the content is a "text/plain" type, we have to make sure
// the encoding of the blob content should always be "utf-8".
let tmpStr = this.decodeStringContent(octetArray, charset);
let encoder = new TextEncoder("UTF-8");
content = new Blob([encoder.encode(tmpStr)], {type : mimeType});
// Make up the missing encoding info.
if (!headers["content-type"].params) {
headers["content-type"].params = {};
}
if (!headers["content-type"].params.charset) {
headers["content-type"].params.charset = {};
}
headers["content-type"].params.charset.charset = "utf-8";
}
}
if (!content) {
content = new Blob([octetArray],
{type : headers["content-type"].media});
content = new Blob([octetArray], {type : mimeType});
}
}

Просмотреть файл

@ -69,15 +69,11 @@ this.PduHelper = {
* Content type of incoming SI message, should be "text/vnd.wap.si" or
* "application/vnd.wap.sic".
* Default value is "application/vnd.wap.sic".
* @param msg [optional]
* Optional target object for decoding.
*
* @return A SI message object or null in case of errors found.
*/
parse: function parse_si(data, contentType, msg) {
if (!msg) {
msg = {};
}
parse: function parse_si(data, contentType) {
let msg = {};
/**
* Message is compressed by WBXML, decode into string.
@ -100,6 +96,7 @@ this.PduHelper = {
WBXML.PduHelper.parse(data, appToken, msg);
msg.contentType = "text/vnd.wap.si";
return msg;
}
@ -110,6 +107,7 @@ this.PduHelper = {
let stringData = WSP.Octet.decodeMultiple(data, data.array.length);
msg.publicId = PUBLIC_IDENTIFIER_SI;
msg.content = WSP.PduHelper.decodeStringContent(stringData, "UTF-8");
msg.contentType = "text/vnd.wap.si";
return msg;
}

Просмотреть файл

@ -30,15 +30,11 @@ this.PduHelper = {
* Content type of incoming SL message, should be "text/vnd.wap.sl" or
* "application/vnd.wap.slc".
* Default value is "application/vnd.wap.slc".
* @param msg [optional]
* Optional target object for decoding.
*
* @return A SL message object or null in case of errors found.
*/
parse: function parse_sl(data, contentType, msg) {
if (!msg) {
msg = {};
}
parse: function parse_sl(data, contentType) {
let msg = {};
/**
* Message is compressed by WBXML, decode into string.
@ -55,6 +51,7 @@ this.PduHelper = {
WBXML.PduHelper.parse(data, appToken, msg);
msg.contentType = "text/vnd.wap.sl";
return msg;
}
@ -65,6 +62,7 @@ this.PduHelper = {
let stringData = WSP.Octet.decodeMultiple(data, data.array.length);
msg.publicId = PUBLIC_IDENTIFIER_SL;
msg.content = WSP.PduHelper.decodeStringContent(stringData, "UTF-8");
msg.contentType = "text/vnd.wap.sl";
return msg;
}

Просмотреть файл

@ -28,6 +28,10 @@ XPCOMUtils.defineLazyGetter(this, "SL", function () {
return SL;
});
XPCOMUtils.defineLazyServiceGetter(this, "gSystemMessenger",
"@mozilla.org/system-message-internal;1",
"nsISystemMessagesInternal");
/**
* Helpers for WAP PDU processing.
*/
@ -80,23 +84,28 @@ this.WapPushManager = {
* @see http://technical.openmobilealliance.org/tech/omna/omna-wsp-content-type.aspx
*/
let contentType = options.headers["content-type"].media;
let msg = { contentType: contentType };
let msg;
if (contentType === "text/vnd.wap.si" ||
contentType === "application/vnd.wap.sic") {
SI.PduHelper.parse(data, contentType, msg);
msg = SI.PduHelper.parse(data, contentType);
} else if (contentType === "text/vnd.wap.sl" ||
contentType === "application/vnd.wap.slc") {
SL.PduHelper.parse(data, contentType, msg);
} else if (contentType === "text/vnd.wap.connectivity-xml" ||
contentType === "application/vnd.wap.connectivity-wbxml") {
// TODO: Bug 869291 - Support Receiving WAP-Push-CP
msg = SL.PduHelper.parse(data, contentType);
} else {
// TODO: Bug 869291 - Support Receiving WAP-Push-CP
// Unsupported type, provide raw data.
msg.content = data.array;
msg = {
contentType: contentType,
content: data.array
};
}
// TODO: Bug 853782 - Notify receiving of WAP Push messages
gSystemMessenger.broadcastMessage("wappush-received", {
contentType: msg.contentType,
content: msg.content
});
},
/**

Просмотреть файл

@ -68,7 +68,7 @@ this.readStringTable = function decode_wbxml_read_string_table(start, stringTabl
}
// Read string table
return WSP.PduHelper.decodeStringContent(stringTable.slice(start, end),
return WSP.PduHelper.decodeStringContent(stringTable.subarray(start, end),
charset);
};

Просмотреть файл

@ -14,27 +14,28 @@ function run_test() {
* SI in Plain text
*/
add_test(function test_si_parse_plain_text() {
let msg = {};
let contentType = "";
let data = {};
contentType = "text/vnd.wap.si";
data.array = [0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x27, 0x31,
0x2E, 0x30, 0x27, 0x3F, 0x3E, 0x0A, 0x3C, 0x73,
0x69, 0x3E, 0x3C, 0x69, 0x6E, 0x64, 0x69, 0x63,
0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x68, 0x72,
0x65, 0x66, 0x3D, 0x27, 0x68, 0x74, 0x74, 0x70,
0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x6F,
0x72, 0x65, 0x69, 0x6C, 0x6C, 0x79, 0x2E, 0x63,
0x6F, 0x6D, 0x27, 0x3E, 0x43, 0x68, 0x65, 0x63,
0x6B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x77,
0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x3C, 0x2F,
0x69, 0x6E, 0x64, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6F, 0x6E, 0x3E, 0x3C, 0x2F, 0x73, 0x69, 0x3E];
data.array = new Uint8Array([
0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x27, 0x31,
0x2E, 0x30, 0x27, 0x3F, 0x3E, 0x0A, 0x3C, 0x73,
0x69, 0x3E, 0x3C, 0x69, 0x6E, 0x64, 0x69, 0x63,
0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x68, 0x72,
0x65, 0x66, 0x3D, 0x27, 0x68, 0x74, 0x74, 0x70,
0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x6F,
0x72, 0x65, 0x69, 0x6C, 0x6C, 0x79, 0x2E, 0x63,
0x6F, 0x6D, 0x27, 0x3E, 0x43, 0x68, 0x65, 0x63,
0x6B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x77,
0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x3C, 0x2F,
0x69, 0x6E, 0x64, 0x69, 0x63, 0x61, 0x74, 0x69,
0x6F, 0x6E, 0x3E, 0x3C, 0x2F, 0x73, 0x69, 0x3E
]);
data.offset = 0;
let result = "<?xml version='1.0'?>\n<si><indication href='http://www.oreilly.com'>Check this website</indication></si>";
SI.PduHelper.parse(data, contentType, msg);
let msg = SI.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();
@ -49,10 +50,12 @@ add_test(function test_si_parse_wbxml_empty() {
let data = {};
contentType = "application/vnd.wap.sic";
data.array = [0x02, 0x05, 0x6A, 0x00, 0x05];
data.array = new Uint8Array([
0x02, 0x05, 0x6A, 0x00, 0x05
]);
data.offset = 0;
let result = "<si/>";
SI.PduHelper.parse(data, contentType, msg);
let msg = SI.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();
@ -67,14 +70,16 @@ add_test(function test_si_parse_wbxml_empty_public_id_string_table() {
let data = {};
contentType = "application/vnd.wap.sic";
data.array = [0x02, 0x00, 0x00, 0x6A, 0x1C, 0x2D, 0x2F, 0x2F,
0x57, 0x41, 0x50, 0x46, 0x4F, 0x52, 0x55, 0x4D,
0x2F, 0x2F, 0x44, 0x54, 0x44, 0x20, 0x53, 0x49,
0x20, 0x31, 0x2E, 0x30, 0x2F, 0x2F, 0x45, 0x4E,
0x00, 0x05];
data.array = new Uint8Array([
0x02, 0x00, 0x00, 0x6A, 0x1C, 0x2D, 0x2F, 0x2F,
0x57, 0x41, 0x50, 0x46, 0x4F, 0x52, 0x55, 0x4D,
0x2F, 0x2F, 0x44, 0x54, 0x44, 0x20, 0x53, 0x49,
0x20, 0x31, 0x2E, 0x30, 0x2F, 0x2F, 0x45, 0x4E,
0x00, 0x05
]);
data.offset = 0;
let result = "<si/>";
SI.PduHelper.parse(data, contentType, msg);
let msg = SI.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();
@ -89,15 +94,17 @@ add_test(function test_si_parse_wbxml_with_href() {
let data = {};
contentType = "application/vnd.wap.sic";
data.array = [0x02, 0x05, 0x6A, 0x00, 0x45, 0xC6, 0x0D, 0x03,
0x6F, 0x72, 0x65, 0x69, 0x6C, 0x6C, 0x79, 0x00,
0x85, 0x01, 0x03, 0x43, 0x68, 0x65, 0x63, 0x6B,
0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x77, 0x65,
0x62, 0x73, 0x69, 0x74, 0x65, 0x00, 0x01, 0x01];
data.array = new Uint8Array([
0x02, 0x05, 0x6A, 0x00, 0x45, 0xC6, 0x0D, 0x03,
0x6F, 0x72, 0x65, 0x69, 0x6C, 0x6C, 0x79, 0x00,
0x85, 0x01, 0x03, 0x43, 0x68, 0x65, 0x63, 0x6B,
0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x77, 0x65,
0x62, 0x73, 0x69, 0x74, 0x65, 0x00, 0x01, 0x01
]);
data.offset = 0;
let result = "<si><indication href=\"http://www.oreilly.com/\">" +
"Check this website</indication></si>";
SI.PduHelper.parse(data, contentType, msg);
let msg = SI.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();
@ -112,21 +119,23 @@ add_test(function test_si_parse_wbxml_with_href_date() {
let data = {};
contentType = "application/vnd.wap.sic";
data.array = [0x02, 0x05, 0x6A, 0x00, 0x45, 0xC6, 0x0D, 0x03,
0x78, 0x79, 0x7A, 0x00, 0x85, 0x03, 0x65, 0x6D,
0x61, 0x69, 0x6C, 0x2F, 0x31, 0x32, 0x33, 0x2F,
0x61, 0x62, 0x63, 0x2E, 0x77, 0x6D, 0x6C, 0x00,
0x0A, 0xC3, 0x07, 0x19, 0x99, 0x06, 0x25, 0x15,
0x23, 0x15, 0x10, 0xC3, 0x04, 0x19, 0x99, 0x06,
0x30, 0x01, 0x03, 0x59, 0x6F, 0x75, 0x20, 0x68,
0x61, 0x76, 0x65, 0x20, 0x34, 0x20, 0x6E, 0x65,
0x77, 0x20, 0x65, 0x6D, 0x61, 0x69, 0x6C, 0x73,
0x00, 0x01, 0x01];
data.array = new Uint8Array([
0x02, 0x05, 0x6A, 0x00, 0x45, 0xC6, 0x0D, 0x03,
0x78, 0x79, 0x7A, 0x00, 0x85, 0x03, 0x65, 0x6D,
0x61, 0x69, 0x6C, 0x2F, 0x31, 0x32, 0x33, 0x2F,
0x61, 0x62, 0x63, 0x2E, 0x77, 0x6D, 0x6C, 0x00,
0x0A, 0xC3, 0x07, 0x19, 0x99, 0x06, 0x25, 0x15,
0x23, 0x15, 0x10, 0xC3, 0x04, 0x19, 0x99, 0x06,
0x30, 0x01, 0x03, 0x59, 0x6F, 0x75, 0x20, 0x68,
0x61, 0x76, 0x65, 0x20, 0x34, 0x20, 0x6E, 0x65,
0x77, 0x20, 0x65, 0x6D, 0x61, 0x69, 0x6C, 0x73,
0x00, 0x01, 0x01
]);
data.offset = 0;
let result = "<si><indication href=\"http://www.xyz.com/email/123/abc.wml\"" +
" created=\"1999-06-25T15:23:15Z\" si-expires=\"1999-06-30T00:00:00Z\">" +
"You have 4 new emails</indication></si>";
SI.PduHelper.parse(data, contentType, msg);
let msg = SI.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();
@ -141,21 +150,23 @@ add_test(function test_si_parse_wbxml_with_attr_string_table() {
let data = {};
contentType = "application/vnd.wap.sic";
data.array = [0x02, 0x05, 0x6A, 0x28, 0x65, 0x6D, 0x61, 0x69,
0x6C, 0x2F, 0x31, 0x32, 0x33, 0x2F, 0x61, 0x62,
0x63, 0x2E, 0x77, 0x6D, 0x6C, 0x00, 0x59, 0x6F,
0x75, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x34,
0x20, 0x6E, 0x65, 0x77, 0x20, 0x65, 0x6D, 0x61,
0x69, 0x6C, 0x73, 0x00, 0x45, 0xC6, 0x0D, 0x03,
0x78, 0x79, 0x7A, 0x00, 0x85, 0x83, 0x00, 0x0A,
0xC3, 0x07, 0x19, 0x99, 0x06, 0x25, 0x15, 0x23,
0x15, 0x10, 0xC3, 0x04, 0x19, 0x99, 0x06, 0x30,
0x01, 0x83, 0x12, 0x01, 0x01];
data.array = new Uint8Array([
0x02, 0x05, 0x6A, 0x28, 0x65, 0x6D, 0x61, 0x69,
0x6C, 0x2F, 0x31, 0x32, 0x33, 0x2F, 0x61, 0x62,
0x63, 0x2E, 0x77, 0x6D, 0x6C, 0x00, 0x59, 0x6F,
0x75, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x34,
0x20, 0x6E, 0x65, 0x77, 0x20, 0x65, 0x6D, 0x61,
0x69, 0x6C, 0x73, 0x00, 0x45, 0xC6, 0x0D, 0x03,
0x78, 0x79, 0x7A, 0x00, 0x85, 0x83, 0x00, 0x0A,
0xC3, 0x07, 0x19, 0x99, 0x06, 0x25, 0x15, 0x23,
0x15, 0x10, 0xC3, 0x04, 0x19, 0x99, 0x06, 0x30,
0x01, 0x83, 0x12, 0x01, 0x01
]);
data.offset = 0;
let result = "<si><indication href=\"http://www.xyz.com/email/123/abc.wml\"" +
" created=\"1999-06-25T15:23:15Z\" si-expires=\"1999-06-30T00:00:00Z\">" +
"You have 4 new emails</indication></si>";
SI.PduHelper.parse(data, contentType, msg);
let msg = SI.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();

Просмотреть файл

@ -13,22 +13,23 @@ function run_test() {
* SL in plain text
*/
add_test(function test_sl_parse_plain_text() {
let msg = {};
let contentType = "";
let data = {};
contentType = "text/vnd.wap.sl";
data.array = [0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x27, 0x31,
0x2E, 0x30, 0x27, 0x3F, 0x3E, 0x0A, 0x3C, 0x73,
0x6C, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3D, 0x27,
0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x77,
0x77, 0x77, 0x2E, 0x6F, 0x72, 0x65, 0x69, 0x6C,
0x6C, 0x79, 0x2E, 0x63, 0x6F, 0x6D, 0x27, 0x2F,
0x3E];
data.array = new Uint8Array([
0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20, 0x76, 0x65,
0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x27, 0x31,
0x2E, 0x30, 0x27, 0x3F, 0x3E, 0x0A, 0x3C, 0x73,
0x6C, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3D, 0x27,
0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x77,
0x77, 0x77, 0x2E, 0x6F, 0x72, 0x65, 0x69, 0x6C,
0x6C, 0x79, 0x2E, 0x63, 0x6F, 0x6D, 0x27, 0x2F,
0x3E
]);
data.offset = 0;
let result = "<?xml version='1.0'?>\n<sl href='http://www.oreilly.com'/>";
SL.PduHelper.parse(data, contentType, msg);
let msg = SL.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();
@ -43,12 +44,14 @@ add_test(function test_sl_parse_wbxml() {
let data = {};
contentType = "application/vnd.wap.slc";
data.array = [0x03, 0x06, 0x6A, 0x00, 0x85, 0x0A, 0x03, 0x6F,
0x72, 0x65, 0x69, 0x6C, 0x6C, 0x79, 0x00, 0x85,
0x01];
data.array = new Uint8Array([
0x03, 0x06, 0x6A, 0x00, 0x85, 0x0A, 0x03, 0x6F,
0x72, 0x65, 0x69, 0x6C, 0x6C, 0x79, 0x00, 0x85,
0x01
]);
data.offset = 0;
let result = "<sl href=\"http://www.oreilly.com/\"/>";
SL.PduHelper.parse(data, contentType, msg);
let msg = SL.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();
@ -63,15 +66,17 @@ add_test(function test_sl_parse_wbxml_public_id_string_table() {
let data = {};
contentType = "application/vnd.wap.slc";
data.array = [0x03, 0x00, 0x00, 0x6A, 0x1C, 0x2D, 0x2F, 0x2F,
0x57, 0x41, 0x50, 0x46, 0x4F, 0x52, 0x55, 0x4D,
0x2F, 0x2F, 0x44, 0x54, 0x44, 0x20, 0x53, 0x4C,
0x20, 0x31, 0x2E, 0x30, 0x2F, 0x2F, 0x45, 0x4E,
0x00, 0x85, 0x0A, 0x03, 0x6F, 0x72, 0x65, 0x69,
0x6C, 0x6C, 0x79, 0x00, 0x85, 0x01];
data.array = new Uint8Array([
0x03, 0x00, 0x00, 0x6A, 0x1C, 0x2D, 0x2F, 0x2F,
0x57, 0x41, 0x50, 0x46, 0x4F, 0x52, 0x55, 0x4D,
0x2F, 0x2F, 0x44, 0x54, 0x44, 0x20, 0x53, 0x4C,
0x20, 0x31, 0x2E, 0x30, 0x2F, 0x2F, 0x45, 0x4E,
0x00, 0x85, 0x0A, 0x03, 0x6F, 0x72, 0x65, 0x69,
0x6C, 0x6C, 0x79, 0x00, 0x85, 0x01
]);
data.offset = 0;
let result = "<sl href=\"http://www.oreilly.com/\"/>";
SL.PduHelper.parse(data, contentType, msg);
let msg = SL.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();
@ -86,12 +91,14 @@ add_test(function test_sl_parse_wbxml_with_string_table() {
let data = {};
contentType = "application/vnd.wap.slc";
data.array = [0x03, 0x06, 0x6A, 0x08, 0x6F, 0x72, 0x65, 0x69,
0x6C, 0x6C, 0x79, 0x00, 0x85, 0x0A, 0x83, 0x00,
0x85, 0x01];
data.array = new Uint8Array([
0x03, 0x06, 0x6A, 0x08, 0x6F, 0x72, 0x65, 0x69,
0x6C, 0x6C, 0x79, 0x00, 0x85, 0x0A, 0x83, 0x00,
0x85, 0x01
]);
data.offset = 0;
let result = "<sl href=\"http://www.oreilly.com/\"/>";
SL.PduHelper.parse(data, contentType, msg);
let msg = SL.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();

Просмотреть файл

@ -301,11 +301,13 @@ public class GeckoSmsManager
* defined in dom/mobilemessage/interfaces/nsISmsRequestManager.idl. They are owned
* owned by the interface.
*/
public final static int kNoError = 0;
public final static int kNoSignalError = 1;
public final static int kNotFoundError = 2;
public final static int kUnknownError = 3;
public final static int kInternalError = 4;
public final static int kNoError = 0;
public final static int kNoSignalError = 1;
public final static int kNotFoundError = 2;
public final static int kUnknownError = 3;
public final static int kInternalError = 4;
public final static int kNoSimCardError = 5;
public final static int kRadioDisabledError = 6;
private final static int kMaxMessageSize = 160;