Bug 1356284 - Avoid a not strictly needed but expensive concat in Sqlite.jsm::bindParam. r=florian
MozReview-Commit-ID: Kx1x4h5odsP
--- a/toolkit/modules/Sqlite.jsm
+++ b/toolkit/modules/Sqlite.jsm
@@ -677,17 +677,19 @@ ConnectionData.prototype = Object.freeze
_bindParameters(statement, params) {
if (!params) {
return;
}
function bindParam(obj, key, val) {
let isBlob = val && typeof val == "object" &&
val.constructor.name == "Uint8Array";
- let args = [key, val].concat(isBlob ? [val.length] : []);
+ let args = [key, val];
+ if (isBlob)
+ args.push(val.length);
let methodName =
`bind${isBlob ? "Blob" : ""}By${typeof key == "number" ? "Index" : "Name"}`;
obj[methodName](...args);
}
if (Array.isArray(params)) {
// It's an array of separate params.
if (params.length && (typeof(params[0]) == "object")) {