Bug 1453647 - [xpcshell] Enforce utf-8 for evaluating injected script via -e argument.
MozReview-Commit-ID: 2sLmBHqbFSx
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -972,17 +972,18 @@ ProcessArgs(AutoJSAPI& jsapi, char** arg
{
RootedValue rval(cx);
if (++i == argc) {
return printUsageAndSetExitCode();
}
JS::CompileOptions opts(cx);
- opts.setFileAndLine("-e", 1);
+ opts.setUTF8(true)
+ .setFileAndLine("-e", 1);
JS::Evaluate(cx, opts, argv[i], strlen(argv[i]), &rval);
isInteractive = false;
break;
}
case 'C':
compileOnly = true;
isInteractive = false;