180377 - openNewTabWith was failing if called from a window which did not have a browser. This was because we were using the current window's document as opposed to the document of the browser (which

we obtained for loading a URL in).
r=bugs4hj@netscape.net, sr=jaggernaut@netscape.com
This commit is contained in:
caillon%returnzero.com 2002-11-16 05:47:57 +00:00
Родитель 596da68ee4
Коммит 784c0dee7d
1 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -104,10 +104,6 @@ function openNewWindowWith(url, sendReferrer)
function openNewTabWith(url, sendReferrer, reverseBackgroundPref)
{
urlSecurityCheck(url, document);
var referrer = sendReferrer ? getReferrer(document) : null;
var browser;
try {
// if we're running in a browser window, this should work
@ -139,6 +135,15 @@ function openNewTabWith(url, sendReferrer, reverseBackgroundPref)
browser = browserWin.getBrowser();
}
// Get the XUL document that the browser is actually contained in.
// This is needed if we are trying to load a URL from a non-navigator
// window such as the JS Console.
var browserDocument = browser.ownerDocument;
urlSecurityCheck(url, browserDocument);
var referrer = sendReferrer ? getReferrer(browserDocument) : null;
var tab = browser.addTab(url, referrer); // open link in new tab
if (pref) {
var loadInBackground = pref.getBoolPref("browser.tabs.loadInBackground");