Bug 1917899 - Check unsupported import attributes before resolving specifier r=jonco
We need to check if we have an unsupported attribute before resolving the specifier because, according to the spec, the unknown attribute should be reported before the invalid specifier. Differential Revision: https://phabricator.services.mozilla.com/D221998
This commit is contained in:
@@ -839,7 +839,15 @@ nsresult ModuleLoaderBase::ResolveRequestedModules(
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
JS::Rooted<JSString*> str(
|
||||
cx, JS::GetRequestedModuleSpecifier(cx, moduleRecord, i));
|
||||
MOZ_ASSERT(str);
|
||||
if (!str) {
|
||||
JS::Rooted<JS::Value> pendingException(cx);
|
||||
if (!JS_GetPendingException(cx, &pendingException)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
ms->SetParseError(pendingException);
|
||||
JS_ClearPendingException(cx);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsAutoJSString specifier;
|
||||
if (!specifier.init(cx, str)) {
|
||||
|
||||
Reference in New Issue
Block a user