зеркало из https://github.com/mozilla/pjs.git
Fix for bug 141035. Application must quit if it fails to load the .cfg file. r=sgehani, ccarlen, sr=alecf.
This commit is contained in:
Родитель
e9bc90ebdf
Коммит
8f3217aa49
|
@ -575,6 +575,7 @@ sub ProcessJarManifests()
|
|||
CreateJarFromManifest(":mozilla:embedding:browser:chrome:jar.mn", $chrome_dir, \%jars);
|
||||
CreateJarFromManifest(":mozilla:embedding:browser:chrome:locale:en-US:jar.mn", $chrome_dir, \%jars);
|
||||
CreateJarFromManifest(":mozilla:extensions:cookie:jar.mn", $chrome_dir, \%jars);
|
||||
CreateJarFromManifest(":mozilla:extensions:pref:autoconfig:resources:jar.mn", $chrome_dir, \%jars);
|
||||
CreateJarFromManifest(":mozilla:extensions:irc:jar.mn", $chrome_dir, \%jars);
|
||||
CreateJarFromManifest(":mozilla:extensions:wallet:jar.mn", $chrome_dir, \%jars);
|
||||
CreateJarFromManifest(":mozilla:intl:uconv:src:jar.mn", $chrome_dir, \%jars);
|
||||
|
|
|
@ -39,7 +39,7 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
DIRS = public resources src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
#!gmake
|
||||
# Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.1 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mitesh Shah <mitesh@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the NPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the NPL, the GPL or the LGPL.
|
||||
|
||||
DEPTH = ..\..\..
|
||||
|
||||
DIRS= \
|
||||
public \
|
||||
src
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the packages being supplied -->
|
||||
<RDF:Seq about="urn:mozilla:package:root">
|
||||
<RDF:li resource="urn:mozilla:package:autoconfig"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- package information -->
|
||||
<RDF:Description about="urn:mozilla:package:autoconfig"
|
||||
chrome:displayName="AutoConfig"
|
||||
chrome:author="mozilla.org"
|
||||
chrome:name="autoconfig"
|
||||
chrome:localeVersion="1.1a">
|
||||
</RDF:Description>
|
||||
|
||||
</RDF:RDF>
|
|
@ -0,0 +1,6 @@
|
|||
comm.jar:
|
||||
content/autoconfig/contents.rdf (content/contents.rdf)
|
||||
|
||||
en-US.jar:
|
||||
locale/en-US/autoconfig/contents.rdf (locale/en-US/contents.rdf)
|
||||
locale/en-US/autoconfig/autoconfig.properties (locale/en-US/autoconfig.properties)
|
|
@ -0,0 +1,5 @@
|
|||
readConfigTitle = Configuration Error
|
||||
readConfigMsg = Failed to read the configuration file. Please contact your system administrator.
|
||||
|
||||
autoConfigTitle = AutoConfig Alert
|
||||
autoConfigMsg = Netscape.cfg/AutoConfig failed. Please contact your system administrator. \n Error: %S failed:
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
|
||||
|
||||
<!-- list all the locales being supplied -->
|
||||
<RDF:Seq about="urn:mozilla:locale:root">
|
||||
<RDF:li resource="urn:mozilla:locale:en-US"/>
|
||||
</RDF:Seq>
|
||||
|
||||
<!-- locale information -->
|
||||
<RDF:Description about="urn:mozilla:locale:en-US">
|
||||
<chrome:packages>
|
||||
<RDF:Seq about="urn:mozilla:locale:en-US:packages">
|
||||
<RDF:li resource="urn:mozilla:locale:en-US:autoconfig"/>
|
||||
</RDF:Seq>
|
||||
</chrome:packages>
|
||||
</RDF:Description>
|
||||
|
||||
<!-- Version Information. State that we work only with major version of this
|
||||
package. -->
|
||||
<RDF:Description about="urn:mozilla:locale:en-US:autoconfig"
|
||||
chrome:localeVersion="1.1a"/>
|
||||
</RDF:RDF>
|
|
@ -48,7 +48,7 @@ endif
|
|||
EXPORT_LIBRARY = 1
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = nsAutoConfigModule
|
||||
REQUIRES = xpcom string js xpconnect necko profile pref embedcomponents
|
||||
REQUIRES = xpcom string intl js xpconnect necko profile pref appshell embedcomponents windowwatcher
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
|
|
|
@ -1,110 +0,0 @@
|
|||
#!gmake
|
||||
# Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.1 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mitesh Shah <mitesh@netscape.com>
|
||||
# Brian Nesse <bnesse@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the NPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the NPL, the GPL or the LGPL.
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH = ..\..\..\..
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
MODULE = autoconfig
|
||||
LIBRARY_NAME = autoconfig
|
||||
MODULE_NAME = nsAutoConfigModule
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
necko \
|
||||
profile \
|
||||
pref \
|
||||
appstartup \
|
||||
js \
|
||||
xpconnect \
|
||||
!if !defined(DISABLE_LDAP)
|
||||
mozldap \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
LCFLAGS = -DMOZILLA_CLIENT \
|
||||
!if !defined(DISABLE_LDAP)
|
||||
-DMOZ_LDAP_XPCOM \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
LLIBS = \
|
||||
$(LIBNSPR) \
|
||||
$(DIST)\lib\js$(MOZ_BITS)$(VERSION_NUMBER).lib \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
$(NULL)
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define the files necessary to build the target (ie. OBJS)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
OBJS = .\$(OBJDIR)\nsConfigFactory.obj \
|
||||
.\$(OBJDIR)\nsAutoConfig.obj \
|
||||
.\$(OBJDIR)\nsReadConfig.obj \
|
||||
.\$(OBJDIR)\nsJSConfigTriggers.obj \
|
||||
!if !defined(DISABLE_LDAP)
|
||||
.\$(OBJDIR)\nsLDAPSyncQuery.obj \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
|
||||
#// (these must be defined before the common makefiles are included)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
libs::
|
||||
$(MAKE_INSTALL) .\prefcalls.js $(DIST)\bin\defaults\autoconfig
|
||||
$(MAKE_INSTALL) .\win\platform.js $(DIST)\bin\defaults\autoconfig
|
|
@ -98,7 +98,7 @@ AutoConfigSecMan::CanAccess(PRUint32 aAction,
|
|||
|
||||
//*****************************************************************************
|
||||
|
||||
static JSContext *autoconfig_cx;
|
||||
static JSContext *autoconfig_cx = nsnull;
|
||||
static JSObject *autoconfig_glob;
|
||||
|
||||
static JSClass global_class = {
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "nsReadConfig.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsIAppShellService.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIAutoConfig.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
@ -47,14 +48,15 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPromptService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "prmem.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
|
||||
|
||||
extern nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
|
||||
const char *filename,
|
||||
PRBool bGlobalContext,
|
||||
|
@ -64,6 +66,37 @@ extern nsresult CentralizedAdminPrefManagerInit();
|
|||
extern nsresult CentralizedAdminPrefManagerFinish();
|
||||
|
||||
|
||||
static void DisplayError(void)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIPromptService> promptService = do_GetService("@mozilla.org/embedcomp/prompt-service;1");
|
||||
if (!promptService)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
if (!bundleService)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
bundleService->CreateBundle("chrome://autoconfig/locale/autoconfig.properties",
|
||||
getter_AddRefs(bundle));
|
||||
if (!bundle)
|
||||
return;
|
||||
|
||||
nsXPIDLString title;
|
||||
rv = bundle->GetStringFromName(NS_LITERAL_STRING("readConfigTitle").get(), getter_Copies(title));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
nsXPIDLString err;
|
||||
rv = bundle->GetStringFromName(NS_LITERAL_STRING("readConfigMsg").get(), getter_Copies(err));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
promptService->Alert(nsnull, title.get(), err.get());
|
||||
}
|
||||
|
||||
|
||||
// nsISupports Implementation
|
||||
|
||||
|
@ -90,9 +123,7 @@ nsresult nsReadConfig::Init()
|
|||
|
||||
nsReadConfig::~nsReadConfig()
|
||||
{
|
||||
|
||||
CentralizedAdminPrefManagerFinish();
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsReadConfig::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *someData)
|
||||
|
@ -101,6 +132,14 @@ NS_IMETHODIMP nsReadConfig::Observe(nsISupports *aSubject, const char *aTopic, c
|
|||
|
||||
if (!nsCRT::strcmp(aTopic, NS_PREFSERVICE_READ_TOPIC_ID)) {
|
||||
rv = readConfigFile();
|
||||
if (NS_FAILED(rv)) {
|
||||
DisplayError();
|
||||
|
||||
nsCOMPtr<nsIAppShellService> appShellService =
|
||||
do_GetService("@mozilla.org/appshell/appShellService;1");
|
||||
if (appShellService)
|
||||
appShellService->Quit();
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -129,7 +168,7 @@ nsresult nsReadConfig::readConfigFile()
|
|||
rv = prefBranch->GetCharPref("general.config.filename",
|
||||
getter_Copies(lockFileName));
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
return rv;
|
||||
|
||||
// This needs to be read only once.
|
||||
//
|
||||
|
|
|
@ -112,7 +112,8 @@ nsAppShellService::nsAppShellService() :
|
|||
mNativeAppSupport( nsnull ),
|
||||
mModalWindowCount( 0 ),
|
||||
mShuttingDown( PR_FALSE ),
|
||||
mQuitOnLastWindowClosing( PR_TRUE )
|
||||
mQuitOnLastWindowClosing( PR_TRUE ),
|
||||
mInProfileStartup( PR_FALSE )
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
@ -242,6 +243,7 @@ nsAppShellService::DoProfileStartup(nsICmdLineService *aCmdLineService, PRBool c
|
|||
nsCOMPtr<nsIProfileInternal> profileMgr(do_GetService(NS_PROFILE_CONTRACTID, &rv));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
mInProfileStartup = PR_TRUE;
|
||||
PRBool saveQuitOnLastWindowClosing = mQuitOnLastWindowClosing;
|
||||
mQuitOnLastWindowClosing = PR_FALSE;
|
||||
|
||||
|
@ -259,6 +261,11 @@ nsAppShellService::DoProfileStartup(nsICmdLineService *aCmdLineService, PRBool c
|
|||
}
|
||||
|
||||
mQuitOnLastWindowClosing = saveQuitOnLastWindowClosing;
|
||||
mInProfileStartup = PR_FALSE;
|
||||
|
||||
// if Quit() was called while we were starting up we have a failure situation...
|
||||
if (mShuttingDown)
|
||||
return NS_ERROR_FAILURE;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -553,7 +560,9 @@ nsAppShellService::HandleExitEvent(PLEvent* aEvent)
|
|||
event->mService->mAppShell->Exit();
|
||||
|
||||
// We're done "shutting down".
|
||||
event->mService->mShuttingDown = PR_FALSE;
|
||||
// unless we are currently "starting up" in which case this event wasn't properly handled.
|
||||
if (!event->mService->mInProfileStartup)
|
||||
event->mService->mShuttingDown = PR_FALSE;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ protected:
|
|||
PRBool mDeleteCalled;
|
||||
nsCOMPtr<nsISplashScreen> mSplashScreen;
|
||||
nsCOMPtr<nsINativeAppSupport> mNativeAppSupport;
|
||||
PRBool mInProfileStartup;
|
||||
|
||||
PRUint16 mModalWindowCount;
|
||||
// Set when the appshell service is going away.
|
||||
|
|
|
@ -48,6 +48,7 @@ if (verifyDiskSpace(fProgram, srDest))
|
|||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/navigator-region/");
|
||||
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"toolkit.jar"),"content/global/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/autoconfig/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/cookie/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/wallet/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"content-packs.jar"),"content/content-packs/");
|
||||
|
|
|
@ -62,6 +62,7 @@ if (verifyDiskSpace(fProgram, srDest))
|
|||
registerChrome(chromeType, cf, localeName + "navigator/");
|
||||
registerChrome(chromeType, cf, localeName + "necko/");
|
||||
registerChrome(chromeType, cf, localeName + "mozldap/");
|
||||
registerChrome(chromeType, cf, localeName + "autoconfig/");
|
||||
registerChrome(chromeType, cf, localeName + "cookie/");
|
||||
registerChrome(chromeType, cf, localeName + "wallet/");
|
||||
registerChrome(chromeType, cf, localeName + "content-packs/");
|
||||
|
|
|
@ -53,6 +53,7 @@ if (verifyDiskSpace(communicatorFolder, srDest))
|
|||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/navigator-region/");
|
||||
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"toolkit.jar"),"content/global/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/autoconfig/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/cookie/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"comm.jar"),"content/wallet/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder(cf,"content-packs.jar"),"content/content-packs/");
|
||||
|
|
|
@ -64,6 +64,7 @@ if (verifyDiskSpace(fProgram, srDest))
|
|||
registerChrome(chromeType, cf, localeName + "aim/");
|
||||
registerChrome(chromeType, cf, localeName + "necko/");
|
||||
registerChrome(chromeType, cf, localeName + "mozldap/");
|
||||
registerChrome(chromeType, cf, localeName + "autoconfig/");
|
||||
registerChrome(chromeType, cf, localeName + "cookie/");
|
||||
registerChrome(chromeType, cf, localeName + "wallet/");
|
||||
registerChrome(chromeType, cf, localeName + "content-packs/");
|
||||
|
|
|
@ -462,6 +462,7 @@ if(verifyDiskSpace(fProgram, srDest))
|
|||
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","toolkit.jar"),"content/global/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","toolkit.jar"),"content/global-region/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/autoconfig/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/cookie/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","comm.jar"),"content/wallet/");
|
||||
registerChrome(CONTENT | DELAYED_CHROME, getFolder("Chrome","content-packs.jar"), "content/content-packs/");
|
||||
|
|
|
@ -63,6 +63,7 @@ if(verifyDiskSpace(fProgram, srDest))
|
|||
registerChrome(chromeType, cf, localeName + "navigator/");
|
||||
registerChrome(chromeType, cf, localeName + "necko/");
|
||||
registerChrome(chromeType, cf, localeName + "mozldap/");
|
||||
registerChrome(chromeType, cf, localeName + "autoconfig/");
|
||||
registerChrome(chromeType, cf, localeName + "cookie/");
|
||||
registerChrome(chromeType, cf, localeName + "wallet/");
|
||||
registerChrome(chromeType, cf, localeName + "content-packs/");
|
||||
|
|
Загрузка…
Ссылка в новой задаче