Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | // Tests conversion of 8-byte decomposed Hangul from EUC-KR (and variants) |
michael@0 | 2 | // to Unicode, including invalid input |
michael@0 | 3 | |
michael@0 | 4 | load('CharsetConversionTests.js'); |
michael@0 | 5 | load('hangulTestStrings.js'); |
michael@0 | 6 | |
michael@0 | 7 | const aliases = [ "euc-kr", "EUC-KR", "iso-ir-149", "ks_c_5601-1989", "ksc_5601", "ksc5601", "korean", "csksc56011987", "5601", "windows-949", "ks_c_5601-1987", "cseuckr"]; |
michael@0 | 8 | |
michael@0 | 9 | function to8byteHangul(byte3, byte5, byte7) |
michael@0 | 10 | { |
michael@0 | 11 | return String.fromCharCode(0xa4, 0xd4, 0xa4, byte3, 0xa4, byte5, 0xa4, byte7); |
michael@0 | 12 | } |
michael@0 | 13 | |
michael@0 | 14 | function run_test() { |
michael@0 | 15 | var converter = CreateScriptableConverter(); |
michael@0 | 16 | for (var i = 0; i < aliases.length; ++i) { |
michael@0 | 17 | var row = 0; |
michael@0 | 18 | for (var byte3 = 0xa0; byte3 < 0xc0; ++byte3) { |
michael@0 | 19 | for (var byte5 = 0xbe; byte5 < 0xd5; ++byte5) { |
michael@0 | 20 | var inString = " row " + byte3.toString(16) + "_" + |
michael@0 | 21 | byte5.toString(16) + "_: "; |
michael@0 | 22 | for (var byte7 = 0xa0; byte7 < 0xc0; ++byte7) { |
michael@0 | 23 | inString += to8byteHangul(byte3, byte5, byte7) + " "; |
michael@0 | 24 | } |
michael@0 | 25 | inString += to8byteHangul(byte3, byte5, 0xd4) + " "; |
michael@0 | 26 | checkDecode(converter, aliases[i], inString, expectedStrings[row++]); |
michael@0 | 27 | } |
michael@0 | 28 | } |
michael@0 | 29 | do_check_eq(row, expectedStrings.length); |
michael@0 | 30 | } |
michael@0 | 31 | } |