fx-compat: Remove 'context' from onStartRequest()/onStopRequest()/etc.
This commit is contained in:
parent
3a77abc8d2
commit
94c7e0674d
8 changed files with 47 additions and 48 deletions
|
@ -758,7 +758,7 @@ ZoteroStandalone.DebugOutput = {
|
|||
return;
|
||||
}
|
||||
req.channel.notificationCallbacks = {
|
||||
onProgress: function (request, context, progress, progressMax) {},
|
||||
onProgress: function (request, progress, progressMax) {},
|
||||
|
||||
// nsIInterfaceRequestor
|
||||
getInterface: function (iid) {
|
||||
|
|
|
@ -431,7 +431,7 @@ Zotero.IPC.Pipe.DeferredOpen = function(file, callback) {
|
|||
Zotero.IPC.Pipe.DeferredOpen.prototype = {
|
||||
"onStartRequest":function() {},
|
||||
"onStopRequest":function() {},
|
||||
"onDataAvailable":function(request, context, inputStream, offset, count) {
|
||||
onDataAvailable: function (request, inputStream, offset, count) {
|
||||
// read from pipe
|
||||
var converterInputStream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIConverterInputStream);
|
||||
|
|
|
@ -216,14 +216,14 @@ Zotero.MIMETypeHandler = new function () {
|
|||
/**
|
||||
* Called when the request is started; we ignore this
|
||||
*/
|
||||
_StreamListener.prototype.onStartRequest = function(channel, context) {}
|
||||
_StreamListener.prototype.onStartRequest = function(channel) {}
|
||||
|
||||
|
||||
/**
|
||||
* Called when there's data available; we collect this data and keep it until the request is
|
||||
* done
|
||||
*/
|
||||
_StreamListener.prototype.onDataAvailable = function(request, context, inputStream, offset, count) {
|
||||
_StreamListener.prototype.onDataAvailable = function(request, inputStream, offset, count) {
|
||||
Zotero.debug(count + " bytes available");
|
||||
|
||||
if (!this._storageStream) {
|
||||
|
@ -244,7 +244,7 @@ Zotero.MIMETypeHandler = new function () {
|
|||
/**
|
||||
* Called when the request is done
|
||||
*/
|
||||
_StreamListener.prototype.onStopRequest = async function (channel, context, status) {
|
||||
_StreamListener.prototype.onStopRequest = async function (channel, status) {
|
||||
Zotero.debug("charset is " + channel.contentCharset);
|
||||
|
||||
var inputStream = this._storageStream.newInputStream(0);
|
||||
|
@ -289,11 +289,11 @@ Zotero.MIMETypeHandler = new function () {
|
|||
this._contentType, this._request, frontWindow, null
|
||||
);
|
||||
if (streamListener) {
|
||||
streamListener.onStartRequest(channel, context);
|
||||
streamListener.onStartRequest(channel);
|
||||
streamListener.onDataAvailable(
|
||||
this._request, context, inputStream, 0, this._storageStream.length
|
||||
this._request, inputStream, 0, this._storageStream.length
|
||||
);
|
||||
streamListener.onStopRequest(channel, context, status);
|
||||
streamListener.onStopRequest(channel, status);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -175,12 +175,12 @@ Zotero.Server.DataListener = function(iStream, oStream) {
|
|||
* called when a request begins (although the request should have begun before
|
||||
* the DataListener was generated)
|
||||
*/
|
||||
Zotero.Server.DataListener.prototype.onStartRequest = function(request, context) {}
|
||||
Zotero.Server.DataListener.prototype.onStartRequest = function(request) {}
|
||||
|
||||
/*
|
||||
* called when a request stops
|
||||
*/
|
||||
Zotero.Server.DataListener.prototype.onStopRequest = function(request, context, status) {
|
||||
Zotero.Server.DataListener.prototype.onStopRequest = function(request, status) {
|
||||
this.iStream.close();
|
||||
this.oStream.close();
|
||||
}
|
||||
|
@ -188,8 +188,7 @@ Zotero.Server.DataListener.prototype.onStopRequest = function(request, context,
|
|||
/*
|
||||
* called when new data is available
|
||||
*/
|
||||
Zotero.Server.DataListener.prototype.onDataAvailable = function(request, context,
|
||||
inputStream, offset, count) {
|
||||
Zotero.Server.DataListener.prototype.onDataAvailable = function (request, inputStream, offset, count) {
|
||||
var readData = NetUtil.readInputStreamToString(inputStream, count);
|
||||
|
||||
if(this.headerFinished) { // reading body
|
||||
|
|
|
@ -42,25 +42,25 @@ Zotero.Sync.Storage.StreamListener.prototype = {
|
|||
_channel: null,
|
||||
|
||||
// nsIProgressEventSink
|
||||
onProgress: function (request, context, progress, progressMax) {
|
||||
onProgress: function (request, progress, progressMax) {
|
||||
Zotero.debug("onProgress with " + progress + "/" + progressMax);
|
||||
this._onProgress(request, progress, progressMax);
|
||||
},
|
||||
|
||||
onStatus: function (request, context, status, statusArg) {
|
||||
onStatus: function (request, status, statusArg) {
|
||||
Zotero.debug('onStatus with ' + status);
|
||||
},
|
||||
|
||||
// nsIRequestObserver
|
||||
// Note: For uploads, this isn't called until data is done uploading
|
||||
onStartRequest: function (request, context) {
|
||||
onStartRequest: function (request) {
|
||||
Zotero.debug('onStartRequest');
|
||||
this._response = "";
|
||||
|
||||
this._onStart(request);
|
||||
},
|
||||
|
||||
onStopRequest: function (request, context, status) {
|
||||
onStopRequest: function (request, status) {
|
||||
Zotero.debug('onStopRequest with ' + status);
|
||||
|
||||
// Some errors from https://developer.mozilla.org/en-US/docs/Table_Of_Errors
|
||||
|
@ -132,7 +132,7 @@ Zotero.Sync.Storage.StreamListener.prototype = {
|
|||
},
|
||||
|
||||
// nsIStreamListener
|
||||
onDataAvailable: function (request, context, stream, sourceOffset, length) {
|
||||
onDataAvailable: function (request, stream, sourceOffset, length) {
|
||||
Zotero.debug('onDataAvailable');
|
||||
var scriptableInputStream =
|
||||
Components.classes["@mozilla.org/scriptableinputstream;1"]
|
||||
|
|
|
@ -251,16 +251,16 @@ Zotero.Utilities.Internal = {
|
|||
size: 0,
|
||||
data: '',
|
||||
|
||||
onStartRequest: function (request, context) {},
|
||||
onStartRequest: function (request) {},
|
||||
|
||||
onStopRequest: function (request, context, status) {
|
||||
onStopRequest: function (request, status) {
|
||||
this.binaryInputStream.close();
|
||||
delete this.binaryInputStream;
|
||||
|
||||
deferred.resolve(this.data);
|
||||
},
|
||||
|
||||
onDataAvailable: function (request, context, inputStream, offset, count) {
|
||||
onDataAvailable: function (request, inputStream, offset, count) {
|
||||
this.size += count;
|
||||
|
||||
this.binaryInputStream = Components.classes["@mozilla.org/binaryinputstream;1"]
|
||||
|
@ -317,13 +317,13 @@ Zotero.Utilities.Internal = {
|
|||
{
|
||||
data: '',
|
||||
|
||||
onStartRequest: function (request, context) {},
|
||||
onStartRequest: function (request) {},
|
||||
|
||||
onStopRequest: function (request, context, status) {
|
||||
onStopRequest: function (request, status) {
|
||||
deferred.resolve(this.data);
|
||||
},
|
||||
|
||||
onDataAvailable: function (request, context, inputStream, offset, count) {
|
||||
onDataAvailable: function (request, inputStream, offset, count) {
|
||||
this.data += NetUtil.readInputStreamToString(
|
||||
inputStream,
|
||||
inputStream.available(),
|
||||
|
|
|
@ -971,11 +971,11 @@ function ZoteroProtocolHandler() {
|
|||
ConnectorChannel.prototype.__defineGetter__("originalURI", function() { return this.URI });
|
||||
ConnectorChannel.prototype.__defineSetter__("originalURI", function() { });
|
||||
|
||||
ConnectorChannel.prototype.asyncOpen = function(streamListener, context) {
|
||||
ConnectorChannel.prototype.asyncOpen = function(streamListener) {
|
||||
if(this.loadGroup) this.loadGroup.addRequest(this, null);
|
||||
streamListener.onStartRequest(this, context);
|
||||
streamListener.onDataAvailable(this, context, this._stream, 0, this.contentLength);
|
||||
streamListener.onStopRequest(this, context, this.status);
|
||||
streamListener.onStartRequest(this);
|
||||
streamListener.onDataAvailable(this, this._stream, 0, this.contentLength);
|
||||
streamListener.onStopRequest(this, this.status);
|
||||
this._isPending = false;
|
||||
if(this.loadGroup) this.loadGroup.removeRequest(this, null, 0);
|
||||
}
|
||||
|
@ -1360,7 +1360,7 @@ function AsyncChannel(uri, gen) {
|
|||
}
|
||||
|
||||
AsyncChannel.prototype = {
|
||||
asyncOpen: Zotero.Promise.coroutine(function* (streamListener, context) {
|
||||
asyncOpen: Zotero.Promise.coroutine(function* (streamListener) {
|
||||
if (this.loadGroup) this.loadGroup.addRequest(this, null);
|
||||
|
||||
var channel = this;
|
||||
|
@ -1373,17 +1373,17 @@ AsyncChannel.prototype = {
|
|||
});
|
||||
|
||||
var listenerWrapper = {
|
||||
onStartRequest: function (request, context) {
|
||||
onStartRequest: function (request) {
|
||||
//Zotero.debug("Starting request");
|
||||
streamListener.onStartRequest(channel, context);
|
||||
streamListener.onStartRequest(channel);
|
||||
},
|
||||
onDataAvailable: function (request, context, inputStream, offset, count) {
|
||||
onDataAvailable: function (request, inputStream, offset, count) {
|
||||
//Zotero.debug("onDataAvailable");
|
||||
streamListener.onDataAvailable(channel, context, inputStream, offset, count);
|
||||
streamListener.onDataAvailable(channel, inputStream, offset, count);
|
||||
},
|
||||
onStopRequest: function (request, context, status) {
|
||||
onStopRequest: function (request, status) {
|
||||
//Zotero.debug("Stopping request");
|
||||
streamListener.onStopRequest(channel, context, status);
|
||||
streamListener.onStopRequest(channel, status);
|
||||
channel._isPending = false;
|
||||
if (status == 0) {
|
||||
resolve();
|
||||
|
@ -1405,15 +1405,15 @@ AsyncChannel.prototype = {
|
|||
if (typeof data == 'string') {
|
||||
//Zotero.debug("AsyncChannel: Got string from generator");
|
||||
|
||||
listenerWrapper.onStartRequest(this, context);
|
||||
listenerWrapper.onStartRequest(this);
|
||||
|
||||
let converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
|
||||
converter.charset = "UTF-8";
|
||||
let inputStream = converter.convertToInputStream(data);
|
||||
listenerWrapper.onDataAvailable(this, context, inputStream, 0, inputStream.available());
|
||||
listenerWrapper.onDataAvailable(this, inputStream, 0, inputStream.available());
|
||||
|
||||
listenerWrapper.onStopRequest(this, context, this.status);
|
||||
listenerWrapper.onStopRequest(this, this.status);
|
||||
}
|
||||
// If an async input stream is given, pass the data asynchronously to the stream listener
|
||||
else if (data instanceof Ci.nsIAsyncInputStream) {
|
||||
|
@ -1426,7 +1426,7 @@ AsyncChannel.prototype = {
|
|||
catch (e) {
|
||||
pump.init(data, -1, -1, 0, 0, true);
|
||||
}
|
||||
pump.asyncRead(listenerWrapper, context);
|
||||
pump.asyncRead(listenerWrapper, null);
|
||||
}
|
||||
else if (data instanceof Ci.nsIFile || data instanceof Ci.nsIURI) {
|
||||
if (data instanceof Ci.nsIFile) {
|
||||
|
@ -1452,14 +1452,14 @@ AsyncChannel.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
listenerWrapper.onStartRequest(channel, context);
|
||||
listenerWrapper.onStartRequest(channel);
|
||||
try {
|
||||
listenerWrapper.onDataAvailable(channel, context, inputStream, 0, inputStream.available());
|
||||
listenerWrapper.onDataAvailable(channel, inputStream, 0, inputStream.available());
|
||||
}
|
||||
catch (e) {
|
||||
reject(e);
|
||||
}
|
||||
listenerWrapper.onStopRequest(channel, context, status);
|
||||
listenerWrapper.onStopRequest(channel, status);
|
||||
});
|
||||
}
|
||||
else if (data === undefined) {
|
||||
|
@ -1478,7 +1478,7 @@ AsyncChannel.prototype = {
|
|||
} catch (e) {
|
||||
Zotero.debug(e, 1);
|
||||
if (channel._isPending) {
|
||||
streamListener.onStopRequest(channel, context, Components.results.NS_ERROR_FAILURE);
|
||||
streamListener.onStopRequest(channel, Components.results.NS_ERROR_FAILURE);
|
||||
channel._isPending = false;
|
||||
}
|
||||
throw e;
|
||||
|
|
|
@ -4081,12 +4081,12 @@ Response.prototype =
|
|||
var response = this;
|
||||
var copyObserver =
|
||||
{
|
||||
onStartRequest: function(request, cx)
|
||||
onStartRequest: function(request)
|
||||
{
|
||||
dumpn("*** preamble copying started");
|
||||
},
|
||||
|
||||
onStopRequest: function(request, cx, statusCode)
|
||||
onStopRequest: function(request, statusCode)
|
||||
{
|
||||
dumpn("*** preamble copying complete " +
|
||||
"[status=0x" + statusCode.toString(16) + "]");
|
||||
|
@ -4145,12 +4145,12 @@ Response.prototype =
|
|||
var response = this;
|
||||
var copyObserver =
|
||||
{
|
||||
onStartRequest: function(request, context)
|
||||
onStartRequest: function(request)
|
||||
{
|
||||
dumpn("*** onStartRequest");
|
||||
},
|
||||
|
||||
onStopRequest: function(request, cx, statusCode)
|
||||
onStopRequest: function(request, statusCode)
|
||||
{
|
||||
dumpn("*** onStopRequest [status=0x" + statusCode.toString(16) + "]");
|
||||
|
||||
|
@ -4275,7 +4275,7 @@ function WriteThroughCopier(source, sink, observer, context)
|
|||
// start copying
|
||||
try
|
||||
{
|
||||
observer.onStartRequest(this, context);
|
||||
observer.onStartRequest(this);
|
||||
this._waitToReadData();
|
||||
this._waitForSinkClosure();
|
||||
}
|
||||
|
@ -4688,7 +4688,7 @@ WriteThroughCopier.prototype =
|
|||
self._completed = true;
|
||||
try
|
||||
{
|
||||
self._observer.onStopRequest(self, self._context, self.status);
|
||||
self._observer.onStopRequest(self, self.status);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue