Bug 1300591 - Update Kinto.js to v4.0.4, r?MattN
MozReview-Commit-ID: B5pB3AmjjAL
--- 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