112071 - timebomb not working. r=hewitt sr=ben

This commit is contained in:
blakeross@telocity.com
2002-02-09 03:18:53 +00:00
parent a76bb470fc
commit 910dd039f5
9 changed files with 71 additions and 16 deletions

View File

@@ -111,13 +111,15 @@
#define ENABLE_PAGE_CYCLER #define ENABLE_PAGE_CYCLER
#endif #endif
#include "nsTimeBomb.h"
/* Define Class IDs */ /* Define Class IDs */
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
static NS_DEFINE_IID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID); static NS_DEFINE_IID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
static NS_DEFINE_IID(kCGlobalHistoryCID, NS_GLOBALHISTORY_CID); static NS_DEFINE_IID(kCGlobalHistoryCID, NS_GLOBALHISTORY_CID);
static NS_DEFINE_CID(kTimeBombCID, NS_TIMEBOMB_CID);
#ifdef DEBUG #ifdef DEBUG
static int APP_DEBUG = 0; // Set to 1 in debugger to turn on debugging. 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; return NS_ERROR_NULL_POINTER;
nsresult rv; nsresult rv;
static PRBool timebombChecked = PR_FALSE;
nsAutoString args; nsAutoString args;
if (!timebombChecked) {
// timebomb check
timebombChecked = PR_TRUE;
PRBool expired;
nsCOMPtr<nsITimeBomb> 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()) { if (args.IsEmpty()) {
nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID)); nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
if (!prefs) return NS_ERROR_FAILURE; if (!prefs) return NS_ERROR_FAILURE;

View File

@@ -0,0 +1,2 @@
<!-- timebomb.dtd -->
<!ENTITY timeBombURL.label "http://www.mozilla.org">

View File

@@ -26,7 +26,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk 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 ifdef MOZ_ENABLE_XREMOTE
DIRS += xremote DIRS += xremote

View File

@@ -68,6 +68,7 @@ SHARED_LIBRARY_LIBS = \
$(DIST)/lib/$(LIB_PREFIX)related_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)related_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)search_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)search_s.$(LIB_SUFFIX) \
$(DIST)/lib/$(LIB_PREFIX)urlbarhistory_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)urlbarhistory_s.$(LIB_SUFFIX) \
$(DIST)/lib/libtimebomb_s.$(LIB_SUFFIX) \
$(NULL) $(NULL)
LOCAL_INCLUDES = \ LOCAL_INCLUDES = \
@@ -77,6 +78,7 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../history/src \ -I$(srcdir)/../history/src \
-I$(srcdir)/../related/src \ -I$(srcdir)/../related/src \
-I$(srcdir)/../search/src \ -I$(srcdir)/../search/src \
-I$(srcdir)/../timebomb \
-I$(srcdir)/../urlbarhistory/src \ -I$(srcdir)/../urlbarhistory/src \
$(NULL) $(NULL)

View File

@@ -36,14 +36,18 @@ REQUIRES = xpcom \
dom \ dom \
pref \ pref \
docshell \ docshell \
downloadmanager \
webshell \ webshell \
bookmarks \ bookmarks \
content \ content \
content_xul \
history \ history \
search \ search \
related \ related \
urlbarhistory \ urlbarhistory \
uriloader \
mozldap \ mozldap \
webbrowserpersist \
$(NULL) $(NULL)
LCFLAGS = -DWIN32_LEAN_AND_MEAN LCFLAGS = -DWIN32_LEAN_AND_MEAN
@@ -60,10 +64,12 @@ SUB_LIBRARIES= \
$(DIST)\lib\autocomplete_s.lib \ $(DIST)\lib\autocomplete_s.lib \
$(DIST)\lib\bookmarks_s.lib \ $(DIST)\lib\bookmarks_s.lib \
$(DIST)\lib\directory_s.lib \ $(DIST)\lib\directory_s.lib \
$(DIST)\lib\downloadmanager_s.lib \
$(DIST)\lib\history_s.lib \ $(DIST)\lib\history_s.lib \
$(DIST)\lib\appcompintl_s.lib \ $(DIST)\lib\appcompintl_s.lib \
$(DIST)\lib\related_s.lib \ $(DIST)\lib\related_s.lib \
$(DIST)\lib\search_s.lib \ $(DIST)\lib\search_s.lib \
$(DIST)\lib\timebomb_s.lib \
$(DIST)\lib\urlbarhistory_s.lib \ $(DIST)\lib\urlbarhistory_s.lib \
$(DIST)\lib\urlwidgt_s.lib \ $(DIST)\lib\urlwidgt_s.lib \
$(DIST)\lib\winhooks_s.lib \ $(DIST)\lib\winhooks_s.lib \
@@ -84,9 +90,11 @@ INCS = $(INCS) \
-I$(DEPTH)\xpfe\components\autocomplete\src \ -I$(DEPTH)\xpfe\components\autocomplete\src \
-I$(DEPTH)\xpfe\components\bookmarks\src \ -I$(DEPTH)\xpfe\components\bookmarks\src \
-I$(DEPTH)\xpfe\components\directory \ -I$(DEPTH)\xpfe\components\directory \
-I$(DEPTH)\xpfe\components\download-manager\src \
-I$(DEPTH)\xpfe\components\history\src \ -I$(DEPTH)\xpfe\components\history\src \
-I$(DEPTH)\xpfe\components\related\src \ -I$(DEPTH)\xpfe\components\related\src \
-I$(DEPTH)\xpfe\components\search\src \ -I$(DEPTH)\xpfe\components\search\src \
-I$(DEPTH)\xpfe\components\timebomb \
-I$(DEPTH)\xpfe\components\urlbarhistory\src \ -I$(DEPTH)\xpfe\components\urlbarhistory\src \
-I$(DEPTH)\xpfe\components\urlwidget \ -I$(DEPTH)\xpfe\components\urlwidget \
-I$(DEPTH)\xpfe\components\winhooks \ -I$(DEPTH)\xpfe\components\winhooks \

