Bug 1198673 - Fix bug in parseModule() error handling r=jandem
authorJon Coppeard <jcoppeard@mozilla.com>
Wed, 26 Aug 2015 13:07:53 +0100
changeset 259375 0a6629904b68ff9aca323231cde87643ecbc82b3
parent 259374 67ad669ce0ad2a7325f836c69d6ce357db58b7d1
child 259376 f7893bbf4cb3809fe88a78587e9e23a7a400ecd4
push id29277
push userryanvm@gmail.com
push dateWed, 26 Aug 2015 18:32:23 +0000
treeherdermozilla-central@fea87cbeaa6b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1198673
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1198673 - Fix bug in parseModule() error handling r=jandem
js/src/jit-test/tests/modules/bug1198673.js
js/src/shell/js.cpp
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;