author | Michelangelo De Simone <mds@mozilla.com> |
Thu, 20 Oct 2016 17:19:25 -0700 | |
changeset 428196 | ae0c581810356184cdee305b990bb625c3b057b6 |
parent 428133 | 28681d252003e3110105473754da2f4097cb83a6 |
child 534673 | 392cd27b708f83310ffb0683fcb92ae3e66fd471 |
push id | 33245 |
push user | mdesimone@mozilla.com |
push date | Fri, 21 Oct 2016 17:57:27 +0000 |
reviewers | ehsan |
bugs | 1311885 |
milestone | 52.0a1 |
--- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -154,17 +154,16 @@ @RESPATH@/components/dom_base.xpt @RESPATH@/components/dom_system.xpt @RESPATH@/components/dom_workers.xpt #ifdef MOZ_WIDGET_GONK @RESPATH@/components/dom_wifi.xpt @RESPATH@/components/dom_system_gonk.xpt #endif #ifdef MOZ_B2G_RIL -@RESPATH@/components/dom_wappush.xpt @RESPATH@/components/dom_mobileconnection.xpt #endif #ifdef MOZ_B2G_BT @RESPATH@/components/dom_bluetooth.xpt #endif @RESPATH@/components/dom_canvas.xpt @RESPATH@/components/dom_contacts.xpt @RESPATH@/components/dom_core.xpt
--- a/dom/apps/PermissionsTable.jsm +++ b/dom/apps/PermissionsTable.jsm @@ -335,21 +335,16 @@ this.PermissionsTable = { geolocation: privileged: ALLOW_ACTION, certified: ALLOW_ACTION }, "input-manage": { app: DENY_ACTION, privileged: DENY_ACTION, certified: ALLOW_ACTION }, - "wappush": { - app: DENY_ACTION, - privileged: DENY_ACTION, - certified: ALLOW_ACTION - }, "audio-capture": { app: PROMPT_ACTION, privileged: PROMPT_ACTION, certified: ALLOW_ACTION }, "audio-capture:3gpp": { app: DENY_ACTION, privileged: ALLOW_ACTION,
--- a/dom/moz.build +++ b/dom/moz.build @@ -116,21 +116,16 @@ if CONFIG['OS_ARCH'] == 'WINNT': if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': DIRS += [ 'speakermanager', 'tethering', 'wifi', ] -if CONFIG['MOZ_B2G_RIL']: - DIRS += [ - 'wappush', - ] - if CONFIG['MOZ_NFC']: DIRS += ['nfc'] if CONFIG['MOZ_SECUREELEMENT']: DIRS += ['secureelement'] if CONFIG['MOZ_B2G']: DIRS += [
deleted file mode 100644 --- a/dom/wappush/gonk/CpPduHelper.jsm +++ /dev/null @@ -1,485 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; - -var WSP = {}; -Cu.import("resource://gre/modules/WspPduHelper.jsm", WSP); -var WBXML = {}; -Cu.import("resource://gre/modules/WbxmlPduHelper.jsm", WBXML); - -Cu.import("resource://services-crypto/utils.js"); -Cu.import("resource://services-common/utils.js"); - -// set to true to see debug messages -var DEBUG = WBXML.DEBUG_ALL | false; - -/** - * Public identifier for CP - * - * @see http://technical.openmobilealliance.org/tech/omna/omna-wbxml-public-docid.aspx - */ -const PUBLIC_IDENTIFIER_CP = "-//WAPFORUM//DTD PROV 1.0//EN"; - -this.PduHelper = { - - /** - * @param data - * A wrapped object containing raw PDU data. - * @param contentType - * Content type of incoming CP message, should be "text/vnd.wap.connectivity-xml" - * or "application/vnd.wap.connectivity-wbxml". - * - * @return A message object containing attribute content and contentType. - * |content| will contain string of decoded CP message if successfully - * decoded, or raw data if failed. - * |contentType| will be string representing corresponding type of - * content. - */ - parse: function parse_cp(data, contentType) { - // We only need content and contentType - let msg = { - contentType: contentType - }; - - /** - * Message is compressed by WBXML, decode into string. - * - * @see WAP-192-WBXML-20010725-A - */ - if (contentType === "application/vnd.wap.connectivity-wbxml") { - let appToken = { - publicId: PUBLIC_IDENTIFIER_CP, - tagTokenList: CP_TAG_FIELDS, - attrTokenList: CP_ATTRIBUTE_FIELDS, - valueTokenList: CP_VALUE_FIELDS, - globalTokenOverride: null - } - - try { - let parseResult = WBXML.PduHelper.parse(data, appToken, msg); - msg.content = parseResult.content; - msg.contentType = "text/vnd.wap.connectivity-xml"; - } catch (e) { - // Provide raw data if we failed to parse. - msg.content = data.array; - } - - return msg; - } - - /** - * Message is plain text, transform raw to string. - */ - try { - let stringData = WSP.Octet.decodeMultiple(data, data.array.length); - msg.content = WSP.PduHelper.decodeStringContent(stringData, "UTF-8"); - } catch (e) { - // Provide raw data if we failed to parse. - msg.content = data.array; - } - return msg; - - } -}; - -/** - * SEC type values - * - * @see WAP-183-ProvCont-20010724-A, clause 5.3 - */ -const AUTH_SEC_TYPE = (function () { - let names = {}; - function add(name, number) { - names[number] = name; - } - - add("NETWPIN", 0); - add("USERPIN", 1); - add("USERNETWPIN", 2); - add("USERPINMAC", 3); - - return names; -})(); - -this.Authenticator = { - /** - * Format IMSI string into GSM format - * - * @param imsi - * IMSI string - * - * @return IMSI in GSM format as string object - */ - formatImsi: function formatImsi(imsi) { - let parityByte = ((imsi.length & 1) ? 9 : 1); - - // Make sure length of IMSI is 15 digits. - // @see GSM 11.11, clause 10.2.2 - let i = 0; - for (i = 15 - imsi.length; i > 0; i--) { - imsi += "F"; - } - - // char-by-char atoi - let imsiValue = []; - imsiValue.push(parityByte); - for (i = 0; i < imsi.length; i++) { - imsiValue.push(parseInt(imsi.substr(i, 1), 10)); - } - - // encoded IMSI - let imsiEncoded = ""; - for (i = 0; i < imsiValue.length; i += 2) { - imsiEncoded += String.fromCharCode(imsiValue[i] | (imsiValue[i+1] << 4)); - } - - return imsiEncoded; - }, - - /** - * Perform HMAC check - * - * @param wbxml - * Uint8 typed array of raw WBXML data. - * @param key - * key string for HMAC check. - * @param mac - * Expected MAC value. - * - * @return true for valid, false for invalid. - */ - isValid: function isValid(wbxml, key, mac) { - let hasher = CryptoUtils.makeHMACHasher(Ci.nsICryptoHMAC.SHA1, - CryptoUtils.makeHMACKey(key)); - hasher.update(wbxml, wbxml.length); - let result = CommonUtils.bytesAsHex(hasher.finish(false)).toUpperCase(); - return mac == result; - }, - - /** - * Perform HMAC authentication. - * - * @param wbxml - * Uint8 typed array of raw WBXML data. - * @param sec - * Security method for HMAC check. - * @param mac - * Expected MAC value. - * @param getNetworkPin - * Callback function for getting network pin. - * - * @return true for valid, false for invalid. - */ - check: function check_hmac(wbxml, sec, mac, getNetworkPin) { - // No security set. - if (sec == null || !mac) { - return null; - } - - let authInfo = { - pass: false, - checked: false, - sec: AUTH_SEC_TYPE[sec], - mac: mac.toUpperCase(), - data: wbxml - }; - - switch (authInfo.sec) { - case "NETWPIN": - let key = getNetworkPin(); - authInfo.pass = this.isValid(wbxml, key, authInfo.mac); - authInfo.checked = true; - return authInfo; - - case "USERPIN": - case "USERPINMAC": - // We can't check without USER PIN - return authInfo; - - case "USERNETWPIN": - default: - return null; - } - } -}; - -/** - * Tag tokens - * - * @see OMA-WAP-TS-ProvCont-V1_1-20090421-C, clause 7.1 - */ -const CP_TAG_FIELDS = (function () { - let names = {}; - function add(name, codepage, number) { - let entry = { - name: name, - number: number, - }; - if (!names[codepage]) { - names[codepage] = {}; - } - names[codepage][number] = entry; - } - - // Code page 0 - add("wap-provisioningdoc", 0, 0x05); - add("characteristic", 0, 0x06); - add("parm", 0, 0x07); - // Code page 1 - add("characteristic", 1, 0x06); - add("parm", 1, 0x07); - - return names; -})(); - -/** - * Attribute Tokens - * - * @see OMA-WAP-TS-ProvCont-V1_1-20090421-C, clause 7.2 - */ -const CP_ATTRIBUTE_FIELDS = (function () { - let names = {}; - function add(name, value, codepage, number) { - let entry = { - name: name, - value: value, - number: number, - }; - if (!names[codepage]) { - names[codepage] = {}; - } - names[codepage][number] = entry; - } - - // Code page 0 - add("name", "", 0, 0x05); - add("value", "", 0, 0x06); - add("name", "NAME", 0, 0x07); - add("name", "NAP-ADDRESS", 0, 0x08); - add("name", "NAP-ADDRTYPE", 0, 0x09); - add("name", "CALLTYPE", 0, 0x0A); - add("name", "VALIDUNTIL", 0, 0x0B); - add("name", "AUTHTYPE", 0, 0x0C); - add("name", "AUTHNAME", 0, 0x0D); - add("name", "AUTHSECRET", 0, 0x0E); - add("name", "LINGER", 0, 0x0F); - add("name", "BEARER", 0, 0x10); - add("name", "NAPID", 0, 0x11); - add("name", "COUNTRY", 0, 0x12); - add("name", "NETWORK", 0, 0x13); - add("name", "INTERNET", 0, 0x14); - add("name", "PROXY-ID", 0, 0x15); - add("name", "PROXY-PROVIDER-ID", 0, 0x16); - add("name", "DOMAIN", 0, 0x17); - add("name", "PROVURL", 0, 0x18); - add("name", "PXAUTH-TYPE", 0, 0x19); - add("name", "PXAUTH-ID", 0, 0x1A); - add("name", "PXAUTH-PW", 0, 0x1B); - add("name", "STARTPAGE", 0, 0x1C); - add("name", "BASAUTH-ID", 0, 0x1D); - add("name", "BASAUTH-PW", 0, 0x1E); - add("name", "PUSHENABLED", 0, 0x1F); - add("name", "PXADDR", 0, 0x20); - add("name", "PXADDRTYPE", 0, 0x21); - add("name", "TO-NAPID", 0, 0x22); - add("name", "PORTNBR", 0, 0x23); - add("name", "SERVICE", 0, 0x24); - add("name", "LINKSPEED", 0, 0x25); - add("name", "DNLINKSPEED", 0, 0x26); - add("name", "LOCAL-ADDR", 0, 0x27); - add("name", "LOCAL-ADDRTYPE", 0, 0x28); - add("name", "CONTEXT-ALLOW", 0, 0x29); - add("name", "TRUST", 0, 0x2A); - add("name", "MASTER", 0, 0x2B); - add("name", "SID", 0, 0x2C); - add("name", "SOC", 0, 0x2D); - add("name", "WSP-VERSION", 0, 0x2E); - add("name", "PHYSICAL-PROXY-ID", 0, 0x2F); - add("name", "CLIENT-ID", 0, 0x30); - add("name", "DELIVERY-ERR-PDU", 0, 0x31); - add("name", "DELIVERY-ORDER", 0, 0x32); - add("name", "TRAFFIC-CLASS", 0, 0x33); - add("name", "MAX-SDU-SIZE", 0, 0x34); - add("name", "MAX-BITRATE-UPLINK", 0, 0x35); - add("name", "MAX-BITRATE-DNLINK", 0, 0x36); - add("name", "RESIDUAL-BER", 0, 0x37); - add("name", "SDU-ERROR-RATIO", 0, 0x38); - add("name", "TRAFFIC-HANDL-PRIO", 0, 0x39); - add("name", "TRANSFER-DELAY", 0, 0x3A); - add("name", "GUARANTEED-BITRATE-UPLINK", 0, 0x3B); - add("name", "GUARANTEED-BITRATE-DNLINK", 0, 0x3C); - add("name", "PXADDR-FQDN", 0, 0x3D); - add("name", "PROXY-PW", 0, 0x3E); - add("name", "PPGAUTH-TYPE", 0, 0x3F); - add("version", "", 0, 0x45); - add("version", "1.0", 0, 0x46); - add("name", "PULLENABLED", 0, 0x47); - add("name", "DNS-ADDR", 0, 0x48); - add("name", "MAX-NUM-RETRY", 0, 0x49); - add("name", "FIRST-RETRY-TIMEOUT", 0, 0x4A); - add("name", "REREG-THRESHOLD", 0, 0x4B); - add("name", "T-BIT", 0, 0x4C); - add("name", "AUTH-ENTITY", 0, 0x4E); - add("name", "SPI", 0, 0x4F); - add("type", "", 0, 0x50); - add("type", "PXLOGICAL", 0, 0x51); - add("type", "PXPHYSICAL", 0, 0x52); - add("type", "PORT", 0, 0x53); - add("type", "VALIDITY", 0, 0x54); - add("type", "NAPDEF", 0, 0x55); - add("type", "BOOTSTRAP", 0, 0x56); -/* - * Mark out VENDORCONFIG so if it is contained in message, parse - * will failed and raw data is returned. - */ -// add("type", "VENDORCONFIG", 0, 0x57); - add("type", "CLIENTIDENTITY", 0, 0x58); - add("type", "PXAUTHINFO", 0, 0x59); - add("type", "NAPAUTHINFO", 0, 0x5A); - add("type", "ACCESS", 0, 0x5B); - - // Code page 1 - add("name", "", 1, 0x05); - add("value", "", 1, 0x06); - add("name", "NAME", 1, 0x07); - add("name", "INTERNET", 1, 0x14); - add("name", "STARTPAGE", 1, 0x1C); - add("name", "TO-NAPID", 1, 0x22); - add("name", "PORTNBR", 1, 0x23); - add("name", "SERVICE", 1, 0x24); - add("name", "AACCEPT", 1, 0x2E); - add("name", "AAUTHDATA", 1, 0x2F); - add("name", "AAUTHLEVEL", 1, 0x30); - add("name", "AAUTHNAME", 1, 0x31); - add("name", "AAUTHSECRET", 1, 0x32); - add("name", "AAUTHTYPE", 1, 0x33); - add("name", "ADDR", 1, 0x34); - add("name", "ADDRTYPE", 1, 0x35); - add("name", "APPID", 1, 0x36); - add("name", "APROTOCOL", 1, 0x37); - add("name", "PROVIDER-ID", 1, 0x38); - add("name", "TO-PROXY", 1, 0x39); - add("name", "URI", 1, 0x3A); - add("name", "RULE", 1, 0x3B); - add("type", "", 1, 0x50); - add("type", "PORT", 1, 0x53); - add("type", "APPLICATION", 1, 0x55); - add("type", "APPADDR", 1, 0x56); - add("type", "APPAUTH", 1, 0x57); - add("type", "CLIENTIDENTITY", 1, 0x58); - add("type", "RESOURCE", 1, 0x59); - - return names; -})(); - -/** - * Value Tokens - * - * @see OMA-WAP-TS-ProvCont-V1_1-20090421-C, clause 7.3 - */ -const CP_VALUE_FIELDS = (function () { - let names = {}; - function add(value, codepage, number) { - let entry = { - value: value, - number: number, - }; - if (!names[codepage]) { - names[codepage] = {}; - } - names[codepage][number] = entry; - } - - // Code page 0 - add("IPV4", 0, 0x85); - add("IPV6", 0, 0x86); - add("E164", 0, 0x87); - add("ALPHA", 0, 0x88); - add("APN", 0, 0x89); - add("SCODE", 0, 0x8A); - add("TETRA-ITSI", 0, 0x8B); - add("MAN", 0, 0x8C); - add("ANALOG-MODEM", 0, 0x90); - add("V.120", 0, 0x91); - add("V.110", 0, 0x92); - add("X.31", 0, 0x93); - add("BIT-TRANSPARENT", 0, 0x94); - add("DIRECT-ASYNCHRONOUS-DATA-SERVICE", 0, 0x95); - add("PAP", 0, 0x9A); - add("CHAP", 0, 0x9B); - add("HTTP-BASIC", 0, 0x9C); - add("HTTP-DIGEST", 0, 0x9D); - add("WTLS-SS", 0, 0x9E); - add("MD5", 0, 0x9F); // Added in OMA, 7.3.3 - add("GSM-USSD", 0, 0xA2); - add("GSM-SMS", 0, 0xA3); - add("ANSI-136-GUTS", 0, 0xA4); - add("IS-95-CDMA-SMS", 0, 0xA5); - add("IS-95-CDMA-CSD", 0, 0xA6); - add("IS-95-CDMA-PAC", 0, 0xA7); - add("ANSI-136-CSD", 0, 0xA8); - add("ANSI-136-GPRS", 0, 0xA9); - add("GSM-CSD", 0, 0xAA); - add("GSM-GPRS", 0, 0xAB); - add("AMPS-CDPD", 0, 0xAC); - add("PDC-CSD", 0, 0xAD); - add("PDC-PACKET", 0, 0xAE); - add("IDEN-SMS", 0, 0xAF); - add("IDEN-CSD", 0, 0xB0); - add("IDEN-PACKET", 0, 0xB1); - add("FLEX/REFLEX", 0, 0xB2); - add("PHS-SMS", 0, 0xB3); - add("PHS-CSD", 0, 0xB4); - add("TETRA-SDS", 0, 0xB5); - add("TETRA-PACKET", 0, 0xB6); - add("ANSI-136-GHOST", 0, 0xB7); - add("MOBITEX-MPAK", 0, 0xB8); - add("CDMA2000-1X-SIMPLE-IP", 0, 0xB9); // Added in OMA, 7.3.4 - add("CDMA2000-1X-MOBILE-IP", 0, 0xBA); // Added in OMA, 7.3.4 - add("AUTOBOUDING", 0, 0xC5); - add("CL-WSP", 0, 0xCA); - add("CO-WSP", 0, 0xCB); - add("CL-SEC-WSP", 0, 0xCC); - add("CO-SEC-WSP", 0, 0xCD); - add("CL-SEC-WTA", 0, 0xCE); - add("CO-SEC-WTA", 0, 0xCF); - add("OTA-HTTP-TO", 0, 0xD0); // Added in OMA, 7.3.6 - add("OTA-HTTP-TLS-TO", 0, 0xD1); // Added in OMA, 7.3.6 - add("OTA-HTTP-PO", 0, 0xD2); // Added in OMA, 7.3.6 - add("OTA-HTTP-TLS-PO", 0, 0xD3); // Added in OMA, 7.3.6 - add("AAA", 0, 0xE0); // Added in OMA, 7.3.8 - add("HA", 0, 0xE1); // Added in OMA, 7.3.8 - - // Code page 1 - add("IPV6", 1, 0x86); - add("E164", 1, 0x87); - add("ALPHA", 1, 0x88); - add("APPSRV", 1, 0x8D); - add("OBEX", 1, 0x8E); - add(",", 1, 0x90); - add("HTTP-", 1, 0x91); - add("BASIC", 1, 0x92); - add("DIGEST", 1, 0x93); - - return names; -})(); - -var debug; -if (DEBUG) { - debug = function (s) { - dump("-$- CpPduHelper: " + s + "\n"); - }; -} else { - debug = function (s) {}; -} - -this.EXPORTED_SYMBOLS = [ - // Parser - "PduHelper", - // HMAC Authenticator - "Authenticator", -];
deleted file mode 100644 --- a/dom/wappush/gonk/SiPduHelper.jsm +++ /dev/null @@ -1,217 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; - -var WSP = {}; -Cu.import("resource://gre/modules/WspPduHelper.jsm", WSP); -var WBXML = {}; -Cu.import("resource://gre/modules/WbxmlPduHelper.jsm", WBXML); - -// set to true to see debug messages -var DEBUG = WBXML.DEBUG_ALL | false; - -/** - * Public identifier for SI - * - * @see http://technical.openmobilealliance.org/tech/omna/omna-wbxml-public-docid.aspx - */ -const PUBLIC_IDENTIFIER_SI = "-//WAPFORUM//DTD SI 1.0//EN"; - -/** - * Parse inline date encoded in OPAQUE format. - * - * @param data - * A wrapped object containing raw PDU data. - * @param msg - * Target object for decoding. - * - * @see WAP-167-SERVICEIND-20010731-A, clause 8.2.2 - * - */ -this.OpaqueAsDate = { - decode: function decode_opaque_as_date(data) { - let size = WSP.UintVar.decode(data); - let dateBuf = [0, 0, 0, 0, 0, 0, 0]; - - // Maximum length for date is 7 bytes. - if (size > dateBuf.length) - size = dateBuf.length - - // Read date date, non-specified parts remain 0. - for (let i = 0; i < size; i++) { - dateBuf[i] = WSP.Octet.decode(data); - } - - // Decode and return result in "YYYY-MM-DDThh:mm:ssZ" form - let year = ((dateBuf[0] >> 4) & 0x0F) * 1000 + (dateBuf[0] & 0x0F) * 100 + - ((dateBuf[1] >> 4) & 0x0F) * 10 + (dateBuf[1] & 0x0F); - let month = ((dateBuf[2] >> 4) & 0x0F) * 10 + (dateBuf[2] & 0x0F); - let date = ((dateBuf[3] >> 4) & 0x0F) * 10 + (dateBuf[3] & 0x0F); - let hour = ((dateBuf[4] >> 4) & 0x0F) * 10 + (dateBuf[4] & 0x0F); - let minute = ((dateBuf[5] >> 4) & 0x0F) * 10 + (dateBuf[5] & 0x0F); - let second = ((dateBuf[6] >> 4) & 0x0F) * 10 + (dateBuf[6] & 0x0F); - let dateValue = new Date(Date.UTC(year, month - 1, date, hour, minute, second)); - - return dateValue.toISOString().replace(".000", ""); - }, -}; - -this.PduHelper = { - - /** - * @param data - * A wrapped object containing raw PDU data. - * @param contentType - * Content type of incoming SI message, should be "text/vnd.wap.si" or - * "application/vnd.wap.sic". - * - * @return A message object containing attribute content and contentType. - * |content| will contain string of decoded SI message if successfully - * decoded, or raw data if failed. - * |contentType| will be string representing corresponding type of - * content. - */ - parse: function parse_si(data, contentType) { - // We only need content and contentType - let msg = { - contentType: contentType - }; - - /** - * Message is compressed by WBXML, decode into string. - * - * @see WAP-192-WBXML-20010725-A - */ - if (contentType === "application/vnd.wap.sic") { - let globalTokenOverride = {}; - globalTokenOverride[0xC3] = { - number: 0xC3, - coder: OpaqueAsDate - }; - - let appToken = { - publicId: PUBLIC_IDENTIFIER_SI, - tagTokenList: SI_TAG_FIELDS, - attrTokenList: SI_ATTRIBUTE_FIELDS, - valueTokenList: SI_VALUE_FIELDS, - globalTokenOverride: globalTokenOverride - } - - try { - let parseResult = WBXML.PduHelper.parse(data, appToken); - msg.content = parseResult.content; - msg.contentType = "text/vnd.wap.si"; - } catch (e) { - // Provide raw data if we failed to parse. - msg.content = data.array; - } - return msg; - } - - /** - * Message is plain text, transform raw to string. - */ - try { - let stringData = WSP.Octet.decodeMultiple(data, data.array.length); - msg.content = WSP.PduHelper.decodeStringContent(stringData, "UTF-8"); - } catch (e) { - // Provide raw data if we failed to parse. - msg.content = data.array; - } - return msg; - - } -}; - -/** - * Tag tokens - * - * @see WAP-167-SERVICEIND-20010731-A, clause 8.3.1 - */ -const SI_TAG_FIELDS = (function () { - let names = {}; - function add(name, codepage, number) { - let entry = { - name: name, - number: number, - }; - if (!names[codepage]) { - names[codepage] = {}; - } - names[codepage][number] = entry; - } - - add("si", 0, 0x05); - add("indication", 0, 0x06); - add("info", 0, 0x07); - add("item", 0, 0x08); - - return names; -})(); - -/** - * Attribute Tokens - * - * @see WAP-167-SERVICEIND-20010731-A, clause 8.3.2 - */ -const SI_ATTRIBUTE_FIELDS = (function () { - let names = {}; - function add(name, value, codepage, number) { - let entry = { - name: name, - value: value, - number: number, - }; - if (!names[codepage]) { - names[codepage] = {}; - } - names[codepage][number] = entry; - } - - add("action", "signal-none", 0, 0x05); - add("action", "signal-low", 0, 0x06); - add("action", "signal-medium", 0, 0x07); - add("action", "signal-high", 0, 0x08); - add("action", "delete", 0, 0x09); - add("created", "", 0, 0x0A); - add("href", "", 0, 0x0B); - add("href", "http://", 0, 0x0C); - add("href", "http://www.", 0, 0x0D); - add("href", "https://", 0, 0x0E); - add("href", "https://www.", 0, 0x0F); - add("si-expires", "", 0, 0x10); - add("si-id", "", 0, 0x11); - add("class", "", 0, 0x12); - - return names; -})(); - -const SI_VALUE_FIELDS = (function () { - let names = {}; - function add(value, codepage, number) { - let entry = { - value: value, - number: number, - }; - if (!names[codepage]) { - names[codepage] = {}; - } - names[codepage][number] = entry; - } - - add(".com/", 0, 0x85); - add(".edu/", 0, 0x86); - add(".net/", 0, 0x87); - add(".org/", 0, 0x88); - - return names; -})(); - -this.EXPORTED_SYMBOLS = [ - // Parser - "PduHelper", -];
deleted file mode 100644 --- a/dom/wappush/gonk/SlPduHelper.jsm +++ /dev/null @@ -1,164 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; - -var WSP = {}; -Cu.import("resource://gre/modules/WspPduHelper.jsm", WSP); -var WBXML = {}; -Cu.import("resource://gre/modules/WbxmlPduHelper.jsm", WBXML); - -// set to true to see debug messages -var DEBUG = WBXML.DEBUG_ALL | false; - -/** - * Public identifier for SL - * - * @see http://technical.openmobilealliance.org/tech/omna/omna-wbxml-public-docid.aspx - */ -const PUBLIC_IDENTIFIER_SL = "-//WAPFORUM//DTD SL 1.0//EN"; - -this.PduHelper = { - - /** - * @param data - * A wrapped object containing raw PDU data. - * @param contentType - * Content type of incoming SL message, should be "text/vnd.wap.sl" or - * "application/vnd.wap.slc". - * - * @return A message object containing attribute content and contentType. - * |content| will contain string of decoded SL message if successfully - * decoded, or raw data if failed. - * |contentType| will be string representing corresponding type of - * content. - */ - parse: function parse_sl(data, contentType) { - // We only need content and contentType - let msg = { - contentType: contentType - }; - - /** - * Message is compressed by WBXML, decode into string. - * - * @see WAP-192-WBXML-20010725-A - */ - if (contentType === "application/vnd.wap.slc") { - let appToken = { - publicId: PUBLIC_IDENTIFIER_SL, - tagTokenList: SL_TAG_FIELDS, - attrTokenList: SL_ATTRIBUTE_FIELDS, - valueTokenList: SL_VALUE_FIELDS, - globalTokenOverride: null - } - - try { - let parseResult = WBXML.PduHelper.parse(data, appToken); - msg.content = parseResult.content; - msg.contentType = "text/vnd.wap.sl"; - } catch (e) { - // Provide raw data if we failed to parse. - msg.content = data.array; - } - - return msg; - } - - /** - * Message is plain text, transform raw to string. - */ - try { - let stringData = WSP.Octet.decodeMultiple(data, data.array.length); - msg.content = WSP.PduHelper.decodeStringContent(stringData, "UTF-8"); - } catch (e) { - // Provide raw data if we failed to parse. - msg.content = data.array; - } - return msg; - - } -}; - -/** - * Tag tokens - * - * @see WAP-168-SERVICELOAD-20010731-A, clause 9.3.1 - */ -const SL_TAG_FIELDS = (function () { - let names = {}; - function add(name, codepage, number) { - let entry = { - name: name, - number: number, - }; - if (!names[codepage]) { - names[codepage] = {}; - } - names[codepage][number] = entry; - } - - add("sl", 0, 0x05); - - return names; -})(); - -/** - * Attribute Tokens - * - * @see WAP-168-SERVICELOAD-20010731-A, clause 9.3.2 - */ -const SL_ATTRIBUTE_FIELDS = (function () { - let names = {}; - function add(name, value, codepage, number) { - let entry = { - name: name, - value: value, - number: number, - }; - if (!names[codepage]) { - names[codepage] = {}; - } - names[codepage][number] = entry; - } - - add("action", "execute-low", 0, 0x05); - add("action", "execute-high", 0, 0x06); - add("action", "cache", 0, 0x07); - add("href", "", 0, 0x08); - add("href", "http://", 0, 0x09); - add("href", "http://www.", 0, 0x0A); - add("href", "https://", 0, 0x0B); - add("href", "https://www.", 0, 0x0C); - - return names; -})(); - -const SL_VALUE_FIELDS = (function () { - let names = {}; - function add(value, codepage, number) { - let entry = { - value: value, - number: number, - }; - if (!names[codepage]) { - names[codepage] = {}; - } - names[codepage][number] = entry; - } - - add(".com/", 0, 0x85); - add(".edu/", 0, 0x86); - add(".net/", 0, 0x87); - add(".org/", 0, 0x88); - - return names; -})(); - -this.EXPORTED_SYMBOLS = [ - // Parser - "PduHelper", -];
deleted file mode 100644 --- a/dom/wappush/gonk/WapPushManager.js +++ /dev/null @@ -1,176 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/Services.jsm"); -Cu.import("resource://gre/modules/PhoneNumberUtils.jsm"); -Cu.import("resource://gre/modules/WspPduHelper.jsm", this); - -const DEBUG = false; // set to true to see debug messages - -/** - * WAP Push decoders - */ -XPCOMUtils.defineLazyGetter(this, "SI", function () { - let SI = {}; - Cu.import("resource://gre/modules/SiPduHelper.jsm", SI); - return SI; -}); - -XPCOMUtils.defineLazyGetter(this, "SL", function () { - let SL = {}; - Cu.import("resource://gre/modules/SlPduHelper.jsm", SL); - return SL; -}); - -XPCOMUtils.defineLazyGetter(this, "CP", function () { - let CP = {}; - Cu.import("resource://gre/modules/CpPduHelper.jsm", CP); - return CP; -}); - -XPCOMUtils.defineLazyServiceGetter(this, "gSystemMessenger", - "@mozilla.org/system-message-internal;1", - "nsISystemMessagesInternal"); -XPCOMUtils.defineLazyServiceGetter(this, "gIccService", - "@mozilla.org/icc/iccservice;1", - "nsIIccService"); - -/** - * Helpers for WAP PDU processing. - */ -this.WapPushManager = { - - /** - * Parse raw PDU data and deliver to a proper target. - * - * @param data - * A wrapped object containing raw PDU data. - * @param options - * Extra context for decoding. - */ - processMessage: function processMessage(data, options) { - try { - PduHelper.parse(data, true, options); - debug("options: " + JSON.stringify(options)); - } catch (ex) { - debug("Failed to parse sessionless WSP PDU: " + ex.message); - return; - } - - // TODO: Support to route the push request using x-wap-application-id. - // See 7.3. Application Addressing in WAP-235-PushOTA-20010425-a. - // http://technical.openmobilealliance.org/tech/affiliates/wap/wap-235-pushota-20010425-a.pdf - - /** - * - * WAP Type content-type x-wap-application-id - * MMS "application/vnd.wap.mms-message" "x-wap-application:mms.ua" - * SI "text/vnd.wap.si" "x-wap-application:wml.ua" - * SI(WBXML) "application/vnd.wap.sic" "x-wap-application:wml.ua" - * SL "text/vnd.wap.sl" "x-wap-application:wml.ua" - * SL(WBXML) "application/vnd.wap.slc" "x-wap-application:wml.ua" - * Provisioning "text/vnd.wap.connectivity-xml" "x-wap-application:wml.ua" - * Provisioning(WBXML) "application/vnd.wap.connectivity-wbxml" "x-wap-application:wml.ua" - * - * @see http://technical.openmobilealliance.org/tech/omna/omna-wsp-content-type.aspx - */ - let contentType = options.headers["content-type"].media; - let msg; - let authInfo = null; - if (contentType === "application/vnd.wap.mms-message") { - let mmsService = Cc["@mozilla.org/mms/gonkmmsservice;1"] - .getService(Ci.nsIMmsService); - mmsService.QueryInterface(Ci.nsIWapPushApplication) - .receiveWapPush(data.array, data.array.length, data.offset, options); - return; - } else if (contentType === "text/vnd.wap.si" || - contentType === "application/vnd.wap.sic") { - msg = SI.PduHelper.parse(data, contentType); - } else if (contentType === "text/vnd.wap.sl" || - contentType === "application/vnd.wap.slc") { - msg = SL.PduHelper.parse(data, contentType); - } else if (contentType === "text/vnd.wap.connectivity-xml" || - contentType === "application/vnd.wap.connectivity-wbxml") { - // Apply HMAC authentication on WBXML encoded CP message. - if (contentType === "application/vnd.wap.connectivity-wbxml") { - let params = options.headers["content-type"].params; - let sec = params && params.sec; - let mac = params && params.mac; - authInfo = CP.Authenticator.check(data.array.subarray(data.offset), - sec, mac, function getNetworkPin() { - let icc = gIccService.getIccByServiceId(options.serviceId); - let imsi = icc ? icc.imsi : null; - return CP.Authenticator.formatImsi(imsi); - }); - } - - msg = CP.PduHelper.parse(data, contentType); - } else { - // Unsupported type, provide raw data. - msg = { - contentType: contentType, - content: data.array - }; - msg.content.length = data.array.length; - } - - let sender = PhoneNumberUtils.normalize(options.sourceAddress, false); - let parsedSender = PhoneNumberUtils.parse(sender); - if (parsedSender && parsedSender.internationalNumber) { - sender = parsedSender.internationalNumber; - } - - gSystemMessenger.broadcastMessage("wappush-received", { - sender: sender, - contentType: msg.contentType, - content: msg.content, - authInfo: authInfo, - serviceId: options.serviceId - }); - }, - - /** - * @param array - * A Uint8Array or an octet array representing raw PDU data. - * @param length - * Length of the array. - * @param offset - * Offset of the array that a raw PDU data begins. - * @param options - * WDP bearer information. - */ - receiveWdpPDU: function receiveWdpPDU(array, length, offset, options) { - if ((options.bearer == null) || !options.sourceAddress - || (options.sourcePort == null) || !array) { - debug("Incomplete WDP PDU"); - return; - } - - if (options.destinationPort != WDP_PORT_PUSH) { - debug("Not WAP Push port: " + options.destinationPort); - return; - } - - this.processMessage({array: array, offset: offset}, options); - }, -}; - -var debug; -if (DEBUG) { - debug = function (s) { - dump("-*- WapPushManager: " + s + "\n"); - }; -} else { - debug = function (s) {}; -} - -this.EXPORTED_SYMBOLS = ALL_CONST_SYMBOLS.concat([ - "WapPushManager", -]); -
deleted file mode 100644 --- a/dom/wappush/gonk/WbxmlPduHelper.jsm +++ /dev/null @@ -1,504 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this file, - * You can obtain one at http://mozilla.org/MPL/2.0/. */ - -"use strict"; - -const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; - -var WSP = {}; -Cu.import("resource://gre/modules/WspPduHelper.jsm", WSP); - -/** - * Token flags - * - * @see WAP-192-WBXML-20010725-A, clause 5.8.2 - */ -const TAG_TOKEN_ATTR_MASK = 0x80; -const TAG_TOKEN_CONTENT_MASK = 0x40; -const TAG_TOKEN_VALUE_MASK = 0x3F; - -/** - * Global tokens - * - * @see WAP-192-WBXML-20010725-A, clause 7.1 - */ -const CODE_PAGE_SWITCH_TOKEN = 0x00; -const TAG_END_TOKEN = 0x01; -const INLINE_STRING_TOKEN = 0x03; -const STRING_TABLE_TOKEN = 0x83; -const OPAQUE_TOKEN = 0xC3; - -// Set to true to enable debug message on all WBXML decoders. -this.DEBUG_ALL = false; - -// Enable debug message for WBXML decoder core. -this.DEBUG = DEBUG_ALL | false; - -/** - * Handle WBXML code page switch. - * - * @param data - * A wrapped object containing raw PDU data. - * @param decodeInfo - * Internal information for decode process. - * - * @see WAP-192-WBXML-20010725-A, clause 5.8.4.7.2 and 5.8.1 - */ -this.WbxmlCodePageSwitch = { - decode: function decode_wbxml_code_page_switch(data, decodeInfo) { - let codePage = WSP.Octet.decode(data); - - if (decodeInfo.currentState === "tag") { - decodeInfo.currentTokenList.tag = decodeInfo.tokenList.tag[codePage]; - - if (!decodeInfo.currentTokenList.tag) { - throw new Error("Invalid tag code page: " + codePage + "."); - } - - return ""; - } - - if (decodeInfo.currentState === "attr") { - decodeInfo.currentTokenList.attr = decodeInfo.tokenList.attr[codePage]; - decodeInfo.currentTokenList.value = decodeInfo.tokenList.value[codePage]; - - if (!decodeInfo.currentTokenList.attr || - !decodeInfo.currentTokenList.value) { - throw new Error("Invalid attr code page: " + codePage + "."); - } - - return ""; - } - - throw new Error("Invalid decoder state: " + decodeInfo.currentState + "."); - }, -}; - -/** - * Parse end WBXML encoded message. - * - * @param data - * A wrapped object containing raw PDU data. - * @param decodeInfo - * Internal information for decode process. - * - * @see WAP-192-WBXML-20010725-A, clause 5.8.4.7.1 - * - */ -this.WbxmlEnd = { - decode: function decode_wbxml_end(data, decodeInfo) { - let tagInfo = decodeInfo.tagStack.pop(); - return "</" + tagInfo.name + ">"; - }, -}; - -/** - * Escape XML reserved characters &, <, >, " and ' which may appear in the - * WBXML-encoded strings in their original form. - * - * @param str - * A string with potentially unescaped characters - * - * @return A string with the &, <, >, " and ' characters turned into XML - * character entitites - * - * @see WAP-192-WBXML-20010725-A, clause 6.1 - */ -this.escapeReservedCharacters = function escape_reserved_characters(str) { - let dst = ""; - - for (var i = 0; i < str.length; i++) { - switch (str[i]) { - case '&' : dst += "&" ; break; - case '<' : dst += "<" ; break; - case '>' : dst += ">" ; break; - case '"' : dst += """; break; - case '\'': dst += "'"; break; - default : dst += str[i]; - } - } - - return dst; -} - -/** - * Handle string table in WBXML message. - * - * @see WAP-192-WBXML-20010725-A, clause 5.7 - */ -this.readStringTable = function decode_wbxml_read_string_table(start, stringTable, charset) { - let end = start; - - // Find end of string - let stringTableLength = stringTable.length; - while (end < stringTableLength) { - if (stringTable[end] === 0) { - break; - } - end++; - } - - // Read string table - return WSP.PduHelper.decodeStringContent(stringTable.subarray(start, end), - charset); -}; - -this.WbxmlStringTable = { - decode: function decode_wbxml_string_table(data, decodeInfo) { - let start = WSP.Octet.decode(data); - let str = readStringTable(start, decodeInfo.stringTable, decodeInfo.charset); - - return escapeReservedCharacters(str); - } -}; - -/** - * Parse inline string in WBXML encoded message. - * - * @param data - * A wrapped object containing raw PDU data. - * @param decodeInfo - * Internal information for decode process. - * - * @see WAP-192-WBXML-20010725-A, clause 5.8.4.1 - * - */ -this.WbxmlInlineString = { - decode: function decode_wbxml_inline_string(data, decodeInfo) { - let charCode = WSP.Octet.decode(data); - let stringData = []; - while (charCode) { - stringData.push(charCode); - charCode = WSP.Octet.decode(data); - } - - let str = WSP.PduHelper.decodeStringContent(stringData, decodeInfo.charset); - - return escapeReservedCharacters(str); - }, -}; - -/** - * Parse inline Opaque data in WBXML encoded message. - * - * @param data - * A wrapped object containing raw PDU data. - * @param decodeInfo - * Internal information for decode process. - * - * @see WAP-192-WBXML-20010725-A, clause 5.8.4.6 - * - */ -this.WbxmlOpaque = { - decode: function decode_wbxml_inline_opaque(data) { - // Inline OPAQUE must be decoded based on application definition, - // so it's illegal to run into OPAQUE type in general decoder. - throw new Error("OPQAUE decoder is not defined."); - }, -}; - -this.PduHelper = { - - /** - * Parse WBXML encoded message into plain text. - * - * @param data - * A wrapped object containing raw PDU data. - * @param decodeInfo - * Information for decoding, now requires charset and string table. - * @param appToken - * Application-specific token difinition. - * - * @return Decoded WBXML message string. - */ - parseWbxml: function parseWbxml_wbxml(data, decodeInfo, appToken) { - - // Parse token definition to my structure. - decodeInfo.tokenList = { - tag: appToken.tagTokenList, - attr: appToken.attrTokenList, - value: appToken.valueTokenList - }; - decodeInfo.tagStack = []; // tag decode stack - decodeInfo.currentTokenList = { - tag: decodeInfo.tokenList.tag[0], - attr: decodeInfo.tokenList.attr[0], - value: decodeInfo.tokenList.value[0] - }; - decodeInfo.currentState = "tag"; // Current decoding state, "tag" or "attr" - // Used to read corresponding code page - // initial state : "tag" - - // Merge global tag tokens into single list, so we don't have - // to search two lists every time. - let globalTagTokenList = Object.create(WBXML_GLOBAL_TOKENS); - if (appToken.globalTokenOverride) { - let globalTokenOverrideList = appToken.globalTokenOverride; - for (let token in globalTokenOverrideList) { - globalTagTokenList[token] = globalTokenOverrideList[token]; - } - } - - let content = ""; - while (data.offset < data.array.length) { - // Decode content, might be a new tag token, an end of tag token, or an - // inline string. - - // Switch to tag domain - decodeInfo.currentState = "tag"; - - let tagToken = WSP.Octet.decode(data); - let tagTokenValue = tagToken & TAG_TOKEN_VALUE_MASK; - - // Try global tag first, tagToken of string table is 0x83, and will be 0x03 - // in tagTokenValue, which is collision with inline string. - // So tagToken need to be searched before tagTokenValue. - let tagInfo = globalTagTokenList[tagToken] || - globalTagTokenList[tagTokenValue]; - if (tagInfo) { - content += tagInfo.coder.decode(data, decodeInfo); - continue; - } - - // Check if application tag token is valid - tagInfo = decodeInfo.currentTokenList.tag[tagTokenValue]; - if (!tagInfo) { - throw new Error("Unsupported WBXML token: " + tagTokenValue + "."); - } - - content += "<" + tagInfo.name; - - if (tagToken & TAG_TOKEN_ATTR_MASK) { - // Decode attributes, might be a new attribute token, a value token, - // or an inline string - - // Switch to attr/value domain - decodeInfo.currentState = "attr"; - - let attrSeperator = ""; - while (data.offset < data.array.length) { - let attrToken = WSP.Octet.decode(data); - if (attrToken === TAG_END_TOKEN) { - break; - } - - let attrInfo = globalTagTokenList[attrToken]; - if (attrInfo) { - content += attrInfo.coder.decode(data, decodeInfo); - continue; - } - - // Check if attribute token is valid - attrInfo = decodeInfo.currentTokenList.attr[attrToken]; - if (attrInfo) { - content += attrSeperator + " " + attrInfo.name + "=\"" + attrInfo.value; - attrSeperator = "\""; - continue; - } - - attrInfo = decodeInfo.currentTokenList.value[attrToken]; - if (attrInfo) { - content += attrInfo.value; - continue; - } - - throw new Error("Unsupported WBXML token: " + attrToken + "."); - } - - content += attrSeperator; - } - - if (tagToken & TAG_TOKEN_CONTENT_MASK) { - content += ">"; - decodeInfo.tagStack.push(tagInfo); - continue; - } - - content += "/>"; - } - - return content; - }, - - /** - * @param data - * A wrapped object containing raw PDU data. - * @param appToken - * contains application-specific token info, including - * { - * publicId : Public identifier of application. - * tagToken : Ojbect defines application tag tokens. - * In form of - * Object[TAG_NAME] = Object[TOKEN_NUMBER] = - * { - * name: "TOKEN_NAME", - * number: TOKEN_NUMBER - * } - * attrToken : Object defines application attribute tokens. - * Object[ATTR_NAME] = Object[TOKEN_NUMBER] = - * { - * name: "ATTR_NAME", - * value: "ATTR_VALUE", - * number: TOKEN_NUMBER - * } - * For attribute value tokens, assign name as "" - * globalTokenOverride : Object overrides decoding behavior of global tokens. - * In form of - * Object[GLOBAL_TOKEN_NUMBER] = - * { - * decode: function(data), - * encode: function(data) - * } - * decode() returns decoded text, encode() returns - * encoded raw data. - * } - * - * @return A WBXML message object or null in case of errors found. - */ - parse: function parse_wbxml(data, appToken) { - let msg = {}; - - /** - * Read WBXML header. - * - * @see WAP-192-WBXML-20010725-A, Clause 5.3 - */ - let headerRaw = {}; - headerRaw.version = WSP.Octet.decode(data); - headerRaw.publicId = WSP.UintVar.decode(data); - if (headerRaw.publicId === 0) { - headerRaw.publicIdStr = WSP.UintVar.decode(data); - } - headerRaw.charset = WSP.UintVar.decode(data); - - let stringTableLen = WSP.UintVar.decode(data); - msg.stringTable = - WSP.Octet.decodeMultiple(data, data.offset + stringTableLen); - - // Transform raw header into user-friendly form - let entry = WSP.WSP_WELL_KNOWN_CHARSETS[headerRaw.charset]; - if (!entry) { - throw new Error("Charset is not supported."); - } - msg.charset = entry.name; - - if (headerRaw.publicId !== 0) { - msg.publicId = WBXML_PUBLIC_ID[headerRaw.publicId]; - } else { - msg.publicId = readStringTable(headerRaw.publicIdStr, msg.stringTable, - WSP.WSP_WELL_KNOWN_CHARSETS[msg.charset].converter); - } - if (msg.publicId != appToken.publicId) { - throw new Error("Public ID does not match."); - } - - msg.version = ((headerRaw.version >> 4) + 1) + "." + (headerRaw.version & 0x0F); - - let decodeInfo = { - charset: WSP.WSP_WELL_KNOWN_CHARSETS[msg.charset].converter, // document character set - stringTable: msg.stringTable // document string table - }; - msg.content = this.parseWbxml(data, decodeInfo, appToken); - - return msg; - } -}; - -/** - * Global Tokens - * - * @see WAP-192-WBXML-20010725-A, clause 7.1 - */ -const WBXML_GLOBAL_TOKENS = (function () { - let names = {}; - function add(number, coder) { - let entry = { - number: number, - coder: coder, - }; - names[number] = entry; - } - - add(CODE_PAGE_SWITCH_TOKEN, WbxmlCodePageSwitch); - add(TAG_END_TOKEN, WbxmlEnd); - add(INLINE_STRING_TOKEN, WbxmlInlineString); - add(STRING_TABLE_TOKEN, WbxmlStringTable); - add(OPAQUE_TOKEN, WbxmlOpaque); - - return names; -})(); - -/** - * Pre-defined public IDs - * - * @see http://technical.openmobilealliance.org/tech/omna/omna-wbxml-public-docid.aspx - */ -const WBXML_PUBLIC_ID = (function () { - let ids = {}; - function add(id, text) { - ids[id] = text; - } - - // Well Known Values - add(0x01, "UNKNOWN"); - add(0x02, "-//WAPFORUM//DTD WML 1.0//EN"); - add(0x03, "-//WAPFORUM//DTD WTA 1.0//EN"); - add(0x04, "-//WAPFORUM//DTD WML 1.1//EN"); - add(0x05, "-//WAPFORUM//DTD SI 1.0//EN"); - add(0x06, "-//WAPFORUM//DTD SL 1.0//EN"); - add(0x07, "-//WAPFORUM//DTD CO 1.0//EN"); - add(0x08, "-//WAPFORUM//DTD CHANNEL 1.1//EN"); - add(0x09, "-//WAPFORUM//DTD WML 1.2//EN"); - add(0x0A, "-//WAPFORUM//DTD WML 1.3//EN"); - add(0x0B, "-//WAPFORUM//DTD PROV 1.0//EN"); - add(0x0C, "-//WAPFORUM//DTD WTA-WML 1.2//EN"); - add(0x0D, "-//WAPFORUM//DTD EMN 1.0//EN"); - add(0x0E, "-//OMA//DTD DRMREL 1.0//EN"); - add(0x0F, "-//WIRELESSVILLAGE//DTD CSP 1.0//EN"); - add(0x10, "-//WIRELESSVILLAGE//DTD CSP 1.1//EN"); - add(0x11, "-//OMA//DTD WV-CSP 1.2//EN"); - add(0x12, "-//OMA//DTD IMPS-CSP 1.3//EN"); - add(0x13, "-//OMA//DRM 2.1//EN"); - add(0x14, "-//OMA//SRM 1.0//EN"); - add(0x15, "-//OMA//DCD 1.0//EN"); - add(0x16, "-//OMA//DTD DS-DataObjectEmail 1.2//EN"); - add(0x17, "-//OMA//DTD DS-DataObjectFolder 1.2//EN"); - add(0x18, "-//OMA//DTD DS-DataObjectFile 1.2//EN"); - - // Registered Values - add(0x0FD1, "-//SYNCML//DTD SyncML 1.0//EN"); - add(0x0FD2, "-//SYNCML//DTD DevInf 1.0//EN"); - add(0x0FD3, "-//SYNCML//DTD SyncML 1.1//EN"); - add(0x0FD4, "-//SYNCML//DTD DevInf 1.1//EN"); - add(0x1100, "-//PHONE.COM//DTD ALERT 1.0//EN"); - add(0x1101, "-//PHONE.COM//DTD CACHE-OPERATION 1.0//EN"); - add(0x1102, "-//PHONE.COM//DTD SIGNAL 1.0//EN"); - add(0x1103, "-//PHONE.COM//DTD LIST 1.0//EN"); - add(0x1104, "-//PHONE.COM//DTD LISTCMD 1.0//EN"); - add(0x1105, "-//PHONE.COM//DTD CHANNEL 1.0//EN"); - add(0x1106, "-//PHONE.COM//DTD MMC 1.0//EN"); - add(0x1107, "-//PHONE.COM//DTD BEARER-CHOICE 1.0//EN"); - add(0x1108, "-//PHONE.COM//DTD WML 1.1//EN"); - add(0x1109, "-//PHONE.COM//DTD CHANNEL 1.1//EN"); - add(0x110A, "-//PHONE.COM//DTD LIST 1.1//EN"); - add(0x110B, "-//PHONE.COM//DTD LISTCMD 1.1//EN"); - add(0x110C, "-//PHONE.COM//DTD MMC 1.1//EN"); - add(0x110D, "-//PHONE.COM//DTD WML 1.3//EN"); - add(0x110E, "-//PHONE.COM//DTD MMC 2.0//EN"); - add(0x1200, "-//3GPP2.COM//DTD IOTA 1.0//EN"); - add(0x1201, "-//SYNCML//DTD SyncML 1.2//EN"); - add(0x1202, "-//SYNCML//DTD MetaInf 1.2//EN"); - add(0x1203, "-//SYNCML//DTD DevInf 1.2//EN"); - add(0x1204, "-//NOKIA//DTD LANDMARKS 1.0//EN"); - add(0x1205, "-//SyncML//Schema SyncML 2.0//EN"); - add(0x1206, "-//SyncML//Schema DevInf 2.0//EN"); - add(0x1207, "-//OMA//DTD DRMREL 1.0//EN"); - - return ids; -})(); - -this.EXPORTED_SYMBOLS = [ - // Parser - "PduHelper", -];
deleted file mode 100644 --- a/dom/wappush/moz.build +++ /dev/null @@ -1,16 +0,0 @@ -# vim: set filetype=python: -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -if CONFIG['ENABLE_TESTS']: - XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell.ini'] - -if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']: - EXTRA_JS_MODULES += [ - 'gonk/CpPduHelper.jsm', - 'gonk/SiPduHelper.jsm', - 'gonk/SlPduHelper.jsm', - 'gonk/WapPushManager.js', - 'gonk/WbxmlPduHelper.jsm' - ]
deleted file mode 100644 --- a/dom/wappush/tests/header_helpers.js +++ /dev/null @@ -1,10 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; - - -var subscriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"] - .getService(Ci.mozIJSSubScriptLoader);
deleted file mode 100644 --- a/dom/wappush/tests/test_cp_pdu_helper.js +++ /dev/null @@ -1,724 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -var CP = {}; -subscriptLoader.loadSubScript("resource://gre/modules/CpPduHelper.jsm", CP); -CP.debug = do_print; - -function run_test() { - run_next_test(); -} - -function test_parser(rawDataArray, contentType, expectResult) { - let data = { array: rawDataArray, offset: 0 }; - let msg = CP.PduHelper.parse(data, contentType); - do_check_eq(msg.contentType, expectResult.contentType); - do_check_eq(msg.content, expectResult.content); - do_check_eq(msg.content.length, expectResult.content.length); -} - -function test_hmac(rawDataArray, mac, key, expectResult) { - let authInfo = CP.Authenticator.check(rawDataArray, 0, mac, function getNetworkPin() { - return key; - }); - do_check_eq(authInfo.data, rawDataArray); - do_check_eq(authInfo.data.length, rawDataArray.length); - do_check_eq(authInfo.checked, expectResult.checked); - do_check_eq(authInfo.pass, expectResult.pass); -} - -/* - * Test data from OMA-TS-WAP_ProvCont-V1_1-2009 0421-C.pdf, clause 6.1 - */ -var text_data_array = new Uint8Array([ - 0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x22, 0x31, - 0x2E, 0x30, 0x22, 0x3F, 0x3E, 0x3C, 0x21, 0x44, - 0x4F, 0x43, 0x54, 0x59, 0x50, 0x45, 0x20, 0x77, - 0x61, 0x70, 0x2D, 0x70, 0x72, 0x6F, 0x76, 0x69, - 0x73, 0x69, 0x6F, 0x6E, 0x69, 0x6E, 0x67, 0x64, - 0x6F, 0x63, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, - 0x43, 0x20, 0x22, 0x2D, 0x2F, 0x2F, 0x57, 0x41, - 0x50, 0x46, 0x4F, 0x52, 0x55, 0x4D, 0x2F, 0x2F, - 0x44, 0x54, 0x44, 0x20, 0x50, 0x52, 0x4F, 0x56, - 0x20, 0x31, 0x2E, 0x30, 0x2F, 0x2F, 0x45, 0x4E, - 0x22, 0x20, 0x22, 0x68, 0x74, 0x74, 0x70, 0x3A, - 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x77, 0x61, - 0x70, 0x66, 0x6F, 0x72, 0x75, 0x6D, 0x2E, 0x6F, - 0x72, 0x67, 0x2F, 0x44, 0x54, 0x44, 0x2F, 0x70, - 0x72, 0x6F, 0x76, 0x2E, 0x64, 0x74, 0x64, 0x22, - 0x3E, 0x3C, 0x77, 0x61, 0x70, 0x2D, 0x70, 0x72, - 0x6F, 0x76, 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x69, - 0x6E, 0x67, 0x64, 0x6F, 0x63, 0x20, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x22, 0x31, - 0x2E, 0x30, 0x22, 0x3E, 0x3C, 0x63, 0x68, 0x61, - 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, 0x69, 0x73, - 0x74, 0x69, 0x63, 0x20, 0x74, 0x79, 0x70, 0x65, - 0x3D, 0x22, 0x50, 0x58, 0x4C, 0x4F, 0x47, 0x49, - 0x43, 0x41, 0x4C, 0x22, 0x3E, 0x3C, 0x70, 0x61, - 0x72, 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, - 0x22, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x2D, 0x49, - 0x44, 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, - 0x3D, 0x22, 0x31, 0x37, 0x30, 0x2E, 0x31, 0x38, - 0x37, 0x2E, 0x35, 0x31, 0x2E, 0x34, 0x22, 0x2F, - 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, 0x20, 0x6E, - 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x50, 0x52, 0x4F, - 0x58, 0x59, 0x2D, 0x50, 0x57, 0x22, 0x20, 0x76, - 0x61, 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x70, 0x72, - 0x6F, 0x78, 0x79, 0x70, 0x61, 0x73, 0x73, 0x77, - 0x64, 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, - 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, - 0x50, 0x50, 0x47, 0x41, 0x55, 0x54, 0x48, 0x2D, - 0x54, 0x59, 0x50, 0x45, 0x22, 0x20, 0x76, 0x61, - 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x48, 0x54, 0x54, - 0x50, 0x2D, 0x42, 0x41, 0x53, 0x49, 0x43, 0x22, - 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, 0x20, - 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x4E, 0x41, - 0x4D, 0x45, 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, - 0x65, 0x3D, 0x22, 0x42, 0x61, 0x6E, 0x6B, 0x4D, - 0x61, 0x69, 0x6E, 0x50, 0x72, 0x6F, 0x78, 0x79, - 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, - 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x53, - 0x54, 0x41, 0x52, 0x54, 0x50, 0x41, 0x47, 0x45, - 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, - 0x22, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, - 0x77, 0x77, 0x77, 0x2E, 0x62, 0x61, 0x6E, 0x6B, - 0x2E, 0x63, 0x6F, 0x6D, 0x2F, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x70, 0x61, 0x67, 0x65, 0x2E, 0x77, - 0x6D, 0x6C, 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, - 0x72, 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, - 0x22, 0x50, 0x55, 0x4C, 0x4C, 0x45, 0x4E, 0x41, - 0x42, 0x4C, 0x45, 0x44, 0x22, 0x20, 0x76, 0x61, - 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x31, 0x22, 0x2F, - 0x3E, 0x3C, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, - 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, - 0x20, 0x74, 0x79, 0x70, 0x65, 0x3D, 0x22, 0x50, - 0x58, 0x41, 0x55, 0x54, 0x48, 0x49, 0x4E, 0x46, - 0x4F, 0x22, 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, - 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x50, - 0x58, 0x41, 0x55, 0x54, 0x48, 0x2D, 0x54, 0x59, - 0x50, 0x45, 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, - 0x65, 0x3D, 0x22, 0x48, 0x54, 0x54, 0x50, 0x2D, - 0x42, 0x41, 0x53, 0x49, 0x43, 0x22, 0x2F, 0x3E, - 0x3C, 0x70, 0x61, 0x72, 0x6D, 0x20, 0x6E, 0x61, - 0x6D, 0x65, 0x3D, 0x22, 0x50, 0x58, 0x41, 0x55, - 0x54, 0x48, 0x2D, 0x49, 0x44, 0x22, 0x20, 0x76, - 0x61, 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x70, 0x78, - 0x75, 0x73, 0x65, 0x72, 0x6E, 0x61, 0x6D, 0x65, - 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, - 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x50, - 0x58, 0x41, 0x55, 0x54, 0x48, 0x2D, 0x50, 0x57, - 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, - 0x22, 0x70, 0x78, 0x75, 0x73, 0x65, 0x72, 0x70, - 0x61, 0x73, 0x73, 0x77, 0x64, 0x22, 0x2F, 0x3E, - 0x3C, 0x2F, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, - 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, - 0x3E, 0x3C, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, - 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, - 0x20, 0x74, 0x79, 0x70, 0x65, 0x3D, 0x22, 0x50, - 0x58, 0x50, 0x48, 0x59, 0x53, 0x49, 0x43, 0x41, - 0x4C, 0x22, 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, - 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x50, - 0x48, 0x59, 0x53, 0x49, 0x43, 0x41, 0x4C, 0x2D, - 0x50, 0x52, 0x4F, 0x58, 0x59, 0x2D, 0x49, 0x44, - 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, - 0x22, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x20, 0x31, - 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, - 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x44, - 0x4F, 0x4D, 0x41, 0x49, 0x4E, 0x22, 0x20, 0x76, - 0x61, 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x77, 0x77, - 0x77, 0x2E, 0x62, 0x61, 0x6E, 0x6B, 0x2E, 0x63, - 0x6F, 0x6D, 0x2F, 0x22, 0x2F, 0x3E, 0x3C, 0x70, - 0x61, 0x72, 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, - 0x3D, 0x22, 0x50, 0x58, 0x41, 0x44, 0x44, 0x52, - 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, - 0x22, 0x31, 0x37, 0x30, 0x2E, 0x31, 0x38, 0x37, - 0x2E, 0x35, 0x31, 0x2E, 0x33, 0x22, 0x2F, 0x3E, - 0x3C, 0x70, 0x61, 0x72, 0x6D, 0x20, 0x6E, 0x61, - 0x6D, 0x65, 0x3D, 0x22, 0x50, 0x58, 0x41, 0x44, - 0x44, 0x52, 0x54, 0x59, 0x50, 0x45, 0x22, 0x20, - 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x49, - 0x50, 0x56, 0x34, 0x22, 0x2F, 0x3E, 0x3C, 0x70, - 0x61, 0x72, 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, - 0x3D, 0x22, 0x50, 0x58, 0x41, 0x44, 0x44, 0x52, - 0x2D, 0x46, 0x51, 0x44, 0x4E, 0x22, 0x20, 0x76, - 0x61, 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x70, 0x72, - 0x6F, 0x78, 0x79, 0x31, 0x2E, 0x6F, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x6F, 0x72, 0x2E, 0x63, 0x6F, - 0x6D, 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, - 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, - 0x54, 0x4F, 0x2D, 0x4E, 0x41, 0x50, 0x49, 0x44, - 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, - 0x22, 0x49, 0x4E, 0x54, 0x45, 0x52, 0x4E, 0x45, - 0x54, 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, - 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, - 0x54, 0x4F, 0x2D, 0x4E, 0x41, 0x50, 0x49, 0x44, - 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, - 0x22, 0x4E, 0x41, 0x50, 0x31, 0x22, 0x2F, 0x3E, - 0x3C, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, - 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, 0x20, - 0x74, 0x79, 0x70, 0x65, 0x3D, 0x22, 0x50, 0x4F, - 0x52, 0x54, 0x22, 0x3E, 0x3C, 0x70, 0x61, 0x72, - 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, - 0x50, 0x4F, 0x52, 0x54, 0x4E, 0x42, 0x52, 0x22, - 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, 0x22, - 0x39, 0x32, 0x30, 0x33, 0x22, 0x2F, 0x3E, 0x3C, - 0x2F, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, - 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, 0x3E, - 0x3C, 0x2F, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, - 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, - 0x3E, 0x3C, 0x2F, 0x63, 0x68, 0x61, 0x72, 0x61, - 0x63, 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, - 0x63, 0x3E, 0x3C, 0x63, 0x68, 0x61, 0x72, 0x61, - 0x63, 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, - 0x63, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3D, 0x22, - 0x4E, 0x41, 0x50, 0x44, 0x45, 0x46, 0x22, 0x3E, - 0x3C, 0x70, 0x61, 0x72, 0x6D, 0x20, 0x6E, 0x61, - 0x6D, 0x65, 0x3D, 0x22, 0x4E, 0x41, 0x50, 0x49, - 0x44, 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, - 0x3D, 0x22, 0x4E, 0x41, 0x50, 0x31, 0x22, 0x2F, - 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, 0x20, 0x6E, - 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x42, 0x45, 0x41, - 0x52, 0x45, 0x52, 0x22, 0x20, 0x76, 0x61, 0x6C, - 0x75, 0x65, 0x3D, 0x22, 0x47, 0x53, 0x4D, 0x2D, - 0x43, 0x53, 0x44, 0x22, 0x2F, 0x3E, 0x3C, 0x70, - 0x61, 0x72, 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, - 0x3D, 0x22, 0x4E, 0x41, 0x4D, 0x45, 0x22, 0x20, - 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x4D, - 0x59, 0x20, 0x49, 0x53, 0x50, 0x20, 0x43, 0x53, - 0x44, 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, - 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, - 0x4E, 0x41, 0x50, 0x2D, 0x41, 0x44, 0x44, 0x52, - 0x45, 0x53, 0x53, 0x22, 0x20, 0x76, 0x61, 0x6C, - 0x75, 0x65, 0x3D, 0x22, 0x2B, 0x33, 0x35, 0x38, - 0x30, 0x38, 0x31, 0x32, 0x34, 0x30, 0x30, 0x32, - 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, - 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x4E, - 0x41, 0x50, 0x2D, 0x41, 0x44, 0x44, 0x52, 0x54, - 0x59, 0x50, 0x45, 0x22, 0x20, 0x76, 0x61, 0x6C, - 0x75, 0x65, 0x3D, 0x22, 0x45, 0x31, 0x36, 0x34, - 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, - 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x44, - 0x4E, 0x53, 0x2D, 0x41, 0x44, 0x44, 0x52, 0x22, - 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, 0x22, - 0x31, 0x37, 0x30, 0x2E, 0x31, 0x38, 0x37, 0x2E, - 0x35, 0x31, 0x2E, 0x32, 0x22, 0x2F, 0x3E, 0x3C, - 0x70, 0x61, 0x72, 0x6D, 0x20, 0x6E, 0x61, 0x6D, - 0x65, 0x3D, 0x22, 0x43, 0x41, 0x4C, 0x4C, 0x54, - 0x59, 0x50, 0x45, 0x22, 0x20, 0x76, 0x61, 0x6C, - 0x75, 0x65, 0x3D, 0x22, 0x41, 0x4E, 0x41, 0x4C, - 0x4F, 0x47, 0x2D, 0x4D, 0x4F, 0x44, 0x45, 0x4D, - 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, - 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x4D, - 0x41, 0x58, 0x2D, 0x4E, 0x55, 0x4D, 0x2D, 0x52, - 0x45, 0x54, 0x52, 0x59, 0x22, 0x20, 0x76, 0x61, - 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x33, 0x22, 0x2F, - 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, 0x20, 0x6E, - 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x46, 0x49, 0x52, - 0x53, 0x54, 0x2D, 0x52, 0x45, 0x54, 0x52, 0x59, - 0x2D, 0x54, 0x49, 0x4D, 0x45, 0x4F, 0x55, 0x54, - 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, - 0x22, 0x36, 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, - 0x72, 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, - 0x22, 0x52, 0x45, 0x52, 0x45, 0x47, 0x2D, 0x54, - 0x48, 0x52, 0x45, 0x53, 0x48, 0x4F, 0x4C, 0x44, - 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, - 0x22, 0x33, 0x30, 0x22, 0x2F, 0x3E, 0x3C, 0x70, - 0x61, 0x72, 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, - 0x3D, 0x22, 0x54, 0x2D, 0x42, 0x49, 0x54, 0x22, - 0x2F, 0x3E, 0x3C, 0x63, 0x68, 0x61, 0x72, 0x61, - 0x63, 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, - 0x63, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3D, 0x22, - 0x4E, 0x41, 0x50, 0x41, 0x55, 0x54, 0x48, 0x49, - 0x4E, 0x46, 0x4F, 0x22, 0x3E, 0x3C, 0x70, 0x61, - 0x72, 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, - 0x22, 0x41, 0x55, 0x54, 0x48, 0x54, 0x59, 0x50, - 0x45, 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, - 0x3D, 0x22, 0x50, 0x41, 0x50, 0x22, 0x2F, 0x3E, - 0x3C, 0x70, 0x61, 0x72, 0x6D, 0x20, 0x6E, 0x61, - 0x6D, 0x65, 0x3D, 0x22, 0x41, 0x55, 0x54, 0x48, - 0x4E, 0x41, 0x4D, 0x45, 0x22, 0x20, 0x76, 0x61, - 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x77, 0x77, 0x77, - 0x6D, 0x6D, 0x6D, 0x75, 0x73, 0x65, 0x72, 0x22, - 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, 0x20, - 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x41, 0x55, - 0x54, 0x48, 0x53, 0x45, 0x43, 0x52, 0x45, 0x54, - 0x22, 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, - 0x22, 0x77, 0x77, 0x77, 0x6D, 0x6D, 0x6D, 0x73, - 0x65, 0x63, 0x72, 0x65, 0x74, 0x22, 0x2F, 0x3E, - 0x3C, 0x70, 0x61, 0x72, 0x6D, 0x20, 0x6E, 0x61, - 0x6D, 0x65, 0x3D, 0x22, 0x41, 0x55, 0x54, 0x48, - 0x2D, 0x45, 0x4E, 0x54, 0x49, 0x54, 0x59, 0x22, - 0x20, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, 0x22, - 0x48, 0x41, 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, - 0x72, 0x6D, 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, - 0x22, 0x53, 0x50, 0x49, 0x22, 0x20, 0x76, 0x61, - 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x46, 0x45, 0x44, - 0x43, 0x42, 0x41, 0x39, 0x38, 0x22, 0x2F, 0x3E, - 0x3C, 0x2F, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, - 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, - 0x3E, 0x3C, 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, - 0x74, 0x65, 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, - 0x20, 0x74, 0x79, 0x70, 0x65, 0x3D, 0x22, 0x56, - 0x41, 0x4C, 0x49, 0x44, 0x49, 0x54, 0x59, 0x22, - 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, 0x20, 0x6E, - 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x43, 0x4F, 0x55, - 0x4E, 0x54, 0x52, 0x59, 0x22, 0x20, 0x76, 0x61, - 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x32, 0x32, 0x38, - 0x22, 0x2F, 0x3E, 0x3C, 0x70, 0x61, 0x72, 0x6D, - 0x20, 0x6E, 0x61, 0x6D, 0x65, 0x3D, 0x22, 0x4E, - 0x45, 0x54, 0x57, 0x4F, 0x52, 0x4B, 0x22, 0x20, - 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, 0x22, 0x30, - 0x30, 0x31, 0x22, 0x2F, 0x3E, 0x3C, 0x2F, 0x63, - 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, - 0x69, 0x73, 0x74, 0x69, 0x63, 0x3E, 0x3C, 0x2F, - 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, - 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, 0x3E, 0x3C, - 0x63, 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, - 0x72, 0x69, 0x73, 0x74, 0x69, 0x63, 0x20, 0x74, - 0x79, 0x70, 0x65, 0x3D, 0x22, 0x41, 0x43, 0x43, - 0x45, 0x53, 0x53, 0x22, 0x3E, 0x3C, 0x2F, 0x63, - 0x68, 0x61, 0x72, 0x61, 0x63, 0x74, 0x65, 0x72, - 0x69, 0x73, 0x74, 0x69, 0x63, 0x3E, 0x3C, 0x2F, - 0x77, 0x61, 0x70, 0x2D, 0x70, 0x72, 0x6F, 0x76, - 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x69, 0x6E, 0x67, - 0x64, 0x6F, 0x63, 0x3E -]); - -/* - * Test data from OMA-TS-WAP_ProvCont-V1_1-20090421-C.pdf, Appendix C - */ -var wbxml_data_array = new Uint8Array([ - // WBXML version 1.3 - 0x03, - // The Public Identifier for "-//WAPFORUM//DTD PROV 1.0//EN" - 0x0b, - // Character set UTF-8 - 0x6a, - // String table length = 05 - 0x05, - // String table: 'N', 'A', 'P', '1', 00 - 0x4e, 0x41, 0x50, 0x31, 0x00, - // <wap-provisioningdoc version="1.0"> - 0xc5, 0x46, 0x01, - // <characteristic type="PXLOGICAL"> - 0xc6, 0x51, 0x01, - // <parm name="PROXY-ID" value="170.187.51.4"/> - 0x87, 0x15, 0x06, 0x03, 0x31, 0x37, 0x30, 0x2e, - 0x31, 0x38, 0x37, 0x2e, 0x35, 0x31, 0x2e, 0x34, - 0x00, 0x01, - // <parm name="PROXY-PW" value="proxypasswd"/> - 0x87, 0x3E, 0x06, 0x03, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, 0x00, - 0x01, - // <parm name="PPGAUTH-TYPE" value="HTTP-BASIC"/> - 0x87, 0x3F, 0x06, 0x9C, 0x01, - // <parm name="NAME" value="BankMainProxy"/> - 0x87, 0x07, 0x06, 0x03, 0x42, 0x61, 0x6e, 0x6b, - 0x4d, 0x61, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x78, - 0x79, 0x00, 0x01, - // <parm name="STARTPAGE" value="http://www.bank.com/startpage.wml"/> - 0x87, 0x1c, 0x06, 0x03, 0x68, 0x74, 0x74, 0x70, - 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x62, - 0x61, 0x6e, 0x6b, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x70, 0x61, 0x67, - 0x65, 0x2e, 0x77, 0x6d, 0x6c, 0x00, 0x01, - // <parm name="PULLENABLED" value="1"/> - 0x87, 0x47, 0x06, 0x03, 0x31, 0x00, 0x01, - // <characteristic type="PXAUTHINFO"> - 0xc6, 0x59, 0x01, - // <parm name="PXAUTH-TYPE" value="HTTP-BASIC"/> - 0x87, 0x19, 0x06, 0x9c, 0x01, - // <parm name="PXAUTH-ID" value="pxusername"/> - 0x87, 0x1a, 0x06, 0x03, 0x70, 0x78, 0x75, 0x73, - 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x01, - // <parm name="PXAUTH-PW" value="pxuserpasswd"/> - 0x87, 0x1b, 0x06, 0x03, 0x70, 0x78, 0x75, 0x73, - 0x65, 0x72, 0x70, 0x61, 0x73, 0x73, 0x77, 0x64, - 0x00, 0x01, - // </characteristic> - 0x01, - // <characteristic type="PXPHYSICAL"> - 0xc6, 0x52, 0x01, - // <parm name="PHYSICAL-PROXY-ID" value="PROXY 1"/> - 0x87, 0x2f, 0x06, 0x03, 0x50, 0x52, 0x4f, 0x58, - 0x59, 0x20, 0x31, 0x00, 0x01, - // <parm name="DOMAIN" value="www.bank.com/"/> - 0x87, 0x17, 0x06, 0x03, 0x77, 0x77, 0x77, 0x2e, - 0x62, 0x61, 0x6e, 0x6b, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x00, 0x01, - // <parm name="PXADDR" value="170.187.51.3"/> - 0x87, 0x20, 0x06, 0x03, 0x31, 0x37, 0x30, 0x2e, - 0x31, 0x38, 0x37, 0x2e, 0x35, 0x31, 0x2e, 0x33, - 0x00, 0x01, - // <parm name="PXADDRTYPE" value="IPV4"/> - 0x87, 0x21, 0x06, 0x85, 0x01, - // <parm name="PXADDR-FQDN" value="proxy1.operator.com"/> - 0x87, 0x3D, 0x06, 0x03, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x31, 0x2e, 0x6f, 0x70, 0x65, 0x72, 0x61, - 0x74, 0x6f, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x00, - 0x01, - // <parm name="TO-NAPID" value="INTERNET"/> - 0x87, 0x22, 0x06, 0x03, 0x49, 0x4e, 0x54, 0x45, - 0x52, 0x4e, 0x45, 0x54, 0x00, 0x01, - // <parm name="TO-NAPID" value="NAP1"/> - 0x87, 0x22, 0x06, 0x83, 0x00, 0x01, - // <characteristic type="PORT"> - 0xc6, 0x53, 0x01, - // <parm name="PORTNBR" value="9203"/> - 0x87, 0x23, 0x06, 0x03, 0x39, 0x32, 0x30, 0x33, - 0x00, 0x01, - // </characteristic> - 0x01, - // </characteristic> - 0x01, - // </characteristic> - 0x01, - // <characteristic type="NAPDEF"> - 0xc6, 0x55, 0x01, - // <parm name="NAPID" value="NAP1"/> - 0x87, 0x11, 0x06, 0x83, 0x00, 0x01, - // <parm name="BEARER" value="GSM-CSD"/> - 0x87, 0x10, 0x06, 0xaa, 0x01, - // <parm name="NAME" value="MY ISP CSD"/> - 0x87, 0x07, 0x06, 0x03, 0x4d, 0x59, 0x20, 0x49, - 0x53, 0x50, 0x20, 0x43, 0x53, 0x44, 0x00, 0x01, - // <parm name="NAP-ADDRESS" value="+35808124002"/> - 0x87, 0x08, 0x06, 0x03, 0x2b, 0x33, 0x35, 0x38, - 0x30, 0x38, 0x31, 0x32, 0x34, 0x30, 0x30, 0x32, - 0x00, 0x01, - // <parm name="NAP-ADDRTYPE" value="E164"/> - 0x87, 0x09, 0x06, 0x87, 0x01, - // <parm name="DNS-ADDR" value="170.187.51.2"/> - 0x87, 0x48, 0x06, 0x03, 0x31, 0x37, 0x30, 0x2e, - 0x31, 0x38, 0x37, 0x2e, 0x35, 0x31, 0x2e, 0x32, - 0x00, 0x01, - // <parm name="CALLTYPE" value="ANALOG-MODEM"/> - 0x87, 0x0a, 0x06, 0x90, 0x01, - // <parm name="MAX-NUM-RETRY" value="3"/> - 0x87, 0x49, 0x06, 0x03, 0x33, 0x00, 0x01, - // <parm name="FIRST-RETRY-TIMEOUT" value="6"/> - 0x87, 0x4A, 0x06, 0x03, 0x36, 0x00, 0x01, - // <parm name="REREG-THRESHOLD" value="30"/> - 0x87, 0x4B, 0x06, 0x03, 0x33, 0x30, 0x00, 0x01, - // <parm name="T-BIT"/> - 0x87, 0x4C, 0x01, - // <characteristic type="NAPAUTHINFO"> - 0xc6, 0x5a, 0x01, - // <parm name="AUTHTYPE" value="PAP"/> - 0x87, 0x0c, 0x06, 0x9a, 0x01, - // <parm name="AUTHNAME" value="wwwmmmuser"/> - 0x87, 0x0d, 0x06, 0x03, 0x77, 0x77, 0x77, 0x6d, - 0x6d, 0x6d, 0x75, 0x73, 0x65, 0x72, 0x00, 0x01, - // <parm name="AUTHSECRET" value="wwwmmmsecret"/> - 0x87, 0x0e, 0x06, 0x03, 0x77, 0x77, 0x77, 0x6d, - 0x6d, 0x6d, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, - 0x00, 0x01, - // <parm name="AUTH-ENTITY" value="HA"/> - 0x87, 0x4E, 0x06, 0xE1, 0x01, - // <parm name="SPI" value="FEDCBA98"/> - 0x87, 0x4F, 0x06, 0x03, 0x46, 0x45, 0x44, 0x43, - 0x42, 0x41, 0x39, 0x38, 0x00, 0x01, - // </characteristic> - 0x01, - // <characteristic type="VALIDITY"> - 0xc6, 0x54, 0x01, - // <parm name="COUNTRY" value="228"/> - 0x87, 0x12, 0x06, 0x03, 0x32, 0x32, 0x38, 0x00, - 0x01, - // <parm name="NETWORK" value="001"/> - 0x87, 0x13, 0x06, 0x03, 0x30, 0x30, 0x31, 0x00, - 0x01, - // </characteristic> - 0x01, - // </characteristic> - 0x01, - // <characteristic type="ACCESS"> - 0xC6, 0x5B, 0x01, - // </characteristic> - 0x01, - // </wap-provisioningdoc> - 0x01 -]); - -/* - * Test data from CHT CP, with code page change - */ -var wbxml_code_page_data_array = new Uint8Array([ - 0x03, 0x0B, 0x6A, 0x00, 0x45, 0xC6, 0x56, 0x01, - 0x87, 0x07, 0x06, 0x03, 0x43, 0x48, 0x54, 0x5F, - 0x65, 0x6D, 0x6F, 0x6D, 0x65, 0x00, 0x01, 0x01, - 0xC6, 0x00, 0x01, 0x55, 0x01, 0x87, 0x36, 0x00, - 0x00, 0x06, 0x03, 0x77, 0x32, 0x00, 0x01, 0x87, - 0x00, 0x01, 0x39, 0x00, 0x00, 0x06, 0x03, 0x57, - 0x50, 0x52, 0x4F, 0x58, 0x59, 0x00, 0x01, 0x87, - 0x07, 0x06, 0x03, 0x43, 0x48, 0x54, 0x5F, 0x65, - 0x6D, 0x6F, 0x6D, 0x65, 0x00, 0x01, 0xC6, 0x00, - 0x01, 0x59, 0x01, 0x87, 0x3A, 0x00, 0x00, 0x06, - 0x03, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, - 0x77, 0x61, 0x70, 0x2E, 0x65, 0x6D, 0x6F, 0x6D, - 0x65, 0x2E, 0x6E, 0x65, 0x74, 0x2F, 0x00, 0x01, - 0x87, 0x07, 0x06, 0x03, 0x43, 0x48, 0x54, 0x5F, - 0x65, 0x6D, 0x6F, 0x6D, 0x65, 0x00, 0x01, 0x87, - 0x1C, 0x01, 0x01, 0x01, 0xC6, 0x00, 0x01, 0x55, - 0x01, 0x87, 0x36, 0x00, 0x00, 0x06, 0x03, 0x77, - 0x34, 0x00, 0x01, 0x87, 0x00, 0x01, 0x39, 0x00, - 0x00, 0x06, 0x03, 0x4D, 0x50, 0x52, 0x4F, 0x58, - 0x59, 0x00, 0x01, 0x87, 0x00, 0x01, 0x34, 0x00, - 0x00, 0x06, 0x03, 0x68, 0x74, 0x74, 0x70, 0x3A, - 0x2F, 0x2F, 0x6D, 0x6D, 0x73, 0x3A, 0x38, 0x30, - 0x30, 0x32, 0x00, 0x01, 0x01, 0xC6, 0x51, 0x01, - 0x87, 0x15, 0x06, 0x03, 0x57, 0x50, 0x52, 0x4F, - 0x58, 0x59, 0x00, 0x01, 0x87, 0x07, 0x06, 0x03, - 0x43, 0x48, 0x54, 0x5F, 0x65, 0x6D, 0x6F, 0x6D, - 0x65, 0x00, 0x01, 0x87, 0x1C, 0x06, 0x03, 0x68, - 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x77, 0x61, - 0x70, 0x2E, 0x65, 0x6D, 0x6F, 0x6D, 0x65, 0x2E, - 0x6E, 0x65, 0x74, 0x2F, 0x00, 0x01, 0xC6, 0x52, - 0x01, 0x87, 0x2F, 0x06, 0x03, 0x50, 0x52, 0x4F, - 0x58, 0x59, 0x31, 0x00, 0x01, 0x87, 0x20, 0x06, - 0x03, 0x31, 0x30, 0x2E, 0x31, 0x2E, 0x31, 0x2E, - 0x31, 0x00, 0x01, 0x87, 0x21, 0x06, 0x85, 0x01, - 0x87, 0x22, 0x06, 0x03, 0x43, 0x48, 0x54, 0x5F, - 0x65, 0x6D, 0x6F, 0x6D, 0x65, 0x00, 0x01, 0xC6, - 0x53, 0x01, 0x87, 0x23, 0x06, 0x03, 0x38, 0x30, - 0x38, 0x30, 0x00, 0x01, 0x01, 0x01, 0x01, 0xC6, - 0x51, 0x01, 0x87, 0x15, 0x06, 0x03, 0x4D, 0x50, - 0x52, 0x4F, 0x58, 0x59, 0x00, 0x01, 0x87, 0x07, - 0x06, 0x03, 0x43, 0x48, 0x54, 0x5F, 0x4D, 0x4D, - 0x53, 0x00, 0x01, 0xC6, 0x52, 0x01, 0x87, 0x2F, - 0x06, 0x03, 0x50, 0x52, 0x4F, 0x58, 0x59, 0x32, - 0x00, 0x01, 0x87, 0x20, 0x06, 0x03, 0x31, 0x30, - 0x2E, 0x31, 0x2E, 0x31, 0x2E, 0x31, 0x00, 0x01, - 0x87, 0x21, 0x06, 0x85, 0x01, 0x87, 0x22, 0x06, - 0x03, 0x43, 0x48, 0x54, 0x5F, 0x4D, 0x4D, 0x53, - 0x00, 0x01, 0xC6, 0x53, 0x01, 0x87, 0x23, 0x06, - 0x03, 0x38, 0x30, 0x38, 0x30, 0x00, 0x01, 0x01, - 0x01, 0x01, 0xC6, 0x55, 0x01, 0x87, 0x11, 0x06, - 0x03, 0x43, 0x48, 0x54, 0x5F, 0x65, 0x6D, 0x6F, - 0x6D, 0x65, 0x00, 0x01, 0x87, 0x07, 0x06, 0x03, - 0x43, 0x48, 0x54, 0x5F, 0x65, 0x6D, 0x6F, 0x6D, - 0x65, 0x00, 0x01, 0x87, 0x10, 0x06, 0xAB, 0x01, - 0x87, 0x08, 0x06, 0x03, 0x65, 0x6D, 0x6F, 0x6D, - 0x65, 0x00, 0x01, 0x87, 0x09, 0x06, 0x89, 0x01, - 0x01, 0xC6, 0x55, 0x01, 0x87, 0x11, 0x06, 0x03, - 0x43, 0x48, 0x54, 0x5F, 0x4D, 0x4D, 0x53, 0x00, - 0x01, 0x87, 0x07, 0x06, 0x03, 0x43, 0x48, 0x54, - 0x5F, 0x4D, 0x4D, 0x53, 0x00, 0x01, 0x87, 0x10, - 0x06, 0xAB, 0x01, 0x87, 0x08, 0x06, 0x03, 0x65, - 0x6D, 0x6F, 0x6D, 0x65, 0x00, 0x01, 0x87, 0x09, - 0x06, 0x89, 0x01, 0x01, 0x01 -]); - -/* - * Test data from OMA-TS-WAP_ProvCont-V1_1-20090421-C.pdf, clause 6.1 - */ -var xml_header = - "<?xml version=\"1.0\"?>" + - "<!DOCTYPE wap-provisioningdoc PUBLIC \"-//WAPFORUM//DTD PROV 1.0//EN\" \"http://www.wapforum.org/DTD/prov.dtd\">"; - -var xml_body = - "<wap-provisioningdoc version=\"1.0\">" + - "<characteristic type=\"PXLOGICAL\">" + - "<parm name=\"PROXY-ID\" value=\"170.187.51.4\"/>" + - "<parm name=\"PROXY-PW\" value=\"proxypasswd\"/>" + - "<parm name=\"PPGAUTH-TYPE\" value=\"HTTP-BASIC\"/>" + - "<parm name=\"NAME\" value=\"BankMainProxy\"/>" + - "<parm name=\"STARTPAGE\" value=\"http://www.bank.com/startpage.wml\"/>" + - "<parm name=\"PULLENABLED\" value=\"1\"/>" + - "<characteristic type=\"PXAUTHINFO\">" + - "<parm name=\"PXAUTH-TYPE\" value=\"HTTP-BASIC\"/>" + - "<parm name=\"PXAUTH-ID\" value=\"pxusername\"/>" + - "<parm name=\"PXAUTH-PW\" value=\"pxuserpasswd\"/>" + - "</characteristic>" + - "<characteristic type=\"PXPHYSICAL\">" + - "<parm name=\"PHYSICAL-PROXY-ID\" value=\"PROXY 1\"/>" + - "<parm name=\"DOMAIN\" value=\"www.bank.com/\"/>" + - "<parm name=\"PXADDR\" value=\"170.187.51.3\"/>" + - "<parm name=\"PXADDRTYPE\" value=\"IPV4\"/>" + - "<parm name=\"PXADDR-FQDN\" value=\"proxy1.operator.com\"/>" + - "<parm name=\"TO-NAPID\" value=\"INTERNET\"/>" + - "<parm name=\"TO-NAPID\" value=\"NAP1\"/>" + - "<characteristic type=\"PORT\">" + - "<parm name=\"PORTNBR\" value=\"9203\"/>" + - "</characteristic>" + - "</characteristic>" + - "</characteristic>" + - "<characteristic type=\"NAPDEF\">" + - "<parm name=\"NAPID\" value=\"NAP1\"/>" + - "<parm name=\"BEARER\" value=\"GSM-CSD\"/>" + - "<parm name=\"NAME\" value=\"MY ISP CSD\"/>" + - "<parm name=\"NAP-ADDRESS\" value=\"+35808124002\"/>" + - "<parm name=\"NAP-ADDRTYPE\" value=\"E164\"/>" + - "<parm name=\"DNS-ADDR\" value=\"170.187.51.2\"/>" + - "<parm name=\"CALLTYPE\" value=\"ANALOG-MODEM\"/>" + - "<parm name=\"MAX-NUM-RETRY\" value=\"3\"/>" + - "<parm name=\"FIRST-RETRY-TIMEOUT\" value=\"6\"/>" + - "<parm name=\"REREG-THRESHOLD\" value=\"30\"/>" + - "<parm name=\"T-BIT\"/>" + - "<characteristic type=\"NAPAUTHINFO\">" + - "<parm name=\"AUTHTYPE\" value=\"PAP\"/>" + - "<parm name=\"AUTHNAME\" value=\"wwwmmmuser\"/>" + - "<parm name=\"AUTHSECRET\" value=\"wwwmmmsecret\"/>" + - "<parm name=\"AUTH-ENTITY\" value=\"HA\"/>" + - "<parm name=\"SPI\" value=\"FEDCBA98\"/>" + - "</characteristic>" + - "<characteristic type=\"VALIDITY\">" + - "<parm name=\"COUNTRY\" value=\"228\"/>" + - "<parm name=\"NETWORK\" value=\"001\"/>" + - "</characteristic>" + - "</characteristic>" + - "<characteristic type=\"ACCESS\">" + - "</characteristic>" + - "</wap-provisioningdoc>"; - -var wbxml_code_page_content = - "<wap-provisioningdoc>" + - "<characteristic type=\"BOOTSTRAP\">" + - "<parm name=\"NAME\" value=\"CHT_emome\"/>" + - "</characteristic>" + - "<characteristic type=\"APPLICATION\">" + - "<parm name=\"APPID\" value=\"w2\"/>" + - "<parm name=\"TO-PROXY\" value=\"WPROXY\"/>" + - "<parm name=\"NAME\" value=\"CHT_emome\"/>" + - "<characteristic type=\"RESOURCE\">" + - "<parm name=\"URI\" value=\"http://wap.emome.net/\"/>" + - "<parm name=\"NAME\" value=\"CHT_emome\"/>" + - "<parm name=\"STARTPAGE\"/>" + - "</characteristic>" + - "</characteristic>" + - "<characteristic type=\"APPLICATION\">" + - "<parm name=\"APPID\" value=\"w4\"/>" + - "<parm name=\"TO-PROXY\" value=\"MPROXY\"/>" + - "<parm name=\"ADDR\" value=\"http://mms:8002\"/>" + - "</characteristic>" + - "<characteristic type=\"PXLOGICAL\">" + - "<parm name=\"PROXY-ID\" value=\"WPROXY\"/>" + - "<parm name=\"NAME\" value=\"CHT_emome\"/>" + - "<parm name=\"STARTPAGE\" value=\"http://wap.emome.net/\"/>" + - "<characteristic type=\"PXPHYSICAL\">" + - "<parm name=\"PHYSICAL-PROXY-ID\" value=\"PROXY1\"/>" + - "<parm name=\"PXADDR\" value=\"10.1.1.1\"/>" + - "<parm name=\"PXADDRTYPE\" value=\"IPV4\"/>" + - "<parm name=\"TO-NAPID\" value=\"CHT_emome\"/>" + - "<characteristic type=\"PORT\">" + - "<parm name=\"PORTNBR\" value=\"8080\"/>" + - "</characteristic>" + - "</characteristic>" + - "</characteristic>" + - "<characteristic type=\"PXLOGICAL\">" + - "<parm name=\"PROXY-ID\" value=\"MPROXY\"/>" + - "<parm name=\"NAME\" value=\"CHT_MMS\"/>" + - "<characteristic type=\"PXPHYSICAL\">" + - "<parm name=\"PHYSICAL-PROXY-ID\" value=\"PROXY2\"/>" + - "<parm name=\"PXADDR\" value=\"10.1.1.1\"/>" + - "<parm name=\"PXADDRTYPE\" value=\"IPV4\"/>" + - "<parm name=\"TO-NAPID\" value=\"CHT_MMS\"/>" + - "<characteristic type=\"PORT\">" + - "<parm name=\"PORTNBR\" value=\"8080\"/>" + - "</characteristic>" + - "</characteristic>" + - "</characteristic>" + - "<characteristic type=\"NAPDEF\">" + - "<parm name=\"NAPID\" value=\"CHT_emome\"/>" + - "<parm name=\"NAME\" value=\"CHT_emome\"/>" + - "<parm name=\"BEARER\" value=\"GSM-GPRS\"/>" + - "<parm name=\"NAP-ADDRESS\" value=\"emome\"/>" + - "<parm name=\"NAP-ADDRTYPE\" value=\"APN\"/>" + - "</characteristic>" + - "<characteristic type=\"NAPDEF\">" + - "<parm name=\"NAPID\" value=\"CHT_MMS\"/>" + - "<parm name=\"NAME\" value=\"CHT_MMS\"/>" + - "<parm name=\"BEARER\" value=\"GSM-GPRS\"/>" + - "<parm name=\"NAP-ADDRESS\" value=\"emome\"/>" + - "<parm name=\"NAP-ADDRTYPE\" value=\"APN\"/>" + - "</characteristic>" + - "</wap-provisioningdoc>"; - -/** - * CP in plain text - * - * Test case from OMA-TS-WAP_ProvCont-V1_1-20090421-C.pdf, clause 6.1 - */ -add_test(function test_cp_parse_plain_text() { - test_parser(text_data_array, "text/vnd.wap.connectivity-xml", { - contentType: "text/vnd.wap.connectivity-xml", - content: xml_header + xml_body - }); - - run_next_test(); -}); - -/** - * CP compressed by WBXML - * - * Test case from OMA-TS-WAP_ProvCont-V1_1-20090421-C.pdf, Appendix C - */ -add_test(function test_cp_parse_wbxml() { - test_parser(wbxml_data_array, "application/vnd.wap.connectivity-wbxml", { - contentType: "text/vnd.wap.connectivity-xml", - content: xml_body - }); - - run_next_test(); -}); - -/** - * CP compressed by WBXML with VENDORCONFIG - */ -add_test(function test_cp_parse_wbxml() { - let wbxml_vendor_config_data_array = new Uint8Array([ - 0x03, 0x0b, 0x6a, 0x05, 0x4e, 0x41, 0x50, 0x31, - 0x00, 0xC5, 0x46, 0x01, 0xc6, 0x57, 0x01, 0x01 - ]); - - test_parser(wbxml_vendor_config_data_array, "application/vnd.wap.connectivity-wbxml", { - contentType: "application/vnd.wap.connectivity-wbxml", - content: wbxml_vendor_config_data_array - }); - - run_next_test(); -}); - -/** - * CP compressed by WBXML with code page switch - */ -add_test(function test_cp_parse_wbxml_code_page() { - test_parser(wbxml_code_page_data_array, "application/vnd.wap.connectivity-wbxml", { - contentType: "text/vnd.wap.connectivity-xml", - content: wbxml_code_page_content - }); - - run_next_test(); -}); - -/** - * HMAC test - */ -add_test(function test_cp_hmac_userpin() { - test_hmac(wbxml_code_page_data_array, - "AA2DC41FC48AEEF3FED7351B1EE704461A8894D4", - "0000", - { - checked: true, - pass: true - }); - - run_next_test(); -}); - -add_test(function test_cp_hmac_networkpin() { - let wbxml_empty_data_array = new Uint8Array([ - 0x03, 0x0b, 0x6a, 0x00, 0x45, 0x01 - ]); - - test_hmac(wbxml_empty_data_array, - "1AF545FE2823DC9347064450F90FF1BBF957E146", - CP.Authenticator.formatImsi("466923103145252"), - { - checked: true, - pass: true - }); - - run_next_test(); -});
deleted file mode 100644 --- a/dom/wappush/tests/test_si_pdu_helper.js +++ /dev/null @@ -1,200 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -var SI = {}; -subscriptLoader.loadSubScript("resource://gre/modules/SiPduHelper.jsm", SI); -SI.debug = do_print; - -function run_test() { - run_next_test(); -} - - -/** - * SI in Plain text - */ -add_test(function test_si_parse_plain_text() { - let contentType = ""; - let data = {}; - - contentType = "text/vnd.wap.si"; - data.array = new Uint8Array([ - 0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x27, 0x31, - 0x2E, 0x30, 0x27, 0x3F, 0x3E, 0x0A, 0x3C, 0x73, - 0x69, 0x3E, 0x3C, 0x69, 0x6E, 0x64, 0x69, 0x63, - 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x68, 0x72, - 0x65, 0x66, 0x3D, 0x27, 0x68, 0x74, 0x74, 0x70, - 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x6F, - 0x72, 0x65, 0x69, 0x6C, 0x6C, 0x79, 0x2E, 0x63, - 0x6F, 0x6D, 0x27, 0x3E, 0x43, 0x68, 0x65, 0x63, - 0x6B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x77, - 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x3C, 0x2F, - 0x69, 0x6E, 0x64, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6F, 0x6E, 0x3E, 0x3C, 0x2F, 0x73, 0x69, 0x3E - ]); - data.offset = 0; - let result = "<?xml version='1.0'?>\n<si><indication href='http://www.oreilly.com'>Check this website</indication></si>"; - let msg = SI.PduHelper.parse(data, contentType); - do_check_eq(msg.content, result); - - run_next_test(); -}); - -/** - * Empty SI compressed by WBXML - */ -add_test(function test_si_parse_wbxml_empty() { - let msg = {}; - let contentType = ""; - let data = {}; - - contentType = "application/vnd.wap.sic"; - data.array = new Uint8Array([ - 0x02, 0x05, 0x6A, 0x00, 0x05 - ]); - data.offset = 0; - let result = "<si/>"; - msg = SI.PduHelper.parse(data, contentType); - do_check_eq(msg.content, result); - - run_next_test(); -}); - -/** - * Empty SI compressed by WBXML, with public ID stored in string table - */ -add_test(function test_si_parse_wbxml_empty_public_id_string_table() { - let msg = {}; - let contentType = ""; - let data = {}; - - contentType = "application/vnd.wap.sic"; - 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/>"; - msg = SI.PduHelper.parse(data, contentType); - do_check_eq(msg.content, result); - - run_next_test(); -}); - -/** - * SI compressed by WBXML with href attribute - */ -add_test(function test_si_parse_wbxml_with_href() { - let msg = {}; - let contentType = ""; - let data = {}; - - contentType = "application/vnd.wap.sic"; - data.array = new Uint8Array([ - 0x02, 0x05, 0x6A, 0x00, 0x45, 0xC6, 0x0D, 0x03, - 0x6F, 0x72, 0x65, 0x69, 0x6C, 0x6C, 0x79, 0x00, - 0x85, 0x01, 0x03, 0x43, 0x68, 0x65, 0x63, 0x6B, - 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x77, 0x65, - 0x62, 0x73, 0x69, 0x74, 0x65, 0x00, 0x01, 0x01 - ]); - data.offset = 0; - let result = "<si><indication href=\"http://www.oreilly.com/\">" + - "Check this website</indication></si>"; - msg = SI.PduHelper.parse(data, contentType); - do_check_eq(msg.content, result); - - run_next_test(); -}); - -/** - * SI compressed by WBXML with href attribute containing reserved XML character - */ -add_test(function test_si_parse_wbxml_with_href_reserved_char() { - let msg = {}; - let contentType = ""; - let data = {}; - - contentType = "application/vnd.wap.sic"; - data.array = new Uint8Array([ - 0x02, 0x05, 0x6A, 0x00, 0x45, 0xC6, 0x0D, 0x03, - 0x6F, 0x72, 0x65, 0x69, 0x6C, 0x6C, 0x79, 0x00, - 0x85, 0x03, 0x66, 0x6F, 0x6F, 0x26, 0x62, 0x61, - 0x72, 0x00, 0x01, 0x03, 0x43, 0x68, 0x65, 0x63, - 0x6B, 0x20, 0x74, 0x68, 0x69, 0x73, 0x20, 0x77, - 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x00, 0x01, - 0x01 - ]); - data.offset = 0; - let result = "<si><indication href=\"http://www.oreilly.com/foo&bar\">" + - "Check this website</indication></si>"; - msg = SI.PduHelper.parse(data, contentType); - do_check_eq(msg.content, result); - - run_next_test(); -}); - -/** - * SI compressed by WBXML with href and date attribute - */ -add_test(function test_si_parse_wbxml_with_href_date() { - let msg = {}; - let contentType = ""; - let data = {}; - - contentType = "application/vnd.wap.sic"; - data.array = new Uint8Array([ - 0x02, 0x05, 0x6A, 0x00, 0x45, 0xC6, 0x0D, 0x03, - 0x78, 0x79, 0x7A, 0x00, 0x85, 0x03, 0x65, 0x6D, - 0x61, 0x69, 0x6C, 0x2F, 0x31, 0x32, 0x33, 0x2F, - 0x61, 0x62, 0x63, 0x2E, 0x77, 0x6D, 0x6C, 0x00, - 0x0A, 0xC3, 0x07, 0x19, 0x99, 0x06, 0x25, 0x15, - 0x23, 0x15, 0x10, 0xC3, 0x04, 0x19, 0x99, 0x06, - 0x30, 0x01, 0x03, 0x59, 0x6F, 0x75, 0x20, 0x68, - 0x61, 0x76, 0x65, 0x20, 0x34, 0x20, 0x6E, 0x65, - 0x77, 0x20, 0x65, 0x6D, 0x61, 0x69, 0x6C, 0x73, - 0x00, 0x01, 0x01 - ]); - data.offset = 0; - let result = "<si><indication href=\"http://www.xyz.com/email/123/abc.wml\"" + - " created=\"1999-06-25T15:23:15Z\" si-expires=\"1999-06-30T00:00:00Z\">" + - "You have 4 new emails</indication></si>"; - msg = SI.PduHelper.parse(data, contentType); - do_check_eq(msg.content, result); - - run_next_test(); -}); - -/** - * SI compressed by WBXML with attributes and string table - */ -add_test(function test_si_parse_wbxml_with_attr_string_table() { - let msg = {}; - let contentType = ""; - let data = {}; - - contentType = "application/vnd.wap.sic"; - data.array = new Uint8Array([ - 0x02, 0x05, 0x6A, 0x28, 0x65, 0x6D, 0x61, 0x69, - 0x6C, 0x2F, 0x31, 0x32, 0x33, 0x2F, 0x61, 0x62, - 0x63, 0x2E, 0x77, 0x6D, 0x6C, 0x00, 0x59, 0x6F, - 0x75, 0x20, 0x68, 0x61, 0x76, 0x65, 0x20, 0x34, - 0x20, 0x6E, 0x65, 0x77, 0x20, 0x65, 0x6D, 0x61, - 0x69, 0x6C, 0x73, 0x00, 0x45, 0xC6, 0x0D, 0x03, - 0x78, 0x79, 0x7A, 0x00, 0x85, 0x83, 0x00, 0x0A, - 0xC3, 0x07, 0x19, 0x99, 0x06, 0x25, 0x15, 0x23, - 0x15, 0x10, 0xC3, 0x04, 0x19, 0x99, 0x06, 0x30, - 0x01, 0x83, 0x12, 0x01, 0x01 - ]); - data.offset = 0; - let result = "<si><indication href=\"http://www.xyz.com/email/123/abc.wml\"" + - " created=\"1999-06-25T15:23:15Z\" si-expires=\"1999-06-30T00:00:00Z\">" + - "You have 4 new emails</indication></si>"; - msg = SI.PduHelper.parse(data, contentType); - do_check_eq(msg.content, result); - - run_next_test(); -});
deleted file mode 100644 --- a/dom/wappush/tests/test_sl_pdu_helper.js +++ /dev/null @@ -1,105 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ */ - -var SL = {}; -subscriptLoader.loadSubScript("resource://gre/modules/SlPduHelper.jsm", SL); -SL.debug = do_print; - -function run_test() { - run_next_test(); -} - -/** - * SL in plain text - */ -add_test(function test_sl_parse_plain_text() { - let contentType = ""; - let data = {}; - - contentType = "text/vnd.wap.sl"; - data.array = new Uint8Array([ - 0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x27, 0x31, - 0x2E, 0x30, 0x27, 0x3F, 0x3E, 0x0A, 0x3C, 0x73, - 0x6C, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3D, 0x27, - 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x77, - 0x77, 0x77, 0x2E, 0x6F, 0x72, 0x65, 0x69, 0x6C, - 0x6C, 0x79, 0x2E, 0x63, 0x6F, 0x6D, 0x27, 0x2F, - 0x3E - ]); - data.offset = 0; - let result = "<?xml version='1.0'?>\n<sl href='http://www.oreilly.com'/>"; - let msg = SL.PduHelper.parse(data, contentType); - do_check_eq(msg.content, result); - - run_next_test(); -}); - -/** - * SL compressed by WBXML - */ -add_test(function test_sl_parse_wbxml() { - let msg = {}; - let contentType = ""; - let data = {}; - - contentType = "application/vnd.wap.slc"; - data.array = new Uint8Array([ - 0x03, 0x06, 0x6A, 0x00, 0x85, 0x0A, 0x03, 0x6F, - 0x72, 0x65, 0x69, 0x6C, 0x6C, 0x79, 0x00, 0x85, - 0x01 - ]); - data.offset = 0; - let result = "<sl href=\"http://www.oreilly.com/\"/>"; - msg = SL.PduHelper.parse(data, contentType); - do_check_eq(msg.content, result); - - run_next_test(); -}); - -/** - * SL compressed by WBXML, with public ID stored in string table - */ -add_test(function test_sl_parse_wbxml_public_id_string_table() { - let msg = {}; - let contentType = ""; - let data = {}; - - contentType = "application/vnd.wap.slc"; - data.array = new Uint8Array([ - 0x03, 0x00, 0x00, 0x6A, 0x1C, 0x2D, 0x2F, 0x2F, - 0x57, 0x41, 0x50, 0x46, 0x4F, 0x52, 0x55, 0x4D, - 0x2F, 0x2F, 0x44, 0x54, 0x44, 0x20, 0x53, 0x4C, - 0x20, 0x31, 0x2E, 0x30, 0x2F, 0x2F, 0x45, 0x4E, - 0x00, 0x85, 0x0A, 0x03, 0x6F, 0x72, 0x65, 0x69, - 0x6C, 0x6C, 0x79, 0x00, 0x85, 0x01 - ]); - data.offset = 0; - let result = "<sl href=\"http://www.oreilly.com/\"/>"; - msg = SL.PduHelper.parse(data, contentType); - do_check_eq(msg.content, result); - - run_next_test(); -}); - -/** - * SL compressed by WBXML with string table - */ -add_test(function test_sl_parse_wbxml_with_string_table() { - let msg = {}; - let contentType = ""; - let data = {}; - - contentType = "application/vnd.wap.slc"; - data.array = new Uint8Array([ - 0x03, 0x06, 0x6A, 0x08, 0x6F, 0x72, 0x65, 0x69, - 0x6C, 0x6C, 0x79, 0x00, 0x85, 0x0A, 0x83, 0x00, - 0x85, 0x01 - ]); - data.offset = 0; - let result = "<sl href=\"http://www.oreilly.com/\"/>"; - msg = SL.PduHelper.parse(data, contentType); - do_check_eq(msg.content, result); - - run_next_test(); -});