Bug 237776 Reload should be disabled for blank tabs

p=ryanvm@gmail.com r=mconnor
This commit is contained in:
bugzilla%arlen.demon.co.uk 2005-02-27 17:59:38 +00:00
parent c2d5dc3304
commit f37562c9de
5 changed files with 38 additions and 27 deletions

View File

@ -115,7 +115,7 @@
<menuitem id="context-reload"
label="&reloadCmd.label;"
accesskey="&reloadCmd.accesskey;"
oncommand="BrowserReload();"/>
command="Browser:Reload"/>
<menuitem id="context-stop"
label="&stopCmd.label;"
accesskey="&stopCmd.accesskey;"

View File

@ -156,7 +156,7 @@
</menu>
<menuseparator/>
<menuitem label="&stopCmd.label;" accesskey="&stopCmd.accesskey;" command="Browser:Stop" key="key_stop"/>
<menuitem accesskey="&reloadCmd.accesskey;" key="key_reload" label="&reloadCmd.label;" command="Browser:Reload"/>
<menuitem label="&reloadCmd.label;" accesskey="&reloadCmd.accesskey;" command="Browser:Reload" key="key_reload"/>
<menuseparator/>
<menu id="viewTextZoomMenu" label="&textSize.label;" accesskey="&textSize.accesskey;">
<menupopup>

View File

@ -150,7 +150,8 @@
<command id="Browser:Back" oncommand="BrowserBack();" disabled="true"/>
<command id="Browser:Forward" oncommand="BrowserForward();" disabled="true"/>
<command id="Browser:Stop" oncommand="BrowserStop();" disabled="true"/>
<command id="Browser:Reload" oncommand="BrowserReload();"/>
<command id="Browser:Reload" oncommand="if (event.shiftKey) BrowserReloadSkipCache(); else BrowserReload()" disabled="true"/>
<command id="Browser:ReloadSkipCache" oncommand="BrowserReloadSkipCache()" disabled="true"/>
<command id="cmd_textZoomReduce" oncommand="ZoomManager.prototype.getInstance().reduce();"/>
<command id="cmd_textZoomEnlarge" oncommand="ZoomManager.prototype.getInstance().enlarge();"/>
<command id="cmd_textZoomReset" oncommand="ZoomManager.prototype.getInstance().reset();"/>
@ -282,10 +283,10 @@
#endif
<key id="goHome" keycode="VK_HOME" command="Browser:Home" modifiers="alt"/>
<key id="key_fullScreen" keycode="VK_F11" command="View:FullScreen"/>
<key keycode="VK_F5" oncommand="BrowserReload();"/>
<key keycode="VK_F5" modifiers="accel" oncommand="BrowserReloadSkipCache();"/>
<key id="key_reload" key="&reloadCmd.commandkey;" oncommand="BrowserReload();" modifiers="accel"/>
<key key="&reloadCmd.commandkey;" oncommand="BrowserReloadSkipCache();" modifiers="accel,shift"/>
<key keycode="VK_F5" command="Browser:Reload"/>
<key keycode="VK_F5" command="Browser:ReloadSkipCache" modifiers="accel"/>
<key key="&reloadCmd.commandkey;" command="Browser:Reload" modifiers="accel" id="key_reload"/>
<key key="&reloadCmd.commandkey;" command="Browser:ReloadSkipCache" modifiers="accel,shift"/>
<key id="key_viewSource" key="&pageSourceCmd.commandkey;" command="View:PageSource" modifiers="accel"/>
#ifndef XP_WIN
<key id="key_viewInfo" key="&pageInfoCmd.commandkey;" command="View:PageInfo" modifiers="accel"/>
@ -304,7 +305,7 @@
<key id="viewBookmarksSidebarWinKb" key="&bookmarksSidebarWinCmd.commandkey;" command="viewBookmarksSidebar" modifiers="accel"/>
#endif
<key id="key_stop" keycode="VK_ESCAPE" oncommand="BrowserStop();"/>
<key id="key_stop" keycode="VK_ESCAPE" command="Browser:Stop"/>
#ifdef XP_MACOSX
<key id="key_gotoHistory" key="&historySidebarCmd.commandKey;" command="viewHistorySidebar" modifiers="accel,shift"/>
#else

