locationless windows need hostname in titlebar (match 1.0x -- bug 304388) r=mconnor/jruderman, sr=bzbarsky

This commit is contained in:
dveditz@cruzio.com 2007-08-21 22:00:43 -07:00
parent 7388cb4015
commit e516ae4137

View File

@ -562,21 +562,36 @@
<![CDATA[
var newTitle = "";
var docTitle;
var docElement = this.ownerDocument.documentElement;
var sep = docElement.getAttribute("titlemenuseparator");
if (this.docShell.contentViewer)
docTitle = this.contentTitle;
if (!docTitle)
docTitle = this.ownerDocument.documentElement.getAttribute("titledefault");
docTitle = docElement.getAttribute("titledefault");
var modifier = this.ownerDocument.documentElement.getAttribute("titlemodifier");
var modifier = docElement.getAttribute("titlemodifier");
if (docTitle) {
newTitle += this.ownerDocument.documentElement.getAttribute("titlepreface");
newTitle += docElement.getAttribute("titlepreface");
newTitle += docTitle;
var sep = this.ownerDocument.documentElement.getAttribute("titlemenuseparator");
if (modifier)
newTitle += sep;
}
newTitle += modifier;
// If location bar is hidden and the URL type supports a host,
// add the scheme and host to the title to prevent spoofing.
// XXX https://bugzilla.mozilla.org/show_bug.cgi?id=22183#c239
try {
if (docElement.getAttribute("chromehidden").indexOf("location") != -1) {
var host = this.mURIFixup.createExposableURI(
this.mCurrentBrowser.currentURI).prePath;
if (host)
newTitle = host + sep + newTitle;
}
} catch (e) {}
this.ownerDocument.title = newTitle;
]]>
</body>