mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
bug 193740. remove timebomb code
r=neil.parkwaycc.co.uk@myrealbox.com sr=alecf
This commit is contained in:
parent
a8253ec478
commit
2caffc1227
@ -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
|
||||
|
@ -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<nsIPref> prefs(do_GetService(kPrefServiceCID));
|
||||
if (!prefs) return NS_ERROR_FAILURE;
|
||||
|
||||
PRBool expired;
|
||||
nsCOMPtr<nsITimeBomb> 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<nsIPref> 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<nsIBrowserHistory> 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<nsIBrowserHistory> 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);
|
||||
|
@ -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:
|
||||
|
@ -1,2 +0,0 @@
|
||||
<!-- timebomb.dtd -->
|
||||
<!ENTITY timeBombURL.label "http://www.mozilla.org/time-bomb.html">
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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 },
|
||||
|
@ -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)
|
||||
|
@ -1 +0,0 @@
|
||||
Makefile
|
@ -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
|
||||
|
@ -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 <dougt@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.
|
||||
*
|
||||
* ***** 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"
|
||||
%}
|
||||
|
@ -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 <dougt@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.
|
||||
*
|
||||
* ***** 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<nsIURI> URL;
|
||||
|
||||
rv = NS_NewURI(getter_AddRefs(URL), (const char *)urlStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIAppShellService> appShell =
|
||||
do_GetService(kAppShellServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIXULWindow> 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;
|
||||
}
|
@ -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 <dougt@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.
|
||||
*
|
||||
* ***** 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<nsIPref> mPrefs;
|
||||
nsresult GetInt64ForPref(const char* pref, PRInt64* time);
|
||||
};
|
||||
|
||||
#endif // nstimebomb_h___
|
@ -1,43 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- 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 Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Doug Turner (dougt@netscape.com)
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % commRegionDTD SYSTEM "chrome://communicator-region/locale/region.dtd" >
|
||||
%commRegionDTD;
|
||||
<!ENTITY % timebombDTD SYSTEM "chrome://communicator/locale/timebomb/timebomb.dtd">
|
||||
%timebombDTD;
|
||||
]>
|
||||
|
||||
<dialog title="&title.label;"
|
||||
id="timebomb-window"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttons="accept"
|
||||
ondialogaccept="window.close()">
|
||||
|
||||
<vbox>
|
||||
<description flex="1">&expireText.label;</description>
|
||||
</vbox>
|
||||
|
||||
</dialog>
|
@ -1,44 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- 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 Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Doug Turner (dougt@netscape.com)
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
|
||||
<!DOCTYPE dialog [
|
||||
<!ENTITY % commRegionDTD SYSTEM "chrome://communicator-region/locale/region.dtd" >
|
||||
%commRegionDTD;
|
||||
<!ENTITY % timebombDTD SYSTEM "chrome://communicator/locale/timebomb/timebomb.dtd">
|
||||
%timebombDTD;
|
||||
]>
|
||||
|
||||
<dialog title="&title.label;"
|
||||
id="timebomb-window"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttons="accept"
|
||||
ondialogaccept="window.close()">
|
||||
|
||||
<vbox>
|
||||
<description flex="1">&warnText.label;</description>
|
||||
</vbox>
|
||||
|
||||
</dialog>
|
||||
|
@ -1,5 +0,0 @@
|
||||
<!ENTITY title.label "Time Bomb Version">
|
||||
<!ENTITY okButton.label "OK">
|
||||
<!ENTITY warnText.label "This is a warning that this product will expire. Please visit &timeBombURL.label; for newer versions.">
|
||||
<!ENTITY expireText.label "This version has expired. You must download a newer version at &timeBombURL.label;.">
|
||||
|
@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
timebombgen
|
@ -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)))
|
||||
|
@ -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 <dougt@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.
|
||||
*
|
||||
* ***** 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();
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user