From 8eac4aa5f7a3fb7d9473a0b8b9b140caaa85f2ea Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Fri, 3 Oct 2003 20:43:59 +0000 Subject: [PATCH] bug 193740. remove timebomb code r=neil.parkwaycc.co.uk@myrealbox.com sr=alecf git-svn-id: svn://10.0.0.236/trunk@147535 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/allmakefiles.sh | 2 - .../xpfe/browser/src/nsBrowserInstance.cpp | 90 ++-- mozilla/xpfe/communicator/jar.mn | 1 - .../resources/locale/en-US/region.dtd | 2 - mozilla/xpfe/components/Makefile.in | 2 - mozilla/xpfe/components/build/Makefile.in | 2 - mozilla/xpfe/components/build/nsModule.cpp | 3 - mozilla/xpfe/components/jar.mn | 3 - mozilla/xpfe/components/timebomb/Makefile.in | 32 -- .../xpfe/components/timebomb/nsITimeBomb.idl | 124 ------ .../xpfe/components/timebomb/nsTimeBomb.cpp | 391 ------------------ mozilla/xpfe/components/timebomb/nsTimeBomb.h | 62 --- .../timebomb/resources/content/expireText.xul | 43 -- .../timebomb/resources/content/warn.xul | 44 -- .../resources/locale/en-US/timebomb.dtd | 5 - .../components/timebomb/tools/Makefile.in | 29 -- .../components/timebomb/tools/timebombgen.cpp | 98 ----- mozilla/xpinstall/packager/packages-os2 | 1 - .../xpinstall/packager/packages-static-unix | 1 - .../xpinstall/packager/packages-static-win | 1 - mozilla/xpinstall/packager/packages-unix | 1 - mozilla/xpinstall/packager/packages-win | 1 - 22 files changed, 31 insertions(+), 907 deletions(-) delete mode 100644 mozilla/xpfe/communicator/resources/locale/en-US/region.dtd delete mode 100644 mozilla/xpfe/components/timebomb/Makefile.in delete mode 100644 mozilla/xpfe/components/timebomb/nsITimeBomb.idl delete mode 100644 mozilla/xpfe/components/timebomb/nsTimeBomb.cpp delete mode 100644 mozilla/xpfe/components/timebomb/nsTimeBomb.h delete mode 100644 mozilla/xpfe/components/timebomb/resources/content/expireText.xul delete mode 100644 mozilla/xpfe/components/timebomb/resources/content/warn.xul delete mode 100644 mozilla/xpfe/components/timebomb/resources/locale/en-US/timebomb.dtd delete mode 100644 mozilla/xpfe/components/timebomb/tools/Makefile.in delete mode 100644 mozilla/xpfe/components/timebomb/tools/timebombgen.cpp diff --git a/mozilla/allmakefiles.sh b/mozilla/allmakefiles.sh index c6907207af3..93f94774b0b 100755 --- a/mozilla/allmakefiles.sh +++ b/mozilla/allmakefiles.sh @@ -650,8 +650,6 @@ xpfe/components/directory/Makefile xpfe/components/download-manager/Makefile xpfe/components/download-manager/src/Makefile xpfe/components/download-manager/public/Makefile -xpfe/components/timebomb/Makefile -xpfe/components/timebomb/tools/Makefile xpfe/components/find/Makefile xpfe/components/find/public/Makefile xpfe/components/find/src/Makefile diff --git a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp index 4141e4d717f..89b47a83ded 100644 --- a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp +++ b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp @@ -113,8 +113,6 @@ #define ENABLE_PAGE_CYCLER #endif -#include "nsITimeBomb.h" - /* Define Class IDs */ static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); @@ -752,73 +750,47 @@ 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; + nsCOMPtr prefs(do_GetService(kPrefServiceCID)); + if (!prefs) return NS_ERROR_FAILURE; - PRBool expired; - nsCOMPtr timeBomb(do_GetService(NS_TIMEBOMB_CONTRACTID, &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 (NeedHomepageOverride(prefs)) { + nsXPIDLString url; + rv = prefs->GetLocalizedUnicharPref(PREF_HOMEPAGE_OVERRIDE_URL, getter_Copies(url)); + if (NS_SUCCEEDED(rv) && (const PRUnichar *)url) { + args = url; } } if (args.IsEmpty()) { - nsCOMPtr prefs(do_GetService(kPrefServiceCID)); - if (!prefs) return NS_ERROR_FAILURE; - - if (NeedHomepageOverride(prefs)) { - nsXPIDLString url; - rv = prefs->GetLocalizedUnicharPref(PREF_HOMEPAGE_OVERRIDE_URL, getter_Copies(url)); - if (NS_SUCCEEDED(rv) && (const PRUnichar *)url) { - args = url; - } - } - - if (args.IsEmpty()) { - PRInt32 choice = 0; - rv = prefs->GetIntPref(PREF_BROWSER_STARTUP_PAGE, &choice); - if (NS_SUCCEEDED(rv)) { - switch (choice) { - case 1: { - // skip the code below - return GetHomePageGroup(prefs, aDefaultArgs); - } - case 2: { - nsCOMPtr history(do_GetService(kCGlobalHistoryCID)); - if (history) { - nsXPIDLCString curl; - rv = history->GetLastPageVisited(getter_Copies(curl)); - args.AssignWithConversion(curl); - } - break; - } - case 0: - default: - // fall through to about:blank below - break; + PRInt32 choice = 0; + rv = prefs->GetIntPref(PREF_BROWSER_STARTUP_PAGE, &choice); + if (NS_SUCCEEDED(rv)) { + switch (choice) { + case 1: { + // skip the code below + return GetHomePageGroup(prefs, aDefaultArgs); } + case 2: { + nsCOMPtr history(do_GetService(kCGlobalHistoryCID)); + if (history) { + nsXPIDLCString curl; + rv = history->GetLastPageVisited(getter_Copies(curl)); + args.AssignWithConversion(curl); + } + break; + } + case 0: + default: + // fall through to about:blank below + break; } - - // the default, in case we fail somewhere - if (args.IsEmpty()) - args.Assign(NS_LITERAL_STRING("about:blank")); } + + // the default, in case we fail somewhere + if (args.IsEmpty()) + args.Assign(NS_LITERAL_STRING("about:blank")); } *aDefaultArgs = ToNewUnicode(args); diff --git a/mozilla/xpfe/communicator/jar.mn b/mozilla/xpfe/communicator/jar.mn index f505f02eb3a..222f0687a5b 100644 --- a/mozilla/xpfe/communicator/jar.mn +++ b/mozilla/xpfe/communicator/jar.mn @@ -57,7 +57,6 @@ en-US.jar: US.jar: locale/US/communicator-region/contents.rdf (resources/locale/en-US/contents-region.rdf) - locale/US/communicator-region/region.dtd (resources/locale/en-US/region.dtd) locale/US/communicator-region/region.properties (resources/locale/en-US/region.properties) en-win.jar: diff --git a/mozilla/xpfe/communicator/resources/locale/en-US/region.dtd b/mozilla/xpfe/communicator/resources/locale/en-US/region.dtd deleted file mode 100644 index e506ca65d85..00000000000 --- a/mozilla/xpfe/communicator/resources/locale/en-US/region.dtd +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/mozilla/xpfe/components/Makefile.in b/mozilla/xpfe/components/Makefile.in index 39149784fb4..2f46fbd7957 100644 --- a/mozilla/xpfe/components/Makefile.in +++ b/mozilla/xpfe/components/Makefile.in @@ -35,7 +35,6 @@ DIRS = \ related \ prefwindow \ shistory \ - timebomb \ console \ updates \ intl \ @@ -74,7 +73,6 @@ DIRS = \ history/public \ shistory/public \ bookmarks/public \ - timebomb \ $(NULL) ifeq ($(OS_ARCH),WINNT) diff --git a/mozilla/xpfe/components/build/Makefile.in b/mozilla/xpfe/components/build/Makefile.in index f768fb463b7..ac4467cee34 100644 --- a/mozilla/xpfe/components/build/Makefile.in +++ b/mozilla/xpfe/components/build/Makefile.in @@ -77,7 +77,6 @@ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/$(LIB_PREFIX)appcompintl_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)related_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)search_s.$(LIB_SUFFIX) \ - $(DIST)/lib/$(LIB_PREFIX)timebomb_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)windowds_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)mozbrwsr_s.$(LIB_SUFFIX) \ $(NULL) @@ -96,7 +95,6 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../directory \ -I$(srcdir)/../related/src \ -I$(srcdir)/../search/src \ - -I$(srcdir)/../timebomb \ -I$(srcdir)/../windowds \ -I$(srcdir)/../../browser/src \ $(NULL) diff --git a/mozilla/xpfe/components/build/nsModule.cpp b/mozilla/xpfe/components/build/nsModule.cpp index b34435f04bd..1abbee41816 100644 --- a/mozilla/xpfe/components/build/nsModule.cpp +++ b/mozilla/xpfe/components/build/nsModule.cpp @@ -38,7 +38,6 @@ #include "nsICategoryManager.h" #include "nsDirectoryViewer.h" #include "rdf.h" -#include "nsTimeBomb.h" #include "nsLocalSearchService.h" #include "nsInternetSearchService.h" #include "nsRelatedLinksHandlerImpl.h" @@ -74,7 +73,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDirectoryViewerFactory) 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(nsFontPackageHandler) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowDataSource, Init) #ifndef MOZ_PHOENIX @@ -179,7 +177,6 @@ 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}, { "nsCharsetMenu", NS_CHARSETMENU_CID, NS_RDF_DATASOURCE_CONTRACTID_PREFIX NS_CHARSETMENU_PID, NS_NewCharsetMenu }, diff --git a/mozilla/xpfe/components/jar.mn b/mozilla/xpfe/components/jar.mn index 4ae2eae24f7..2b4ff61edfd 100644 --- a/mozilla/xpfe/components/jar.mn +++ b/mozilla/xpfe/components/jar.mn @@ -96,8 +96,6 @@ 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) content/communicator/alerts/alert.xul (alerts/resources/content/alert.xul) content/communicator/alerts/alert.js (alerts/resources/content/alert.js) @@ -157,7 +155,6 @@ en-US.jar: 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/update-notifications.properties (updates/resources/locale/en-US/update-notifications.properties) - locale/en-US/communicator/timebomb/timebomb.dtd (timebomb/resources/locale/en-US/timebomb.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) locale/en-US/global/filepicker.properties (filepicker/res/locale/en-US/filepicker.properties) diff --git a/mozilla/xpfe/components/timebomb/Makefile.in b/mozilla/xpfe/components/timebomb/Makefile.in deleted file mode 100644 index f493d59521b..00000000000 --- a/mozilla/xpfe/components/timebomb/Makefile.in +++ /dev/null @@ -1,32 +0,0 @@ -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -DIRS = tools - -MODULE = appcomps -LIBRARY_NAME = timebomb_s -XPIDL_MODULE = timebomb -REQUIRES = xpcom \ - string \ - pref \ - appshell \ - necko \ - webbrwsr \ - $(NULL) - -XPIDLSRCS = nsITimeBomb.idl - -CPPSRCS = nsTimeBomb.cpp - -EXPORTS = nsTimeBomb.h - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk - diff --git a/mozilla/xpfe/components/timebomb/nsITimeBomb.idl b/mozilla/xpfe/components/timebomb/nsITimeBomb.idl deleted file mode 100644 index 71b33824c8e..00000000000 --- a/mozilla/xpfe/components/timebomb/nsITimeBomb.idl +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * 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): - * Doug Turner - * - * 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. - * - * ***** END LICENSE BLOCK ***** */ - - - -/**************************************************************** - Time Bomb - - In order to use timebombs, you must set the preference: - - timebomb.enabled - - This must be set to true for the time bomb to be activated. - - There are two type of timebombs. The first is an absolute - timebomb which expires on a given date regardless of build - date. These absolute dates are set in the preferences: - - timebomb.expiration_time - timebomb.warning_time - - The values are relative to the epoch, midnight, January 1, - 1970 UTC in microseconds. This is basically a PRTime. - - The second form of timebomb is naturally relative. It take - a start date and an two offset. - - The first relative check is agains the build time preference: - - timebomb.build_time - - The two offsets are: - - timebomb.expiration_offset - timebomb.warning_offset - - The next relative check is against the first launch. The - preferences for first run is: - - timebomb.first_launch_time - - It will be set for you the first time nsITimeBomb is called. - - If you only want to preform a time bomb after the - first launch, simply do not define timebomb.build_time. - - - Since these preferences are set in a plain text - javascript file and there currently is not pref - locking in mozilla, a user could simply remove - any one of these setting. - - When the application does expire, you can specify a - URL to load. - - timebomb.timebombURL - - -****************************************************************/ -#include "nsISupports.idl" - -[scriptable, uuid(93fabc84-e1bf-11d3-ac71-00c04fa0d26b)] -interface nsITimeBomb : nsISupports -{ - void init(); - - void checkWithUI(out boolean expired); - void loadUpdateURL(); - - readonly attribute boolean expired; - readonly attribute boolean warned; - - readonly attribute boolean enabled; - - readonly attribute PRTime expirationTime; - readonly attribute PRTime warningTime; - - readonly attribute PRTime buildTime; - readonly attribute PRTime firstLaunch; - readonly attribute PRInt64 warningOffset; - readonly attribute PRInt64 expirationOffset; - - readonly attribute string timebombURL; -}; - -%{ C++ -#define NS_TIMEBOMB_CONTRACTID "@mozilla.org/timebomb;1" -%} - diff --git a/mozilla/xpfe/components/timebomb/nsTimeBomb.cpp b/mozilla/xpfe/components/timebomb/nsTimeBomb.cpp deleted file mode 100644 index 143c2abbba8..00000000000 --- a/mozilla/xpfe/components/timebomb/nsTimeBomb.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * 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 Communicator client 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): - * Doug Turner - * - * 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. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsTimeBomb.h" -#include "nsIServiceManager.h" -#include "nspr.h" -#include "plstr.h" - -#include "nsIAppShellService.h" -#include "nsAppShellCIDs.h" - -#include "nsIIOService.h" -#include "nsNetUtil.h" - -//Interfaces Needed -#include "nsIXULWindow.h" -#include "nsIWebBrowserChrome.h" - -static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); -static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); - - -static nsresult DisplayURI(const char *urlStr, PRBool block) -{ - - nsresult rv; - nsCOMPtr URL; - - rv = NS_NewURI(getter_AddRefs(URL), (const char *)urlStr); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr appShell = - do_GetService(kAppShellServiceCID, &rv); - if (NS_FAILED(rv)) return rv; - - nsCOMPtr window; - rv = appShell->CreateTopLevelWindow(nsnull, - URL, - PR_TRUE, - PR_TRUE, - nsIWebBrowserChrome::CHROME_ALL, - nsIAppShellService::SIZE_TO_CONTENT, // width - nsIAppShellService::SIZE_TO_CONTENT, // height - getter_AddRefs(window)); - - if (NS_FAILED(rv)) return rv; - - /* - * Start up the main event loop... - */ - if (block) - rv = appShell->Run(); - - return rv; -} - -nsTimeBomb::nsTimeBomb() -{ -} - -nsTimeBomb::~nsTimeBomb() -{ -} - -NS_IMPL_ISUPPORTS1(nsTimeBomb, nsITimeBomb) - -NS_IMETHODIMP -nsTimeBomb::Init() -{ - nsresult rv; - - rv = nsServiceManager::GetService(kPrefCID, NS_GET_IID(nsIPref), getter_AddRefs(mPrefs)); - NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get prefs"); - if (NS_FAILED(rv)) - return rv; - - PRTime time = LL_Zero(); - rv = GetFirstLaunch(&time); - if (NS_FAILED(rv)) - { - time = PR_Now(); - char buffer[30]; - PR_snprintf(buffer, 30, "%lld", time); - mPrefs->SetCharPref("timebomb.first_launch_time", buffer); - rv = NS_OK; - } - return rv; -} - -NS_IMETHODIMP -nsTimeBomb::CheckWithUI(PRBool *expired) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - *expired = PR_FALSE; - - PRBool val; - nsresult rv = GetEnabled(&val); - - if (NS_FAILED(rv) || !val) - { - // was not set or not enabled. - // no problems. just return okay. - return NS_OK; - } - - rv = GetExpired(&val); - - if (NS_SUCCEEDED(rv) && val) - { -#ifdef DEBUG - printf("******** Expired version ********\n"); -#endif - DisplayURI("chrome://communicator/content/timebomb/expireText.xul", PR_FALSE); - *expired = PR_TRUE; - return NS_OK; - } - - rv = GetWarned(&val); - - if (NS_SUCCEEDED(rv) && val) - { -#ifdef DEBUG - printf("******** ABOUT TO EXPIRE ********\n"); -#endif - DisplayURI("chrome://communicator/content/timebomb/warnText.xul", PR_FALSE); - } - - return NS_OK; - -} - -NS_IMETHODIMP -nsTimeBomb::LoadUpdateURL() -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - char* url; - nsresult rv = GetTimebombURL(&url); - if (NS_FAILED(rv)) return rv; - rv = DisplayURI(url, PR_FALSE); - nsMemory::Free(url); - return rv; -} - -NS_IMETHODIMP -nsTimeBomb::GetExpired(PRBool *expired) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - *expired = PR_FALSE; - - PRTime bombTime = LL_Zero(); - PRTime currentTime = PR_Now(); - - // check absolute expiration; - - nsresult rv = GetExpirationTime(&bombTime); - - if (NS_FAILED(rv)) return NS_OK; - - if (LL_CMP(bombTime, <, currentTime)) - { - *expired = PR_TRUE; - return NS_OK; - } - - // try relative expiration; - - PRTime offsetTime = LL_Zero(); - PRTime offset = LL_Zero(); - - rv = GetBuildTime(&bombTime); - if (NS_FAILED(rv)) return NS_OK; - rv = GetExpirationOffset(&offset); - if (NS_FAILED(rv)) return NS_OK; - - LL_ADD(offsetTime, bombTime, offset); - if (LL_CMP(offsetTime, <, currentTime)) - { - *expired = PR_FALSE; - return NS_OK; - } - - rv = GetFirstLaunch(&bombTime); - if (NS_FAILED(rv)) return NS_OK; - - LL_ADD(offsetTime, bombTime, offset); - if (LL_CMP(offsetTime, <, currentTime)) - { - *expired = PR_FALSE; - return NS_OK; - } - - - return NS_OK; -} - -NS_IMETHODIMP -nsTimeBomb::GetWarned(PRBool *warn) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - *warn = PR_FALSE; - - PRTime bombTime = LL_Zero(); - PRTime currentTime = PR_Now(); - - // check absolute expiration; - - nsresult rv = GetWarningTime(&bombTime); - - if (NS_FAILED(rv)) return NS_OK; - - if (LL_CMP(bombTime, <, currentTime)) - { - *warn = PR_TRUE; - return NS_OK; - } - - // try relative expiration; - - PRTime offsetTime = LL_Zero(); - PRTime offset = LL_Zero(); - - rv = GetBuildTime(&bombTime); - if (NS_FAILED(rv)) return NS_OK; - rv = GetWarningOffset(&offset); - if (NS_FAILED(rv)) return NS_OK; - - LL_ADD(offsetTime, bombTime, offset); - if (LL_CMP(offsetTime, <, currentTime)) - { - *warn = PR_FALSE; - return NS_OK; - } - - rv = GetFirstLaunch(&bombTime); - if (NS_FAILED(rv)) return NS_OK; - - LL_ADD(offsetTime, bombTime, offset); - if (LL_CMP(offsetTime, <, currentTime)) - { - *warn = PR_FALSE; - return NS_OK; - } - - return NS_OK; -} - - -NS_IMETHODIMP -nsTimeBomb::GetEnabled(PRBool *enabled) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - return mPrefs->GetBoolPref("timebomb.enabled",enabled); -} - - -NS_IMETHODIMP -nsTimeBomb::GetExpirationTime(PRTime *time) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - return GetInt64ForPref("timebomb.expiration_time", time); -} - - -NS_IMETHODIMP -nsTimeBomb::GetWarningTime(PRTime *time) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - return GetInt64ForPref("timebomb.warning_time", time); -} - - -NS_IMETHODIMP -nsTimeBomb::GetBuildTime(PRTime *time) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - return GetInt64ForPref("timebomb.build_time", time); -} - -NS_IMETHODIMP -nsTimeBomb::GetFirstLaunch(PRTime *time) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - return GetInt64ForPref("timebomb.first_launch_time", time); -} - - -NS_IMETHODIMP -nsTimeBomb::GetWarningOffset(PRInt64 *offset) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - return GetInt64ForPref("timebomb.warning_offset", offset); -} - -NS_IMETHODIMP -nsTimeBomb::GetExpirationOffset(PRInt64 *offset) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - return GetInt64ForPref("timebomb.expiration_offset", offset); -} - - - -NS_IMETHODIMP -nsTimeBomb::GetTimebombURL(char* *url) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - char* string; - nsresult rv = mPrefs->CopyCharPref("timebomb.timebombURL", &string); - if (NS_SUCCEEDED(rv)) - { - *url = (char*)nsMemory::Clone(string, (strlen(string)+1)*sizeof(char)); - - PL_strfree(string); - - if(*url == nsnull) - return NS_ERROR_OUT_OF_MEMORY; - return NS_OK; - } - - string = "http://www.mozilla.org/projects/seamonkey/"; - *url = (char*)nsMemory::Clone(string, (strlen(string)+1)*sizeof(char)); - - if(!*url) - return NS_ERROR_OUT_OF_MEMORY; - - return NS_OK; -} - - - -nsresult -nsTimeBomb::GetInt64ForPref(const char* pref, PRInt64* time) -{ - if (!mPrefs) return NS_ERROR_NULL_POINTER; - - char* string; - nsresult rv = mPrefs->CopyCharPref(pref, &string); - if (NS_SUCCEEDED(rv)) - { - PR_sscanf(string, "%lld", time); - PL_strfree(string); - } - return rv; -} diff --git a/mozilla/xpfe/components/timebomb/nsTimeBomb.h b/mozilla/xpfe/components/timebomb/nsTimeBomb.h deleted file mode 100644 index 2d46efaa0d2..00000000000 --- a/mozilla/xpfe/components/timebomb/nsTimeBomb.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * 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 Communicator client 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): - * Doug Turner - * - * 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. - * - * ***** END LICENSE BLOCK ***** */ -#ifndef nstimebomb_h___ -#define nstimebomb_h___ - -#include "nsITimeBomb.h" -#include "nsCOMPtr.h" -#include "nsIPref.h" - -#define NS_TIMEBOMB_CID { 0x141917dc, 0xe1c3, 0x11d3, {0xac, 0x71, 0x00, 0xc0, 0x4f, 0xa0, 0xd2, 0x6b}} - -class nsTimeBomb : public nsITimeBomb -{ -public: - - nsTimeBomb(); - virtual ~nsTimeBomb(); - - NS_DECL_ISUPPORTS - NS_DECL_NSITIMEBOMB - -protected: - nsCOMPtr mPrefs; - nsresult GetInt64ForPref(const char* pref, PRInt64* time); -}; - -#endif // nstimebomb_h___ diff --git a/mozilla/xpfe/components/timebomb/resources/content/expireText.xul b/mozilla/xpfe/components/timebomb/resources/content/expireText.xul deleted file mode 100644 index ce75c522560..00000000000 --- a/mozilla/xpfe/components/timebomb/resources/content/expireText.xul +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - -%commRegionDTD; - -%timebombDTD; -]> - - - - - &expireText.label; - - - diff --git a/mozilla/xpfe/components/timebomb/resources/content/warn.xul b/mozilla/xpfe/components/timebomb/resources/content/warn.xul deleted file mode 100644 index 42bdc9282cb..00000000000 --- a/mozilla/xpfe/components/timebomb/resources/content/warn.xul +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - -%commRegionDTD; - -%timebombDTD; -]> - - - - - &warnText.label; - - - - diff --git a/mozilla/xpfe/components/timebomb/resources/locale/en-US/timebomb.dtd b/mozilla/xpfe/components/timebomb/resources/locale/en-US/timebomb.dtd deleted file mode 100644 index 116e69ec2df..00000000000 --- a/mozilla/xpfe/components/timebomb/resources/locale/en-US/timebomb.dtd +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/mozilla/xpfe/components/timebomb/tools/Makefile.in b/mozilla/xpfe/components/timebomb/tools/Makefile.in deleted file mode 100644 index fc258ef7c60..00000000000 --- a/mozilla/xpfe/components/timebomb/tools/Makefile.in +++ /dev/null @@ -1,29 +0,0 @@ -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = timebombgen -SIMPLE_PROGRAMS = timebombgen$(BIN_SUFFIX) - -CPPSRCS = \ - timebombgen.cpp \ - $(NULL) - -LIBS = \ - $(XPCOM_LIBS) \ - $(NSPR_LIBS) \ - $(NULL) - -EXTRA_DSO_LDOPTS += \ - $(MOZ_COMPONENT_LIBS) \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -# Hack to remove object files placed in the srcdir -export:: - $(RM) -f $(addprefix $(srcdir)/, $(CPPSRCS:.cpp=.$(OBJ_SUFFIX))) - diff --git a/mozilla/xpfe/components/timebomb/tools/timebombgen.cpp b/mozilla/xpfe/components/timebomb/tools/timebombgen.cpp deleted file mode 100644 index 827b1b2fe53..00000000000 --- a/mozilla/xpfe/components/timebomb/tools/timebombgen.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * 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): - * Doug Turner - * - * 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. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nspr.h" - -int PrintTime(PRTime* time) -{ - char buffer[30]; - - PR_snprintf(buffer, 30, "%lld", *time); - - printf("time: %s", buffer); - - return 0; -} - -int ParseTime(const char* string, PRTime* time) -{ - PRStatus status = PR_ParseTimeString (string, PR_FALSE, time); - - if (status == PR_FAILURE) - printf("ERROR: Could not parse time. \n"); - return 0; -} - -int Usage() -{ - printf("Usage: timebombgen [-ct] string\n"); - printf(" All time relative to local time zone.\n"); - return 0; -} - -int -main(int argc, char **argv) -{ - PRTime time = LL_Zero(); - - if (argc < 2) - return Usage(); - - char *command = argv[1]; - - if (command && command[0] == '-') - { - if (command[1] == 'c') - { - time = PR_Now(); - return PrintTime(&time); - } - else if (command[1] == 't') - { - char * timeString = argv[2]; - - if (argc < 3 || !timeString || timeString[0] == '\0') - return Usage(); - - ParseTime(timeString, &time); - return PrintTime(&time); - } - } - - return Usage(); -} diff --git a/mozilla/xpinstall/packager/packages-os2 b/mozilla/xpinstall/packager/packages-os2 index 099afef358b..0fe9f9bf197 100644 --- a/mozilla/xpinstall/packager/packages-os2 +++ b/mozilla/xpinstall/packager/packages-os2 @@ -94,7 +94,6 @@ bin/components/history.xpt ;bin/components/alerts.xpt bin/components/related.xpt bin/components/search.xpt -bin/components/timebomb.xpt bin/components/urlbarhistory.xpt ;bin/components/urlwidgt.xpt bin/components/caps.dll diff --git a/mozilla/xpinstall/packager/packages-static-unix b/mozilla/xpinstall/packager/packages-static-unix index 38439974566..ad37a88d9ba 100644 --- a/mozilla/xpinstall/packager/packages-static-unix +++ b/mozilla/xpinstall/packager/packages-static-unix @@ -72,7 +72,6 @@ bin/components/bookmarks.xpt bin/components/directory.xpt bin/components/downloadmanager.xpt bin/components/history.xpt -bin/components/timebomb.xpt bin/components/related.xpt bin/components/urlbarhistory.xpt bin/components/search.xpt diff --git a/mozilla/xpinstall/packager/packages-static-win b/mozilla/xpinstall/packager/packages-static-win index 0ed75f0d96d..74e32bb9443 100644 --- a/mozilla/xpinstall/packager/packages-static-win +++ b/mozilla/xpinstall/packager/packages-static-win @@ -89,7 +89,6 @@ bin\components\history.xpt bin\components\winhooks.xpt bin\components\related.xpt bin\components\search.xpt -bin\components\timebomb.xpt bin\components\urlbarhistory.xpt bin\components\urlwidgt.xpt bin\components\universalchardet.dll diff --git a/mozilla/xpinstall/packager/packages-unix b/mozilla/xpinstall/packager/packages-unix index a651012ecaa..c5e266036f6 100644 --- a/mozilla/xpinstall/packager/packages-unix +++ b/mozilla/xpinstall/packager/packages-unix @@ -81,7 +81,6 @@ bin/components/bookmarks.xpt bin/components/directory.xpt bin/components/downloadmanager.xpt bin/components/history.xpt -bin/components/timebomb.xpt bin/components/related.xpt bin/components/urlbarhistory.xpt bin/components/search.xpt diff --git a/mozilla/xpinstall/packager/packages-win b/mozilla/xpinstall/packager/packages-win index 8efb8c36f22..cfd6bf768f5 100644 --- a/mozilla/xpinstall/packager/packages-win +++ b/mozilla/xpinstall/packager/packages-win @@ -86,7 +86,6 @@ bin\components\winhooks.xpt bin\components\alerts.xpt bin\components\related.xpt bin\components\search.xpt -bin\components\timebomb.xpt bin\components\urlbarhistory.xpt bin\components\urlwidgt.xpt bin\components\chardetc.dll