diff --git a/b2g/chrome/content/settings.js b/b2g/chrome/content/settings.js
index 11bfcb3f14b5..54bc97b00fd2 100644
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -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 ====================
diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index d35396dd2430..2c89343222fb 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
{
- "revision": "123a4b7418cf70cee6862cc407572ab97ae570fd",
+ "revision": "fc8faac211332ebdbbea8bf11f3ca2deba541cee",
"repo_path": "/integration/gaia-central"
}
diff --git a/dom/contacts/ContactManager.js b/dom/contacts/ContactManager.js
index 026d53ba46b8..d641f088108a 100644
--- a/dom/contacts/ContactManager.js
+++ b/dom/contacts/ContactManager.js
@@ -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];
diff --git a/dom/contacts/ContactManager.manifest b/dom/contacts/ContactManager.manifest
index 0b34c5833f65..20484b625633 100644
--- a/dom/contacts/ContactManager.manifest
+++ b/dom/contacts/ContactManager.manifest
@@ -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}
diff --git a/dom/contacts/fallback/ContactDB.jsm b/dom/contacts/fallback/ContactDB.jsm
index 89d0248aabdb..7df0dd53886a 100644
--- a/dom/contacts/fallback/ContactDB.jsm
+++ b/dom/contacts/fallback/ContactDB.jsm
@@ -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) {
diff --git a/dom/contacts/tests/test_contacts_basics.html b/dom/contacts/tests/test_contacts_basics.html
index 51a7305fc395..8d617dd47ed1 100644
--- a/dom/contacts/tests/test_contacts_basics.html
+++ b/dom/contacts/tests/test_contacts_basics.html
@@ -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,
diff --git a/dom/interfaces/contacts/nsIContactProperties.idl b/dom/interfaces/contacts/nsIContactProperties.idl
index aa0d482f8af4..e5fe19f41537 100644
--- a/dom/interfaces/contacts/nsIContactProperties.idl
+++ b/dom/interfaces/contacts/nsIContactProperties.idl
@@ -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[]
};
diff --git a/dom/messages/SystemMessagePermissionsChecker.jsm b/dom/messages/SystemMessagePermissionsChecker.jsm
index 062aa13d398a..5965331e4b86 100644
--- a/dom/messages/SystemMessagePermissionsChecker.jsm
+++ b/dom/messages/SystemMessagePermissionsChecker.jsm
@@ -97,7 +97,10 @@ this.SystemMessagePermissionsTable = {
},
"ussd-received": {
"mobileconnection": []
- }
+ },
+ "wappush-received": {
+ "sms": []
+ },
};
this.SystemMessagePermissionsChecker = {
diff --git a/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl b/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl
index 0b921be210c3..5d7ed281a10d 100644
--- a/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl
+++ b/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl
@@ -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)]
diff --git a/dom/mobilemessage/interfaces/nsIMobileMessageCallback.idl b/dom/mobilemessage/interfaces/nsIMobileMessageCallback.idl
index 1cf2201aecec..37b0c5a1777f 100644
--- a/dom/mobilemessage/interfaces/nsIMobileMessageCallback.idl
+++ b/dom/mobilemessage/interfaces/nsIMobileMessageCallback.idl
@@ -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.
diff --git a/dom/mobilemessage/src/MobileMessageCallback.cpp b/dom/mobilemessage/src/MobileMessageCallback.cpp
index edc7ee54485b..3b5961d75173 100644
--- a/dom/mobilemessage/src/MobileMessageCallback.cpp
+++ b/dom/mobilemessage/src/MobileMessageCallback.cpp
@@ -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;
diff --git a/dom/mobilemessage/src/ril/MmsService.js b/dom/mobilemessage/src/ril/MmsService.js
index d5ec6c34c28e..639e06d6b733 100644
--- a/dom/mobilemessage/src/ril/MmsService.js
+++ b/dom/mobilemessage/src/ril/MmsService.js
@@ -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);
});
});
},
diff --git a/dom/mobilemessage/src/ril/WspPduHelper.jsm b/dom/mobilemessage/src/ril/WspPduHelper.jsm
index 7047d905eec5..ff68e6493694 100644
--- a/dom/mobilemessage/src/ril/WspPduHelper.jsm
+++ b/dom/mobilemessage/src/ril/WspPduHelper.jsm
@@ -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});
}
}
diff --git a/dom/wappush/src/gonk/SiPduHelper.jsm b/dom/wappush/src/gonk/SiPduHelper.jsm
index dbcc6773f776..95585f5f2045 100644
--- a/dom/wappush/src/gonk/SiPduHelper.jsm
+++ b/dom/wappush/src/gonk/SiPduHelper.jsm
@@ -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;
}
diff --git a/dom/wappush/src/gonk/SlPduHelper.jsm b/dom/wappush/src/gonk/SlPduHelper.jsm
index 24bddd2d6a1e..2fc1e9430dd9 100644
--- a/dom/wappush/src/gonk/SlPduHelper.jsm
+++ b/dom/wappush/src/gonk/SlPduHelper.jsm
@@ -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;
}
diff --git a/dom/wappush/src/gonk/WapPushManager.js b/dom/wappush/src/gonk/WapPushManager.js
index 3fc5753263e9..d017ddd92bd3 100644
--- a/dom/wappush/src/gonk/WapPushManager.js
+++ b/dom/wappush/src/gonk/WapPushManager.js
@@ -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
+ });
},
/**
diff --git a/dom/wappush/src/gonk/WbxmlPduHelper.jsm b/dom/wappush/src/gonk/WbxmlPduHelper.jsm
index 808e3077e271..d625261d33a2 100644
--- a/dom/wappush/src/gonk/WbxmlPduHelper.jsm
+++ b/dom/wappush/src/gonk/WbxmlPduHelper.jsm
@@ -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);
};
diff --git a/dom/wappush/tests/test_si_pdu_helper.js b/dom/wappush/tests/test_si_pdu_helper.js
index 248cc041bc15..6c070265f96e 100644
--- a/dom/wappush/tests/test_si_pdu_helper.js
+++ b/dom/wappush/tests/test_si_pdu_helper.js
@@ -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 = "\nCheck this website";
- 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.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.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 = "" +
"Check this website";
- 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 = "" +
"You have 4 new emails";
- 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 = "" +
"You have 4 new emails";
- SI.PduHelper.parse(data, contentType, msg);
+ let msg = SI.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();
diff --git a/dom/wappush/tests/test_sl_pdu_helper.js b/dom/wappush/tests/test_sl_pdu_helper.js
index 28993df6f5be..9b6a0e7ebb99 100644
--- a/dom/wappush/tests/test_sl_pdu_helper.js
+++ b/dom/wappush/tests/test_sl_pdu_helper.js
@@ -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 = "\n";
- 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.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.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.PduHelper.parse(data, contentType, msg);
+ let msg = SL.PduHelper.parse(data, contentType);
do_check_eq(msg.content, result);
run_next_test();
diff --git a/embedding/android/GeckoSmsManager.java b/embedding/android/GeckoSmsManager.java
index 7be4ee4fd8a8..c22a89ea0672 100644
--- a/embedding/android/GeckoSmsManager.java
+++ b/embedding/android/GeckoSmsManager.java
@@ -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;