After sending the content to the ContentChannel, set the mostRecentWindow URL bar if its LOAD_INITIAL_DOCUMENT_URI bit is set.
Thie fixes a bug where sometimes the consumer of the ContentChannel wouldn't set the URL.
diff --git a/js/ccnxProtocol.xpi b/js/ccnxProtocol.xpi
index 7648812..b90ab65 100644
--- a/js/ccnxProtocol.xpi
+++ b/js/ccnxProtocol.xpi
Binary files differ
diff --git a/js/ccnxProtocol/components/ccnxProtocolService.js b/js/ccnxProtocol/components/ccnxProtocolService.js
index 4690b17..b466067 100644
--- a/js/ccnxProtocol/components/ccnxProtocolService.js
+++ b/js/ccnxProtocol/components/ccnxProtocolService.js
@@ -40,6 +40,7 @@
     		var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);

     		var mostRecentWindow = wm.getMostRecentWindow("navigator:browser");

     

+            var contentChannel;

 			var requestContent = function(contentListener) {

                 // Set nameString to the URI without the protocol.

                 var nameString = trimmedSpec;

@@ -76,12 +77,12 @@
 					contentListener.onReceivedContent(content, 

                         contentTypeEtc.contentType, contentTypeEtc.contentCharset);

                     

-                    // Assume that onReceivedContent sends all the content immediately and updatse

-                    //   the gURLBar if the content is for the main window.

-                    var urlBar = mostRecentWindow.gURLBar;

-                    if (urlBar && urlBar.value.trim() == trimmedSpec) {

-                        // Assume the URI is for the window.  Update the URL bar.

+                    // Load flags bit 19 "LOAD_INITIAL_DOCUMENT_URI" means the channel is

+                    //   for the main window with the URL bar.

+                    if (contentChannel.loadFlags & (1<<19)) {

+                        // Update the URL bar.

                         // Show the name without the ending sequence (unless the original URI had it).

+                        var urlBar = mostRecentWindow.gURLBar;

                         if (!uriEndsWithSequence && endsWithSequence(contentObject.name)) {

                             var nameWithoutSequence = new Name

                                 (contentObject.name.components.slice

@@ -98,7 +99,8 @@
 				ndn.expressInterest(name, new ContentClosure());

 			};

 

-			return new ContentChannel(aURI, requestContent);

+			contentChannel = new ContentChannel(aURI, requestContent);

+            return contentChannel;

 		} catch (ex) {

 			dump("CcnxProtocol.newChannel exception: " + ex + "\n");

 		}

diff --git a/js/ccnxProtocol/modules/ndn-js.jsm b/js/ccnxProtocol/modules/ndn-js.jsm
index 8134e79..39c7661 100644
--- a/js/ccnxProtocol/modules/ndn-js.jsm
+++ b/js/ccnxProtocol/modules/ndn-js.jsm
@@ -2548,10 +2548,8 @@
 		length) {
 
 
-	if ((null == blob) || (length == 0)) {
-
+	if (null == blob)
 		return;
-	}
 	
 	if(LOG>4) console.log('LENGTH OF XML_BLOB IS '+length);
 	
@@ -3159,15 +3157,10 @@
 
 BinaryXMLDecoder.prototype.decodeTypeAndVal = function() {
 	
-	/*int*/next;
-	/*int*/type = -1;
-	/*long*/val = 0;
-	/*boolean*/more = true;
+	/*int*/var type = -1;
+	/*long*/var val = 0;
+	/*boolean*/var more = true;
 
-	
-	//var savedOffset = this.offset;
-	var count = 0;
-	
 	do {
 		
 		var next = this.istream[this.offset ];
@@ -3249,14 +3242,11 @@
 	//
 	//byte [] 
 
-	bytes = this.istream.slice(this.offset, this.offset+ blobLength);
+	var bytes = this.istream.slice(this.offset, this.offset+ blobLength);
 	this.offset += blobLength;
 	
 	//int 
 	return bytes;
-	
-	count = 0;
-
 };
 
 var count =0;