View File

@@ -14,7 +14,7 @@
* *
* The Original Code is mozilla.org code. * 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. * Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998 * Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved. * the Initial Developer. All Rights Reserved.
@@ -22,7 +22,7 @@
* Contributor(s): * Contributor(s):
* *
* Alternatively, the contents of this file may be used under the terms of * 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"), * 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 * 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 * of those above. If you wish to allow use of your version of this file only
@@ -39,8 +39,10 @@
#include "nsAutoComplete.h" #include "nsAutoComplete.h"
#include "nsBookmarksService.h" #include "nsBookmarksService.h"
#include "nsDirectoryViewer.h" #include "nsDirectoryViewer.h"
#include "nsDownloadManager.h"
#include "nsGlobalHistory.h" #include "nsGlobalHistory.h"
#include "rdf.h" #include "rdf.h"
#include "nsTimeBomb.h"
#include "nsLocalSearchService.h" #include "nsLocalSearchService.h"
#include "nsInternetSearchService.h" #include "nsInternetSearchService.h"
#include "nsRelatedLinksHandlerImpl.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(nsBookmarksService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHTTPIndex, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHTTPIndex, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDirectoryViewerFactory) 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(nsGlobalHistory, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(LocalSearchDataSource, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(LocalSearchDataSource, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(InternetSearchDataSource, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(InternetSearchDataSource, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(RelatedLinksHandlerImpl, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(RelatedLinksHandlerImpl, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimeBomb)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlbarHistory) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlbarHistory)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontPackageHandler) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFontPackageHandler)
#if defined(XP_WIN) #if defined(XP_WIN)
@@ -93,20 +98,20 @@ RegisterProc(nsIComponentManager *aCompMgr,
nsXPIDLCString previous; nsXPIDLCString previous;
rv = catman->AddCategoryEntry("Gecko-Content-Viewers", "application/http-index-format", rv = catman->AddCategoryEntry("Gecko-Content-Viewers", "application/http-index-format",
NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX "view;1?type=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)); getter_Copies(previous));
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
rv = catman->AddCategoryEntry("Gecko-Content-Viewers", "application/http-index-format; x-view-type=view-source", 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", 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)); getter_Copies(previous));
return rv; return rv;
} }
static NS_METHOD static NS_METHOD
UnregisterProc(nsIComponentManager *aCompMgr, UnregisterProc(nsIComponentManager *aCompMgr,
nsIFile *aPath, nsIFile *aPath,
const char *registryLocation, const char *registryLocation,
@@ -116,11 +121,11 @@ UnregisterProc(nsIComponentManager *aCompMgr,
nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) return 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); "application/http-index-format", PR_TRUE);
if (NS_FAILED(rv)) return rv; 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); "application/http-index-format; x-view-type=view-source", PR_TRUE);
return rv; return rv;
@@ -145,6 +150,10 @@ static const nsModuleComponentInfo components[] = {
nsHTTPIndexConstructor }, nsHTTPIndexConstructor },
{ "Directory Viewer", NS_HTTPINDEX_SERVICE_CID, NS_HTTPINDEX_DATASOURCE_CONTRACTID, { "Directory Viewer", NS_HTTPINDEX_SERVICE_CID, NS_HTTPINDEX_DATASOURCE_CONTRACTID,
nsHTTPIndexConstructor }, 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, { "Global History", NS_GLOBALHISTORY_CID, NS_GLOBALHISTORY_CONTRACTID,
nsGlobalHistoryConstructor }, nsGlobalHistoryConstructor },
{ "Global History", NS_GLOBALHISTORY_CID, NS_GLOBALHISTORY_DATASOURCE_CONTRACTID, { "Global History", NS_GLOBALHISTORY_CID, NS_GLOBALHISTORY_DATASOURCE_CONTRACTID,
@@ -161,6 +170,7 @@ static const nsModuleComponentInfo components[] = {
NS_INTERNETSEARCH_DATASOURCE_CONTRACTID, InternetSearchDataSourceConstructor }, NS_INTERNETSEARCH_DATASOURCE_CONTRACTID, InternetSearchDataSourceConstructor },
{ "Related Links Handler", NS_RELATEDLINKSHANDLER_CID, NS_RELATEDLINKSHANDLER_CONTRACTID, { "Related Links Handler", NS_RELATEDLINKSHANDLER_CID, NS_RELATEDLINKSHANDLER_CONTRACTID,
RelatedLinksHandlerImplConstructor}, RelatedLinksHandlerImplConstructor},
{ "Netscape TimeBomb", NS_TIMEBOMB_CID, NS_TIMEBOMB_CONTRACTID, nsTimeBombConstructor},
{ "nsUrlbarHistory", NS_URLBARHISTORY_CID, { "nsUrlbarHistory", NS_URLBARHISTORY_CID,
NS_URLBARHISTORY_CONTRACTID, nsUrlbarHistoryConstructor }, NS_URLBARHISTORY_CONTRACTID, nsUrlbarHistoryConstructor },
{ "nsUrlbarHistory", NS_URLBARHISTORY_CID, { "nsUrlbarHistory", NS_URLBARHISTORY_CID,
@@ -172,14 +182,14 @@ static const nsModuleComponentInfo components[] = {
"@mozilla.org/locale/default-font-package-handler;1", "@mozilla.org/locale/default-font-package-handler;1",
nsFontPackageHandlerConstructor }, nsFontPackageHandlerConstructor },
#if defined(XP_WIN) #if defined(XP_WIN)
{ NS_IURLWIDGET_CLASSNAME, NS_IURLWIDGET_CID, NS_IURLWIDGET_CONTRACTID, { NS_IURLWIDGET_CLASSNAME, NS_IURLWIDGET_CID, NS_IURLWIDGET_CONTRACTID,
nsUrlWidgetConstructor }, nsUrlWidgetConstructor },
{ NS_IWINDOWSHOOKS_CLASSNAME, NS_IWINDOWSHOOKS_CID, NS_IWINDOWSHOOKS_CONTRACTID, { NS_IWINDOWSHOOKS_CLASSNAME, NS_IWINDOWSHOOKS_CID, NS_IWINDOWSHOOKS_CONTRACTID,
nsWindowsHooksConstructor }, nsWindowsHooksConstructor },
#endif // Windows #endif // Windows
#if defined(MOZ_LDAP_XPCOM) #if defined(MOZ_LDAP_XPCOM)
{ "LDAP Autocomplete Session", NS_LDAPAUTOCOMPLETESESSION_CID, { "LDAP Autocomplete Session", NS_LDAPAUTOCOMPLETESESSION_CID,
"@mozilla.org/autocompleteSession;1?type=ldap", "@mozilla.org/autocompleteSession;1?type=ldap",
nsLDAPAutoCompleteSessionConstructor }, nsLDAPAutoCompleteSessionConstructor },
#endif #endif
}; };

