base_uri_worker.js (1156B)
1 // This file is for testing the module loader's path handling. 2 // ESLint rules that modifies path shouldn't be applied. 3 4 onmessage = async event => { 5 // This file is loaded as resource://test/data/base_uri_worker.js 6 // Relative/absolute paths should be resolved based on the URI, instead of 7 // file: path. 8 9 const namespaceWithURI = await import( 10 "resource://test/data/base_uri_module.mjs" 11 ); 12 const namespaceWithCurrentDir = await import("./base_uri_module.mjs"); 13 const namespaceWithParentDir = await import("../data/base_uri_module.mjs"); 14 const namespaceWithAbsoluteDir = await import("/data/base_uri_module.mjs"); 15 16 postMessage({ 17 scriptToModule: { 18 equal1: namespaceWithURI.obj == namespaceWithCurrentDir.obj, 19 equal2: namespaceWithURI.obj == namespaceWithParentDir.obj, 20 equal3: namespaceWithURI.obj == namespaceWithAbsoluteDir.obj, 21 }, 22 moduleToModuleURI: await namespaceWithURI.doImport(), 23 moduleToModuleCurrent: await namespaceWithCurrentDir.doImport(), 24 moduleToModuleParent: await namespaceWithParentDir.doImport(), 25 moduleToModuleAbsolute: await namespaceWithAbsoluteDir.doImport(), 26 }); 27 };