Commit 5347ff53 authored by Vincent Bechu's avatar Vincent Bechu

Revert works on saferepair and scenarii

This reverts commits
215a2cca
e391b71d
ddf61098
5d6e60dd
bafcf854
parent 642e0571
...@@ -180,8 +180,7 @@ module.exports = function (grunt) { ...@@ -180,8 +180,7 @@ module.exports = function (grunt) {
'src/jio.storage/localstorage.js', 'src/jio.storage/localstorage.js',
'src/jio.storage/indexeddbstorage.js', 'src/jio.storage/indexeddbstorage.js',
'src/jio.storage/cryptstorage.js', 'src/jio.storage/cryptstorage.js',
'src/jio.storage/websqlstorage.js', 'src/jio.storage/websqlstorage.js'
'src/jio.storage/saferepairstorage.js'
], ],
dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js' dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js'
// dest: 'jio.js' // dest: 'jio.js'
......
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>OfficeJS Coverage Scenario</title>
<script src="../node_modules/rsvp/dist/rsvp-2.0.4.js"></script>
<script src="../dist/jio-latest.js"></script>
<script src="../src/jio.storage/saferepairstorage.js"></script>
<link rel="stylesheet" href="../node_modules/grunt-contrib-qunit/test/libs/qunit.css" type="text/css" media="screen"/>
<script src="../node_modules/grunt-contrib-qunit/test/libs/qunit.js" type="text/javascript"></script>
<script src="scenario_officejs.js"></script>
</head>
<body>
<h1 id="qunit-header">OfficeJS Coverage Scenario</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup, will be hidden</div>
</body>
</html>
This diff is collapsed.
/*jslint indent:2,maxlen:80,nomen:true*/
/*global jIO, RSVP*/
(function (jIO, RSVP) {
"use strict";
/**
* The jIO SafeRepairStorage extension
*
* @class SafeRepairStorage
* @constructor
*/
function SafeRepairStorage(spec) {
this._sub_storage = jIO.createJIO(spec.sub_storage);
this._id_dict = {};
}
SafeRepairStorage.prototype.get = function () {
return this._sub_storage.get.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.allAttachments = function () {
return this._sub_storage.allAttachments.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.post = function () {
return this._sub_storage.post.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.put = function (id, doc) {
var storage = this;
return this._sub_storage.put.apply(this._sub_storage, arguments)
.push(undefined, function (error) {
if (error instanceof jIO.util.jIOError &&
error.status_code === 403) {
if (storage._id_dict[id]) {
return storage._sub_storage.put(storage._id_dict[id], doc);
}
return storage._sub_storage.post(doc)
.push(function (sub_id) {
storage._id_dict[id] = sub_id;
return sub_id;
});
}
});
};
SafeRepairStorage.prototype.remove = function () {
return;
};
SafeRepairStorage.prototype.getAttachment = function () {
return this._sub_storage.getAttachment.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.putAttachment = function (id, attachment_id,
attachment) {
var storage = this;
return this._sub_storage.putAttachment.apply(this._sub_storage, arguments)
.push(undefined, function (error) {
if (error instanceof jIO.util.jIOError &&
error.status_code === 403) {
return new RSVP.Queue()
.push(function () {
if (storage._id_dict[id]) {
return storage._id_dict[id];
}
return storage._sub_storage.get(id)
.push(function (doc) {
return storage._sub_storage.post(doc);
});
})
.push(function (sub_id) {
storage._id_dict[id] = sub_id;
return storage._sub_storage.putAttachment(sub_id, attachment_id,
attachment);
});
}
});
};
SafeRepairStorage.prototype.removeAttachment = function () {
return;
};
SafeRepairStorage.prototype.repair = function () {
return this._sub_storage.repair.apply(this._sub_storage, arguments);
};
SafeRepairStorage.prototype.hasCapacity = function (name) {
return this._sub_storage.hasCapacity(name);
};
SafeRepairStorage.prototype.buildQuery = function () {
return this._sub_storage.buildQuery.apply(this._sub_storage,
arguments);
};
jIO.addStorage('saferepair', SafeRepairStorage);
}(jIO, RSVP));
...@@ -53,11 +53,6 @@ ...@@ -53,11 +53,6 @@
<script src="jio.storage/zipstorage.tests.js"></script> <script src="jio.storage/zipstorage.tests.js"></script>
<script src="jio.storage/gdrivestorage.tests.js"></script> <script src="jio.storage/gdrivestorage.tests.js"></script>
<script src="jio.storage/websqlstorage.tests.js"></script> <script src="jio.storage/websqlstorage.tests.js"></script>
<script src="../node_modules/renderjs/dist/renderjs-latest.js"></script>
<script src="../examples/scenario.js"></script>
<script src="../examples/scenario_officejs.js"></script>
<!--script src="../lib/jquery/jquery.min.js"></script> <!--script src="../lib/jquery/jquery.min.js"></script>
<script src="../src/jio.storage/xwikistorage.js"></script> <script src="../src/jio.storage/xwikistorage.js"></script>
<script src="jio.storage/xwikistorage.tests.js"></script--> <script src="jio.storage/xwikistorage.tests.js"></script-->
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment