bug 217611 - page info can be opened multiple times, patch by Jason Barnabe (jason_barnabe@fastmail.fm), r=me, a=asa

This commit is contained in:
mconnor%steelgryphon.com 2005-04-26 16:55:59 +00:00
Родитель bf13f43de8
Коммит ba5b3b4d3f
2 изменённых файлов: 29 добавлений и 4 удалений

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

@ -31,6 +31,7 @@
# Joe Hewitt <hewitt@netscape.com>
# Alec Flett <alecf@netscape.com>
# Asaf Romano <mozilla.mano@sent.com>
# Jason Barnabe <jason_barnabe@fastmail.fm>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -1892,8 +1893,9 @@ function BrowserViewSourceOfURL(url, charset, pageCookie)
// doc=null for regular page info, doc=owner document for frame info.
function BrowserPageInfo(doc)
{
window.openDialog("chrome://browser/content/pageInfo.xul",
"_blank",
toOpenDialogByTypeAndUrl("Browser:page-info",
doc ? doc.location : window.content.document.location,
"chrome://browser/content/pageInfo.xul",
"chrome,dialog=no",
doc);
}
@ -2763,6 +2765,27 @@ function toOpenWindowByType(inType, uri, features)
window.open(uri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar");
}
function toOpenDialogByTypeAndUrl(inType, relatedUrl, windowUri, features, extraArgument)
{
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
var windows = windowManagerInterface.getEnumerator(inType);
// Check for windows matching the url
while (windows.hasMoreElements()) {
var currentWindow = windows.getNext();
if (currentWindow.document.firstChild.getAttribute("relatedUrl") == relatedUrl) {
currentWindow.focus();
return;
}
}
// We didn't find a matching window, so open a new one.
if (features)
window.openDialog(windowUri, "_blank", features, extraArgument);
else
window.openDialog(windowUri, "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar", extraArgument);
}
function OpenBrowserWindow()
{

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

@ -291,6 +291,8 @@ function onLoadPageInfo()
document.title = docTitle;
document.getElementById("main-window").setAttribute("relatedUrl", theDocument.location.toString());
// do the easy stuff first
makeGeneralTab();