mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibJS: Do not attempt to link modules which have failed to load
Linking a module has assertions about the module's state, namely that the state is not "new". The state remains "new" if loading the module has failed. See: https://tc39.es/ecma262/#figure-module-graph-missing In any case, this exception causes a loading failure, which results in A's [[Status]] remaining new. So we must propagate that failure, instead of blindly moving on to the linking steps.
This commit is contained in:
parent
7d420bbd3d
commit
049109452e
Notes:
github-actions[bot]
2025-01-21 13:59:50 +00:00
Author: https://github.com/trflynn89
Commit: 049109452e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3324
2 changed files with 8 additions and 1 deletions
|
@ -219,6 +219,10 @@ describe("in- and exports", () => {
|
|||
expect(result.default).toBeInstanceOf(RegExp);
|
||||
expect(result.default.toString()).toBe(/foo/.toString());
|
||||
});
|
||||
|
||||
test("importing a non-existent file results in a SyntaxError", () => {
|
||||
expectedModuleToThrowSyntaxError("./i-do-no-exist.mjs", "Cannot find/open module");
|
||||
});
|
||||
});
|
||||
|
||||
describe("loops", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue