WebDAV, NPOTB.

Don't propagatge NS_BINDING_ABORTED to put() callers.

PUT() test wrapper and findErr helper.
This commit is contained in:
shaver%mozilla.org 2004-10-13 21:30:21 +00:00
parent 48acafa86d
commit b9f243f10c
2 changed files with 31 additions and 4 deletions

View File

@ -110,7 +110,7 @@ OperationStreamListener::OnDataAvailable(nsIRequest *aRequest,
PRUint32 offset, PRUint32 count)
{
aRequest->Cancel(NS_BINDING_ABORTED);
return NS_BINDING_ABORTED;
return NS_OK;
}
nsresult

View File

@ -1,6 +1,18 @@
const C = Components;
const CI = C.interfaces;
// I wonder how many copies of this are floating around
function findErr(result)
{
for (var i in C.results) {
if (C.results[i] == result) {
dump(i + "\n");
return;
}
}
dump("No result code found for " + result + "\n");
}
function getService(contract, iface)
{
return C.classes[contract].getService(CI[iface]);
@ -32,8 +44,16 @@ Resource.prototype = {
function ResourceWithFileData(url, filename)
{
this.urlSpec = url;
this.mFilename = filename;
this.urlSpec = url;
var file = makeFile(filename);
var instream = createInstance("@mozilla.org/network/file-input-stream;1",
"nsIFileInputStream");
instream.init(file, 0x01, 0, 0);
var buffered = createInstance("@mozilla.org/network/buffered-input-stream;1",
"nsIBufferedInputStream");
buffered.init(instream, 64 * 1024);
this.data = buffered;
}
ResourceWithFileData.prototype = {
@ -44,7 +64,7 @@ ResourceWithFileData.prototype = {
return Resource.prototype.QueryInterface.call(this, outer, iid);
},
__proto__: Resource.prototype
__proto__: Resource.prototype,
};
function propertiesToKeyArray(props)
@ -185,3 +205,10 @@ function GET(url, filename)
new OperationListener());
runEventPump();
}
function PUT(filename, url, contentType)
{
var resource = new ResourceWithFileData(url, filename);
davSvc.put(resource, contentType, new OperationListener());
runEventPump();
}