intl/uconv/tests/unit/test_bug367026.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* Tests conversion from Unicode to HZ-GB-2312 (bug 367026)
     2  *
     3  * Notes:
     4  * HZ-GB-2312 is a 7-bit encoding of the GB2312 simplified Chinese character
     5  * set. It uses the escape sequences "~{" to mark the start of GB encoded text
     6  * and "~}" to mark the end.
     7  *
     8  * See http://www.ietf.org/rfc/rfc1843.txt
     9  */
    11 load('CharsetConversionTests.js');
    13 const inASCII = "Hello World";
    14 const inHanzi = "\u4E00";
    15 const inMixed = "Hello \u4E00 World";
    17 const expectedASCII = "Hello World";
    18 const expectedHanzi = "~{R;~}";
    19 const expectedMixed = "Hello ~{R;~} World";
    21 const charset = "HZ-GB-2312";
    23 function run_test() {
    24     var converter = CreateScriptableConverter();
    26     checkEncode(converter, charset, inASCII, expectedASCII);
    27     checkEncode(converter, charset, inMixed, expectedMixed);
    28     checkEncode(converter, charset, inHanzi, expectedHanzi);
    29 }

mercurial