diff --git a/js/ccnxProtocol/modules/ContentChannel.jsm b/js/ccnxProtocol/modules/ContentChannel.jsm
index 12badcf..d675c2f 100644
--- a/js/ccnxProtocol/modules/ContentChannel.jsm
+++ b/js/ccnxProtocol/modules/ContentChannel.jsm
@@ -11,10 +11,8 @@
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
   
-/** Create an nsIChannel where asyncOpen calls requestContent(contentListener).  When the content
-	is available, call contentListener.onReceivedContent(content, contentType, contentCharset),  
-    which sends the content	to the listener passed to asyncOpen and returns after calling its
-    onStopRequest.
+/* Create an nsIChannel for returning content to the caller of asyncOpen. 
+ * For requestContent detail, see asyncOpen.
  */
 function ContentChannel(uri, requestContent) {
 	this.requestContent = requestContent;
@@ -36,6 +34,10 @@
 	this.owner = null;
 	this.notificationCallback = null;
 	this.securityInfo = null;
+            
+    // Save the mostRecentWindow from the moment of creating the channel.
+    var wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
+    this.mostRecentWindow = wm.getMostRecentWindow("navigator:browser");
 }
 
 ContentChannel.prototype = {
@@ -71,45 +73,61 @@
 	
 	open: function() {
 		throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-	},
-	
-	asyncOpen: function(aListener, aContext) {
-        try {
-            var thisContentChannel = this;
-            
-    		var threadManager = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
-			var callingThread = threadManager.currentThread; 
-            
-            var contentListener = {
-                onReceivedContent : function(content, contentType, contentCharset) {
-                    thisContentChannel.contentLength = content.length;
-                    thisContentChannel.contentType = contentType;
-                    thisContentChannel.contentCharset = contentCharset;
-				
-                    var pipe = Cc["@mozilla.org/pipe;1"].createInstance(Ci.nsIPipe);
-                    pipe.init(true, true, 0, 0, null);
-                    pipe.outputStream.write(content, content.length);
-                    pipe.outputStream.close();
-				
-                    // nsIChannel requires us to call aListener on its calling thread.
-                    // Set dispatch flags to 1 to wait for it to finish.
-					callingThread.dispatch({
-						run: function() { 				
-                            aListener.onStartRequest(thisContentChannel, aContext);
-                            aListener.onDataAvailable(thisContentChannel, aContext, 
-                                pipe.inputStream, 0, content.length);
-				
-                            thisContentChannel.done = true;
-                            aListener.onStopRequest(thisContentChannel, aContext, 
-                                thisContentChannel.status);
-						}
-					}, 1);
-                }
-            };
-		
-            this.requestContent(contentListener);
-        } catch (ex) {
-            dump("ContentChannel.asyncOpen exception: " + ex + "\n");
-        }
 	}
 };
+
+/*  Call requestContent(contentListener).  When the content is available, you should call 
+ *  contentListener.onReceivedContent(content, contentType, contentCharset, uri), 
+ *  which sends the content	aListener.  If uri is not null, update this.URI and if this.loadFlags
+ *  LOAD_INITIAL_DOCUMENT_URI bit is set, then update the URL bar of the mostRecentWindow.
+ *  (Note that the caller of asyncOpen sets this.loadFlags.)
+ */
+ContentChannel.prototype.asyncOpen = function(aListener, aContext) {
+    try {
+        var thisContentChannel = this;
+            
+		var threadManager = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
+		var callingThread = threadManager.currentThread; 
+            
+        var contentListener = {
+            onReceivedContent : function(content, contentType, contentCharset, uri) {
+                if (uri)
+                    thisContentChannel.URI = uri;
+                thisContentChannel.contentLength = content.length;
+                thisContentChannel.contentType = contentType;
+                thisContentChannel.contentCharset = contentCharset;
+				
+                var pipe = Cc["@mozilla.org/pipe;1"].createInstance(Ci.nsIPipe);
+                pipe.init(true, true, 0, 0, null);
+                pipe.outputStream.write(content, content.length);
+                pipe.outputStream.close();
+				
+                // nsIChannel requires us to call aListener on its calling thread.
+                // Set dispatch flags to 0 to return immediately.
+				callingThread.dispatch({
+					run: function() { 				
+                        aListener.onStartRequest(thisContentChannel, aContext);
+                        // Load flags bit 19 "LOAD_INITIAL_DOCUMENT_URI" means this channel is
+                        //   for the main window with the URL bar.
+                        if (uri && thisContentChannel.loadFlags & (1<<19))
+                            // aListener.onStartRequest may set the URL bar but now we update it.
+                            thisContentChannel.mostRecentWindow.gURLBar.value = 
+                                thisContentChannel.URI.spec;
+                        
+                        aListener.onDataAvailable(thisContentChannel, aContext, 
+                            pipe.inputStream, 0, content.length);
+				
+                        thisContentChannel.done = true;
+                        aListener.onStopRequest(thisContentChannel, aContext, 
+                            thisContentChannel.status);
+					}
+				}, 0);
+            }
+        };
+		
+        this.requestContent(contentListener);
+    } catch (ex) {
+        dump("ContentChannel.asyncOpen exception: " + ex + "\n");
+    }
+};
+
