tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

charset-bom.any.js (838B)


      1 // META: global=window,dedicatedworker,sharedworker
      2 // META: script=/common/utils.js
      3 
      4 promise_test(async () => {
      5    const jsonModule = await import('./bom-utf-8.json', { with: { type: 'json' } });
      6    assert_equals(jsonModule.default.data, 'hello');
      7 }, 'UTF-8 BOM should be stripped when decoding JSON module script');
      8 
      9 promise_test(async test => {
     10    await promise_rejects_js(test, SyntaxError,
     11        import('./bom-utf-16be.json', { with: { type: 'json' } }), 'Expected parse error from UTF-16BE BOM');
     12 }, 'UTF-16BE BOM should result in parse error in JSON module script');
     13 
     14 promise_test(async test => {
     15    await promise_rejects_js(test, SyntaxError,
     16        import('./bom-utf-16le.json', { with: { type: 'json' } }), 'Expected parse error from UTF-16LE BOM');
     17 }, 'UTF-16LE BOM should result in parse error in JSON module script');