mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 13:30:31 +00:00
LibWeb: Remove module validation in "create a JavaScript module script"
Some checks are pending
Push notes / build (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Some checks are pending
Push notes / build (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
This is uneeded and not present for this function in the spec now that HostLoadImportedModule performs this validation.
This commit is contained in:
parent
bb68f09855
commit
2ff03ea7d2
Notes:
github-actions[bot]
2024-12-01 11:26:39 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/2ff03ea7d29 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2671
1 changed files with 2 additions and 44 deletions
|
@ -63,52 +63,10 @@ WebIDL::ExceptionOr<GC::Ptr<JavaScriptModuleScript>> JavaScriptModuleScript::cre
|
|||
return script;
|
||||
}
|
||||
|
||||
// 9. For each ModuleRequest record requested of result.[[RequestedModules]]:
|
||||
for (auto const& requested : result.value()->requested_modules()) {
|
||||
// FIXME: Clarify if this should be checked for all requested before running the steps below.
|
||||
// 1. If requested.[[Attributes]] contains a Record entry such that entry.[[Key]] is not "type", then:
|
||||
for (auto const& attribute : requested.attributes) {
|
||||
if (attribute.key != "type"sv) {
|
||||
// 1. Let error be a new SyntaxError exception.
|
||||
auto error = JS::SyntaxError::create(realm, "Module request attributes must only contain a type attribute"_string);
|
||||
|
||||
// 2. Set script's parse error to error.
|
||||
script->set_parse_error(error);
|
||||
|
||||
// 3. Return script.
|
||||
return script;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Let url be the result of resolving a module specifier given script and requested.[[Specifier]], catching any exceptions.
|
||||
auto url = resolve_module_specifier(*script, requested.module_specifier);
|
||||
|
||||
// 3. If the previous step threw an exception, then:
|
||||
if (url.is_exception()) {
|
||||
// FIXME: 1. Set script's parse error to that exception.
|
||||
|
||||
// 2. Return script.
|
||||
return script;
|
||||
}
|
||||
|
||||
// 4. Let moduleType be the result of running the module type from module request steps given requested.
|
||||
auto module_type = module_type_from_module_request(requested);
|
||||
|
||||
// 5. If the result of running the module type allowed steps given moduleType and realm is false, then:
|
||||
if (!module_type_allowed(realm, module_type)) {
|
||||
// FIXME: 1. Let error be a new TypeError exception.
|
||||
|
||||
// FIXME: 2. Set script's parse error to error.
|
||||
|
||||
// 3. Return script.
|
||||
return script;
|
||||
}
|
||||
}
|
||||
|
||||
// 10. Set script's record to result.
|
||||
// 9. Set script's record to result.
|
||||
script->m_record = result.value();
|
||||
|
||||
// 11. Return script.
|
||||
// 10. Return script.
|
||||
return script;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue