Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / intl / strres / tests / unit / test_bug397093.js
blob6769fc619f385df0b54fb5b0ac58784a22fcabca
1 /* Tests getting properties from string bundles with incorrect encoding.
2  * The string bundle contains one ascii property, one UTF-8 and one Latin-1.
3  * Expected behaviour is that the whole string bundle should be rejected and
4  * all GetStringFromName calls should fail.
5  */
7 const name_ascii = "asciiProperty";
8 const value_ascii = "";
10 const name_utf8 = "utf8Property";
11 const value_utf8 = "";
13 const name_latin1 = "latin1";
14 const value_latin1 = "";
17 function run_test() {
18     var StringBundle = 
19         Components.classes["@mozilla.org/intl/stringbundle;1"]
20          .getService(Components.interfaces.nsIStringBundleService);
22     var bundle = StringBundle.createBundle("resource://gre/res/397093.properties");
23     
24     var bundle_ascii="", bundle_utf8="", bundle_latin1="";
25     try {
26         bundle_ascii = bundle.GetStringFromName(name_ascii);
27     } catch(e) {}
28     do_check_eq(bundle_ascii, value_ascii);
30     try {
31         bundle_utf8 = bundle.GetStringFromName(name_utf8);
32     } catch(e) {}
33     do_check_eq(bundle_utf8, value_utf8);
35     try {
36         bundle_latin1 = bundle.GetStringFromName(name_latin1);
37     } catch(e) {}
38     do_check_eq(bundle_latin1, value_latin1);
40