diff options
author | Justin Seyster <justin.seyster@mongodb.com> | 2022-02-28 22:30:51 -0500 |
---|---|---|
committer | Justin Seyster <justin.seyster@mongodb.com> | 2022-03-07 12:08:01 -0500 |
commit | 26bab136615f5f7a5d6c35e767e2321dcc31b956 (patch) | |
tree | 63ecab22fa06e3b308f91697864f272c44152595 /src/mongo/shell | |
parent | 82190f17c29d5090c16af894ec21a9b51312cc4f (diff) | |
download | mongo-26bab136615f5f7a5d6c35e767e2321dcc31b956.tar.gz |
SERVER-61008 Upgrade vendorized mozjs to esr91.3
Co-authored-by: Mohammad Dashti <mdashti@gmail.com>
Diffstat (limited to 'src/mongo/shell')
-rw-r--r-- | src/mongo/shell/encrypted_dbclient_base.cpp | 13 | ||||
-rw-r--r-- | src/mongo/shell/types.js | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/mongo/shell/encrypted_dbclient_base.cpp b/src/mongo/shell/encrypted_dbclient_base.cpp index 4d09dea34dc..39df1d3f345 100644 --- a/src/mongo/shell/encrypted_dbclient_base.cpp +++ b/src/mongo/shell/encrypted_dbclient_base.cpp @@ -31,6 +31,9 @@ #include "mongo/shell/encrypted_dbclient_base.h" +#include <js/Object.h> +#include <js/ValueArray.h> + #include "mongo/base/data_cursor.h" #include "mongo/base/data_type_validated.h" #include "mongo/bson/bson_depth.h" @@ -359,7 +362,7 @@ void EncryptedDBClientBase::encrypt(mozjs::MozJSImplScope* scope, BufBuilder plaintextBuilder; if (args.get(1).isObject()) { JS::RootedObject rootedObj(cx, &args.get(1).toObject()); - auto jsclass = JS_GetClass(rootedObj); + auto jsclass = JS::GetClass(rootedObj); if (strcmp(jsclass->name, "Object") == 0 || strcmp(jsclass->name, "Array") == 0) { uassert(ErrorCodes::BadValue, @@ -461,7 +464,7 @@ void EncryptedDBClientBase::encrypt(mozjs::MozJSImplScope* scope, ConstDataRange ciphertextBlob(encryptionFrame.get()); std::string blobStr = base64::encode(StringData(ciphertextBlob.data(), ciphertextBlob.length())); - JS::AutoValueArray<2> arr(cx); + JS::RootedValueArray<2> arr(cx); arr[0].setInt32(BinDataType::Encrypt); mozjs::ValueReader(cx, arr[1]).fromStringData(blobStr); @@ -605,7 +608,7 @@ std::vector<uint8_t> EncryptedDBClientBase::getBinDataArg( str::stream() << "Incorrect bindata type, expected" << typeName(type) << " but got " << typeName(binType), binType == type); - auto str = static_cast<std::string*>(JS_GetPrivate(args.get(index).toObjectOrNull())); + auto str = static_cast<std::string*>(JS::GetPrivate(args.get(index).toObjectOrNull())); uassert(ErrorCodes::BadValue, "Cannot call getter on BinData prototype", str); std::string string = base64::decode(*str); return std::vector<uint8_t>(string.data(), string.data() + string.length()); @@ -694,7 +697,7 @@ void createCollectionObject(JSContext* cx, // The collection object requires a database object to be constructed as well. JS::RootedValue databaseRV(cx); - JS::AutoValueArray<2> databaseArgs(cx); + JS::RootedValueArray<2> databaseArgs(cx); databaseArgs[0].setObject(client.toObject()); mozjs::ValueReader(cx, databaseArgs[1]).fromStringData(ns.db()); @@ -703,7 +706,7 @@ void createCollectionObject(JSContext* cx, invariant(databaseRV.isObject()); auto databaseObj = databaseRV.toObjectOrNull(); - JS::AutoValueArray<4> collectionArgs(cx); + JS::RootedValueArray<4> collectionArgs(cx); collectionArgs[0].setObject(client.toObject()); collectionArgs[1].setObject(*databaseObj); mozjs::ValueReader(cx, collectionArgs[2]).fromStringData(ns.coll()); diff --git a/src/mongo/shell/types.js b/src/mongo/shell/types.js index 6a0f78dad6a..c06601f9161 100644 --- a/src/mongo/shell/types.js +++ b/src/mongo/shell/types.js @@ -44,7 +44,7 @@ Date.prototype.tojson = function() { this.getTime(); } catch (e) { if (e instanceof TypeError && - e.message.includes("getTime method called on incompatible Object")) { + e.message.includes("Date.prototype.getTime called on incompatible")) { return new Date(NaN).tojson(); } throw e; |