зеркало из https://github.com/mozilla/gecko-dev.git
Enabling and disabling turbo should not require a restart (89504). Also fixes 85437, 81715, 91221, 91350, 92292. r=ccarlen sr=ben
This commit is contained in:
Родитель
0f3e3a87b9
Коммит
6a13fe367b
|
@ -86,6 +86,8 @@ pref("browser.toolbars.showbutton.net2phone", true);
|
|||
pref("browser.toolbars.showbutton.print", true);
|
||||
pref("browser.toolbars.showbutton.search", true);
|
||||
|
||||
pref("browser.turbo.enabled", true);
|
||||
|
||||
pref("browser.helperApps.alwaysAsk.force", false);
|
||||
pref("browser.helperApps.neverAsk.saveToDisk", "");
|
||||
pref("browser.helperApps.neverAsk.openFile", "");
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
#include "nsXRemoteClientCID.h"
|
||||
#include "nsIXRemoteClient.h"
|
||||
#endif
|
||||
#define TURBO_PREF "browser.turbo.enabled"
|
||||
|
||||
#ifdef NS_TRACE_MALLOC
|
||||
#include "nsTraceMalloc.h"
|
||||
|
@ -826,12 +827,12 @@ static nsresult Ensure1Window( nsICmdLineService* cmdLineArgs)
|
|||
{
|
||||
// If starting up in server mode, then we do things differently.
|
||||
nsCOMPtr<nsINativeAppSupport> nativeApp;
|
||||
PRBool serverMode;
|
||||
PRBool serverMode = PR_FALSE;
|
||||
rv = GetNativeAppSupport(getter_AddRefs(nativeApp));
|
||||
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(nativeApp->GetIsServerMode(&serverMode)) && serverMode) {
|
||||
// Create special Nav window.
|
||||
nativeApp->StartServerMode();
|
||||
return NS_OK;
|
||||
// Create special Nav window.
|
||||
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(nativeApp->GetIsStartupServerMode(&serverMode)) && serverMode) {
|
||||
nativeApp->StartServerMode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// No window exists so lets create a browser one
|
||||
|
@ -1268,10 +1269,22 @@ static nsresult main1(int argc, char* argv[], nsISupports *nativeApp )
|
|||
// if the profile manager ever switches to using nsIDOMWindowInternal stuff, this might have to change
|
||||
appShell->CreateHiddenWindow();
|
||||
|
||||
// This will go away once Components are handling there own commandlines
|
||||
// if we have no command line arguments, we need to heed the
|
||||
// "general.startup.*" prefs
|
||||
// if we had no command line arguments, argc == 1.
|
||||
nsCOMPtr<nsINativeAppSupport> nativeApps;
|
||||
rv = GetNativeAppSupport(getter_AddRefs(nativeApps));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv) && prefs) {
|
||||
PRBool serverMode = PR_FALSE;
|
||||
prefs->GetBoolPref(TURBO_PREF, &serverMode);
|
||||
nativeApps->SetIsServerMode(serverMode);
|
||||
}
|
||||
}
|
||||
|
||||
// This will go away once Components are handling there own commandlines
|
||||
// if we have no command line arguments, we need to heed the
|
||||
// "general.startup.*" prefs
|
||||
// if we had no command line arguments, argc == 1.
|
||||
|
||||
#ifdef XP_MAC
|
||||
// if we do no command line args on the mac, it says argc is 0, and not 1
|
||||
rv = DoCommandLines( cmdLineArgs, ((argc == 1) || (argc == 0)) );
|
||||
|
|
|
@ -26,6 +26,7 @@ nsNativeAppSupportBase::nsNativeAppSupportBase()
|
|||
: mRefCnt( 0 ),
|
||||
mSplash( 0 ),
|
||||
mServerMode( PR_FALSE ),
|
||||
mStartupServerMode( PR_FALSE ),
|
||||
mNeedsProfileUI( PR_FALSE ) {
|
||||
}
|
||||
|
||||
|
@ -93,6 +94,13 @@ nsNativeAppSupportBase::GetIsServerMode(PRBool *aIsServerMode) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNativeAppSupportBase::GetIsStartupServerMode(PRBool *aIsStartupServerMode) {
|
||||
NS_ENSURE_ARG( aIsStartupServerMode );
|
||||
*aIsStartupServerMode = mStartupServerMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNativeAppSupportBase::GetNeedsProfileUI(PRBool *aNeedsProfileUI) {
|
||||
NS_ENSURE_ARG_POINTER(aNeedsProfileUI);
|
||||
|
@ -158,3 +166,4 @@ nsNativeAppSupportBase::QueryInterface( const nsIID &iid, void**p ) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
nsrefcnt mRefCnt;
|
||||
nsCOMPtr<nsISplashScreen> mSplash;
|
||||
PRBool mServerMode;
|
||||
PRBool mStartupServerMode;
|
||||
PRBool mNeedsProfileUI;
|
||||
}; // class nsSplashScreenWin
|
||||
|
||||
|
|
|
@ -585,7 +585,7 @@ nsNativeAppSupportWin::CheckConsole() {
|
|||
||
|
||||
strcmp( "/server", __argv[i] ) == 0 ) {
|
||||
// Start in server mode (and suppress splash screen).
|
||||
SetIsServerMode( PR_TRUE );
|
||||
mStartupServerMode = PR_TRUE;
|
||||
__argv[i] = "-nosplash"; // Bit of a hack, but it works!
|
||||
// Ignore other args.
|
||||
break;
|
||||
|
@ -1730,9 +1730,7 @@ nsNativeAppSupportWin::SetupSysTrayIcon() {
|
|||
delete [] exitACPText ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_QUIT, exitText.get() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add the tray icon.
|
||||
|
@ -1758,6 +1756,7 @@ nsNativeAppSupportWin::RemoveSysTrayIcon() {
|
|||
// - Pass magic arg to cause window to close in onload handler.
|
||||
NS_IMETHODIMP
|
||||
nsNativeAppSupportWin::StartServerMode() {
|
||||
|
||||
// Turn on system tray icon.
|
||||
SetupSysTrayIcon();
|
||||
|
||||
|
@ -1812,6 +1811,9 @@ nsNativeAppSupportWin::SetIsServerMode( PRBool isServerMode ) {
|
|||
if ( mServerMode && !isServerMode ) {
|
||||
RemoveSysTrayIcon();
|
||||
}
|
||||
else if ( !mServerMode && isServerMode) {
|
||||
SetupSysTrayIcon();
|
||||
}
|
||||
return nsNativeAppSupportBase::SetIsServerMode( isServerMode );
|
||||
}
|
||||
|
||||
|
|
|
@ -75,37 +75,12 @@
|
|||
|
||||
function turboCheck()
|
||||
{
|
||||
var aframe = document.getElementById("perfSettings");
|
||||
var abox = document.getElementById("perfLabel");
|
||||
var alabel = document.getElementById("perfBox");
|
||||
var acheckbox = document.getElementById("enableTurbo");
|
||||
if ( navigator.platform != "Win32" ) {
|
||||
aframe.setAttribute( "style", "visibility: hidden" );
|
||||
return;
|
||||
}
|
||||
else
|
||||
aframe.setAttribute( "style", "visibility: visible" );
|
||||
|
||||
/* find out what the setting should be and reflect it in the UI */
|
||||
|
||||
try {
|
||||
hooks = Components.classes["@mozilla.org/winhooks;1"];
|
||||
if ( hooks ) {
|
||||
hooks = hooks.getService(Components.interfaces.nsIWindowsHooks);
|
||||
}
|
||||
if ( hooks ) {
|
||||
var isEnabled = hooks.isStartupTurboEnabled();
|
||||
if ( isEnabled == true ) {
|
||||
acheckbox.setAttribute( "checked", true );
|
||||
}
|
||||
else {
|
||||
acheckbox.setAttribute( "checked", false );
|
||||
}
|
||||
}
|
||||
} catch( ex ) {
|
||||
}
|
||||
|
||||
parent.hPrefWindow.registerOKCallbackFunc( saveTurboSetting );
|
||||
var frame = document.getElementById("perfSettings");
|
||||
if (navigator.platform != "Win32") {
|
||||
frame.setAttribute("hidden", "true");
|
||||
return;
|
||||
}
|
||||
parent.hPrefWindow.registerOKCallbackFunc( saveTurboSetting );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -125,25 +100,31 @@
|
|||
|
||||
function saveTurboSetting()
|
||||
{
|
||||
if ( navigator.platform != "Win32" ) {
|
||||
if ( navigator.platform != "Win32" )
|
||||
return;
|
||||
}
|
||||
|
||||
var acheckbox = document.getElementById("enableTurbo");
|
||||
var acheckbox = document.getElementById("enableTurbo");
|
||||
try {
|
||||
hooks = Components.classes["@mozilla.org/winhooks;1"];
|
||||
if ( hooks ) {
|
||||
hooks = hooks.getService(Components.interfaces.nsIWindowsHooks);
|
||||
}
|
||||
if ( hooks ) {
|
||||
var isEnabled = acheckbox.checked;
|
||||
if ( isEnabled == true ) {
|
||||
hooks.startupTurboEnable();
|
||||
}
|
||||
else {
|
||||
hooks.startupTurboDisable();
|
||||
}
|
||||
}
|
||||
hooks = Components.classes["@mozilla.org/winhooks;1"];
|
||||
if ( hooks )
|
||||
hooks = hooks.getService(Components.interfaces.nsIWindowsHooks);
|
||||
if ( hooks ) {
|
||||
var isEnabled = acheckbox.checked;
|
||||
if ( isEnabled == true )
|
||||
hooks.startupTurboEnable();
|
||||
else
|
||||
hooks.startupTurboDisable();
|
||||
var appShell = Components.classes['@mozilla.org/appshell/appShellService;1'].getService();
|
||||
appShell = appShell.QueryInterface( Components.interfaces.nsIAppShellService );
|
||||
var nativeAppSupport = null;
|
||||
try {
|
||||
nativeAppSupport = appShell.nativeAppSupport;
|
||||
}
|
||||
catch ( ex ) {
|
||||
}
|
||||
if (nativeAppSupport)
|
||||
nativeAppSupport.isServerMode = isEnabled;
|
||||
}
|
||||
} catch( ex ) {
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +165,8 @@
|
|||
<groupbox orient="vertical" id="perfSettings">
|
||||
<label id="perfLabel" value="&perfTitle.label;"/>
|
||||
<vbox id="perfBox" align="start">
|
||||
<checkbox id="enableTurbo" label="&enableTurbo.label;" accesskey="&enableTurboCheck.accesskey;"/>
|
||||
<checkbox id="enableTurbo" label="&enableTurbo.label;" accesskey="&enableTurboCheck.accesskey;"
|
||||
pref="true" preftype="bool" prefstring="browser.turbo.enabled" prefattribute="checked"/>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче