зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
f00a21fa81
Коммит
51ef802661
|
@ -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");
|
||||
|
|
Загрузка…
Ссылка в новой задаче