mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1129325 - Remove nonstandard let blocks from dom. r=mrbkap
This commit is contained in:
parent
2fd37b675d
commit
6c6aceb1db
@ -142,13 +142,12 @@ function readTemplate(path) {
|
||||
cis.init(fis, "UTF-8", 0, 0);
|
||||
|
||||
var data = "";
|
||||
let (str = {}) {
|
||||
let read = 0;
|
||||
do {
|
||||
read = cis.readString(0xffffffff, str); // read as much as we can and put it in str.value
|
||||
data += str.value;
|
||||
} while (read != 0);
|
||||
}
|
||||
let str = {};
|
||||
let read = 0;
|
||||
do {
|
||||
read = cis.readString(0xffffffff, str); // read as much as we can and put it in str.value
|
||||
data += str.value;
|
||||
} while (read != 0);
|
||||
cis.close();
|
||||
return data;
|
||||
}
|
||||
|
@ -35,13 +35,12 @@ function readTemplate(path) {
|
||||
cis.init(fis, "UTF-8", 0, 0);
|
||||
|
||||
var data = "";
|
||||
let (str = {}) {
|
||||
let read = 0;
|
||||
do {
|
||||
read = cis.readString(0xffffffff, str); // read as much as we can and put it in str.value
|
||||
data += str.value;
|
||||
} while (read != 0);
|
||||
}
|
||||
let str = {};
|
||||
let read = 0;
|
||||
do {
|
||||
read = cis.readString(0xffffffff, str); // read as much as we can and put it in str.value
|
||||
data += str.value;
|
||||
} while (read != 0);
|
||||
cis.close();
|
||||
return data;
|
||||
}
|
||||
|
@ -665,31 +665,29 @@ add_test(function test_EncodedStringValue_decode() {
|
||||
// Test for non-well-known charset
|
||||
wsp_decode_test(MMS.EncodedStringValue, [1, 0x80], null, "NotWellKnownEncodingError");
|
||||
// Test for utf-8
|
||||
let (entry = MMS.WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"]) {
|
||||
// "Mozilla" in full width.
|
||||
let str = "\uff2d\uff4f\uff5a\uff49\uff4c\uff4c\uff41";
|
||||
let entry = MMS.WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"];
|
||||
// "Mozilla" in full width.
|
||||
let str = "\uff2d\uff4f\uff5a\uff49\uff4c\uff4c\uff41";
|
||||
|
||||
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
conv.charset = entry.converter;
|
||||
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
conv.charset = entry.converter;
|
||||
|
||||
let raw = conv.convertToByteArray(str).concat([0]);
|
||||
wsp_decode_test(MMS.EncodedStringValue,
|
||||
[raw.length + 2, 0x80 | entry.number, 127].concat(raw), str);
|
||||
}
|
||||
let raw = conv.convertToByteArray(str).concat([0]);
|
||||
wsp_decode_test(MMS.EncodedStringValue,
|
||||
[raw.length + 2, 0x80 | entry.number, 127].concat(raw), str);
|
||||
|
||||
let (entry = MMS.WSP.WSP_WELL_KNOWN_CHARSETS["utf-16"]) {
|
||||
// "Mozilla" in full width.
|
||||
let str = "\u004d\u006F\u007A\u0069\u006C\u006C\u0061";
|
||||
entry = MMS.WSP.WSP_WELL_KNOWN_CHARSETS["utf-16"];
|
||||
// "Mozilla" in full width.
|
||||
str = "\u004d\u006F\u007A\u0069\u006C\u006C\u0061";
|
||||
|
||||
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
conv.charset = entry.converter;
|
||||
conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
conv.charset = entry.converter;
|
||||
|
||||
let raw = conv.convertToByteArray(str).concat([0]);
|
||||
wsp_decode_test(MMS.EncodedStringValue,
|
||||
[raw.length + 3, 2, 3, 247].concat(raw), str);
|
||||
}
|
||||
raw = conv.convertToByteArray(str).concat([0]);
|
||||
wsp_decode_test(MMS.EncodedStringValue,
|
||||
[raw.length + 3, 2, 3, 247].concat(raw), str);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
@ -701,28 +699,27 @@ add_test(function test_EncodedStringValue_encode() {
|
||||
wsp_encode_test(MMS.EncodedStringValue, "Hello", strToCharCodeArray("Hello"));
|
||||
|
||||
// Test for utf-8
|
||||
let (entry = MMS.WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"]) {
|
||||
// "Mozilla" in full width.
|
||||
let str = "\uff2d\uff4f\uff5a\uff49\uff4c\uff4c\uff41";
|
||||
let entry = MMS.WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"];
|
||||
// "Mozilla" in full width.
|
||||
let str = "\uff2d\uff4f\uff5a\uff49\uff4c\uff4c\uff41";
|
||||
|
||||
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
conv.charset = entry.converter;
|
||||
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
conv.charset = entry.converter;
|
||||
|
||||
let raw = conv.convertToByteArray(str).concat([0]);
|
||||
wsp_encode_test(MMS.EncodedStringValue, str,
|
||||
[raw.length + 2, 0x80 | entry.number, 127].concat(raw));
|
||||
let raw = conv.convertToByteArray(str).concat([0]);
|
||||
wsp_encode_test(MMS.EncodedStringValue, str,
|
||||
[raw.length + 2, 0x80 | entry.number, 127].concat(raw));
|
||||
|
||||
// MMS.EncodedStringValue encodes non us-ascii characters (128 ~ 255)
|
||||
// (e.g., 'Ñ' or 'ü') by the utf-8 encoding. Otherwise, for us-ascii
|
||||
// characters (0 ~ 127), still use the normal TextString encoding.
|
||||
// MMS.EncodedStringValue encodes non us-ascii characters (128 ~ 255)
|
||||
// (e.g., 'Ñ' or 'ü') by the utf-8 encoding. Otherwise, for us-ascii
|
||||
// characters (0 ~ 127), still use the normal TextString encoding.
|
||||
|
||||
// "Ñü" in full width.
|
||||
str = "\u00d1\u00fc";
|
||||
raw = conv.convertToByteArray(str).concat([0]);
|
||||
wsp_encode_test(MMS.EncodedStringValue, str,
|
||||
[raw.length + 2, 0x80 | entry.number, 127].concat(raw));
|
||||
}
|
||||
// "Ñü" in full width.
|
||||
str = "\u00d1\u00fc";
|
||||
raw = conv.convertToByteArray(str).concat([0]);
|
||||
wsp_encode_test(MMS.EncodedStringValue, str,
|
||||
[raw.length + 2, 0x80 | entry.number, 127].concat(raw));
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
@ -790,10 +787,9 @@ add_test(function test_FromValue_decode() {
|
||||
// Test for Insert-address-token:
|
||||
wsp_decode_test(MMS.FromValue, [1, 129], null);
|
||||
// Test for Address-present-token:
|
||||
let (addr = strToCharCodeArray("+123/TYPE=PLMN")) {
|
||||
wsp_decode_test(MMS.FromValue, [addr.length + 1, 128].concat(addr),
|
||||
{address: "+123", type: "PLMN"});
|
||||
}
|
||||
let addr = strToCharCodeArray("+123/TYPE=PLMN");
|
||||
wsp_decode_test(MMS.FromValue, [addr.length + 1, 128].concat(addr),
|
||||
{address: "+123", type: "PLMN"});
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
@ -804,10 +800,9 @@ add_test(function test_FromValue_encode() {
|
||||
// Test for Insert-address-token:
|
||||
wsp_encode_test(MMS.FromValue, null, [1, 129]);
|
||||
// Test for Address-present-token:
|
||||
let (addr = strToCharCodeArray("+123/TYPE=PLMN")) {
|
||||
wsp_encode_test(MMS.FromValue, {address: "+123", type: "PLMN"},
|
||||
[addr.length + 1, 128].concat(addr));
|
||||
}
|
||||
let addr = strToCharCodeArray("+123/TYPE=PLMN");
|
||||
wsp_encode_test(MMS.FromValue, {address: "+123", type: "PLMN"},
|
||||
[addr.length + 1, 128].concat(addr));
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
@ -1371,4 +1366,3 @@ add_test(function test_PduHelper_encodeHeaders() {
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
|
@ -275,15 +275,14 @@ add_test(function test_AcceptCharsetValue_decode() {
|
||||
wsp_decode_test(WSP.AcceptCharsetValue, [128], {charset: "*"});
|
||||
// Test for Constrained-Charset
|
||||
wsp_decode_test(WSP.AcceptCharsetValue, [65, 0], {charset: "A"});
|
||||
let (entry = WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"]) {
|
||||
wsp_decode_test(WSP.AcceptCharsetValue, [entry.number | 0x80], {charset: entry.name});
|
||||
}
|
||||
let entry = WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"];
|
||||
wsp_decode_test(WSP.AcceptCharsetValue, [entry.number | 0x80], {charset: entry.name});
|
||||
|
||||
// Test for Accept-Charset-General-Form
|
||||
wsp_decode_test(WSP.AcceptCharsetValue, [1, 128], {charset: "*"});
|
||||
let (entry = WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"]) {
|
||||
wsp_decode_test(WSP.AcceptCharsetValue, [2, 1, entry.number], {charset: entry.name});
|
||||
wsp_decode_test(WSP.AcceptCharsetValue, [1, entry.number | 0x80], {charset: entry.name});
|
||||
}
|
||||
entry = WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"];
|
||||
wsp_decode_test(WSP.AcceptCharsetValue, [2, 1, entry.number], {charset: entry.name});
|
||||
wsp_decode_test(WSP.AcceptCharsetValue, [1, entry.number | 0x80], {charset: entry.name});
|
||||
wsp_decode_test(WSP.AcceptCharsetValue, [3, 65, 0, 100], {charset: "A", q: 0.99});
|
||||
|
||||
run_next_test();
|
||||
@ -551,10 +550,9 @@ add_test(function test_ApplicationIdValue_decode() {
|
||||
wsp_decode_test(WSP.ApplicationIdValue, [0], "");
|
||||
wsp_decode_test(WSP.ApplicationIdValue, [65, 0], "A");
|
||||
wsp_decode_test(WSP.ApplicationIdValue, [97, 0], "a");
|
||||
let (entry = WSP.OMNA_PUSH_APPLICATION_IDS["x-wap-application:mms.ua"]) {
|
||||
wsp_decode_test(WSP.ApplicationIdValue, [entry.number | 0x80], entry.urn);
|
||||
wsp_decode_test(WSP.ApplicationIdValue, [1, entry.number], entry.urn);
|
||||
}
|
||||
let entry = WSP.OMNA_PUSH_APPLICATION_IDS["x-wap-application:mms.ua"];
|
||||
wsp_decode_test(WSP.ApplicationIdValue, [entry.number | 0x80], entry.urn);
|
||||
wsp_decode_test(WSP.ApplicationIdValue, [1, entry.number], entry.urn);
|
||||
wsp_decode_test(WSP.ApplicationIdValue, [0xFF], null, "NotWellKnownEncodingError");
|
||||
|
||||
run_next_test();
|
||||
|
@ -43,22 +43,22 @@ add_test(function test_Header_decode() {
|
||||
|
||||
add_test(function test_WellKnownHeader_decode() {
|
||||
wsp_decode_test(WSP.WellKnownHeader, [0xFF], null, "NotWellKnownEncodingError");
|
||||
let (entry = WSP.WSP_HEADER_FIELDS["push-flag"]) {
|
||||
// Test for Short-Integer
|
||||
wsp_decode_test(WSP.WellKnownHeader, [entry.number | 0x80, 0x80],
|
||||
{name: entry.name, value: 0});
|
||||
// Test for NoValue
|
||||
wsp_decode_test(WSP.WellKnownHeader, [entry.number | 0x80, 0],
|
||||
{name: entry.name, value: null});
|
||||
// Test for TokenText
|
||||
wsp_decode_test(WSP.WellKnownHeader, [entry.number | 0x80, 65, 0],
|
||||
{name: entry.name, value: "A"});
|
||||
// Test for QuotedString
|
||||
wsp_decode_test(WSP.WellKnownHeader, [entry.number | 0x80, 34, 128, 0],
|
||||
{name: entry.name, value: String.fromCharCode(128)});
|
||||
// Test for skipValue
|
||||
wsp_decode_test(WSP.WellKnownHeader, [entry.number | 0x80, 2, 0, 0], null);
|
||||
}
|
||||
let entry = WSP.WSP_HEADER_FIELDS["push-flag"];
|
||||
|
||||
// Test for Short-Integer
|
||||
wsp_decode_test(WSP.WellKnownHeader, [entry.number | 0x80, 0x80],
|
||||
{name: entry.name, value: 0});
|
||||
// Test for NoValue
|
||||
wsp_decode_test(WSP.WellKnownHeader, [entry.number | 0x80, 0],
|
||||
{name: entry.name, value: null});
|
||||
// Test for TokenText
|
||||
wsp_decode_test(WSP.WellKnownHeader, [entry.number | 0x80, 65, 0],
|
||||
{name: entry.name, value: "A"});
|
||||
// Test for QuotedString
|
||||
wsp_decode_test(WSP.WellKnownHeader, [entry.number | 0x80, 34, 128, 0],
|
||||
{name: entry.name, value: String.fromCharCode(128)});
|
||||
// Test for skipValue
|
||||
wsp_decode_test(WSP.WellKnownHeader, [entry.number | 0x80, 2, 0, 0], null);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
@ -109,9 +109,8 @@ add_test(function test_FieldName_decode() {
|
||||
wsp_decode_test(WSP.FieldName, [0], "");
|
||||
wsp_decode_test(WSP.FieldName, [65, 0], "a");
|
||||
wsp_decode_test(WSP.FieldName, [97, 0], "a");
|
||||
let (entry = WSP.WSP_HEADER_FIELDS["content-length"]) {
|
||||
wsp_decode_test(WSP.FieldName, [entry.number | 0x80], entry.name);
|
||||
}
|
||||
let entry = WSP.WSP_HEADER_FIELDS["content-length"];
|
||||
wsp_decode_test(WSP.FieldName, [entry.number | 0x80], entry.name);
|
||||
wsp_decode_test(WSP.FieldName, [0xFF], null, "NotWellKnownEncodingError");
|
||||
|
||||
run_next_test();
|
||||
@ -146,37 +145,36 @@ add_test(function test_PduHelper_parseHeaders() {
|
||||
|
||||
add_test(function StringContent_decode() {
|
||||
//Test for utf-8
|
||||
let (entry = WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"]) {
|
||||
// "Mozilla" in full width.
|
||||
let str = "\uff2d\uff4f\uff5a\uff49\uff4c\uff4c\uff41";
|
||||
let entry = WSP.WSP_WELL_KNOWN_CHARSETS["utf-8"];
|
||||
|
||||
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
conv.charset = entry.converter;
|
||||
// "Mozilla" in full width.
|
||||
let str = "\uff2d\uff4f\uff5a\uff49\uff4c\uff4c\uff41";
|
||||
|
||||
let raw = conv.convertToByteArray(str);
|
||||
let data = {array: raw, offset: 0};
|
||||
let octetArray = WSP.Octet.decodeMultiple(data, data.array.length);
|
||||
wsp_decode_test_ex(function(data) {
|
||||
return WSP.PduHelper.decodeStringContent(data.array, "utf-8");
|
||||
}, octetArray, str);
|
||||
}
|
||||
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
conv.charset = entry.converter;
|
||||
|
||||
let (entry = WSP.WSP_WELL_KNOWN_CHARSETS["utf-16"]) {
|
||||
// "Mozilla" in full width.
|
||||
let str = "\u004d\u006F\u007A\u0069\u006C\u006C\u0061";
|
||||
let raw = conv.convertToByteArray(str);
|
||||
let data = {array: raw, offset: 0};
|
||||
let octetArray = WSP.Octet.decodeMultiple(data, data.array.length);
|
||||
wsp_decode_test_ex(function(data) {
|
||||
return WSP.PduHelper.decodeStringContent(data.array, "utf-8");
|
||||
}, octetArray, str);
|
||||
|
||||
let conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
conv.charset = entry.converter;
|
||||
entry = WSP.WSP_WELL_KNOWN_CHARSETS["utf-16"];
|
||||
// "Mozilla" in full width.
|
||||
str = "\u004d\u006F\u007A\u0069\u006C\u006C\u0061";
|
||||
|
||||
let raw = conv.convertToByteArray(str);
|
||||
let data = {array: raw, offset: 0};
|
||||
let octetArray = WSP.Octet.decodeMultiple(data, data.array.length);
|
||||
wsp_decode_test_ex(function(data) {
|
||||
return WSP.PduHelper.decodeStringContent(data.array, "utf-16");
|
||||
}, raw, str);
|
||||
}
|
||||
conv = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
conv.charset = entry.converter;
|
||||
|
||||
raw = conv.convertToByteArray(str);
|
||||
data = {array: raw, offset: 0};
|
||||
octetArray = WSP.Octet.decodeMultiple(data, data.array.length);
|
||||
wsp_decode_test_ex(function(data) {
|
||||
return WSP.PduHelper.decodeStringContent(data.array, "utf-16");
|
||||
}, raw, str);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
@ -32,13 +32,12 @@ function readTemplate(path) {
|
||||
cis.init(fis, "UTF-8", 0, 0);
|
||||
|
||||
var data = "";
|
||||
let (str = {}) {
|
||||
let read = 0;
|
||||
do {
|
||||
read = cis.readString(0xffffffff, str); // read as much as we can and put it in str.value
|
||||
data += str.value;
|
||||
} while (read != 0);
|
||||
}
|
||||
let str = {};
|
||||
let read = 0;
|
||||
do {
|
||||
read = cis.readString(0xffffffff, str); // read as much as we can and put it in str.value
|
||||
data += str.value;
|
||||
} while (read != 0);
|
||||
cis.close();
|
||||
return data;
|
||||
}
|
||||
@ -51,4 +50,3 @@ function getQuery(request) {
|
||||
});
|
||||
return query;
|
||||
}
|
||||
|
||||
|
@ -35,13 +35,12 @@ function readTemplate(path) {
|
||||
cis.init(fis, "UTF-8", 0, 0);
|
||||
|
||||
var data = "";
|
||||
let (str = {}) {
|
||||
let read = 0;
|
||||
do {
|
||||
read = cis.readString(0xffffffff, str); // read as much as we can and put it in str.value
|
||||
data += str.value;
|
||||
} while (read != 0);
|
||||
}
|
||||
let str = {};
|
||||
let read = 0;
|
||||
do {
|
||||
read = cis.readString(0xffffffff, str); // read as much as we can and put it in str.value
|
||||
data += str.value;
|
||||
} while (read != 0);
|
||||
cis.close();
|
||||
return data;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user