From 9dde4a920a5de7893d8a2df5424ca1456cda4b96 Mon Sep 17 00:00:00 2001 From: "blakeross%telocity.com" Date: Sat, 9 Feb 2002 03:18:53 +0000 Subject: [PATCH] 112071 - timebomb not working. r=hewitt sr=ben --- xpfe/browser/src/nsBrowserInstance.cpp | 28 +++++++++++++- .../resources/locale/en-US/region.dtd | 2 + xpfe/components/Makefile.in | 2 +- xpfe/components/build/Makefile.in | 2 + xpfe/components/build/makefile.win | 8 ++++ xpfe/components/build/nsModule.cpp | 38 ++++++++++++------- xpfe/components/console/makefile.win | 2 + xpfe/components/jar.mn | 4 ++ xpfe/components/makefile.win | 1 + 9 files changed, 71 insertions(+), 16 deletions(-) diff --git a/xpfe/browser/src/nsBrowserInstance.cpp b/xpfe/browser/src/nsBrowserInstance.cpp index 03099fb2a640..a21e0051ab81 100644 --- a/xpfe/browser/src/nsBrowserInstance.cpp +++ b/xpfe/browser/src/nsBrowserInstance.cpp @@ -111,13 +111,15 @@ #define ENABLE_PAGE_CYCLER #endif +#include "nsTimeBomb.h" + /* Define Class IDs */ static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); static NS_DEFINE_IID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID); static NS_DEFINE_IID(kCGlobalHistoryCID, NS_GLOBALHISTORY_CID); - +static NS_DEFINE_CID(kTimeBombCID, NS_TIMEBOMB_CID); #ifdef DEBUG static int APP_DEBUG = 0; // Set to 1 in debugger to turn on debugging. @@ -732,8 +734,32 @@ NS_IMETHODIMP nsBrowserContentHandler::GetDefaultArgs(PRUnichar **aDefaultArgs) return NS_ERROR_NULL_POINTER; nsresult rv; + static PRBool timebombChecked = PR_FALSE; nsAutoString args; + if (!timebombChecked) { + // timebomb check + timebombChecked = PR_TRUE; + + PRBool expired; + nsCOMPtr timeBomb(do_GetService(kTimeBombCID, &rv)); + if (NS_FAILED(rv)) return rv; + + rv = timeBomb->Init(); + if (NS_FAILED(rv)) return rv; + + rv = timeBomb->CheckWithUI(&expired); + if (NS_FAILED(rv)) return rv; + + if (expired) { + nsXPIDLCString urlString; + rv = timeBomb->GetTimebombURL(getter_Copies(urlString)); + if (NS_FAILED(rv)) return rv; + + args.AssignWithConversion(urlString); + } + } + if (args.IsEmpty()) { nsCOMPtr prefs(do_GetService(kPrefServiceCID)); if (!prefs) return NS_ERROR_FAILURE; diff --git a/xpfe/communicator/resources/locale/en-US/region.dtd b/xpfe/communicator/resources/locale/en-US/region.dtd index e69de29bb2d1..3256790c2d97 100644 --- a/xpfe/communicator/resources/locale/en-US/region.dtd +++ b/xpfe/communicator/resources/locale/en-US/region.dtd @@ -0,0 +1,2 @@ + + diff --git a/xpfe/components/Makefile.in b/xpfe/components/Makefile.in index d8fdcfa35833..4ce2d25f831b 100644 --- a/xpfe/components/Makefile.in +++ b/xpfe/components/Makefile.in @@ -26,7 +26,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = bookmarks directory filepicker find history search sidebar related regviewer xfer prefwindow shistory console autocomplete urlbarhistory intl +DIRS = bookmarks directory filepicker find history search sidebar related regviewer xfer prefwindow shistory timebomb console autocomplete urlbarhistory intl ifdef MOZ_ENABLE_XREMOTE DIRS += xremote diff --git a/xpfe/components/build/Makefile.in b/xpfe/components/build/Makefile.in index 1060fd6d1ed3..2920f3e7e668 100644 --- a/xpfe/components/build/Makefile.in +++ b/xpfe/components/build/Makefile.in @@ -68,6 +68,7 @@ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/$(LIB_PREFIX)related_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)search_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)urlbarhistory_s.$(LIB_SUFFIX) \ + $(DIST)/lib/libtimebomb_s.$(LIB_SUFFIX) \ $(NULL) LOCAL_INCLUDES = \ @@ -77,6 +78,7 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../history/src \ -I$(srcdir)/../related/src \ -I$(srcdir)/../search/src \ + -I$(srcdir)/../timebomb \ -I$(srcdir)/../urlbarhistory/src \ $(NULL) diff --git a/xpfe/components/build/makefile.win b/xpfe/components/build/makefile.win index 79f326785df3..371e95306042 100644 --- a/xpfe/components/build/makefile.win +++ b/xpfe/components/build/makefile.win @@ -36,14 +36,18 @@ REQUIRES = xpcom \ dom \ pref \ docshell \ + downloadmanager \ webshell \ bookmarks \ content \ + content_xul \ history \ search \ related \ urlbarhistory \ + uriloader \ mozldap \ + webbrowserpersist \ $(NULL) LCFLAGS = -DWIN32_LEAN_AND_MEAN @@ -60,10 +64,12 @@ SUB_LIBRARIES= \ $(DIST)\lib\autocomplete_s.lib \ $(DIST)\lib\bookmarks_s.lib \ $(DIST)\lib\directory_s.lib \ + $(DIST)\lib\downloadmanager_s.lib \ $(DIST)\lib\history_s.lib \ $(DIST)\lib\appcompintl_s.lib \ $(DIST)\lib\related_s.lib \ $(DIST)\lib\search_s.lib \ + $(DIST)\lib\timebomb_s.lib \ $(DIST)\lib\urlbarhistory_s.lib \ $(DIST)\lib\urlwidgt_s.lib \ $(DIST)\lib\winhooks_s.lib \ @@ -84,9 +90,11 @@ INCS = $(INCS) \ -I$(DEPTH)\xpfe\components\autocomplete\src \ -I$(DEPTH)\xpfe\components\bookmarks\src \ -I$(DEPTH)\xpfe\components\directory \ + -I$(DEPTH)\xpfe\components\download-manager\src \ -I$(DEPTH)\xpfe\components\history\src \ -I$(DEPTH)\xpfe\components\related\src \ -I$(DEPTH)\xpfe\components\search\src \ + -I$(DEPTH)\xpfe\components\timebomb \ -I$(DEPTH)\xpfe\components\urlbarhistory\src \ -I$(DEPTH)\xpfe\components\urlwidget \ -I$(DEPTH)\xpfe\components\winhooks \ diff --git a/xpfe/components/build/nsModule.cpp b/xpfe/components/build/nsModule.cpp index e3ec763024c3..4c1d95184ba9 100644 --- a/xpfe/components/build/nsModule.cpp +++ b/xpfe/components/build/nsModule.cpp @@ -14,7 +14,7 @@ * * The Original Code is mozilla.org code. * - * The Initial Developer of the Original Code is + * 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. @@ -22,7 +22,7 @@ * Contributor(s): * * 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 + * 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 @@ -39,8 +39,10 @@ #include "nsAutoComplete.h" #include "nsBookmarksService.h" #include "nsDirectoryViewer.h" +#include "nsDownloadManager.h" #include "nsGlobalHistory.h" #include "rdf.h" +#include "nsTimeBomb.h" #include "nsLocalSearchService.h" #include "nsInternetSearchService.h" #include "nsRelatedLinksHandlerImpl.h" @@ -62,10 +64,13 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteResults) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsBookmarksService, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHTTPIndex, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDirectoryViewerFactory) +NS_GENERIC_FACTORY_CONSTRUCTOR(DownloadItem) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDownloadManager, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGlobalHistory, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(LocalSearchDataSource, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(InternetSearchDataSource, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(RelatedLinksHandlerImpl, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimeBomb) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlbarHistory) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontPackageHandler) #if defined(XP_WIN) @@ -93,20 +98,20 @@ RegisterProc(nsIComponentManager *aCompMgr, nsXPIDLCString previous; rv = catman->AddCategoryEntry("Gecko-Content-Viewers", "application/http-index-format", NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX "view;1?type=application/http-index-format", - PR_TRUE, - PR_TRUE, + PR_TRUE, + PR_TRUE, getter_Copies(previous)); if (NS_FAILED(rv)) return rv; rv = catman->AddCategoryEntry("Gecko-Content-Viewers", "application/http-index-format; x-view-type=view-source", NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX "view;1?type=application/http-index-format; x-view-type=view-source", - PR_TRUE, - PR_TRUE, + PR_TRUE, + PR_TRUE, getter_Copies(previous)); - + return rv; } -static NS_METHOD +static NS_METHOD UnregisterProc(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *registryLocation, @@ -116,11 +121,11 @@ UnregisterProc(nsIComponentManager *aCompMgr, nsCOMPtr catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; - rv = catman->DeleteCategoryEntry("Gecko-Content-Viewers", + rv = catman->DeleteCategoryEntry("Gecko-Content-Viewers", "application/http-index-format", PR_TRUE); if (NS_FAILED(rv)) return rv; - rv = catman->DeleteCategoryEntry("Gecko-Content-Viewers", + rv = catman->DeleteCategoryEntry("Gecko-Content-Viewers", "application/http-index-format; x-view-type=view-source", PR_TRUE); return rv; @@ -145,6 +150,10 @@ static const nsModuleComponentInfo components[] = { nsHTTPIndexConstructor }, { "Directory Viewer", NS_HTTPINDEX_SERVICE_CID, NS_HTTPINDEX_DATASOURCE_CONTRACTID, nsHTTPIndexConstructor }, + { "Download Manager", NS_DOWNLOADMANAGER_CID, NS_DOWNLOADMANAGER_CONTRACTID, + nsDownloadManagerConstructor }, + { "Download Manager Item", NS_DOWNLOADITEM_CID, NS_DOWNLOADITEM_CONTRACTID, + DownloadItemConstructor }, { "Global History", NS_GLOBALHISTORY_CID, NS_GLOBALHISTORY_CONTRACTID, nsGlobalHistoryConstructor }, { "Global History", NS_GLOBALHISTORY_CID, NS_GLOBALHISTORY_DATASOURCE_CONTRACTID, @@ -161,6 +170,7 @@ static const nsModuleComponentInfo components[] = { NS_INTERNETSEARCH_DATASOURCE_CONTRACTID, InternetSearchDataSourceConstructor }, { "Related Links Handler", NS_RELATEDLINKSHANDLER_CID, NS_RELATEDLINKSHANDLER_CONTRACTID, RelatedLinksHandlerImplConstructor}, + { "Netscape TimeBomb", NS_TIMEBOMB_CID, NS_TIMEBOMB_CONTRACTID, nsTimeBombConstructor}, { "nsUrlbarHistory", NS_URLBARHISTORY_CID, NS_URLBARHISTORY_CONTRACTID, nsUrlbarHistoryConstructor }, { "nsUrlbarHistory", NS_URLBARHISTORY_CID, @@ -172,14 +182,14 @@ static const nsModuleComponentInfo components[] = { "@mozilla.org/locale/default-font-package-handler;1", nsFontPackageHandlerConstructor }, #if defined(XP_WIN) - { NS_IURLWIDGET_CLASSNAME, NS_IURLWIDGET_CID, NS_IURLWIDGET_CONTRACTID, - nsUrlWidgetConstructor }, - { NS_IWINDOWSHOOKS_CLASSNAME, NS_IWINDOWSHOOKS_CID, NS_IWINDOWSHOOKS_CONTRACTID, + { NS_IURLWIDGET_CLASSNAME, NS_IURLWIDGET_CID, NS_IURLWIDGET_CONTRACTID, + nsUrlWidgetConstructor }, + { NS_IWINDOWSHOOKS_CLASSNAME, NS_IWINDOWSHOOKS_CID, NS_IWINDOWSHOOKS_CONTRACTID, nsWindowsHooksConstructor }, #endif // Windows #if defined(MOZ_LDAP_XPCOM) { "LDAP Autocomplete Session", NS_LDAPAUTOCOMPLETESESSION_CID, - "@mozilla.org/autocompleteSession;1?type=ldap", + "@mozilla.org/autocompleteSession;1?type=ldap", nsLDAPAutoCompleteSessionConstructor }, #endif }; diff --git a/xpfe/components/console/makefile.win b/xpfe/components/console/makefile.win index 420effa6acc8..90e247966680 100644 --- a/xpfe/components/console/makefile.win +++ b/xpfe/components/console/makefile.win @@ -19,6 +19,8 @@ # # Contributor(s): +# copied in part from ../timebomb/makefile.win + DEPTH = ..\..\.. include <$(DEPTH)/config/config.mak> diff --git a/xpfe/components/jar.mn b/xpfe/components/jar.mn index 1745778979df..384ac6502077 100644 --- a/xpfe/components/jar.mn +++ b/xpfe/components/jar.mn @@ -94,6 +94,9 @@ comm.jar: content/communicator/sidebar/sidebarOverlay.xul (sidebar/resources/sidebarOverlay.xul) content/communicator/sidebar/PageNotFound.xul (sidebar/resources/PageNotFound.xul) content/communicator/sidebar/local-panels.rdf (sidebar/resources/local-panels.rdf) + content/communicator/timebomb/warn.xul (timebomb/resources/content/warn.xul) + content/communicator/timebomb/expireText.xul (timebomb/resources/content/expireText.xul) + en-US.jar: locale/en-US/communicator/directory/directory.dtd (directory/locale/en-US/directory.dtd) locale/en-US/communicator/history/history.dtd (history/resources/locale/en-US/history.dtd) @@ -148,6 +151,7 @@ en-US.jar: locale/en-US/communicator/sidebar/local-panels.dtd (sidebar/resources/locale/en-US/local-panels.dtd) locale/en-US/communicator/sidebar/sidebarOverlay.dtd (sidebar/resources/locale/en-US/sidebarOverlay.dtd) locale/en-US/communicator/sidebar/sidebar.properties (sidebar/resources/locale/en-US/sidebar.properties) + locale/en-US/communicator/timebomb/timebomb.dtd (timebomb/resources/locale/en-US/timebomb.dtd) locale/en-US/global/downloadProgress.dtd (xfer/resources/locale/en-US/downloadProgress.dtd) locale/en-US/global/downloadProgress.properties (xfer/resources/locale/en-US/downloadProgress.properties) locale/en-US/global/filepicker.dtd (filepicker/res/locale/en-US/filepicker.dtd) diff --git a/xpfe/components/makefile.win b/xpfe/components/makefile.win index 5a6ec32dc7c2..8acc75e5303e 100644 --- a/xpfe/components/makefile.win +++ b/xpfe/components/makefile.win @@ -36,6 +36,7 @@ DIRS= \ shistory \ console \ autocomplete \ + download-manager \ urlbarhistory \ winhooks \ urlwidget \