Bug 1315247 - Update version of Kinto.js client to 5.1.0, r?MattN draft
authorEthan Glasser-Camp <eglassercamp@mozilla.com>
Fri, 04 Nov 2016 09:38:34 -0400
changeset 433939 fa0aba08d0dc5e9c884d1ef8d4580fa323585958
parent 432230 3e73fd638e687a4d7f46613586e5156b8e2af846
child 535986 7c5c9a0ae6e3dd58ef515955116733e2a61714dc
push id34684
push usereglassercamp@mozilla.com
push dateFri, 04 Nov 2016 13:39:04 +0000
reviewersMattN
bugs1315247
milestone52.0a1
Bug 1315247 - Update version of Kinto.js client to 5.1.0, r?MattN MozReview-Commit-ID: K68DXYrpHYX
services/common/kinto-offline-client.js
--- a/services/common/kinto-offline-client.js
+++ b/services/common/kinto-offline-client.js
@@ -15,17 +15,17 @@
 
 /*
  * This file is generated from kinto.js - do not modify directly.
  */
 
 this.EXPORTED_SYMBOLS = ["loadKinto"];
 
 /*
- * Version 5.0.0 - 63b7632
+ * Version 5.1.0 - 8beb61d
  */
 
 (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.loadKinto = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
 "use strict";
 
 Object.defineProperty(exports, "__esModule", {
   value: true
 });
@@ -152,22 +152,26 @@ const currentSchemaVersion = 1;
  * Uses Sqlite as a backing store.
  *
  * Options:
  *  - path: the filename/path for the Sqlite database. If absent, use SQLITE_PATH.
  */
 class FirefoxAdapter extends _base2.default {
   constructor(collection, options = {}) {
     super();
+    const { sqliteHandle = null } = options;
     this.collection = collection;
-    this._connection = null;
+    this._connection = sqliteHandle;
     this._options = options;
   }
 
-  _init(connection) {
+  // We need to be capable of calling this from "outside" the adapter
+  // so that someone can initialize a connection and pass it to us in
+  // adapterOptions.
+  static _init(connection) {
     return Task.spawn(function* () {
       yield connection.executeTransaction(function* doSetup() {
         const schema = yield connection.getSchemaVersion();
 
         if (schema == 0) {
 
           for (let statementName of createStatements) {
             yield connection.execute(statements[statementName]);
@@ -187,20 +191,20 @@ class FirefoxAdapter extends _base2.defa
       throw new Error("The storage adapter is not open");
     }
     return this._connection.executeCached(statement, params);
   }
 
   open() {
     const self = this;
     return Task.spawn(function* () {
-      const path = self._options.path || SQLITE_PATH;
-      const opts = { path, sharedMemoryCache: false };
       if (!self._connection) {
-        self._connection = yield Sqlite.openConnection(opts).then(self._init);
+        const path = self._options.path || SQLITE_PATH;
+        const opts = { path, sharedMemoryCache: false };
+        self._connection = yield Sqlite.openConnection(opts).then(FirefoxAdapter._init);
       }
     });
   }
 
   close() {
     if (this._connection) {
       const promise = this._connection.close();
       this._connection = null;