Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
jio
Commits
d3f1a671
Commit
d3f1a671
authored
Oct 29, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
davstorage{,.tests}.js `.bind()` no longer used
In order to avoid phantomjs (or headless webkit) bug.
parent
dbf5b58f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
27 deletions
+29
-27
src/jio.storage/davstorage.js
src/jio.storage/davstorage.js
+26
-26
test/jio.storage/davstorage.tests.js
test/jio.storage/davstorage.tests.js
+3
-1
No files found.
src/jio.storage/davstorage.js
View file @
d3f1a671
...
@@ -386,7 +386,7 @@
...
@@ -386,7 +386,7 @@
DavStorage
.
prototype
.
postOrPut
=
function
(
method
,
command
,
metadata
)
{
DavStorage
.
prototype
.
postOrPut
=
function
(
method
,
command
,
metadata
)
{
metadata
.
_id
=
metadata
.
_id
||
jIO
.
util
.
generateUuid
();
metadata
.
_id
=
metadata
.
_id
||
jIO
.
util
.
generateUuid
();
var
o
=
{
var
that
=
this
,
o
=
{
error_message
:
"
DavStorage, unable to get metadata.
"
,
error_message
:
"
DavStorage, unable to get metadata.
"
,
notify_message
:
"
Getting metadata
"
,
notify_message
:
"
Getting metadata
"
,
percentage
:
[
0
,
30
],
percentage
:
[
0
,
30
],
...
@@ -406,8 +406,8 @@
...
@@ -406,8 +406,8 @@
o
.
notify_message
=
"
Updating metadata
"
;
o
.
notify_message
=
"
Updating metadata
"
;
o
.
error_message
=
"
DavStorage, unable to update document.
"
;
o
.
error_message
=
"
DavStorage, unable to update document.
"
;
o
.
percentage
=
[
30
,
100
];
o
.
percentage
=
[
30
,
100
];
th
is
.
_put
(
metadata
).
then
(
o
.
success
,
o
.
reject
,
o
.
notifyProgress
);
th
at
.
_put
(
metadata
).
then
(
o
.
success
,
o
.
reject
,
o
.
notifyProgress
);
}
.
bind
(
this
)
,
},
errorDocumentExists
:
function
(
e
)
{
errorDocumentExists
:
function
(
e
)
{
command
.
error
(
command
.
error
(
"
conflict
"
,
"
conflict
"
,
...
@@ -426,8 +426,8 @@
...
@@ -426,8 +426,8 @@
o
.
percentage
=
[
30
,
100
];
o
.
percentage
=
[
30
,
100
];
o
.
notify_message
=
"
Updating metadata
"
;
o
.
notify_message
=
"
Updating metadata
"
;
o
.
error_message
=
"
DavStorage, unable to create document.
"
;
o
.
error_message
=
"
DavStorage, unable to create document.
"
;
th
is
.
_put
(
metadata
).
then
(
o
.
success
,
o
.
reject
,
o
.
notifyProgress
);
th
at
.
_put
(
metadata
).
then
(
o
.
success
,
o
.
reject
,
o
.
notifyProgress
);
}
.
bind
(
this
)
,
},
success
:
function
(
e
)
{
success
:
function
(
e
)
{
command
.
success
(
e
.
target
.
status
,
{
"
id
"
:
metadata
.
_id
});
command
.
success
(
e
.
target
.
status
,
{
"
id
"
:
metadata
.
_id
});
},
},
...
@@ -481,7 +481,7 @@
...
@@ -481,7 +481,7 @@
* @param {Object} options The command options
* @param {Object} options The command options
*/
*/
DavStorage
.
prototype
.
putAttachment
=
function
(
command
,
param
)
{
DavStorage
.
prototype
.
putAttachment
=
function
(
command
,
param
)
{
var
o
=
{
var
that
=
this
,
o
=
{
error_message
:
"
DavStorage unable to put attachment
"
,
error_message
:
"
DavStorage unable to put attachment
"
,
percentage
:
[
0
,
30
],
percentage
:
[
0
,
30
],
notify_message
:
"
Getting metadata
"
,
notify_message
:
"
Getting metadata
"
,
...
@@ -501,7 +501,7 @@
...
@@ -501,7 +501,7 @@
o
.
notify_message
=
"
Putting attachment
"
;
o
.
notify_message
=
"
Putting attachment
"
;
o
.
remote_metadata
=
e
.
target
.
response
;
o
.
remote_metadata
=
e
.
target
.
response
;
return
RSVP
.
all
([
return
RSVP
.
all
([
th
is
.
_putAttachment
(
param
),
th
at
.
_putAttachment
(
param
),
jIO
.
util
.
readBlobAsBinaryString
(
param
.
_blob
)
jIO
.
util
.
readBlobAsBinaryString
(
param
.
_blob
)
]).
then
(
null
,
null
,
function
(
e
)
{
]).
then
(
null
,
null
,
function
(
e
)
{
// propagate only putAttachment progress
// propagate only putAttachment progress
...
@@ -510,7 +510,7 @@
...
@@ -510,7 +510,7 @@
}
}
throw
null
;
throw
null
;
});
});
}
.
bind
(
this
)
,
},
putMetadata
:
function
(
answers
)
{
putMetadata
:
function
(
answers
)
{
o
.
percentage
=
[
70
,
100
];
o
.
percentage
=
[
70
,
100
];
o
.
notify_message
=
"
Updating metadata
"
;
o
.
notify_message
=
"
Updating metadata
"
;
...
@@ -521,8 +521,8 @@
...
@@ -521,8 +521,8 @@
"
digest
"
:
jIO
.
util
.
makeBinaryStringDigest
(
answers
[
1
].
target
.
result
),
"
digest
"
:
jIO
.
util
.
makeBinaryStringDigest
(
answers
[
1
].
target
.
result
),
"
content_type
"
:
param
.
_blob
.
type
"
content_type
"
:
param
.
_blob
.
type
};
};
return
th
is
.
_put
(
o
.
remote_metadata
);
return
th
at
.
_put
(
o
.
remote_metadata
);
}
.
bind
(
this
)
,
},
success
:
function
(
e
)
{
success
:
function
(
e
)
{
command
.
success
(
e
.
target
.
status
,
{
command
.
success
(
e
.
target
.
status
,
{
"
digest
"
:
o
.
remote_metadata
.
_attachments
[
param
.
_attachment
].
digest
"
digest
"
:
o
.
remote_metadata
.
_attachments
[
param
.
_attachment
].
digest
...
@@ -586,7 +586,7 @@
...
@@ -586,7 +586,7 @@
* @param {Object} options The command options
* @param {Object} options The command options
*/
*/
DavStorage
.
prototype
.
getAttachment
=
function
(
command
,
param
)
{
DavStorage
.
prototype
.
getAttachment
=
function
(
command
,
param
)
{
var
o
=
{
var
that
=
this
,
o
=
{
error_message
:
"
DavStorage, unable to get attachment.
"
,
error_message
:
"
DavStorage, unable to get attachment.
"
,
percentage
:
[
0
,
30
],
percentage
:
[
0
,
30
],
notify_message
:
"
Getting metedata
"
,
notify_message
:
"
Getting metedata
"
,
...
@@ -616,8 +616,8 @@
...
@@ -616,8 +616,8 @@
o
.
notify_message
=
"
Retrieving attachment
"
;
o
.
notify_message
=
"
Retrieving attachment
"
;
o
.
percentage
=
[
30
,
100
];
o
.
percentage
=
[
30
,
100
];
o
.
digest
=
attachment
.
digest
;
o
.
digest
=
attachment
.
digest
;
return
th
is
.
_getAttachment
(
param
);
return
th
at
.
_getAttachment
(
param
);
}
.
bind
(
this
)
,
},
success
:
function
(
e
)
{
success
:
function
(
e
)
{
command
.
success
(
e
.
target
.
status
,
{
command
.
success
(
e
.
target
.
status
,
{
"
data
"
:
new
Blob
([
e
.
target
.
response
],
{
"
type
"
:
o
.
type
}),
"
data
"
:
new
Blob
([
e
.
target
.
response
],
{
"
type
"
:
o
.
type
}),
...
@@ -647,7 +647,7 @@
...
@@ -647,7 +647,7 @@
* @param {Object} options The command options
* @param {Object} options The command options
*/
*/
DavStorage
.
prototype
.
remove
=
function
(
command
,
param
)
{
DavStorage
.
prototype
.
remove
=
function
(
command
,
param
)
{
var
o
=
{
var
that
=
this
,
o
=
{
error_message
:
"
DavStorage, unable to get metadata.
"
,
error_message
:
"
DavStorage, unable to get metadata.
"
,
notify_message
:
"
Getting metadata
"
,
notify_message
:
"
Getting metadata
"
,
percentage
:
[
0
,
70
],
percentage
:
[
0
,
70
],
...
@@ -669,8 +669,8 @@
...
@@ -669,8 +669,8 @@
o
.
percentage
=
[
70
,
80
];
o
.
percentage
=
[
70
,
80
];
o
.
notify_message
=
"
Removing document
"
;
o
.
notify_message
=
"
Removing document
"
;
o
.
error_message
=
"
DavStorage, unable to remove document
"
;
o
.
error_message
=
"
DavStorage, unable to remove document
"
;
return
th
is
.
_remove
(
param
);
return
th
at
.
_remove
(
param
);
}
.
bind
(
this
)
,
},
removeAllAttachments
:
function
(
e
)
{
removeAllAttachments
:
function
(
e
)
{
var
k
,
requests
=
[],
attachments
;
var
k
,
requests
=
[],
attachments
;
attachments
=
o
.
get_result
.
target
.
response
.
_attachments
;
attachments
=
o
.
get_result
.
target
.
response
.
_attachments
;
...
@@ -679,7 +679,7 @@
...
@@ -679,7 +679,7 @@
for
(
k
in
attachments
)
{
for
(
k
in
attachments
)
{
if
(
attachments
.
hasOwnProperty
(
k
))
{
if
(
attachments
.
hasOwnProperty
(
k
))
{
requests
[
requests
.
length
]
=
promiseSucceed
(
requests
[
requests
.
length
]
=
promiseSucceed
(
th
is
.
_removeAttachment
({
th
at
.
_removeAttachment
({
"
_id
"
:
param
.
_id
,
"
_id
"
:
param
.
_id
,
"
_attachment
"
:
k
"
_attachment
"
:
k
})
})
...
@@ -708,7 +708,7 @@
...
@@ -708,7 +708,7 @@
}
}
return
null
;
return
null
;
});
});
}
.
bind
(
this
)
,
},
success
:
function
()
{
success
:
function
()
{
command
.
success
(
o
.
remove_result
.
target
.
status
);
command
.
success
(
o
.
remove_result
.
target
.
status
);
},
},
...
@@ -736,7 +736,7 @@
...
@@ -736,7 +736,7 @@
* @param {Object} options The command options
* @param {Object} options The command options
*/
*/
DavStorage
.
prototype
.
removeAttachment
=
function
(
command
,
param
)
{
DavStorage
.
prototype
.
removeAttachment
=
function
(
command
,
param
)
{
var
o
=
{
var
that
=
this
,
o
=
{
error_message
:
"
DavStorage, an error occured while getting metadata.
"
,
error_message
:
"
DavStorage, an error occured while getting metadata.
"
,
percentage
:
[
0
,
40
],
percentage
:
[
0
,
40
],
notify_message
:
"
Getting metadata
"
,
notify_message
:
"
Getting metadata
"
,
...
@@ -774,15 +774,15 @@
...
@@ -774,15 +774,15 @@
o
.
notify_message
=
"
Updating metadata
"
;
o
.
notify_message
=
"
Updating metadata
"
;
o
.
error_message
=
"
DavStorage, an error occured
"
+
o
.
error_message
=
"
DavStorage, an error occured
"
+
"
while updating metadata.
"
;
"
while updating metadata.
"
;
return
th
is
.
_put
(
doc
);
return
th
at
.
_put
(
doc
);
}
.
bind
(
this
)
,
},
removeAttachment
:
function
()
{
removeAttachment
:
function
()
{
o
.
percentage
=
[
80
,
100
];
o
.
percentage
=
[
80
,
100
];
o
.
notify_message
=
"
Removing attachment
"
;
o
.
notify_message
=
"
Removing attachment
"
;
o
.
error_message
=
"
DavStorage, an error occured
"
+
o
.
error_message
=
"
DavStorage, an error occured
"
+
"
while removing attachment.
"
;
"
while removing attachment.
"
;
return
th
is
.
_removeAttachment
(
param
);
return
th
at
.
_removeAttachment
(
param
);
}
.
bind
(
this
)
,
},
success
:
function
(
e
)
{
success
:
function
(
e
)
{
command
.
success
(
e
.
status
);
command
.
success
(
e
.
status
);
},
},
...
@@ -812,7 +812,7 @@
...
@@ -812,7 +812,7 @@
* Also retrieve the actual document content.
* Also retrieve the actual document content.
*/
*/
DavStorage
.
prototype
.
allDocs
=
function
(
command
,
param
,
options
)
{
DavStorage
.
prototype
.
allDocs
=
function
(
command
,
param
,
options
)
{
var
o
=
{
var
that
=
this
,
o
=
{
error_message
:
"
DavStorage, an error occured while
"
+
error_message
:
"
DavStorage, an error occured while
"
+
"
retrieving document list
"
,
"
retrieving document list
"
,
max_percentage
:
options
.
include_docs
===
true
?
20
:
100
,
max_percentage
:
options
.
include_docs
===
true
?
20
:
100
,
...
@@ -834,7 +834,7 @@
...
@@ -834,7 +834,7 @@
}
}
e
.
target
.
response
.
data
.
rows
.
forEach
(
function
(
row
)
{
e
.
target
.
response
.
data
.
rows
.
forEach
(
function
(
row
)
{
requests
[
requests
.
length
]
=
th
is
.
_get
({
"
_id
"
:
row
.
id
}).
requests
[
requests
.
length
]
=
th
at
.
_get
({
"
_id
"
:
row
.
id
}).
done
(
function
(
e
)
{
done
(
function
(
e
)
{
row
.
doc
=
e
.
target
.
response
;
row
.
doc
=
e
.
target
.
response
;
});
});
...
@@ -860,7 +860,7 @@
...
@@ -860,7 +860,7 @@
}
}
throw
null
;
throw
null
;
});
});
}
.
bind
(
this
)
,
},
success
:
function
()
{
success
:
function
()
{
command
.
success
(
o
.
alldocs_result
.
target
.
status
,
{
command
.
success
(
o
.
alldocs_result
.
target
.
status
,
{
"
data
"
:
o
.
alldocs_result
.
target
.
response
"
data
"
:
o
.
alldocs_result
.
target
.
response
...
...
test/jio.storage/davstorage.tests.js
View file @
d3f1a671
...
@@ -1074,7 +1074,9 @@
...
@@ -1074,7 +1074,9 @@
//then(checkStorage).done(checkStorageTest).
//then(checkStorage).done(checkStorageTest).
fail
(
unexpectedError
).
fail
(
unexpectedError
).
always
(
start
).
always
(
start
).
always
(
server
.
restore
.
bind
(
server
));
always
(
function
()
{
server
.
restore
();
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment