Bug 1198673 - Fix bug in parseModule() error handling r=jandem
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/modules/bug1198673.js
@@ -0,0 +1,2 @@
+// |jit-test| error: expected string to compile
+parseModule((1));
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -3069,18 +3069,18 @@ ParseModule(JSContext* cx, unsigned argc
{
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() < 1) {
JS_ReportErrorNumber(cx, GetErrorMessage, nullptr,
JSMSG_MORE_ARGS_NEEDED, "parseModule", "0", "s");
return false;
}
if (!args[0].isString()) {
- JS_ReportError(cx, "expected string to compile, got %s",
- JS_TypeOfValue(cx, args[0]));
+ const char* typeName = InformalValueTypeName(args[0]);
+ JS_ReportError(cx, "expected string to compile, got %s", typeName);
return false;
}
RootedObject global(cx, JS::CurrentGlobalOrNull(cx));
JSFlatString* scriptContents = args[0].toString()->ensureFlat(cx);
if (!scriptContents)
return false;