In ContentChannel contentListener, added function isDone since it needs to wrap the ContentChannel.isDone.
diff --git a/ndnProtocol/components/ndnProtocolService.js b/ndnProtocol/components/ndnProtocolService.js
index 9973288..4005e1f 100644
--- a/ndnProtocol/components/ndnProtocolService.js
+++ b/ndnProtocol/components/ndnProtocolService.js
@@ -88,7 +88,8 @@
template);
};
- return new ContentChannel(aURI, requestContent);
+ var contentChannel = new ContentChannel(aURI, requestContent);
+ return contentChannel;
} catch (ex) {
dump("NdnProtocol.newChannel exception: " + ex + "\n" + ex.stack);
}
@@ -142,7 +143,7 @@
ContentClosure.prototype.upcall = function(kind, upcallInfo) {
try {
- if (this.contentListener.done)
+ if (this.contentListener.isDone())
// We are getting unexpected extra results.
return Closure.RESULT_ERR;
diff --git a/ndnProtocol/modules/ContentChannel.jsm b/ndnProtocol/modules/ContentChannel.jsm
index ba09fa9..9384317 100644
--- a/ndnProtocol/modules/ContentChannel.jsm
+++ b/ndnProtocol/modules/ContentChannel.jsm
@@ -97,7 +97,7 @@
var callingThread = threadManager.currentThread;
var contentListener = {
- onStart : function(contentType, contentCharset, uri) {
+ onStart: function(contentType, contentCharset, uri) {
if (uri)
thisContentChannel.URI = uri;
thisContentChannel.contentType = contentType;
@@ -117,7 +117,7 @@
}, 0);
},
- onReceivedContent : function(content) {
+ onReceivedContent: function(content) {
var pipe = Cc["@mozilla.org/pipe;1"].createInstance(Ci.nsIPipe);
pipe.init(true, true, 0, 0, null);
pipe.outputStream.write(content, content.length);
@@ -133,7 +133,7 @@
}, 0);
},
- onStop : function() {
+ onStop: function() {
thisContentChannel.done = true;
// nsIChannel requires us to call aListener on its calling thread.
@@ -143,7 +143,9 @@
thisContentChannel.status);
}
}, 0);
- }
+ },
+
+ isDone: function() { return thisContentChannel.done; }
};
this.requestContent(contentListener);