tor-browser

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

base_uri_module.mjs (890B)


      1 // This file is for testing the module loader's path handling.
      2 // ESLint rules that modifies path shouldn't be applied.
      3 
      4 export const obj = {};
      5 
      6 export async function doImport() {
      7  // This file is loaded as resource://test/data/base_uri_module.mjs
      8  // Relative/absolute paths should be resolved based on the URI, instead of
      9  // file: path.
     10 
     11  const namespaceWithURI = await import(
     12    "resource://test/data/base_uri_module2.mjs"
     13  );
     14  const namespaceWithCurrentDir = await import("./base_uri_module2.mjs");
     15  const namespaceWithParentDir = await import("../data/base_uri_module2.mjs");
     16  const namespaceWithAbsoluteDir = await import("/data/base_uri_module2.mjs");
     17 
     18  return {
     19    equal1: namespaceWithURI.obj2 == namespaceWithCurrentDir.obj2,
     20    equal2: namespaceWithURI.obj2 == namespaceWithParentDir.obj2,
     21    equal3: namespaceWithURI.obj2 == namespaceWithAbsoluteDir.obj2,
     22  };
     23 }