mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 13:25:37 +00:00
36136 [regression]View source with meta charset info does not display properly
r=ftang
This commit is contained in:
parent
dfd2e3e18f
commit
597f39a1d0
@ -1151,39 +1151,49 @@ function BrowserEditBookmarks()
|
||||
function BrowserViewSource()
|
||||
{
|
||||
dump("BrowserViewSource(); \n ");
|
||||
var charsetArg = new String();
|
||||
|
||||
if (appCore != null) {
|
||||
|
||||
try
|
||||
{
|
||||
//let's try to extract the current charset menu setting
|
||||
var DocCharset = appCore.GetDocumentCharset();
|
||||
charsetArg = "charset="+DocCharset;
|
||||
dump("*** Current document charset: " + DocCharset + "\n");
|
||||
var docCharset = null;
|
||||
|
||||
//we should "inherit" the charset menu setting in a new window
|
||||
window.openDialog( "chrome://navigator/content/viewSource.xul",
|
||||
"_blank",
|
||||
"chrome,dialog=no",
|
||||
window.content.location, charsetArg);
|
||||
}
|
||||
|
||||
catch(ex)
|
||||
{
|
||||
dump("*** failed to read document charset \n");
|
||||
}
|
||||
try
|
||||
{
|
||||
var wnd = document.commandDispatcher.focusedWindow;
|
||||
if (window == wnd) wnd = window.content;
|
||||
docCharset = "charset="+ wnd.document.characterSet;
|
||||
dump("*** Current document charset: " + docCharset + "\n");
|
||||
}
|
||||
|
||||
catch(ex)
|
||||
{
|
||||
docCharset = null;
|
||||
dump("*** Failed to determine current document charset \n");
|
||||
}
|
||||
|
||||
|
||||
if (docCharset != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
//now try to open a view-source window while inheriting the charset
|
||||
window.openDialog( "chrome://navigator/content/viewSource.xul",
|
||||
"_blank",
|
||||
"chrome,dialog=no",
|
||||
window.content.location, docCharset);
|
||||
}
|
||||
|
||||
catch(ex)
|
||||
{
|
||||
dump("*** Failed to open view-source window with preset charset menu.\n");
|
||||
}
|
||||
|
||||
} else {
|
||||
//if everythig else fails, forget about the charset
|
||||
window.openDialog( "chrome://navigator/content/viewSource.xul",
|
||||
"_blank",
|
||||
"chrome,dialog=no",
|
||||
window.content.location);
|
||||
//default: forcing the view-source widow
|
||||
dump("*** Failed to preset charset menu for the view-source window\n");
|
||||
window.openDialog( "chrome://navigator/content/viewSource.xul",
|
||||
"_blank",
|
||||
"chrome,dialog=no",
|
||||
window.content.location);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function BrowserPageInfo()
|
||||
{
|
||||
dump("BrowserPageInfo(); \n ");
|
||||
|
Loading…
Reference in New Issue
Block a user