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:
Promise.resolve('import(`./example.mjs`)').then(eval);
<button onclick="Promise.resolve('import(`./example.mjs`)').then(eval)">Click me</button>
I am interested in first one example. Imagine the following structure:
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 won't throw an error and it will print "example.js is included". That I think will be correct because import gets GetActiveScriptOrModule() that will be Module Record
In case 2: then(eval) will throw the error. And for some reason this code will think that baseURL is "http://127.0.0.1:5501/" but not the "http://127.0.0.1:5501/modules"
Why these cases are different? Doesn't HostMakeJobCallback save active script for the future restoration with his baseURL from module script?