Bug 1427233 - BinParse checks whether the argument is an ArrayBuffer;r?jandem draft
authorDavid Teller <dteller@mozilla.com>
Wed, 17 Jan 2018 12:14:06 +0100
changeset 721539 46578dff6c4fe3fceab52b1794ed49cef3c94a87
parent 718505 d5f42a23909eb181274731b07e4984bfbd18557d
child 746357 bbfc65143cb88a5b0407927fd7cb2b508d2ba60f
push id95861
push userbmo:dteller@mozilla.com
push dateWed, 17 Jan 2018 11:15:11 +0000
reviewersjandem
bugs1427233
milestone59.0a1
Bug 1427233 - BinParse checks whether the argument is an ArrayBuffer;r?jandem MozReview-Commit-ID: 9ztVYwYtK0E
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -4409,24 +4409,24 @@ BinParse(JSContext* cx, unsigned argc, V
 
     if (args.length() < 1) {
         JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                                   "parse", "0", "s");
         return false;
     }
     if (!args[0].isObject()) {
         const char* typeName = InformalValueTypeName(args[0]);
-        JS_ReportErrorASCII(cx, "expected object (typed array) to parse, got %s", typeName);
+        JS_ReportErrorASCII(cx, "expected object (ArrayBuffer) to parse, got %s", typeName);
         return false;
     }
 
     RootedObject obj(cx, &args[0].toObject());
-    if (!JS_IsTypedArrayObject(obj)) {
+    if (!JS_IsArrayBufferObject(obj)) {
         const char* typeName = InformalValueTypeName(args[0]);
-        JS_ReportErrorASCII(cx, "expected typed array to parse, got %s", typeName);
+        JS_ReportErrorASCII(cx, "expected ArrayBuffer to parse, got %s", typeName);
         return false;
     }
 
     uint32_t buf_length = 0;
     bool buf_isSharedMemory = false;
     uint8_t* buf_data = nullptr;
     GetArrayBufferViewLengthAndData(obj, &buf_length, &buf_isSharedMemory, &buf_data);
     MOZ_ASSERT(buf_data);