bug 199237 : fix the rendering of the non-ASCII title of a non-text doc(image, media) opened in a new tab/window (checking in for jshin@mailaps.org, r=bryner, sr=bz)

This commit is contained in:
bryner%brianryner.com 2003-07-26 06:42:50 +00:00
Родитель 557d5ece5a
Коммит 95d977de84
3 изменённых файлов: 30 добавлений и 4 удалений

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

@ -61,8 +61,17 @@ function openNewTabWith(href, linkNode, event, securityCheck)
if (event && event.shiftKey) if (event && event.shiftKey)
loadInBackground = !loadInBackground; loadInBackground = !loadInBackground;
// As in openNewWindowWith(), we want to pass the charset of the
// current document over to a new tab.
var wintype = document.firstChild.getAttribute('windowtype');
var originCharset;
if (wintype == "navigator:browser") {
originCharset = window._content.document.characterSet;
}
// open link in new tab
var browser = top.document.getElementById("content"); var browser = top.document.getElementById("content");
var theTab = browser.addTab(href, getReferrer(document)); var theTab = browser.addTab(href, getReferrer(document), originCharset);
if (!loadInBackground) if (!loadInBackground)
browser.selectedTab = theTab; browser.selectedTab = theTab;

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

@ -110,11 +110,12 @@
<method name="loadURI"> <method name="loadURI">
<parameter name="aURI"/> <parameter name="aURI"/>
<parameter name="aReferrerURI"/> <parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
<body> <body>
<![CDATA[ <![CDATA[
const nsIWebNavigation = Components.interfaces.nsIWebNavigation; const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
const flags = nsIWebNavigation.LOAD_FLAGS_NONE; const flags = nsIWebNavigation.LOAD_FLAGS_NONE;
this.loadURIWithFlags(aURI, flags, aReferrerURI); this.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset);
]]> ]]>
</body> </body>
</method> </method>
@ -124,11 +125,19 @@
<parameter name="aURI"/> <parameter name="aURI"/>
<parameter name="aFlags"/> <parameter name="aFlags"/>
<parameter name="aReferrerURI"/> <parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
<body> <body>
<![CDATA[ <![CDATA[
if (!aURI) if (!aURI)
aURI = "about:blank"; aURI = "about:blank";
if (aCharset) {
try {
this.documentCharsetInfo.parentCharset = this.mAtomService.getAtom(aCharset);
}
catch (e) {
}
}
this.webNavigation.loadURI(aURI, aFlags, aReferrerURI, null, null); this.webNavigation.loadURI(aURI, aFlags, aReferrerURI, null, null);
]]> ]]>
</body> </body>
@ -238,6 +247,11 @@
.getBranch(null); .getBranch(null);
</field> </field>
<field name="mAtomService" readonly="true">
Components.classes['@mozilla.org/atom-service;1']
.getService(Components.interfaces.nsIAtomService);
</field>
<field name="_mStrBundle">null</field> <field name="_mStrBundle">null</field>
<property name="mStrBundle"> <property name="mStrBundle">

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

@ -644,6 +644,7 @@
<method name="addTab"> <method name="addTab">
<parameter name="aURI"/> <parameter name="aURI"/>
<parameter name="aReferrerURI"/> <parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
<body> <body>
<![CDATA[ <![CDATA[
var blank = (aURI == "about:blank"); var blank = (aURI == "about:blank");
@ -1018,9 +1019,10 @@
<method name="loadURI"> <method name="loadURI">
<parameter name="aURI"/> <parameter name="aURI"/>
<parameter name="aReferrerURI"/> <parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
<body> <body>
<![CDATA[ <![CDATA[
return this.mCurrentBrowser.loadURI(aURI, aReferrerURI); return this.mCurrentBrowser.loadURI(aURI, aReferrerURI, aCharset);
]]> ]]>
</body> </body>
</method> </method>
@ -1030,9 +1032,10 @@
<parameter name="aURI"/> <parameter name="aURI"/>
<parameter name="aFlags"/> <parameter name="aFlags"/>
<parameter name="aReferrerURI"/> <parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
<body> <body>
<![CDATA[ <![CDATA[
return this.mCurrentBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI); return this.mCurrentBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset);
]]> ]]>
</body> </body>
</method> </method>