Changed to pass a charset to openDialog so that a new window inherits the charset, bug 27646, r=ftang.

This commit is contained in:
nhotta%netscape.com 2000-07-10 22:29:33 +00:00
parent 3a3c654a54
commit ee6608a5ff
2 changed files with 21 additions and 2 deletions

View File

@ -881,7 +881,25 @@ function RevealSearchPanel()
}
function openNewWindowWith( url ) {
var newWin = window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
var newWin;
var wintype = document.firstChild.getAttribute('windowtype');
// if and only if the current window is a browser window and it has a document with a character
// set, then extract the current charset menu setting from the current document and use it to
// initialize the new browser window...
if (window && (wintype == "navigator:browser") && window._content && window._content.document)
{
var DocCharset = window._content.document.characterSet;
charsetArg = "charset="+DocCharset;
dump("*** Current document charset: " + DocCharset + "\n");
//we should "inherit" the charset menu setting in a new window
newWin = window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url, charsetArg );
}
else // forget about the charset information.
{
newWin = window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
}
// Fix new window.
newWin.saveFileAndPos = true;

View File

@ -103,11 +103,12 @@ function OpenBrowserWindow()
handler = handler.QueryInterface(Components.interfaces.nsICmdLineHandler);
var startpage = handler.defaultArgs;
var url = handler.chromeUrlForTask;
var wintype = document.firstChild.getAttribute('windowtype');
// if and only if the current window is a browser window and it has a document with a character
// set, then extract the current charset menu setting from the current document and use it to
// initialize the new browser window...
if (window && (window.windowtype == "navigator:browser") && window._content && window._content.document)
if (window && (wintype == "navigator:browser") && window._content && window._content.document)
{
var DocCharset = window._content.document.characterSet;
charsetArg = "charset="+DocCharset;