Bug 1356284 - Avoid a not strictly needed but expensive concat in Sqlite.jsm::bindParam. r=florian draft
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 13 Apr 2017 18:49:45 +0200
changeset 562206 1bfabbf6f8a96a50a647a2cb9599cea4f7145de9
parent 561911 819a666afddc804b6099ee1b3cff3a0fdf35ec15
child 624204 4b249c909ad77ba53fbf7092d6e948773e737db3
push id53989
push usermak77@bonardo.net
push dateThu, 13 Apr 2017 16:53:10 +0000
reviewersflorian
bugs1356284
milestone55.0a1
Bug 1356284 - Avoid a not strictly needed but expensive concat in Sqlite.jsm::bindParam. r=florian MozReview-Commit-ID: Kx1x4h5odsP
toolkit/modules/Sqlite.jsm
--- 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")) {