tor-browser

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

dynamic-import-unsupported-attribute.js (991B)


      1 // |jit-test|
      2 
      3 async function test() {
      4    try {
      5      await import('./not-a-real-file.json', {with:{'unsupportedAttributeKey': 'json'}});
      6      throw new Error("unreachable");
      7    } catch (error) {
      8      assertEq(error instanceof TypeError, true);
      9      assertEq(error.message, "Unsupported import attribute: unsupportedAttributeKey");
     10    }
     11 
     12    try {
     13      await import('./not-a-real-file.json', {with:{'unsupportedAttributeKey': 'json', type: 'json'}});
     14      throw new Error("unreachable");
     15    } catch (error) {
     16      assertEq(error instanceof TypeError, true);
     17      assertEq(error.message, "Unsupported import attribute: unsupportedAttributeKey");
     18    }
     19 
     20    try {
     21      await import('./not-a-real-file.json', {with:{type: 'json', 'unsupportedAttributeKey': 'json'}});
     22      throw new Error("unreachable");
     23    } catch (error) {
     24      assertEq(error instanceof TypeError, true);
     25      assertEq(error.message, "Unsupported import attribute: unsupportedAttributeKey");
     26    }
     27 }
     28 
     29 test();