charset-02.html (1205B)
1 <!DOCTYPE html> 2 <title>Module scripts should ignore BOMs and always use UTF-8</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script> 6 setup({allow_uncaught_exception: true}); 7 </script> 8 <script type="module" src="../serve-with-content-type.py?fn=resources/bom-utf-8.js&ct=text/javascript"></script> 9 <script type="module" src="../serve-with-content-type.py?fn=resources/bom-utf-16be.js&ct=text/javascript"></script> 10 <script type="module" src="../serve-with-content-type.py?fn=resources/bom-utf-16le.js&ct=text/javascript"></script> 11 <script type="module"> 12 test(function() { 13 assert_equals(window.executed_utf8_bom, '\u4e09\u6751\u304b\u306a\u5b50', 14 'Should be decoded as UTF-8'); 15 }, 'UTF-8 module script with UTF-8 BOM'); 16 17 test(function() { 18 assert_equals(window.executed_utf16be_bom, undefined, 19 'Should result in compile error because of UTF-16BE BOM'); 20 }, 'UTF-16 module script with UTF-16BE BOM'); 21 22 test(function() { 23 assert_equals(window.executed_utf16le_bom, undefined, 24 'Should result in compile error because of UTF-16LE BOM'); 25 }, 'UTF-16 module script with UTF-16LE BOM'); 26 </script>