I have a question. I saw in spec operation HostMakeJobCallback, it describes two cases with non-null and null active script. Also there are two examples with code:
active script is non-null
Promise.resolve('import(`./example.mjs`)').then(eval);
active script is null
<button onclick="Promise.resolve('import(`./example.mjs`)').then(eval)">Click me</button>
I am interested in first one example. Imagine the following structure:
root/
index.html
example.js
modules/
a.js
index.html
<script type="module" src="modules/a.js"></script>
example.js
console.log("example.js is included")
a.js (don't run with all cases together)
/// case 1
eval('import(`./example.js`)');
/// case 2
Promise.resolve("import('./example.js')").then(eval)
In case 1: eval will throw an error and show path "http://127.0.0.1:5501/root/modules/example.js" That I think will be correct because import gets GetActiveScriptOrModule() that will be Module Record
In case 2: If we will use another one code, like this, we won't get an error. And for some reason this code will think that baseURL is "http://127.0.0.1:5501/root/" but not the "http://127.0.0.1:5501/root/modules"
Why these cases are different? Doesn't HostMakeJobCallback save active script for the future restoration with his baseURL from module script?