From 9c6c7f083c5b13b8db9272bcb740af812787feff Mon Sep 17 00:00:00 2001 From: Chuck Lee Date: Mon, 17 Jun 2013 18:49:03 +0800 Subject: [PATCH 01/22] Bug 853782 - 0001. Set content type of wap push message. r=vicamo --- dom/wappush/src/gonk/SiPduHelper.jsm | 10 ++++------ dom/wappush/src/gonk/SlPduHelper.jsm | 10 ++++------ dom/wappush/src/gonk/WapPushManager.js | 16 +++++++++------- 3 files changed, 17 insertions(+), 19 deletions(-) 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..0b1b520f5da7 100644 --- a/dom/wappush/src/gonk/WapPushManager.js +++ b/dom/wappush/src/gonk/WapPushManager.js @@ -80,20 +80,22 @@ 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 From 8cd77f3da4efd2f8532a2ac46b0218a64d57444e Mon Sep 17 00:00:00 2001 From: Chuck Lee Date: Mon, 17 Jun 2013 16:37:59 +0800 Subject: [PATCH 02/22] Bug 853782 - 0002. Notify receiving of WAP Push by System Message. r=vicamo --- dom/messages/SystemMessagePermissionsChecker.jsm | 5 ++++- dom/wappush/src/gonk/WapPushManager.js | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) 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/wappush/src/gonk/WapPushManager.js b/dom/wappush/src/gonk/WapPushManager.js index 0b1b520f5da7..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. */ @@ -98,7 +102,10 @@ this.WapPushManager = { }; } - // TODO: Bug 853782 - Notify receiving of WAP Push messages + gSystemMessenger.broadcastMessage("wappush-received", { + contentType: msg.contentType, + content: msg.content + }); }, /** From 0920d1133323a095384e3e112bb3ca1042fb29e1 Mon Sep 17 00:00:00 2001 From: Chuck Lee Date: Mon, 17 Jun 2013 18:49:06 +0800 Subject: [PATCH 03/22] Bug 853782 - 0003. Treat PDU data in correct type, Uint8Array. r=vicamo --- dom/wappush/src/gonk/WbxmlPduHelper.jsm | 2 +- dom/wappush/tests/test_si_pdu_helper.js | 113 +++++++++++++----------- dom/wappush/tests/test_sl_pdu_helper.js | 57 ++++++------ 3 files changed, 95 insertions(+), 77 deletions(-) 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(); From 44281ac35093f826af4f167e4e927dcdedd0ddb1 Mon Sep 17 00:00:00 2001 From: Gene Lian Date: Tue, 18 Jun 2013 16:13:39 +0800 Subject: [PATCH 04/22] Bug 880648 - [MMS] Accented characters are not correctly sent/received in a MMS (part 1, content blob should be encoded by utf-8). r=vicamo a=leo+ --- .../interfaces/nsIDOMMozMmsMessage.idl | 3 +- dom/mobilemessage/src/ril/WspPduHelper.jsm | 42 ++++++++++++++----- 2 files changed, 34 insertions(+), 11 deletions(-) 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/src/ril/WspPduHelper.jsm b/dom/mobilemessage/src/ril/WspPduHelper.jsm index 7047d905eec5..0613b50d0907 100644 --- a/dom/mobilemessage/src/ril/WspPduHelper.jsm +++ b/dom/mobilemessage/src/ril/WspPduHelper.jsm @@ -2292,18 +2292,40 @@ 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 = {}; + } + if (!headers["content-type"].params.charset.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}); } } From ed62156249558f5b9e49cefa02218d555c8e6200 Mon Sep 17 00:00:00 2001 From: Gene Lian Date: Tue, 18 Jun 2013 16:25:52 +0800 Subject: [PATCH 05/22] Backed out changeset 66523a98fe19 --- .../interfaces/nsIDOMMozMmsMessage.idl | 3 +- dom/mobilemessage/src/ril/WspPduHelper.jsm | 42 +++++-------------- 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl b/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl index 5d7ed281a10d..0b921be210c3 100644 --- a/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl +++ b/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl @@ -11,8 +11,7 @@ dictionary MmsAttachment { DOMString? id; DOMString? location; - nsIDOMBlob content; // If the content blob is a text/plain type, the encoding - // for text should always be "utf-8". + nsIDOMBlob content; }; [scriptable, builtinclass, uuid(2e5e1c16-b7af-11e2-af04-8f4b1610a600)] diff --git a/dom/mobilemessage/src/ril/WspPduHelper.jsm b/dom/mobilemessage/src/ril/WspPduHelper.jsm index 0613b50d0907..7047d905eec5 100644 --- a/dom/mobilemessage/src/ril/WspPduHelper.jsm +++ b/dom/mobilemessage/src/ril/WspPduHelper.jsm @@ -2292,40 +2292,18 @@ this.PduHelper = { let octetArray = Octet.decodeMultiple(data, contentEnd); let content = null; if (octetArray) { - 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 = {}; - } - if (!headers["content-type"].params.charset.charset) { - headers["content-type"].params.charset.charset = "utf-8"; - } - } + // 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); } - if (!content) { - content = new Blob([octetArray], {type : mimeType}); + content = new Blob([octetArray], + {type : headers["content-type"].media}); } } From dfee1a5c53a0f21a5b801814e1d400209bf55782 Mon Sep 17 00:00:00 2001 From: Gene Lian Date: Tue, 18 Jun 2013 16:28:55 +0800 Subject: [PATCH 06/22] Bug 880648 - [MMS] Accented characters are not correctly sent/received in a MMS (part 1, content blob should be encoded by utf-8). r=vicamo a=leo+ --- .../interfaces/nsIDOMMozMmsMessage.idl | 3 +- dom/mobilemessage/src/ril/WspPduHelper.jsm | 40 ++++++++++++++----- 2 files changed, 32 insertions(+), 11 deletions(-) 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/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}); } } From 80cec5a2d15c2c1a4a0a464c89b3be8bf542121e Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 02:46:24 -0700 Subject: [PATCH 07/22] Bumping gaia.json for 2 gaia-central revision(s) Truncated some number of revisions since the previous bump. ======== https://hg.mozilla.org/integration/gaia-central/rev/37fad82492ac Author: David Flanagan Desc: Merge pull request #10452 from davidflanagan/bug883250 Bug 883250: don't auto-punctuate after punctuation r=rudylu ======== https://hg.mozilla.org/integration/gaia-central/rev/243c24d81ed0 Author: David Flanagan Desc: Bug 883250: don't auto-punctuate after punctuation --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index d35396dd2430..1e25ca30ed25 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "123a4b7418cf70cee6862cc407572ab97ae570fd", + "revision": "37fad82492accaac4b49967c53dd6d790a89ff5e", "repo_path": "/integration/gaia-central" } From 7c81f91241e86a03e7ff0ecf13a263ed395e0a13 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 03:16:23 -0700 Subject: [PATCH 08/22] Bumping gaia.json for 2 gaia-central revision(s) Truncated some number of revisions since the previous bump. ======== https://hg.mozilla.org/integration/gaia-central/rev/2f4145930d57 Author: Fabien Cazenave Desc: Merge pull request #10341 from jaoo/881645 Bug 881645 - Voice mail number for Costa Rica is not OK, r=kaze ======== https://hg.mozilla.org/integration/gaia-central/rev/d9da434a7740 Author: Jose Antonio Olivera Ortega Desc: Bug 881645 - Voice mail number for Costa Rica is not OK --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 1e25ca30ed25..98e5bc5e3ebd 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "37fad82492accaac4b49967c53dd6d790a89ff5e", + "revision": "2f4145930d57d68cab755a9aa00d1007bbbe978e", "repo_path": "/integration/gaia-central" } From 7e55ceb2db0465ede1de5ab774832c292148bbfa Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 03:16:45 -0700 Subject: [PATCH 09/22] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/e2c833158599 Author: Fabien Cazenave Desc: Merge pull request #10340 from jaoo/882089 Bug 882089 - Automatic channel configuration for 1.1/DT PL, r=kaze ======== https://hg.mozilla.org/integration/gaia-central/rev/7c2c8b41a603 Author: Jose Antonio Olivera Ortega Desc: Bug 882089 - Automatic channel configuration for 1.1/DT PL (follow-up 874793) --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 98e5bc5e3ebd..bfbf4ac7c58e 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "2f4145930d57d68cab755a9aa00d1007bbbe978e", + "revision": "e2c833158599353bedb3b4c9062fe0828cba850c", "repo_path": "/integration/gaia-central" } From ffd0bf2890f194d2d22ae11e8dd9a6a0cd4f346e Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 08:16:22 -0700 Subject: [PATCH 10/22] Bumping gaia.json for 2 gaia-central revision(s) Truncated some number of revisions since the previous bump. ======== https://hg.mozilla.org/integration/gaia-central/rev/b9a72c658443 Author: Francisco Jordano Desc: Merge pull request #10399 from arcturus/bug-882067 Bug 882067 - [SMS] Unable to send SMS after opening the link from previous received thread ======== https://hg.mozilla.org/integration/gaia-central/rev/2e34f5f9fa84 Author: Francisco Jordano Desc: Bug 882067 - [SMS] Unable to send SMS after opening the link from previous received thread r=borja --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index bfbf4ac7c58e..72ea2ee829a0 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "e2c833158599353bedb3b4c9062fe0828cba850c", + "revision": "b9a72c658443954d33c857f49ca9ba93e5d88df0", "repo_path": "/integration/gaia-central" } From b1196e0f3c2477c4e2406ac5df48769207ac542d Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 08:16:42 -0700 Subject: [PATCH 11/22] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/f845586fb561 Author: steveck-chung Desc: Merge pull request #10438 from airpingu/bug-880648-mms-accented-characters-part-2 Bug 880648 - [MMS] Accented characters are not correctly sent/received in a MMS (part 2, content blob must be encoded by utf-8). r=steveck-chung, a=leo+ ======== https://hg.mozilla.org/integration/gaia-central/rev/687ed1aad9fa Author: Gene Lian Desc: Bug 880648 - [MMS] Accented characters are not correctly sent/received in a MMS (part 2, content blob must be encoded by utf-8). r=schung a=leo+ --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 72ea2ee829a0..3e69a510f84a 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "b9a72c658443954d33c857f49ca9ba93e5d88df0", + "revision": "f845586fb561ee138a34afefae7d4f2b3c380cb9", "repo_path": "/integration/gaia-central" } From 560a042facc71ca21db075ed39c46cbf7a05a628 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 08:27:21 -0700 Subject: [PATCH 12/22] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/e0cc4a34ba83 Author: gasolin Desc: Merge pull request #10459 from gasolin/issue-877675-2 fix regression of Bug 877675, r=alive ======== https://hg.mozilla.org/integration/gaia-central/rev/a29e920f44eb Author: gasolin Desc: fix regression of Bug 877675 --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 3e69a510f84a..87305102b319 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "f845586fb561ee138a34afefae7d4f2b3c380cb9", + "revision": "e0cc4a34ba83e091b51fe5045fa26e30ec913b6c", "repo_path": "/integration/gaia-central" } From 25b36e3606e90cfc95a6bd18caa221dd9caf9c7f Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 08:27:44 -0700 Subject: [PATCH 13/22] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/de03a5f157a7 Author: Anthony Ricaud Desc: Merge pull request #10372 from Rik/pre-commit-882116 Bug 882116 - Install a pre-commit hook to run the linter tests r=timdream ======== https://hg.mozilla.org/integration/gaia-central/rev/480400239f31 Author: Anthony Ricaud Desc: Bug 882116 - Install a pre-commit hook to run the linter tests Also enables --multiprocess for make lint --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 87305102b319..06539ece073f 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "e0cc4a34ba83e091b51fe5045fa26e30ec913b6c", + "revision": "de03a5f157a75f1c641417b735d0275188b3cc54", "repo_path": "/integration/gaia-central" } From 246e6235127f361024108fb45fdfa659c9e462ef Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 08:37:39 -0700 Subject: [PATCH 14/22] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/8cdfe7674f6a Author: Anthony Ricaud Desc: Merge pull request #10466 from Rik/no-multiprocess-884338 Bug 884338 - Travis no likey multiprocess :( r=kaze ======== https://hg.mozilla.org/integration/gaia-central/rev/c9a5d7b78533 Author: Anthony Ricaud Desc: Bug 884338 - Travis no likey multiprocess :( --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 06539ece073f..306b9a4c54c4 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "de03a5f157a75f1c641417b735d0275188b3cc54", + "revision": "8cdfe7674f6a4f9713c7a4e5aea36fe5a083d9eb", "repo_path": "/integration/gaia-central" } From 43efe8d04ae06fb048c07b2007848f48fb979693 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 08:46:22 -0700 Subject: [PATCH 15/22] Bumping gaia.json for 1 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/840b192df265 Author: Rick Waldron Desc: Bug 884050 - [SMS][MMS] Regression. New renderContact rules missed untested cases - r=gnarf https://bugzilla.mozilla.org/show_bug.cgi?id=884050 - Only render a contact's tel value entry for the _specified_ input value when not rendering a suggestion. If the tel record value _doesn't_ match, then continue. - If rendering for contact search result suggestions, don't render contact tel records for values that are already selected as recipients. This comparison should be safe, as the value in this.recipients.numbers comes from the same source that current.value comes from. Signed-off-by: Rick Waldron (cherry picked from commit 3191a6fc9a6b295d0b401da23e71bbcc4136f77b) Closes gh-10448 --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 306b9a4c54c4..fe2735191c8b 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "8cdfe7674f6a4f9713c7a4e5aea36fe5a083d9eb", + "revision": "840b192df265b5e4bad731779696b1e0344646e1", "repo_path": "/integration/gaia-central" } From f1ec351b6386a624908d9e45cda6ad56412641ac Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 5 Jun 2013 17:57:26 -0400 Subject: [PATCH 16/22] Bug 867895 - Ensure the geolocation provider's high accuracy flag is reset when all requests that require it are satisfied. r=dougt --- dom/src/geolocation/nsGeolocation.cpp | 6 ++ dom/tests/unit/test_highaccuracy.js | 86 ++++++++++++++++++++++++ dom/tests/unit/test_highaccuracy_wrap.js | 52 ++++++++++++++ dom/tests/unit/xpcshell.ini | 3 +- 4 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 dom/tests/unit/test_highaccuracy.js create mode 100644 dom/tests/unit/test_highaccuracy_wrap.js diff --git a/dom/src/geolocation/nsGeolocation.cpp b/dom/src/geolocation/nsGeolocation.cpp index d5e8c0e48612..5735d58b92d5 100644 --- a/dom/src/geolocation/nsGeolocation.cpp +++ b/dom/src/geolocation/nsGeolocation.cpp @@ -509,6 +509,12 @@ nsGeolocationRequest::MarkCleared() mTimeoutTimer = nullptr; } mCleared = true; + + // Attempt to save power when possible + if (WantsHighAccuracy()) { + nsRefPtr gs = nsGeolocationService::GetGeolocationService(); + gs->SetHigherAccuracy(false); + } } void diff --git a/dom/tests/unit/test_highaccuracy.js b/dom/tests/unit/test_highaccuracy.js new file mode 100644 index 000000000000..8ce30e4c3793 --- /dev/null +++ b/dom/tests/unit/test_highaccuracy.js @@ -0,0 +1,86 @@ +const Cc = Components.classes; +const Ci = Components.interfaces; + +const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}"); +const providerContract = "@mozilla.org/geolocation/provider;1"; + +var provider = { + QueryInterface: function eventsink_qi(iid) { + if (iid.equals(Components.interfaces.nsISupports) || + iid.equals(Components.interfaces.nsIFactory) || + iid.equals(Components.interfaces.nsIGeolocationProvider)) + return this; + throw Components.results.NS_ERROR_NO_INTERFACE; + }, + createInstance: function eventsink_ci(outer, iid) { + if (outer) + throw Components.results.NS_ERROR_NO_AGGREGATION; + return this.QueryInterface(iid); + }, + lockFactory: function eventsink_lockf(lock) { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + startup: function() { + }, + watch: function(callback, isPrivate) { + do_execute_soon(function() { + callback.update({coords: {latitude: 42, longitude: 42}, timestamp: 0}); + }); + }, + shutdown: function() { + }, + setHighAccuracy: function(enable) { + this._status = enable; + }, + _status: false +}; + +let runningInParent = true; +try { + runningInParent = Components.classes["@mozilla.org/xre/runtime;1"]. + getService(Components.interfaces.nsIXULRuntime).processType + == Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT; +} +catch (e) { } + +var geolocation; + +add_test(function() { + geolocation.getCurrentPosition(function() { + do_execute_soon(function() { + if (runningInParent) { + do_check_false(provider._status); + } + run_next_test(); + }); + }, null, {enableHighAccuracy: true, maxAge: 0}); +}); + +add_test(function() { + var watchId = geolocation.watchPosition(function() { + do_execute_soon(function() { + geolocation.clearWatch(watchId); + if (runningInParent) { + do_check_false(provider._status); + } + run_next_test(); + }); + }, null, {enableHighAccuracy: true, maxAge: 0}); +}); + +function run_test() +{ + if (runningInParent) { + Components.manager.nsIComponentRegistrar.registerFactory(providerCID, + "Unit test geo provider", providerContract, provider); + var catMan = Components.classes["@mozilla.org/categorymanager;1"] + .getService(Components.interfaces.nsICategoryManager); + + var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); + prefs.setBoolPref("geo.testing.ignore_ipc_principal", true); + prefs.setBoolPref("geo.wifi.scan", false); + } + + geolocation = Cc["@mozilla.org/geolocation;1"].createInstance(Ci.nsISupports); + run_next_test(); +} \ No newline at end of file diff --git a/dom/tests/unit/test_highaccuracy_wrap.js b/dom/tests/unit/test_highaccuracy_wrap.js new file mode 100644 index 000000000000..4edd609906c6 --- /dev/null +++ b/dom/tests/unit/test_highaccuracy_wrap.js @@ -0,0 +1,52 @@ +const Cc = Components.classes; +const Ci = Components.interfaces; + +const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}"); +const providerContract = "@mozilla.org/geolocation/provider;1"; + +var provider = { + QueryInterface: function eventsink_qi(iid) { + if (iid.equals(Components.interfaces.nsISupports) || + iid.equals(Components.interfaces.nsIFactory) || + iid.equals(Components.interfaces.nsIGeolocationProvider)) + return this; + throw Components.results.NS_ERROR_NO_INTERFACE; + }, + createInstance: function eventsink_ci(outer, iid) { + if (outer) + throw Components.results.NS_ERROR_NO_AGGREGATION; + return this.QueryInterface(iid); + }, + lockFactory: function eventsink_lockf(lock) { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + }, + startup: function() { + }, + watch: function(callback, isPrivate) { + do_execute_soon(function() { + callback.update({coords: {latitude: 42, longitude: 42}, timestamp: 0}); + }); + }, + shutdown: function() { + }, + setHighAccuracy: function(enable) { + this._status = enable; + }, + _status: false +}; + +function run_test() { + Components.manager.nsIComponentRegistrar.registerFactory(providerCID, + "Unit test geo provider", providerContract, provider); + var catMan = Components.classes["@mozilla.org/categorymanager;1"] + .getService(Components.interfaces.nsICategoryManager); + + var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); + prefs.setBoolPref("geo.testing.ignore_ipc_principal", true); + prefs.setBoolPref("geo.wifi.scan", false); + + run_test_in_child("test_highaccuracy.js", function() { + do_check_false(provider._status); + do_test_finished(); + }); +} \ No newline at end of file diff --git a/dom/tests/unit/xpcshell.ini b/dom/tests/unit/xpcshell.ini index e4dc5103a380..5ba115eec7d8 100644 --- a/dom/tests/unit/xpcshell.ini +++ b/dom/tests/unit/xpcshell.ini @@ -9,5 +9,6 @@ tail = skip-if = os == "android" [test_geolocation_timeout.js] [test_geolocation_timeout_wrap.js] -skip-if = os == "mac" +[test_highaccuracy.js] +[test_highaccuracy_wrap.js]skip-if = os == "mac" skip-if = os == "android" From 87838cd54b9018e1eba637c301ac1c8add3f3ebd Mon Sep 17 00:00:00 2001 From: Chia-hung Tai Date: Tue, 18 Jun 2013 12:06:32 +0800 Subject: [PATCH 17/22] Bug 880561 - B2G MMS: Add 2 more error status (in flight mode and no sim card) when sending MMS. r=gene --- b2g/chrome/content/settings.js | 5 ++ .../interfaces/nsIMobileMessageCallback.idl | 16 +++-- .../src/MobileMessageCallback.cpp | 6 ++ dom/mobilemessage/src/ril/MmsService.js | 64 +++++++++++++++---- embedding/android/GeckoSmsManager.java | 12 ++-- 5 files changed, 79 insertions(+), 24 deletions(-) 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/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/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; From d544cfcdd8aed01578fe6992bc2991af73694289 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 18 Jun 2013 12:31:56 -0400 Subject: [PATCH 18/22] Backed out changeset 9915f8dae4e5 (bug 867895) for xpcshell bustage and landing on the wrong branch. --- dom/src/geolocation/nsGeolocation.cpp | 6 -- dom/tests/unit/test_highaccuracy.js | 86 ------------------------ dom/tests/unit/test_highaccuracy_wrap.js | 52 -------------- dom/tests/unit/xpcshell.ini | 3 +- 4 files changed, 1 insertion(+), 146 deletions(-) delete mode 100644 dom/tests/unit/test_highaccuracy.js delete mode 100644 dom/tests/unit/test_highaccuracy_wrap.js diff --git a/dom/src/geolocation/nsGeolocation.cpp b/dom/src/geolocation/nsGeolocation.cpp index 5735d58b92d5..d5e8c0e48612 100644 --- a/dom/src/geolocation/nsGeolocation.cpp +++ b/dom/src/geolocation/nsGeolocation.cpp @@ -509,12 +509,6 @@ nsGeolocationRequest::MarkCleared() mTimeoutTimer = nullptr; } mCleared = true; - - // Attempt to save power when possible - if (WantsHighAccuracy()) { - nsRefPtr gs = nsGeolocationService::GetGeolocationService(); - gs->SetHigherAccuracy(false); - } } void diff --git a/dom/tests/unit/test_highaccuracy.js b/dom/tests/unit/test_highaccuracy.js deleted file mode 100644 index 8ce30e4c3793..000000000000 --- a/dom/tests/unit/test_highaccuracy.js +++ /dev/null @@ -1,86 +0,0 @@ -const Cc = Components.classes; -const Ci = Components.interfaces; - -const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}"); -const providerContract = "@mozilla.org/geolocation/provider;1"; - -var provider = { - QueryInterface: function eventsink_qi(iid) { - if (iid.equals(Components.interfaces.nsISupports) || - iid.equals(Components.interfaces.nsIFactory) || - iid.equals(Components.interfaces.nsIGeolocationProvider)) - return this; - throw Components.results.NS_ERROR_NO_INTERFACE; - }, - createInstance: function eventsink_ci(outer, iid) { - if (outer) - throw Components.results.NS_ERROR_NO_AGGREGATION; - return this.QueryInterface(iid); - }, - lockFactory: function eventsink_lockf(lock) { - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - }, - startup: function() { - }, - watch: function(callback, isPrivate) { - do_execute_soon(function() { - callback.update({coords: {latitude: 42, longitude: 42}, timestamp: 0}); - }); - }, - shutdown: function() { - }, - setHighAccuracy: function(enable) { - this._status = enable; - }, - _status: false -}; - -let runningInParent = true; -try { - runningInParent = Components.classes["@mozilla.org/xre/runtime;1"]. - getService(Components.interfaces.nsIXULRuntime).processType - == Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT; -} -catch (e) { } - -var geolocation; - -add_test(function() { - geolocation.getCurrentPosition(function() { - do_execute_soon(function() { - if (runningInParent) { - do_check_false(provider._status); - } - run_next_test(); - }); - }, null, {enableHighAccuracy: true, maxAge: 0}); -}); - -add_test(function() { - var watchId = geolocation.watchPosition(function() { - do_execute_soon(function() { - geolocation.clearWatch(watchId); - if (runningInParent) { - do_check_false(provider._status); - } - run_next_test(); - }); - }, null, {enableHighAccuracy: true, maxAge: 0}); -}); - -function run_test() -{ - if (runningInParent) { - Components.manager.nsIComponentRegistrar.registerFactory(providerCID, - "Unit test geo provider", providerContract, provider); - var catMan = Components.classes["@mozilla.org/categorymanager;1"] - .getService(Components.interfaces.nsICategoryManager); - - var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); - prefs.setBoolPref("geo.testing.ignore_ipc_principal", true); - prefs.setBoolPref("geo.wifi.scan", false); - } - - geolocation = Cc["@mozilla.org/geolocation;1"].createInstance(Ci.nsISupports); - run_next_test(); -} \ No newline at end of file diff --git a/dom/tests/unit/test_highaccuracy_wrap.js b/dom/tests/unit/test_highaccuracy_wrap.js deleted file mode 100644 index 4edd609906c6..000000000000 --- a/dom/tests/unit/test_highaccuracy_wrap.js +++ /dev/null @@ -1,52 +0,0 @@ -const Cc = Components.classes; -const Ci = Components.interfaces; - -const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}"); -const providerContract = "@mozilla.org/geolocation/provider;1"; - -var provider = { - QueryInterface: function eventsink_qi(iid) { - if (iid.equals(Components.interfaces.nsISupports) || - iid.equals(Components.interfaces.nsIFactory) || - iid.equals(Components.interfaces.nsIGeolocationProvider)) - return this; - throw Components.results.NS_ERROR_NO_INTERFACE; - }, - createInstance: function eventsink_ci(outer, iid) { - if (outer) - throw Components.results.NS_ERROR_NO_AGGREGATION; - return this.QueryInterface(iid); - }, - lockFactory: function eventsink_lockf(lock) { - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - }, - startup: function() { - }, - watch: function(callback, isPrivate) { - do_execute_soon(function() { - callback.update({coords: {latitude: 42, longitude: 42}, timestamp: 0}); - }); - }, - shutdown: function() { - }, - setHighAccuracy: function(enable) { - this._status = enable; - }, - _status: false -}; - -function run_test() { - Components.manager.nsIComponentRegistrar.registerFactory(providerCID, - "Unit test geo provider", providerContract, provider); - var catMan = Components.classes["@mozilla.org/categorymanager;1"] - .getService(Components.interfaces.nsICategoryManager); - - var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); - prefs.setBoolPref("geo.testing.ignore_ipc_principal", true); - prefs.setBoolPref("geo.wifi.scan", false); - - run_test_in_child("test_highaccuracy.js", function() { - do_check_false(provider._status); - do_test_finished(); - }); -} \ No newline at end of file diff --git a/dom/tests/unit/xpcshell.ini b/dom/tests/unit/xpcshell.ini index 5ba115eec7d8..e4dc5103a380 100644 --- a/dom/tests/unit/xpcshell.ini +++ b/dom/tests/unit/xpcshell.ini @@ -9,6 +9,5 @@ tail = skip-if = os == "android" [test_geolocation_timeout.js] [test_geolocation_timeout_wrap.js] -[test_highaccuracy.js] -[test_highaccuracy_wrap.js]skip-if = os == "mac" +skip-if = os == "mac" skip-if = os == "android" From 7404c9e4ad10ae82aa2c414c2a3800770a56f67f Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 10:46:23 -0700 Subject: [PATCH 19/22] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/2064f98a9c27 Author: Anthony Ricaud Desc: Merge pull request #10467 from Rik/unbreak-birch-884406 Bug 884406 - Check that we have a .git directory before copying r=julienw ======== https://hg.mozilla.org/integration/gaia-central/rev/0ec09b86a8f8 Author: Anthony Ricaud Desc: Bug 884406 - Check that we have a .git directory before copying --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index fe2735191c8b..c497f918bd7f 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "840b192df265b5e4bad731779696b1e0344646e1", + "revision": "2064f98a9c2765ea04cc2d467d1d66d8c168e990", "repo_path": "/integration/gaia-central" } From 226ae3ee4437faae4ac3fc1f710f3e81332de138 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 11:31:22 -0700 Subject: [PATCH 20/22] Bumping gaia.json for 1 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/f4f6162e7fb0 Author: Anthony Ricaud Desc: Bug 884406 - Makefile will throw an error if the test fails r=julienw --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index c497f918bd7f..aa358214d181 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "2064f98a9c2765ea04cc2d467d1d66d8c168e990", + "revision": "f4f6162e7fb05fbba5bdf4de9d10e84b034ce0e2", "repo_path": "/integration/gaia-central" } From 7f9d19b94a2b366c25e308cd1c1891fd8dca5a87 Mon Sep 17 00:00:00 2001 From: Gaia Pushbot Date: Tue, 18 Jun 2013 13:16:22 -0700 Subject: [PATCH 21/22] Bumping gaia.json for 2 gaia-central revision(s) ======== https://hg.mozilla.org/integration/gaia-central/rev/fc8faac21133 Author: David Flanagan Desc: Merge pull request #10350 from punamdahiya/Bug-838179_ShowFiles Bug-838179 - [Music] - Show files beginning with . in the music app r=davidflanagan ======== https://hg.mozilla.org/integration/gaia-central/rev/ec12ffc1b3d1 Author: Punam Dahiya Desc: Bug-838179 - [Music] - Show files beginning with . in the music app r=davidflanagan --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index aa358214d181..2c89343222fb 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "f4f6162e7fb05fbba5bdf4de9d10e84b034ce0e2", + "revision": "fc8faac211332ebdbbea8bf11f3ca2deba541cee", "repo_path": "/integration/gaia-central" } From 7aedf5013b96af1c5506efce2afb10c2582584de Mon Sep 17 00:00:00 2001 From: Shane Tully Date: Fri, 14 Jun 2013 10:15:57 -0700 Subject: [PATCH 22/22] Bug 807688 - Add "key" field to the mozContact interface. r=gwagner sr=sicking --- dom/contacts/ContactManager.js | 17 ++++++++++++++--- dom/contacts/ContactManager.manifest | 4 ++-- dom/contacts/fallback/ContactDB.jsm | 5 +++-- dom/contacts/tests/test_contacts_basics.html | 8 ++++++-- .../contacts/nsIContactProperties.idl | 7 ++++--- 5 files changed, 29 insertions(+), 12 deletions(-) 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[] };