comparison content/river.js @ 346:398b9ca0264b

when updating the URI in the river view, make sure we update the river document's URI rather than the URI for the current tab, since the river view might not be the current tab on startup
author Myk Melez <myk@mozilla.org>
date Fri, 24 Oct 2008 15:01:24 -0700
parents e08a381e3ff7
children e9d7087abad1
comparison
equal deleted inserted replaced
345:1bbcbc4d95d2 346:398b9ca0264b
445 445
446 // FIXME: do add the All period if it's already in the list of params. 446 // FIXME: do add the All period if it's already in the list of params.
447 if (this._periodMenu.selectedItem && this._periodMenu.selectedItem.value != "all") 447 if (this._periodMenu.selectedItem && this._periodMenu.selectedItem.value != "all")
448 params.push("period=" + encodeURIComponent(this._periodMenu.selectedItem.value)); 448 params.push("period=" + encodeURIComponent(this._periodMenu.selectedItem.value));
449 449
450 let gBrowserWindow = window.QueryInterface(Ci.nsIInterfaceRequestor). 450 let browser = gBrowserWindow.gBrowser.getBrowserForDocument(document);
451 getInterface(Ci.nsIWebNavigation). 451
452 QueryInterface(Ci.nsIDocShellTreeItem). 452 let currentURI = browser.docShell.currentURI.QueryInterface(Ci.nsIURL);
453 rootTreeItem.
454 QueryInterface(Ci.nsIInterfaceRequestor).
455 getInterface(Ci.nsIDOMWindow);
456
457 let currentURI = gBrowserWindow.gBrowser.docShell.currentURI.QueryInterface(Ci.nsIURL);
458 453
459 let query = params.length > 0 ? "?" + params.join("&") : ""; 454 let query = params.length > 0 ? "?" + params.join("&") : "";
460 let spec = currentURI.prePath + currentURI.filePath + query; 455 let spec = currentURI.prePath + currentURI.filePath + query;
461 let uri = Cc["@mozilla.org/network/io-service;1"]. 456 let uri = Cc["@mozilla.org/network/io-service;1"].
462 getService(Ci.nsIIOService). 457 getService(Ci.nsIIOService).
463 newURI(spec, null, null); 458 newURI(spec, null, null);
464 459
465 // Update the docshell with the new URI. This updates the location bar 460 // Update the docshell with the new URI. This updates the location bar
466 // and gets used by the bookmarks service when the user bookmarks the page. 461 // and gets used by the bookmarks service when the user bookmarks the page.
467 gBrowserWindow.gBrowser.docShell.setCurrentURI(uri); 462 browser.docShell.setCurrentURI(uri);
468 463
469 // Update the session history entry for the page with the new URI. 464 // Update the session history entry for the page with the new URI.
470 // This gets used when the user reloads the page or traverses history. 465 // This gets used when the user reloads the page or traverses history.
471 let history = gBrowserWindow.gBrowser.sessionHistory; 466 let history = browser.sessionHistory;
472 let historyEntry = history.getEntryAtIndex(history.index, false); 467 let historyEntry = history.getEntryAtIndex(history.index, false);
473 if (historyEntry instanceof Ci.nsISHEntry) 468 if (historyEntry instanceof Ci.nsISHEntry)
474 historyEntry.setURI(uri); 469 historyEntry.setURI(uri);
475 else 470 else
476 this._log.error("can't update session history URI for " + 471 this._log.error("can't update session history URI for " +