View File

@@ -19,6 +19,8 @@
# #
# Contributor(s): # Contributor(s):
# copied in part from ../timebomb/makefile.win
DEPTH = ..\..\.. DEPTH = ..\..\..
include <$(DEPTH)/config/config.mak> include <$(DEPTH)/config/config.mak>

View File

@@ -94,6 +94,9 @@ comm.jar:
content/communicator/sidebar/sidebarOverlay.xul (sidebar/resources/sidebarOverlay.xul) content/communicator/sidebar/sidebarOverlay.xul (sidebar/resources/sidebarOverlay.xul)
content/communicator/sidebar/PageNotFound.xul (sidebar/resources/PageNotFound.xul) content/communicator/sidebar/PageNotFound.xul (sidebar/resources/PageNotFound.xul)
content/communicator/sidebar/local-panels.rdf (sidebar/resources/local-panels.rdf) 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: en-US.jar:
locale/en-US/communicator/directory/directory.dtd (directory/locale/en-US/directory.dtd) 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) 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/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/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/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.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/downloadProgress.properties (xfer/resources/locale/en-US/downloadProgress.properties)
locale/en-US/global/filepicker.dtd (filepicker/res/locale/en-US/filepicker.dtd) locale/en-US/global/filepicker.dtd (filepicker/res/locale/en-US/filepicker.dtd)

View File

@@ -36,6 +36,7 @@ DIRS= \
shistory \ shistory \
console \ console \
autocomplete \ autocomplete \
download-manager \
urlbarhistory \ urlbarhistory \
winhooks \ winhooks \
urlwidget \ urlwidget \