Bug 1300591 - Update Kinto.js to v4.0.4, r=MattN
authorEthan Glasser-Camp <eglassercamp@mozilla.com>
Mon, 05 Sep 2016 13:18:25 -0400
changeset 354375 9377cc9dc164dcadcd76c881484617310a461161
parent 354374 bc76c6abe3dfb20b2cc566706441e6d8e56499f7
child 354376 c8096f896f7cf570dd77b503861650847337febc
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1300591
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1300591 - Update Kinto.js to v4.0.4, r=MattN MozReview-Commit-ID: B5pB3AmjjAL
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 4.0.3 - 8100433
+ * Version 4.0.4 - 03f82da
  */
 
 (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
 });
@@ -1800,25 +1800,17 @@ class Collection {
           if (imported.type !== "void") {
             syncResultObject.add(imported.type, imported.data);
           }
         }
         return syncResultObject;
       });
     }).then(syncResultObject => {
       syncResultObject.lastModified = changeObject.lastModified;
-      // Don't persist lastModified value if any conflict or error occured
-      if (!syncResultObject.ok) {
-        return syncResultObject;
-      }
-      // No conflict occured, persist collection's lastModified value
-      return this.db.saveLastModified(syncResultObject.lastModified).then(lastModified => {
-        this._lastModified = lastModified;
-        return syncResultObject;
-      });
+      return syncResultObject;
     });
   }
 
   /**
    * Execute a bunch of operations in a transaction.
    *
    * This transaction should be atomic -- either all of its operations
    * will succeed, or none will.
@@ -2211,17 +2203,28 @@ class Collection {
     const syncPromise = this.db.getLastModified().then(lastModified => this._lastModified = lastModified).then(_ => this.pullChanges(client, result, options)).then(result => this.pushChanges(client, result, options)).then(result => {
       // Avoid performing a last pull if nothing has been published.
       if (result.published.length === 0) {
         return result;
       }
       // Avoid redownloading our own changes during the last pull.
       const pullOpts = _extends({}, options, { exclude: result.published });
       return this.pullChanges(client, result, pullOpts);
+    }).then(syncResultObject => {
+      // Don't persist lastModified value if any conflict or error occured
+      if (!syncResultObject.ok) {
+        return syncResultObject;
+      }
+      // No conflict occured, persist collection's lastModified value
+      return this.db.saveLastModified(syncResultObject.lastModified).then(lastModified => {
+        this._lastModified = lastModified;
+        return syncResultObject;
+      });
     });
+
     // Ensure API default remote is reverted if a custom one's been used
     return (0, _utils.pFinally)(syncPromise, () => this.api.remote = previousRemote);
   }
 
   /**
    * Load a list of records already synced with the remote server.
    *
    * The local records which are unsynced or whose timestamp is either missing