Bug 1918449 - Part 1: Handle unknown module type earlier r=jonco,dom-worker-reviewers,dom-core,asuth,mccr8
We never reach `CompileFetchedModule` if we have an unknown module type since we take the module type into account when we do mime type checking, so the file always fails to load because of MIME mismatch, and we don't get the expected `TypeError.` Checking if we have an unknown type should happen much earlier in the process. Differential Revision: https://phabricator.services.mozilla.com/D222222
This commit is contained in:
@@ -204,9 +204,7 @@ nsresult ModuleLoader::CompileFetchedModule(
|
||||
|
||||
switch (aRequest->mModuleType) {
|
||||
case JS::ModuleType::Unknown:
|
||||
JS_ReportErrorNumberASCII(aCx, js::GetErrorMessage, nullptr,
|
||||
JSMSG_BAD_MODULE_TYPE);
|
||||
return NS_ERROR_FAILURE;
|
||||
MOZ_CRASH("Unexpected module type");
|
||||
case JS::ModuleType::JavaScript:
|
||||
return CompileJavaScriptModule(aCx, aOptions, aRequest, aModuleOut);
|
||||
case JS::ModuleType::JSON: {
|
||||
|
||||
Reference in New Issue
Block a user