diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 019e002d8bcd..e1821492d288 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -2265,7 +2265,7 @@ Parser::moduleBody(ModuleSharedContext* modulesc) DeclaredNamePtr p = modulepc.varScope().lookupDeclaredName(name); if (!p) { JSAutoByteString str; - if (!str.encodeLatin1(context, name)) + if (!AtomToPrintableString(context, name, &str)) return null(); JS_ReportErrorNumberLatin1(context, GetErrorMessage, nullptr,