Rename BrowserSetForcedDetector and remove unnecessary parameter. Bug 720310, r=gavin

This commit is contained in:
Simon Montagu 2012-01-24 11:52:05 +02:00
Родитель b94da4bbfd
Коммит d7c7ea501c
3 изменённых файлов: 12 добавлений и 34 удалений

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

@ -5973,12 +5973,12 @@ function MultiplexHandler(event)
var name = node.getAttribute('name');
if (name == 'detectorGroup') {
SetForcedDetector(true);
BrowserCharsetReload();
SelectDetector(event, false);
} else if (name == 'charsetGroup') {
var charset = node.getAttribute('id');
charset = charset.substring('charset.'.length, charset.length)
SetForcedCharset(charset);
BrowserSetForcedCharacterSet(charset);
} else if (name == 'charsetCustomize') {
//do nothing - please remove this else statement, once the charset prefs moves to the pref window
} else {
@ -6009,28 +6009,17 @@ function SelectDetector(event, doReload)
}
}
function SetForcedDetector(doReload)
{
BrowserSetForcedDetector(doReload);
}
function SetForcedCharset(charset)
{
BrowserSetForcedCharacterSet(charset);
}
function BrowserSetForcedCharacterSet(aCharset)
{
gBrowser.docShell.charset = aCharset;
// Save the forced character-set
PlacesUtils.history.setCharsetForURI(getWebNavigation().currentURI, aCharset);
BrowserReloadWithFlags(nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
BrowserCharsetReload();
}
function BrowserSetForcedDetector(doReload)
function BrowserCharsetReload()
{
if (doReload)
BrowserReloadWithFlags(nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
BrowserReloadWithFlags(nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
}
function charsetMenuGetElement(parent, id) {

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

@ -711,11 +711,12 @@ function highlightSyntax()
gPageLoader.loadPage(gPageLoader.currentDescriptor, gPageLoader.DISPLAY_NORMAL);
}
// Reload after change to character encoding or autodetection
//
// Fix for bug 136322: this function overrides the function in
// browser.js to call PageLoader.loadPage() instead of BrowserReloadWithFlags()
function BrowserSetForcedCharacterSet(aCharset)
function BrowserCharsetReload()
{
gBrowser.docShell.charset = aCharset;
if (isHistoryEnabled()) {
gPageLoader.loadPage(gPageLoader.currentDescriptor,
gPageLoader.DISPLAY_NORMAL);
@ -724,22 +725,10 @@ function BrowserSetForcedCharacterSet(aCharset)
}
}
// fix for bug #229503
// we need to define BrowserSetForcedDetector() so that we can
// change auto-detect options in the "View | Character Encoding" menu.
// As with BrowserSetForcedCharacterSet(), call PageLoader.loadPage()
// instead of BrowserReloadWithFlags()
function BrowserSetForcedDetector(doReload)
function BrowserSetForcedCharacterSet(aCharset)
{
if (doReload)
{
if (isHistoryEnabled()) {
gPageLoader.loadPage(gPageLoader.currentDescriptor,
gPageLoader.DISPLAY_NORMAL);
} else {
gBrowser.reloadWithFlags(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
}
}
gBrowser.docShell.charset = aCharset;
BrowserCharsetReload();
}
function BrowserForward(aEvent) {

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

@ -3,7 +3,7 @@ function MultiplexHandler(aEvent)
MultiplexHandlerEx(
aEvent,
function Browser_SelectDetector(event) {
BrowserSetForcedDetector(true/*Reload from history*/);
BrowserCharsetReload();
/* window.content.location.reload() will re-download everything */
SelectDetector(event, null);
},