Bug 1777450 - Separate error messages for module resulution failure when the specifier might be bare r=allstarschh,flod
This fixes the original case by adding an extra error reason which is used when the specifier could be bare and and only warning about relative URLs in this case. The same problem happens with import maps enable where "./foo.js" produces an error about it being a bare specifier, which it's not. For that case make ParseURLLikeImportSpecifier return a ResolveResult and use the same approach. Differential Revision: https://phabricator.services.mozilla.com/D151153
This commit is contained in:
@@ -624,13 +624,13 @@ ResolveResult ModuleLoaderBase::ResolveModuleSpecifier(
|
||||
}
|
||||
|
||||
if (rv != NS_ERROR_MALFORMED_URI) {
|
||||
return Err(ResolveError::ModuleResolveFailure);
|
||||
return Err(ResolveError::Failure);
|
||||
}
|
||||
|
||||
if (!StringBeginsWith(aSpecifier, u"/"_ns) &&
|
||||
!StringBeginsWith(aSpecifier, u"./"_ns) &&
|
||||
!StringBeginsWith(aSpecifier, u"../"_ns)) {
|
||||
return Err(ResolveError::ModuleResolveFailure);
|
||||
return Err(ResolveError::FailureMayBeBare);
|
||||
}
|
||||
|
||||
// Get the document's base URL if we don't have a referencing script here.
|
||||
@@ -646,7 +646,7 @@ ResolveResult ModuleLoaderBase::ResolveModuleSpecifier(
|
||||
return WrapNotNull(uri);
|
||||
}
|
||||
|
||||
return Err(ResolveError::ModuleResolveFailure);
|
||||
return Err(ResolveError::Failure);
|
||||
}
|
||||
|
||||
nsresult ModuleLoaderBase::ResolveRequestedModules(
|
||||
|
||||
Reference in New Issue
Block a user