View File

@ -959,8 +959,8 @@ function nonBrowserWindowStartup()
// Disable inappropriate commands / submenus
var disabledItems = ['cmd_newNavigatorTab', 'cmd_close', 'Browser:SavePage', 'Browser:SendLink',
'cmd_pageSetup', 'cmd_print', 'cmd_find', 'cmd_findAgain', 'viewToolbarsMenu',
'cmd_toggleTaskbar', 'viewSidebarMenuMenu', 'Browser:Reload', 'viewTextZoomMenu',
'pageStyleMenu', 'charsetMenu', 'View:PageSource', 'View:FullScreen',
'cmd_toggleTaskbar', 'viewSidebarMenuMenu', 'Browser:Reload', 'Browser:ReloadSkipCache',
'viewTextZoomMenu', 'pageStyleMenu', 'charsetMenu', 'View:PageSource', 'View:FullScreen',
'viewHistorySidebar', 'Browser:AddBookmarkAs', 'Tools:Search', 'View:PageInfo'];
var element;
@ -2948,12 +2948,14 @@ nsBrowserStatusHandler.prototype =
init : function()
{
this.throbberElement = document.getElementById("navigator-throbber");
this.statusMeter = document.getElementById("statusbar-icon");
this.stopCommand = document.getElementById("Browser:Stop");
this.statusTextField = document.getElementById("statusbar-display");
this.securityButton = document.getElementById("security-button");
this.urlBar = document.getElementById("urlbar");
this.throbberElement = document.getElementById("navigator-throbber");
this.statusMeter = document.getElementById("statusbar-icon");
this.stopCommand = document.getElementById("Browser:Stop");
this.reloadCommand = document.getElementById("Browser:Reload");
this.reloadSkipCacheCommand = document.getElementById("Browser:ReloadSkipCache");
this.statusTextField = document.getElementById("statusbar-display");
this.securityButton = document.getElementById("security-button");
this.urlBar = document.getElementById("urlbar");
// Initialize the security button's state and tooltip text
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
@ -2963,14 +2965,16 @@ nsBrowserStatusHandler.prototype =
destroy : function()
{
// XXXjag to avoid leaks :-/, see bug 60729
this.throbberElement = null;
this.statusMeter = null;
this.stopCommand = null;
this.statusTextField = null;
this.securityButton = null;
this.urlBar = null;
this.statusText = null;
this.lastURI = null;
this.throbberElement = null;
this.statusMeter = null;
this.stopCommand = null;
this.reloadCommand = null;
this.reloadSkipCacheCommand = null;
this.statusTextField = null;
this.securityButton = null;
this.urlBar = null;
this.statusText = null;
this.lastURI = null;
},
setJSStatus : function(status)
@ -3167,8 +3171,14 @@ nsBrowserStatusHandler.prototype =
var location = aLocation.spec;
if (location == "about:blank")
location = "";
if (location == "about:blank" || location == "") { //second condition is for new tabs, otherwise
location = ""; //reload function is enabled until tab is refreshed
this.reloadCommand.setAttribute("disabled", "true");
this.reloadSkipCacheCommand.setAttribute("disabled", "true");
} else {
this.reloadCommand.removeAttribute("disabled");
this.reloadSkipCacheCommand.removeAttribute("disabled");
}
// We should probably not do this if the value has changed since the user
// searched

View File

@ -185,7 +185,7 @@
<toolbarbutton id="reload-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&reloadCmd.label;"
oncommand="if (event.shiftKey) BrowserReloadSkipCache(); else BrowserReload();"
command="Browser:Reload"
tooltiptext="&reloadButton.tooltip;"/>
<toolbarbutton id="stop-button" class="toolbarbutton-1 chromeclass-toolbar-additional"