Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <meta charset=utf-8> |
michael@0 | 5 | <title>Test loading various utf-16 files (little or big endian, with or without BOM)</title> |
michael@0 | 6 | <script type="text/javascript" src="/resources/testharness.js"></script> |
michael@0 | 7 | <script type="text/javascript" src="/resources/testharnessreport.js"></script> |
michael@0 | 8 | <link rel="stylesheet" href="file_utf16_be_bom.css"> |
michael@0 | 9 | <link rel="stylesheet" href="file_utf16_le_bom.css"> |
michael@0 | 10 | <script type="text/javascript" src="file_utf16_be_bom.js"></script> |
michael@0 | 11 | <script type="text/javascript" src="file_utf16_le_bom.js"></script> |
michael@0 | 12 | </head> |
michael@0 | 13 | <body> |
michael@0 | 14 | <div id="log"></div> |
michael@0 | 15 | <iframe name="ifr1" src="file_utf16_be_bom.xhtml"></iframe> |
michael@0 | 16 | <iframe name="ifr2" src="file_utf16_le_bom.xhtml"></iframe> |
michael@0 | 17 | <iframe name="ifr3" src="file_utf16_le_nobom.xhtml"></iframe> |
michael@0 | 18 | <script> |
michael@0 | 19 | |
michael@0 | 20 | runTest(); |
michael@0 | 21 | |
michael@0 | 22 | function runTest() { |
michael@0 | 23 | test(function() { |
michael@0 | 24 | assert_equals(document.styleSheets[0].cssRules[0].selectorText, ".css1", ".css1 should exist."); |
michael@0 | 25 | assert_equals(document.styleSheets[1].cssRules[0].selectorText, ".css2", ".css2 should exist."); |
michael@0 | 26 | }, "Test loading utf-16 css files"); |
michael@0 | 27 | test(function() { |
michael@0 | 28 | assert_equals(js1, "Unicåde", "js1 should be defined."); |
michael@0 | 29 | assert_equals(js2, "Unicåde", "js2 should be defined."); |
michael@0 | 30 | }, "Test loading utf-16 javascript files"); |
michael@0 | 31 | var tests = [ |
michael@0 | 32 | {ifr: ifr1, fails: false, name: "Test loading utf-16, big endian, with BOM"}, |
michael@0 | 33 | {ifr: ifr2, fails: false, name: "Test loading utf-16, little endian, with BOM"}, |
michael@0 | 34 | {ifr: ifr3, fails: true, name: "Test loading utf-16le xml fails"}, |
michael@0 | 35 | ]; |
michael@0 | 36 | tests.forEach(function(test) { |
michael@0 | 37 | var t = async_test(test.name); |
michael@0 | 38 | var fails = test.fails; |
michael@0 | 39 | var ifr = test.ifr; |
michael@0 | 40 | ifr.onload = ifr.onerror = function() { |
michael@0 | 41 | t.step(fails ? function() { |
michael@0 | 42 | assert_equals(ifr.document.body, null, ifr.name + " should NOT load."); |
michael@0 | 43 | } : function() { |
michael@0 | 44 | assert_true(ifr.document.body instanceof ifr.HTMLBodyElement, ifr.name + " should load."); |
michael@0 | 45 | }); |
michael@0 | 46 | t.done(); |
michael@0 | 47 | }; |
michael@0 | 48 | }); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | </script> |
michael@0 | 52 | </body> |
michael@0 | 53 | </html> |