diff --git a/src/jio.storage/cryptstorage.js b/src/jio.storage/cryptstorage.js index d0ca3895f46d4ec462d03dffc72c7841c1a7b9b6..270f05c1f4f555435997c6e822573b1576ff0660 100644 --- a/src/jio.storage/cryptstorage.js +++ b/src/jio.storage/cryptstorage.js @@ -1,6 +1,7 @@ /*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true */ /*global jIO: true, sjcl: true, $: true, setTimeout: true */ jIO.addStorageType('crypt', function (spec, my) { + /*jslint todo: true*/ spec = spec || {}; var that = my.basicStorage(spec, my), priv = {}, @@ -80,7 +81,9 @@ jIO.addStorageType('crypt', function (spec, my) { obj._wait = obj._wait || {}; if (obj._wait[function_name]) { obj._wait[function_name] -= 1; - return function () {}; + return function () { + return; + }; } // ok if undef or 0 arglist = arglist || []; @@ -97,7 +100,9 @@ jIO.addStorageType('crypt', function (spec, my) { obj._wait[function_name] = times; }; async.end = function () { - async.call = function () {}; + async.call = function () { + return; + }; }; return async; }; diff --git a/src/jio.storage/s3storage.js b/src/jio.storage/s3storage.js index ee3de1db911c13f5417de547f25649b4845d0706..2639efc2a09921adcb9081a28512b6257e81ea9c 100644 --- a/src/jio.storage/s3storage.js +++ b/src/jio.storage/s3storage.js @@ -17,7 +17,7 @@ var b64_hmac_sha1 = sha1.b64_hmac_sha1; jIO.addStorageType("s3", function (spec, my) { - var evt, that, priv = {}; + var that, priv = {}; spec = spec || {}; that = my.basicStorage(spec, my); @@ -258,10 +258,10 @@ - that.encodePolicy = function (form) { + that.encodePolicy = function () { //generates the policy //enables the choice for the http response code - var http_code, s3_policy, Signature = ''; + var s3_policy; s3_policy = { "expiration": "2020-01-01T00:00:00Z", "conditions": [ @@ -269,7 +269,7 @@ ["starts-with", "$key", ""], {"acl": priv.acl }, {"success_action_redirect": ""}, - {"success_action_status": http_code }, + {"success_action_status": undefined }, // http_code ["starts-with", "$Content-Type", ""], ["content-length-range", 0, 524288000] ] @@ -280,7 +280,7 @@ priv.b64_policy = btoa(JSON.stringify(s3_policy)); //generates the signature value using the policy and the secret access key //use of sha1.js to generate the signature - Signature = that.signature(priv.b64_policy); + //Signature = that.signature(priv.b64_policy); }; @@ -407,6 +407,7 @@ } priv.updateMeta = function (doc, docid, attachid, action, data) { + /*jslint unparam: true */ doc._attachments = doc._attachments || {}; switch (action) { case "add": @@ -453,7 +454,7 @@ return error; }; - that.encodeAuthorization = function (key, mime) { + that.encodeAuthorization = function (key) { //GET oriented method var requestUTC, httpVerb, StringToSign, Signature; requestUTC = new Date().toUTCString(); @@ -670,7 +671,6 @@ docId, attachId, mime, - attachment_id, attachment_data, attachment_md5, attachment_mimetype, @@ -682,7 +682,7 @@ mime = 'text/plain; charset=UTF-8'; //récupération des variables de l'attachement - attachment_id = command.getAttachmentId(); + //attachment_id = command.getAttachmentId(); attachment_data = command.getAttachmentData(); attachment_md5 = command.md5SumAttachmentData(); attachment_mimetype = command.getAttachmentMimeType(); @@ -697,7 +697,7 @@ attachment_data, false, true, - function (reponse) { + function () { that.success({ // response "ok": true, @@ -722,7 +722,7 @@ doc = priv.updateMeta(data, docId, attachId, "add", attachment_obj); that.XHRwrapper(command, docId, '', 'PUT', mime, doc, false, false, - function (reponse) { + function () { putAttachment(); } ); @@ -760,7 +760,7 @@ function deleteDocument() { that.XHRwrapper(command, docId, '', 'DELETE', mime, '', true, false, - function (reponse) { + function () { that.success({ // response "ok": true, @@ -771,7 +771,8 @@ ); } - function myCallback(response) { + function myCallback() { + return; } that.XHRwrapper(command, docId, '', 'GET', mime, '', false, false, @@ -801,12 +802,7 @@ var mon_document, docId, attachId, - mime, - attachment_id, - attachment_data, - attachment_md5, - attachment_mimetype, - attachment_length; + mime; mon_document = null; docId = command.getDocId(); @@ -814,17 +810,17 @@ mime = 'text/plain; charset=UTF-8'; //récupération des variables de l'attachement - attachment_id = command.getAttachmentId(); - attachment_data = command.getAttachmentData(); - attachment_md5 = command.md5SumAttachmentData(); - attachment_mimetype = command.getAttachmentMimeType(); - attachment_length = command.getAttachmentLength(); + // attachment_id = command.getAttachmentId(); + // attachment_data = command.getAttachmentData(); + // attachment_md5 = command.md5SumAttachmentData(); + // attachment_mimetype = command.getAttachmentMimeType(); + // attachment_length = command.getAttachmentLength(); function removeAttachment() { that.XHRwrapper(command, docId, attachId, 'DELETE', mime, '', true, - true, function (reponse) { - } - ); + true, function () { + return; + }); } function putDocument() { @@ -832,10 +828,9 @@ data = JSON.parse(mon_document); doc = priv.updateMeta(data, docId, attachId, "remove", ''); that.XHRwrapper(command, docId, '', 'PUT', mime, doc, - false, false, function (reponse) { + false, false, function () { removeAttachment(); - } - ); + }); } function getDocument() { @@ -873,16 +868,14 @@ keyId, Signature, callURL, - requestUTC, - parse, - checkCounter; + requestUTC; keys = $(mon_document).find('Key'); resultTable = []; counter = 0; - keys.each(function (index) { + keys.each(function () { var that, filename, docId; that = $(this); filename = that.context.textContent; @@ -908,6 +901,7 @@ countB = 0; dealCallback = function (i, countB, allDoc) { + /*jslint unparam: true */ return function (doc, statustext, response) { allDoc.rows[i].doc = response.responseText; if (count === 0) { @@ -941,14 +935,12 @@ Signature = that.encodeAuthorization(keyId); callURL = 'http://' + priv.server + '.s3.amazonaws.com/' + keyId; requestUTC = new Date().toUTCString(); - parse = true; allDocResponse.rows[i] = { "id": priv.fileNameToIds(keyId).join(), "key": keyId, "value": {} }; - checkCounter = i; $.ajax({ contentType : '', diff --git a/src/jio.storage/xwikistorage.js b/src/jio.storage/xwikistorage.js index c282f5176346df473eadcfcee60f26fcd4d32767..8813df2b6b31d396c535468044d427a55563a3e3 100644 --- a/src/jio.storage/xwikistorage.js +++ b/src/jio.storage/xwikistorage.js @@ -9,7 +9,8 @@ XMLHttpRequest: true, Blob: true, FormData: true, - window: true + window: true, + setTimeout: true */ /** * JIO XWiki Storage. Type = 'xwiki'. @@ -86,7 +87,7 @@ priv.xwikiurl + "]", "reason": cause }); - }, + } }); }; @@ -125,7 +126,7 @@ }; priv.isBlob = function (potentialBlob) { - return typeof (potentialBlob) !== 'undefined' && + return potentialBlob !== undefined && potentialBlob.toString() === "[object Blob]"; }; @@ -225,7 +226,7 @@ xhr.responseType = 'text'; } - xhr.onload = function (e) { + xhr.onload = function () { if (xhr.status === 200) { var contentType = xhr.getResponseHeader("Content-Type"); if (contentType.indexOf(';') > -1) { @@ -327,7 +328,7 @@ xhr = new XMLHttpRequest(); xhr.open('POST', priv.xwikiurl + "/bin/upload/" + parts.space + '/' + parts.page, true); - xhr.onload = function (e) { + xhr.onload = function () { if (xhr.status === 302 || xhr.status === 200) { andThen(null); } else { @@ -490,7 +491,7 @@ return { "username": priv.username, "language": priv.language, - "xwikiurl": priv.xwikiurl, + "xwikiurl": priv.xwikiurl }; }; @@ -666,16 +667,16 @@ * @param {object} command The JIO command */ that.remove = that.removeAttachment = function (command) { - var notFoundError, objId, complete; - notFoundError = function (word) { - that.error({ - "status": 404, - "statusText": "Not Found", - "error": "not_found", - "message": word + " not found", - "reason": "missing" - }); - }; + var objId, complete; + // notFoundError = function (word) { + // that.error({ + // "status": 404, + // "statusText": "Not Found", + // "error": "not_found", + // "message": word + " not found", + // "reason": "missing" + // }); + // }; objId = command.getDocId(); complete = function (err) { @@ -718,7 +719,7 @@ return that; }; - if (typeof (define) === 'function' && define.amd) { + if (typeof define === 'function' && define.amd) { define(['jquery', 'jio'], function (jquery, jIO) { $ = jquery; jIO.addStorageType('xwiki', store); diff --git a/test/jio.storage/replicaterevisionstorage.tests.js b/test/jio.storage/replicaterevisionstorage.tests.js index 123c28412ddf6d40e9a73cc4e95cb5f1b8d06320..bef79ead52cab0f9f7478e2afd3967cec25517af 100644 --- a/test/jio.storage/replicaterevisionstorage.tests.js +++ b/test/jio.storage/replicaterevisionstorage.tests.js @@ -1,6 +1,6 @@ /*jslint indent: 2, maxlen: 80, nomen: true */ /*global define, jIO, jio_tests, hex_sha256, test, ok, deepEqual, sinon, - expect */ + expect, module */ // define([module_name], [dependencies], module); (function (dependencies, module) { @@ -75,6 +75,7 @@ module("Replicate Revision Storage"); var testReplicateRevisionStorage = function (sinon, jio_description) { + /*jslint unparam: true */ var o = generateTools(), leavesAction, generateLocalPath; @@ -778,6 +779,7 @@ description, index ) { + /*jslint unparam: true */ var o = generateTools(); o.jio = jIO.newJio(description); @@ -792,7 +794,7 @@ "children": [{ "rev": "1-111", "status": "available", - "children": [], + "children": [] }] }; o.doc1_1 = {"_id": "doc1.1-111", "title": "A"}; diff --git a/test/jio.storage/s3storage.tests.js b/test/jio.storage/s3storage.tests.js index f17a03aa5bd25aaef745aadc52e9cbf441391852..bdb573ef1edd92bb7a7eeb61f24e43693649ae54 100644 --- a/test/jio.storage/s3storage.tests.js +++ b/test/jio.storage/s3storage.tests.js @@ -1,5 +1,6 @@ /*jslint indent: 2, maxlen: 80, nomen: true */ -/*global define, jIO, jio_tests, window, test, ok, deepEqual, sinon, expect */ +/*global define, jIO, jio_tests, window, test, ok, deepEqual, sinon, expect, + module */ // define([module_name], [dependencies], module); (function (dependencies, module) { diff --git a/test/jio.storage/splitstorage.tests.js b/test/jio.storage/splitstorage.tests.js index c5b5c34239a0e1ec8d2c2ff5131e9eec70984db3..61c89f7854aafaa8285f6237720c6a0d4b90b4a5 100644 --- a/test/jio.storage/splitstorage.tests.js +++ b/test/jio.storage/splitstorage.tests.js @@ -1,5 +1,5 @@ /*jslint indent: 2, maxlen: 80, nomen: true */ -/*global define, jIO, jio_tests, test, ok, deepEqual, sinon */ +/*global define, jIO, jio_tests, test, ok, deepEqual, sinon, module */ // define([module_name], [dependencies], module); (function (dependencies, module) { diff --git a/test/jio.storage/xwikistorage.tests.js b/test/jio.storage/xwikistorage.tests.js index cc23f7d55fd4c14ac4c8557219ac8e9ebef4bdc5..c06ccd13a0f535d64e82a07cadd745f66dc3f0d4 100644 --- a/test/jio.storage/xwikistorage.tests.js +++ b/test/jio.storage/xwikistorage.tests.js @@ -1,5 +1,5 @@ /*jslint indent: 2, maxlen: 80, nomen: true */ -/*global define, jIO, jio_tests, test, ok, sinon */ +/*global define, jIO, jio_tests, test, ok, sinon, module */ // define([module_name], [dependencies], module); (function (dependencies, module) { @@ -18,6 +18,7 @@ tick: util.otick }; function addFakeServerResponse(type, method, path, status, response) { + /*jslint unparam: true */ o.server.respondWith(method, new RegExp(path), [ status, {"Content-Type": 'application/xml'}, @@ -30,7 +31,7 @@ module('XWikiStorage'); - function setUp(that, liveTest) { + function setUp(that) { var o = generateTools(that); o.server = sinon.fakeServer.create(); o.jio = jIO.newJio({type: 'xwiki', formTokenPath: 'form_token'});