зеркало из https://github.com/mozilla/gecko-dev.git
Bug 383167 try #3 - need buildid in an external file, r=luser sr=jst with additional parts r=biesi
This commit is contained in:
Родитель
d16e5a9bee
Коммит
f1593a410c
|
@ -198,4 +198,4 @@ deliver: splitsymbols rebase signnss
|
|||
|
||||
endif # WINNT
|
||||
|
||||
BUILDID = $(shell cat $(DEPTH)/config/build_number)
|
||||
BUILDID = $(shell $(PYTHON) $(srcdir)/config/printconfigsetting.py $(DIST)/bin/application.ini App BuildID)
|
||||
|
|
|
@ -65,27 +65,16 @@ DEFINES += -DAPP_VERSION="$(APP_VERSION)"
|
|||
APP_UA_NAME = $(shell echo $(MOZ_APP_DISPLAYNAME) | sed -e's/[^A-Za-z]//g')
|
||||
DEFINES += -DAPP_UA_NAME="$(APP_UA_NAME)"
|
||||
|
||||
ifdef LIBXUL_SDK
|
||||
# Build application.ini for a XULRunner app
|
||||
|
||||
DIST_FILES = application.ini
|
||||
|
||||
# GRE_BUILD_ID is only available in nsBuildID.h in a form that we can't use
|
||||
# directly. So munge it. Beware makefile and shell escaping
|
||||
AWK_EXPR = '/\#define GRE_BUILD_ID/ { gsub(/"/, "", $$3); print $$3 }'
|
||||
AWK_CMD = awk $(AWK_EXPR) < $(LIBXUL_DIST)/include/nsBuildID.h
|
||||
GRE_MILESTONE = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build Milestone)
|
||||
GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBXUL_DIST)/bin/platform.ini Build BuildID)
|
||||
|
||||
GRE_BUILD_ID = $(shell $(AWK_CMD))
|
||||
DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DGRE_BUILDID=$(GRE_BUILDID)
|
||||
|
||||
DEFINES += -DGRE_BUILD_ID=$(GRE_BUILD_ID)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
else
|
||||
ifndef LIBXUL_SDK
|
||||
# Build a binary bootstrapping with XRE_main
|
||||
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
|
||||
ifeq ($(USE_SHORT_LIBNAME), 1)
|
||||
PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
|
||||
else
|
||||
|
@ -94,6 +83,7 @@ endif
|
|||
|
||||
REQUIRES = \
|
||||
xpcom \
|
||||
string \
|
||||
xulapp \
|
||||
$(NULL)
|
||||
|
||||
|
@ -120,11 +110,18 @@ ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
|||
TK_LIBS := -framework Cocoa $(TK_LIBS)
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_LIBXUL
|
||||
APP_XPCOM_LIBS = $(XPCOM_GLUE_LDOPTS)
|
||||
else
|
||||
MOZILLA_INTERNAL_API = 1
|
||||
APP_XPCOM_LIBS = $(XPCOM_LIBS)
|
||||
endif
|
||||
|
||||
LIBS += \
|
||||
$(STATIC_COMPONENTS_LINKER_PATH) \
|
||||
$(EXTRA_DSO_LIBS) \
|
||||
$(MOZ_JS_LIBS) \
|
||||
$(XPCOM_LIBS) \
|
||||
$(APP_XPCOM_LIBS) \
|
||||
$(NSPR_LIBS) \
|
||||
$(TK_LIBS) \
|
||||
$(NULL)
|
||||
|
|
|
@ -40,18 +40,20 @@
|
|||
Vendor=Mozilla
|
||||
Name=Firefox
|
||||
Version=@APP_VERSION@
|
||||
BuildID=@BUILD_ID@
|
||||
BuildID=@GRE_BUILDID@
|
||||
Copyright=Copyright (c) 1998 - 2007 mozilla.org
|
||||
ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
|
||||
|
||||
[Gecko]
|
||||
MinVersion=@GRE_BUILD_ID@
|
||||
MaxVersion=@GRE_BUILD_ID@
|
||||
MinVersion=@GRE_MILESTONE@
|
||||
MaxVersion=@GRE_MILESTONE@
|
||||
|
||||
[XRE]
|
||||
EnableProfileMigrator=1
|
||||
EnableExtensionManager=1
|
||||
|
||||
[Crash Reporter]
|
||||
Enabled=0
|
||||
#if MOZILLA_OFFICIAL
|
||||
Enabled=1
|
||||
#endif
|
||||
ServerURL=https://crash-reports.mozilla.com/submit
|
||||
|
|
|
@ -41,32 +41,52 @@
|
|||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include "nsBuildID.h"
|
||||
|
||||
static const nsXREAppData kAppData = {
|
||||
sizeof(nsXREAppData),
|
||||
nsnull,
|
||||
"Mozilla",
|
||||
"Firefox",
|
||||
NS_STRINGIFY(APP_VERSION),
|
||||
NS_STRINGIFY(BUILD_ID),
|
||||
"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"Copyright (c) 1998 - 2007 mozilla.org",
|
||||
NS_XRE_ENABLE_PROFILE_MIGRATOR |
|
||||
NS_XRE_ENABLE_EXTENSION_MANAGER
|
||||
#if defined(MOZILLA_OFFICIAL)
|
||||
| NS_XRE_ENABLE_CRASH_REPORTER
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
static void Output(const char *fmt, ... )
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
||||
#if defined(XP_WIN) && !MOZ_WINCONSOLE
|
||||
char msg[2048];
|
||||
|
||||
vsnprintf(msg, sizeof(msg), fmt, ap);
|
||||
|
||||
MessageBox(NULL, msg, "XULRunner", MB_OK | MB_ICONERROR);
|
||||
#else
|
||||
vfprintf(stderr, fmt, ap);
|
||||
#endif
|
||||
,
|
||||
nsnull, // xreDirectory
|
||||
nsnull, // minVersion
|
||||
nsnull, // maxVersion
|
||||
"https://crash-reports.mozilla.com/submit"
|
||||
};
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
return XRE_main(argc, argv, &kAppData);
|
||||
nsCOMPtr<nsILocalFile> appini;
|
||||
nsresult rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appini));
|
||||
if (NS_FAILED(rv)) {
|
||||
Output("Couldn't calculate the application directory.");
|
||||
return 255;
|
||||
}
|
||||
appini->SetNativeLeafName(NS_LITERAL_CSTRING("application.ini"));
|
||||
|
||||
nsXREAppData *appData;
|
||||
rv = XRE_CreateAppData(appini, &appData);
|
||||
if (NS_FAILED(rv)) {
|
||||
Output("Couldn't read application.ini");
|
||||
return 255;
|
||||
}
|
||||
|
||||
int result = XRE_main(argc, argv, appData);
|
||||
XRE_FreeAppData(appData);
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined( XP_WIN ) && defined( WIN32 ) && !defined(__GNUC__)
|
||||
|
|
|
@ -45,6 +45,8 @@ bin/components/libjar50.so
|
|||
; [Base Browser Files]
|
||||
bin/@MOZ_APP_NAME@-bin
|
||||
bin/@MOZ_APP_NAME@
|
||||
bin/application.ini
|
||||
bin/platform.ini
|
||||
bin/mozilla-xremote-client
|
||||
bin/run-mozilla.sh
|
||||
bin/plugins/libnullplugin.so
|
||||
|
|
|
@ -48,6 +48,8 @@ bin\msvcr80.dll
|
|||
[browser]
|
||||
; [Base Browser Files]
|
||||
bin\@MOZ_APP_NAME@.exe
|
||||
bin\application.ini
|
||||
bin\platform.ini
|
||||
bin\plugins\npnul32.dll
|
||||
bin\res\cmessage.txt
|
||||
bin\res\effective_tld_names.dat
|
||||
|
|
|
@ -457,6 +457,7 @@ ifndef MAKE
|
|||
MAKE := gmake
|
||||
endif
|
||||
PERL ?= perl
|
||||
PYTHON ?= python
|
||||
|
||||
CONFIG_GUESS_SCRIPT := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess)
|
||||
ifdef CONFIG_GUESS_SCRIPT
|
||||
|
@ -940,7 +941,7 @@ else
|
|||
ifdef MOZ_UNIFY_BDATE
|
||||
ifndef MOZ_BUILD_DATE
|
||||
ifdef MOZ_BUILD_PROJECTS
|
||||
MOZ_BUILD_DATE = $(shell $(PERL) -I$(TOPSRCDIR)/config $(TOPSRCDIR)/config/bdate.pl)
|
||||
MOZ_BUILD_DATE = $(shell $(PYTHON) $(TOPSRCDIR)/toolkit/xre/make-platformini.py --print-buildid)
|
||||
export MOZ_BUILD_DATE
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -59,9 +59,6 @@ PLSRCS = nfspwd.pl revdepth.pl
|
|||
|
||||
TARGETS = $(HOST_PROGRAM) $(PLSRCS:.pl=) $(SIMPLE_PROGRAMS)
|
||||
|
||||
# Generate the build number on the fly.
|
||||
TARGETS += build_number nsBuildID.h
|
||||
|
||||
ifndef CROSS_COMPILE
|
||||
ifdef USE_ELF_DYNSTR_GC
|
||||
TARGETS += elf-dynstr-gc
|
||||
|
@ -96,7 +93,6 @@ NSPR_CFLAGS += -I$(srcdir)/../nsprpub/pr/include/md
|
|||
endif
|
||||
|
||||
HEADERS = \
|
||||
nsBuildID.h \
|
||||
$(DEPTH)/mozilla-config.h \
|
||||
$(srcdir)/nsStaticComponents.h \
|
||||
$(NULL)
|
||||
|
@ -123,35 +119,12 @@ export::
|
|||
$(INSTALL) system_wrappers $(DIST)/include
|
||||
endif
|
||||
|
||||
# we don't use an explicit dependency here because then we would
|
||||
# regenerate nsBuildID.h during the make install phase and that would
|
||||
# be bad.
|
||||
install::
|
||||
@if test ! -f nsBuildID.h; then\
|
||||
echo "You must have done at least a make export before trying to do a make install."; \
|
||||
echo "(nsBuildID.h is missing.)"; \
|
||||
exit 1; \
|
||||
fi;
|
||||
$(SYSINSTALL) $(IFLAGS1) $(DEPTH)/mozilla-config.h $(DESTDIR)$(includedir)
|
||||
|
||||
GARBAGE += build_number nsBuildID \
|
||||
GARBAGE += \
|
||||
$(FINAL_LINK_COMPS) $(FINAL_LINK_LIBS) $(FINAL_LINK_COMP_NAMES)
|
||||
|
||||
ifneq (,$(BUILD_OFFICIAL)$(MOZILLA_OFFICIAL))
|
||||
_BN_OFFICIAL=1
|
||||
else
|
||||
_BN_OFFICIAL=
|
||||
endif
|
||||
|
||||
build_number: FORCE
|
||||
$(PERL) -I$(srcdir) $(srcdir)/bdate.pl $@ $(_BN_OFFICIAL)
|
||||
|
||||
nsBuildID.h: nsBuildID.h.in build_number $(srcdir)/milestone.txt Makefile
|
||||
$(RM) $@
|
||||
MOZ_MILESTONE_RELEASE=$(MOZ_MILESTONE_RELEASE); \
|
||||
export MOZ_MILESTONE_RELEASE; \
|
||||
$(PERL) -I$(srcdir) $(srcdir)/aboutime.pl -m $(srcdir)/milestone.txt $@ build_number $(srcdir)/nsBuildID.h.in
|
||||
|
||||
ifndef CROSS_COMPILE
|
||||
ifdef USE_ELF_DYNSTR_GC
|
||||
elf-dynstr-gc: elf-dynstr-gc.c Makefile Makefile.in
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
|
||||
use strict;
|
||||
use Getopt::Std;
|
||||
require mozBDate;
|
||||
require "Moz/Milestone.pm";
|
||||
|
||||
my $mfile;
|
||||
getopts('m:');
|
||||
if (defined($::opt_m)) {
|
||||
$mfile = $::opt_m;
|
||||
}
|
||||
|
||||
my $outfile = $ARGV[0];
|
||||
my $build_num_file = $ARGV[1];
|
||||
my $infile = "";
|
||||
|
||||
$infile = $ARGV[2] if ("$ARGV[2]" ne "");
|
||||
|
||||
if (defined($mfile)) {
|
||||
my $milestone = &Moz::Milestone::getOfficialMilestone($mfile);
|
||||
&mozBDate::SetMilestone($milestone);
|
||||
}
|
||||
&mozBDate::SubstituteBuildNumber($outfile, $build_num_file, $infile);
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 MPL, 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 MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
**
|
||||
** bdate.c: Possibly cross-platform date-based build number
|
||||
** generator. Output is YYJJJ, where YY == 2-digit
|
||||
** year, and JJJ is the Julian date (day of the year).
|
||||
**
|
||||
** Author: briano@netscape.com
|
||||
**
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef SUNOS4
|
||||
#include "sunos4.h"
|
||||
#endif
|
||||
|
||||
void main(void)
|
||||
{
|
||||
time_t t = time(NULL);
|
||||
struct tm *tms;
|
||||
|
||||
tms = localtime(&t);
|
||||
printf("500%02d%03d%02d\n", tms->tm_year, 1+tms->tm_yday, tms->tm_hour);
|
||||
exit(0);
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla 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/MPL/
|
||||
#
|
||||
# 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):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of 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 MPL, 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 MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
use mozBDate;
|
||||
|
||||
# Both "generate" args are optional
|
||||
$file = $ARGV[0] if ("$ARGV[0]" ne "");
|
||||
$official = 1 if ("$ARGV[1]" ne "");
|
||||
&mozBDate::UpdateBuildNumber($file, $official);
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla 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/MPL/
|
||||
#
|
||||
# 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):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of 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 MPL, 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 MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
my $progname = $0;
|
||||
my $contents;
|
||||
|
||||
# this script needs to be run in config
|
||||
my $numberfile = "build_number";
|
||||
|
||||
# This is the preferences file that gets read and written.
|
||||
|
||||
open(NUMBER, "<$numberfile") || die "no build_number file\n";
|
||||
|
||||
while ( <NUMBER> ) {
|
||||
$build_number = $_
|
||||
}
|
||||
close (NUMBER);
|
||||
|
||||
chop($build_number);
|
||||
|
|
@ -871,12 +871,6 @@ ifdef LOCALE_SRCDIR
|
|||
MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
|
||||
endif
|
||||
|
||||
#
|
||||
# Add BUILD_ID to set of DEFINES
|
||||
#
|
||||
BUILD_ID := $(shell cat $(DEPTH)/config/build_number)
|
||||
DEFINES += -DBUILD_ID=$(BUILD_ID)
|
||||
|
||||
ifeq (,$(filter WINCE WINNT OS2,$(OS_ARCH)))
|
||||
RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
|
||||
endif
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,172 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla 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/MPL/
|
||||
#
|
||||
# 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-2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of 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 MPL, 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 MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
package mozBDate;
|
||||
|
||||
use strict;
|
||||
use IO::File;
|
||||
|
||||
BEGIN {
|
||||
use Exporter ();
|
||||
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $milestone);
|
||||
|
||||
$VERSION = 1.00;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT = qw(&UpdateBuildNumber &SubstituteBuildNumber &SetMilestone);
|
||||
%EXPORT_TAGS = ( );
|
||||
@EXPORT_OK = qw();
|
||||
}
|
||||
|
||||
local $mozBDate::milestone = "0.0";
|
||||
|
||||
sub write_number($) {
|
||||
my ($file, $num) = @_;
|
||||
unlink($file);
|
||||
open(OUT, ">$file") || die "$file: $!\n";
|
||||
print OUT "$num\n";
|
||||
close(OUT);
|
||||
}
|
||||
|
||||
sub UpdateBuildNumber($$) {
|
||||
|
||||
my ($outfile, $official) = @_;
|
||||
my $given_date = $ENV{"MOZ_BUILD_DATE"};
|
||||
my $build_number;
|
||||
|
||||
if ($given_date eq "") {
|
||||
# XP way of doing the build date.
|
||||
# 1998091509 = 1998, September, 15th, 9am local time zone
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
|
||||
localtime(time);
|
||||
|
||||
# localtime returns year minus 1900
|
||||
$year = $year + 1900;
|
||||
$build_number = sprintf("%04d%02d%02d%02d", $year, 1+$mon,
|
||||
$mday, $hour);
|
||||
}
|
||||
else {
|
||||
$build_number = $given_date;
|
||||
}
|
||||
|
||||
if ("$outfile" eq "") {
|
||||
print "$build_number\n";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$official) {
|
||||
$build_number = "0000000000";
|
||||
}
|
||||
|
||||
my $old_num = "";
|
||||
|
||||
# Don't overwrite $outfile if its contents won't change
|
||||
if ( -e $outfile ) {
|
||||
open(OLD, "<$outfile") || die "$outfile: $!\n";
|
||||
$old_num = <OLD>;
|
||||
chomp($old_num);
|
||||
close(OLD);
|
||||
}
|
||||
|
||||
if ($old_num ne $build_number) {
|
||||
&write_number($outfile, $build_number);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub SubstituteBuildNumber($$$) {
|
||||
|
||||
my ($outfile, $build_num, $infile) = @_;
|
||||
my $INFILE = new IO::File;
|
||||
my $OUTFILE = new IO::File;
|
||||
|
||||
open $INFILE, "<$build_num";
|
||||
my $build = <$INFILE>;
|
||||
close $INFILE;
|
||||
chomp $build;
|
||||
chop $build if (substr($build, -1, 1) eq "\r");
|
||||
|
||||
if ($infile ne "") {
|
||||
open($INFILE, "< $infile") || die "$infile: $!\n";
|
||||
} else {
|
||||
open($INFILE, "< $outfile") || die "$outfile: $!\n";
|
||||
}
|
||||
open $OUTFILE, ">${outfile}.old" || die;
|
||||
|
||||
while (<$INFILE>) {
|
||||
my $id = $_;
|
||||
my $temp;
|
||||
if ($id =~ "Build ID:") {
|
||||
$temp = "Build ID: " . $build;
|
||||
$id =~ s/Build ID:\s\d+/$temp/;
|
||||
print $OUTFILE $id;
|
||||
}
|
||||
elsif ($id =~ "NS_BUILD_ID") {
|
||||
$temp = "NS_BUILD_ID " . $build;
|
||||
$id =~ s/NS_BUILD_ID\s\d+/$temp/;
|
||||
print $OUTFILE $id;
|
||||
}
|
||||
elsif ($id =~ "GRE_BUILD_ID") {
|
||||
if (defined($ENV{'MOZ_MILESTONE_RELEASE'}) &&
|
||||
$ENV{'MOZ_MILESTONE_RELEASE'} ne "") {
|
||||
$temp = "GRE_BUILD_ID \"$milestone\"";
|
||||
} else {
|
||||
$temp = "GRE_BUILD_ID \"${milestone}_${build}\"";
|
||||
}
|
||||
$id =~ s/GRE_BUILD_ID\s\"\d+\"/$temp/;
|
||||
print $OUTFILE $id;
|
||||
}
|
||||
else {
|
||||
print $OUTFILE $_;
|
||||
}
|
||||
}
|
||||
|
||||
close $INFILE;
|
||||
close $OUTFILE;
|
||||
|
||||
unlink $outfile;
|
||||
rename "${outfile}.old", "$outfile";
|
||||
}
|
||||
|
||||
sub SetMilestone($) {
|
||||
my ($mstone) = (@_);
|
||||
$milestone = $mstone if ($mstone ne "");
|
||||
}
|
||||
|
||||
END {};
|
||||
|
||||
1;
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import configobj, sys
|
||||
|
||||
try:
|
||||
(file, section, key) = sys.argv[1:]
|
||||
except ValueError:
|
||||
print "Usage: printconfigsetting.py <file> <section> <setting>"
|
||||
sys.exit(1)
|
||||
|
||||
c = configobj.ConfigObj(file)
|
||||
|
||||
try:
|
||||
s = c[section]
|
||||
except KeyError:
|
||||
print >>sys.stderr, "Section [%s] not found." % section
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
print s[key]
|
||||
except KeyError:
|
||||
print >>sys.stderr, "Key %s not found." % key
|
||||
sys.exit(1)
|
|
@ -138,7 +138,6 @@ if ($bits eq "16") { $fileos="VOS__WINDOWS16"; }
|
|||
my $bufferstr=" ";
|
||||
|
||||
my $MILESTONE_FILE = "$topsrcdir/config/milestone.txt";
|
||||
my $BUILDID_FILE = "$depth/config/build_number";
|
||||
|
||||
#Read module.ver file
|
||||
#Version file overrides for WIN32:
|
||||
|
@ -243,17 +242,7 @@ if ($official eq "1") {
|
|||
|
||||
}
|
||||
|
||||
my ($buildid, $buildid_hi, $buildid_lo);
|
||||
open(NUMBER, "<$BUILDID_FILE") || die "No build number file\n";
|
||||
while ( <NUMBER> ) { $buildid = $_ }
|
||||
close (NUMBER);
|
||||
$buildid =~ s/^\s*(.*)\s*$/$1/;
|
||||
$buildid_hi = substr($buildid, 0, 5);
|
||||
$buildid_lo = substr($buildid, 5);
|
||||
|
||||
$mfversion = $mpversion = "$milestone: $buildid";
|
||||
my @pvarray = split(',', $productversion);
|
||||
$fileversion = "$pvarray[0],$pvarray[1],$buildid_hi,$buildid_lo";
|
||||
$mfversion = $mpversion = "$milestone";
|
||||
}
|
||||
|
||||
my $copyright = "License: MPL 1.1/GPL 2.0/LGPL 2.1";
|
||||
|
@ -390,7 +379,6 @@ print RCFILE qq{
|
|||
//
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION $fileversion
|
||||
PRODUCTVERSION $productversion
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS $fileflags
|
||||
|
|
|
@ -157,6 +157,7 @@
|
|||
#include "nsCDefaultURIFixup.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIXULAppInfo.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "plbase64.h"
|
||||
|
@ -193,8 +194,6 @@
|
|||
static PRLogModuleInfo* gDOMLeakPRLog;
|
||||
#endif
|
||||
|
||||
#include "nsBuildID.h"
|
||||
|
||||
nsIFactory *nsGlobalWindow::sComputedDOMStyleFactory = nsnull;
|
||||
|
||||
static nsIEntropyCollector *gEntropyCollector = nsnull;
|
||||
|
@ -8250,8 +8249,18 @@ nsNavigator::GetOnLine(PRBool* aOnline)
|
|||
NS_IMETHODIMP
|
||||
nsNavigator::GetBuildID(nsAString& aBuildID)
|
||||
{
|
||||
aBuildID = NS_LITERAL_STRING(NS_STRINGIFY(NS_BUILD_ID));
|
||||
nsCOMPtr<nsIXULAppInfo> appInfo =
|
||||
do_GetService("@mozilla.org/xre/app-info;1");
|
||||
if (!appInfo)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
nsCAutoString buildID;
|
||||
nsresult rv = appInfo->GetAppBuildID(buildID);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
aBuildID.Truncate();
|
||||
AppendASCIItoUTF16(buildID, aBuildID);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,10 +73,6 @@
|
|||
#include "nsCRT.h"
|
||||
#include "nsFontMetricsPS.h"
|
||||
|
||||
#ifndef NS_BUILD_ID
|
||||
#include "nsBuildID.h"
|
||||
#endif /* !NS_BUILD_ID */
|
||||
|
||||
#include "nsPrintfCString.h"
|
||||
|
||||
#include "prenv.h"
|
||||
|
@ -413,8 +409,8 @@ nsPostScriptObj::write_prolog(FILE *aHandle, PRBool aFTPEnable)
|
|||
fpCString(fWidth).get(),
|
||||
fpCString(fHeight).get());
|
||||
|
||||
fprintf(f, "%%%%Creator: Mozilla PostScript module (%s/%lu)\n",
|
||||
"rv:" MOZILLA_VERSION, (unsigned long)NS_BUILD_ID);
|
||||
fprintf(f, "%%%%Creator: Mozilla PostScript module (%s)\n",
|
||||
"rv:" MOZILLA_VERSION);
|
||||
fprintf(f, "%%%%DocumentData: Clean8Bit\n");
|
||||
fprintf(f, "%%%%DocumentPaperSizes: %s\n", mPrintSetup->paper_name);
|
||||
fprintf(f, "%%%%Orientation: %s\n",
|
||||
|
|
|
@ -50,9 +50,6 @@ ifeq ($(OS_ARCH),OSF1)
|
|||
SHELL := ksh
|
||||
endif
|
||||
|
||||
BUILD_DATE = gbdate.h
|
||||
BUILD_DATE_TS = gbdate.tstamp
|
||||
|
||||
MODULE = layout
|
||||
LIBRARY_NAME = gklayout
|
||||
EXPORT_LIBRARY = 1
|
||||
|
@ -112,7 +109,6 @@ endif
|
|||
|
||||
CPPSRCS = \
|
||||
nsLayoutModule.cpp \
|
||||
nsContentHTTPStartup.cpp \
|
||||
nsContentDLF.cpp \
|
||||
nsLayoutStatics.cpp \
|
||||
$(NULL)
|
||||
|
@ -298,24 +294,8 @@ endif
|
|||
|
||||
DEFINES += -D_IMPL_NS_LAYOUT
|
||||
|
||||
GARBAGE += $(BUILD_DATE) $(BUILD_DATE_TS)
|
||||
|
||||
ifeq ($(OS_ARCH),IRIX)
|
||||
ifeq ($(GNU_CXX),1)
|
||||
LDFLAGS += -Wl,-LD_LAYOUT:lgot_buffer=50
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
export:: $(BUILD_DATE)
|
||||
|
||||
$(BUILD_DATE_TS): FORCE
|
||||
@for f in $(SHARED_LIBRARY_LIBS); do \
|
||||
if [ $$f -nt $@ ]; then \
|
||||
touch $@; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
$(BUILD_DATE):: gbdate.pl $(BUILD_DATE_TS)
|
||||
$(RM) $@
|
||||
$(PERL) $(srcdir)/gbdate.pl > $@
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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):
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 MPL, 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 MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICategoryManager.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsContentHTTPStartup.h"
|
||||
#include "nsIHttpProtocolHandler.h"
|
||||
#include "gbdate.h"
|
||||
|
||||
#define PRODUCT_NAME "Gecko"
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsContentHTTPStartup,nsIObserver)
|
||||
|
||||
nsresult
|
||||
nsContentHTTPStartup::Observe( nsISupports *aSubject,
|
||||
const char *aTopic,
|
||||
const PRUnichar *aData)
|
||||
{
|
||||
if (nsCRT::strcmp(aTopic, NS_HTTP_STARTUP_TOPIC) != 0)
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv = nsnull;
|
||||
|
||||
nsCOMPtr<nsIHttpProtocolHandler> http(do_QueryInterface(aSubject));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = http->SetProduct(NS_LITERAL_CSTRING(PRODUCT_NAME));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = http->SetProductSub(NS_LITERAL_CSTRING(PRODUCT_VERSION));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentHTTPStartup::RegisterHTTPStartup(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath,
|
||||
const char* aRegistryLocation,
|
||||
const char* aComponentType,
|
||||
const nsModuleComponentInfo* aInfo)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICategoryManager>
|
||||
catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString previousEntry;
|
||||
rv = catMan->AddCategoryEntry(NS_HTTP_STARTUP_CATEGORY,
|
||||
"Content UserAgent Setter",
|
||||
NS_CONTENTHTTPSTARTUP_CONTRACTID,
|
||||
PR_TRUE, PR_TRUE,
|
||||
getter_Copies(previousEntry));
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentHTTPStartup::UnregisterHTTPStartup(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath,
|
||||
const char* aRegistryLocation,
|
||||
const nsModuleComponentInfo* aInfo)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICategoryManager>
|
||||
catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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):
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 MPL, 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 MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIObserver.h"
|
||||
|
||||
#define NS_CONTENTHTTPSTARTUP_CONTRACTID \
|
||||
"@mozilla.org/content/http-startup;1"
|
||||
|
||||
/* c2f6ef7e-afd5-4be4-a1f5-c824efa4231b */
|
||||
#define NS_CONTENTHTTPSTARTUP_CID \
|
||||
{ 0xc2f6ef7e, 0xafd5, 0x4be4, \
|
||||
{0xa1, 0xf5, 0xc8, 0x24, 0xef, 0xa4, 0x23, 0x1b} }
|
||||
|
||||
struct nsModuleComponentInfo;
|
||||
class nsIFile;
|
||||
|
||||
class nsContentHTTPStartup : public nsIObserver
|
||||
{
|
||||
public:
|
||||
nsContentHTTPStartup() { }
|
||||
virtual ~nsContentHTTPStartup() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
public:
|
||||
static NS_IMETHODIMP
|
||||
RegisterHTTPStartup(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath,
|
||||
const char* aRegistryLocation,
|
||||
const char* aComponentType,
|
||||
const nsModuleComponentInfo* aInfo);
|
||||
|
||||
static NS_IMETHODIMP
|
||||
UnregisterHTTPStartup(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath,
|
||||
const char* aRegistryLocation,
|
||||
const nsModuleComponentInfo* aInfo);
|
||||
|
||||
private:
|
||||
nsresult setUserAgent();
|
||||
|
||||
};
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
#include "nsLayoutStatics.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsContentHTTPStartup.h"
|
||||
#include "nsContentDLF.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsDataDocumentContentPolicy.h"
|
||||
|
@ -517,7 +516,6 @@ MAKE_CTOR(CreateXULPopupListener, nsIXULPopupListener, NS_NewXUL
|
|||
MAKE_CTOR(CreateXTFService, nsIXTFService, NS_NewXTFService)
|
||||
MAKE_CTOR(CreateXMLContentBuilder, nsIXMLContentBuilder, NS_NewXMLContentBuilder)
|
||||
#endif
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsContentHTTPStartup)
|
||||
MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCSSOMFactory)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsInspectorCSSUtils)
|
||||
|
@ -1218,13 +1216,6 @@ static const nsModuleComponentInfo gComponents[] = {
|
|||
CreateXMLContentBuilder },
|
||||
#endif
|
||||
|
||||
{ "Content HTTP Startup Listener",
|
||||
NS_CONTENTHTTPSTARTUP_CID,
|
||||
NS_CONTENTHTTPSTARTUP_CONTRACTID,
|
||||
nsContentHTTPStartupConstructor,
|
||||
nsContentHTTPStartup::RegisterHTTPStartup,
|
||||
nsContentHTTPStartup::UnregisterHTTPStartup },
|
||||
|
||||
{ "Document Loader Factory",
|
||||
NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID,
|
||||
"@mozilla.org/content/document-loader-factory;1",
|
||||
|
|
|
@ -606,17 +606,10 @@ int strncasecmp(const char *str1, const char *str2, int length)
|
|||
|
||||
#include "NSReg.h"
|
||||
#include "VerReg.h"
|
||||
#include "nsBuildID.h"
|
||||
|
||||
char *TheRegistry = "registry";
|
||||
char *Flist;
|
||||
|
||||
/* WARNING: build hackery */
|
||||
#if defined(STANDALONE_REGISTRY) && !defined(XP_MAC) && !defined(XP_MACOSX)
|
||||
long BUILDNUM = NS_BUILD_ID;
|
||||
#endif
|
||||
|
||||
|
||||
REGERR vr_ParseVersion(char *verstr, VERSION *result);
|
||||
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
|
|
|
@ -75,6 +75,8 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsIOService.h"
|
||||
|
||||
#include "nsIXULAppInfo.h"
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
@ -164,6 +166,7 @@ nsHttpHandler::nsHttpHandler()
|
|||
, mPhishyUserPassLength(1)
|
||||
, mLastUniqueID(NowInSeconds())
|
||||
, mSessionStartTime(0)
|
||||
, mProduct("Gecko")
|
||||
, mUserAgentIsDirty(PR_TRUE)
|
||||
, mUseCache(PR_TRUE)
|
||||
, mSendSecureXSiteReferrer(PR_TRUE)
|
||||
|
@ -258,6 +261,11 @@ nsHttpHandler::Init()
|
|||
rv = InitConnectionMgr();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIXULAppInfo> appInfo =
|
||||
do_GetService("@mozilla.org/xre/app-info;1");
|
||||
if (appInfo)
|
||||
appInfo->GetPlatformBuildID(mProductSub);
|
||||
|
||||
// Startup the http category
|
||||
// Bring alive the objects in the http-protocol-startup category
|
||||
NS_CreateServicesFromCategory(NS_HTTP_STARTUP_CATEGORY,
|
||||
|
@ -816,16 +824,6 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
|||
}
|
||||
|
||||
// Gather product values.
|
||||
if (PREF_CHANGED(UA_PREF("product"))) {
|
||||
prefs->GetCharPref(UA_PREF_PREFIX "product",
|
||||
getter_Copies(mProduct));
|
||||
mUserAgentIsDirty = PR_TRUE;
|
||||
}
|
||||
if (PREF_CHANGED(UA_PREF("productSub"))) {
|
||||
prefs->GetCharPref(UA_PREF("productSub"),
|
||||
getter_Copies(mProductSub));
|
||||
mUserAgentIsDirty = PR_TRUE;
|
||||
}
|
||||
if (PREF_CHANGED(UA_PREF("productComment"))) {
|
||||
prefs->GetCharPref(UA_PREF("productComment"),
|
||||
getter_Copies(mProductComment));
|
||||
|
|
|
@ -284,7 +284,7 @@ private:
|
|||
nsXPIDLCString mVendor;
|
||||
nsXPIDLCString mVendorSub;
|
||||
nsXPIDLCString mVendorComment;
|
||||
nsXPIDLCString mProduct;
|
||||
nsCString mProduct;
|
||||
nsXPIDLCString mProductSub;
|
||||
nsXPIDLCString mProductComment;
|
||||
nsCString mExtraUA;
|
||||
|
|
|
@ -93,7 +93,6 @@ FORCE_STATIC_LIB = 1
|
|||
|
||||
XPIDLSRCS = \
|
||||
nsINativeAppSupport.idl \
|
||||
nsIXULAppInfo.idl \
|
||||
nsIXULRuntime.idl \
|
||||
$(NULL)
|
||||
|
||||
|
@ -253,3 +252,12 @@ endif
|
|||
|
||||
export:: $(addprefix $(topsrcdir)/xpfe/bootstrap/, $(SHAREDCPPSRCS)) $(STACKWALK_CPPSRCS)
|
||||
$(INSTALL) $^ .
|
||||
|
||||
platform.ini: FORCE
|
||||
$(PYTHON) $(srcdir)/make-platformini.py $(topsrcdir)/config/milestone.txt > $@
|
||||
|
||||
libs:: platform.ini
|
||||
$(INSTALL) $^ $(DIST)/bin
|
||||
|
||||
install::
|
||||
$(INSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
from optparse import OptionParser
|
||||
from datetime import datetime
|
||||
import sys
|
||||
import os
|
||||
|
||||
o = OptionParser()
|
||||
o.add_option("--print-buildid", action="store_true", dest="print_buildid")
|
||||
|
||||
(options, args) = o.parse_args()
|
||||
buildid = os.environ.get('MOZ_BUILD_DATE', datetime.now().strftime('%Y%m%d%H'))
|
||||
|
||||
if options.print_buildid:
|
||||
print buildid
|
||||
sys.exit(0)
|
||||
|
||||
(milestoneFile,) = args
|
||||
for line in open(milestoneFile, 'r'):
|
||||
if line[0] == '#':
|
||||
continue
|
||||
|
||||
line = line.strip()
|
||||
if line == '':
|
||||
continue
|
||||
|
||||
milestone = line
|
||||
|
||||
print """[Build]
|
||||
BuildID=%s
|
||||
Milestone=%s""" % (buildid, milestone)
|
|
@ -69,6 +69,8 @@ ScopedAppData::ScopedAppData(const nsXREAppData* aAppData)
|
|||
{
|
||||
Zero();
|
||||
|
||||
this->size = aAppData->size;
|
||||
|
||||
SetAllocatedString(this->vendor, aAppData->vendor);
|
||||
SetAllocatedString(this->name, aAppData->name);
|
||||
SetAllocatedString(this->version, aAppData->version);
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
|
||||
#include "nsAppRunner.h"
|
||||
#include "nsUpdateDriver.h"
|
||||
#include "nsBuildID.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include "MacLaunchHelper.h"
|
||||
|
@ -266,6 +265,9 @@ extern "C" {
|
|||
int gArgc;
|
||||
char **gArgv;
|
||||
|
||||
static char gToolkitVersion[20];
|
||||
static char gToolkitBuildID[40];
|
||||
|
||||
static int gRestartArgc;
|
||||
static char **gRestartArgv;
|
||||
|
||||
|
@ -590,7 +592,7 @@ nsXULAppInfo::GetVersion(nsACString& aResult)
|
|||
NS_IMETHODIMP
|
||||
nsXULAppInfo::GetPlatformVersion(nsACString& aResult)
|
||||
{
|
||||
aResult.AssignLiteral(TOOLKIT_EM_VERSION);
|
||||
aResult.AssignLiteral(gToolkitVersion);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -606,7 +608,7 @@ nsXULAppInfo::GetAppBuildID(nsACString& aResult)
|
|||
NS_IMETHODIMP
|
||||
nsXULAppInfo::GetPlatformBuildID(nsACString& aResult)
|
||||
{
|
||||
aResult.Assign(NS_STRINGIFY(BUILD_ID));
|
||||
aResult.Assign(gToolkitBuildID);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1980,7 +1982,7 @@ static void BuildVersion(nsCString &aBuf)
|
|||
aBuf.Append('_');
|
||||
aBuf.Append(gAppData->buildID);
|
||||
aBuf.Append('/');
|
||||
aBuf.AppendLiteral(GRE_BUILD_ID);
|
||||
aBuf.Append(gToolkitBuildID);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2305,27 +2307,6 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (appData.size > offsetof(nsXREAppData, minVersion)) {
|
||||
if (!appData.minVersion) {
|
||||
Output(PR_TRUE, "Error: Gecko:MinVersion not specified in application.ini\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!appData.maxVersion) {
|
||||
// If no maxVersion is specified, we assume the app is only compatible
|
||||
// with the initial preview release. Do not increment this number ever!
|
||||
SetAllocatedString(appData.maxVersion, "1.*");
|
||||
}
|
||||
|
||||
if (NS_CompareVersions(appData.minVersion, TOOLKIT_EM_VERSION) > 0 ||
|
||||
NS_CompareVersions(appData.maxVersion, TOOLKIT_EM_VERSION) < 0) {
|
||||
Output(PR_TRUE, "Error: Platform version " TOOLKIT_EM_VERSION " is not compatible with\n"
|
||||
"minVersion >= %s\nmaxVersion <= %s\n",
|
||||
appData.minVersion, appData.maxVersion);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
ScopedLogging log;
|
||||
|
||||
if (!appData.xreDirectory) {
|
||||
|
@ -2344,6 +2325,54 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||
return 2;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> iniFile;
|
||||
rv = appData.xreDirectory->Clone(getter_AddRefs(iniFile));
|
||||
if (NS_FAILED(rv))
|
||||
return 2;
|
||||
|
||||
iniFile->AppendNative(NS_LITERAL_CSTRING("platform.ini"));
|
||||
|
||||
nsCOMPtr<nsILocalFile> localIniFile = do_QueryInterface(iniFile);
|
||||
if (!localIniFile)
|
||||
return 2;
|
||||
|
||||
nsINIParser parser;
|
||||
rv = parser.Init(localIniFile);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = parser.GetString("Build", "Milestone",
|
||||
gToolkitVersion, sizeof(gToolkitVersion));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get toolkit version");
|
||||
|
||||
rv = parser.GetString("Build", "BuildID",
|
||||
gToolkitBuildID, sizeof(gToolkitBuildID));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get toolkit buildid");
|
||||
}
|
||||
else {
|
||||
NS_ERROR("Couldn't parse platform.ini!");
|
||||
}
|
||||
|
||||
if (appData.size > offsetof(nsXREAppData, minVersion)) {
|
||||
if (!appData.minVersion) {
|
||||
Output(PR_TRUE, "Error: Gecko:MinVersion not specified in application.ini\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!appData.maxVersion) {
|
||||
// If no maxVersion is specified, we assume the app is only compatible
|
||||
// with the initial preview release. Do not increment this number ever!
|
||||
SetAllocatedString(appData.maxVersion, "1.*");
|
||||
}
|
||||
|
||||
if (NS_CompareVersions(appData.minVersion, gToolkitVersion) > 0 ||
|
||||
NS_CompareVersions(appData.maxVersion, gToolkitVersion) < 0) {
|
||||
Output(PR_TRUE, "Error: Platform version '%s' is not compatible with\n"
|
||||
"minVersion >= %s\nmaxVersion <= %s\n",
|
||||
gToolkitVersion,
|
||||
appData.minVersion, appData.maxVersion);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_AIRBAG
|
||||
const char* airbagEnv = PR_GetEnv("MOZ_CRASHREPORTER");
|
||||
if (airbagEnv && *airbagEnv) {
|
||||
|
|
|
@ -84,7 +84,6 @@ CSRCS = \
|
|||
CPPSRCS = \
|
||||
$(XPCOM_GLUE_SRC_LCPPSRCS) \
|
||||
nsXPCOMGlue.cpp \
|
||||
nsGREDirServiceProvider.cpp \
|
||||
$(LINKSRC) \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -1,320 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sean Su <ssu@netscape.com>
|
||||
* Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
*
|
||||
* 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 MPL, 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 MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsBuildID.h"
|
||||
|
||||
#include "nsEmbedString.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
#include "nsXPCOMGlue.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
#include "nspr.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#ifdef XP_WIN32
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <mbstring.h>
|
||||
#elif defined(XP_OS2)
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "prenv.h"
|
||||
#elif defined(XP_MACOSX)
|
||||
#include <Processes.h>
|
||||
#include <CFBundle.h>
|
||||
#elif defined(XP_UNIX)
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/param.h>
|
||||
#include "prenv.h"
|
||||
#elif defined(XP_BEOS)
|
||||
#include <stdlib.h>
|
||||
#include <image.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "nsGREDirServiceProvider.h"
|
||||
|
||||
static PRBool GRE_GetCurrentProcessDirectory(char* buffer);
|
||||
|
||||
//*****************************************************************************
|
||||
// nsGREDirServiceProvider::nsISupports
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsGREDirServiceProvider, nsIDirectoryServiceProvider)
|
||||
|
||||
//*****************************************************************************
|
||||
// nsGREDirServiceProvider::nsIDirectoryServiceProvider
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGREDirServiceProvider::GetFile(const char *prop, PRBool *persistent, nsIFile **_retval)
|
||||
{
|
||||
*_retval = nsnull;
|
||||
*persistent = PR_TRUE;
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Note that by returning a valid localFile's for NS_GRE_DIR,
|
||||
// your app is indicating to XPCOM that it found a GRE version
|
||||
// with which it's compatible with and intends to be "run against"
|
||||
// that GRE.
|
||||
//
|
||||
// Please see http://www.mozilla.org/projects/embedding/GRE.html
|
||||
// for more info on GRE.
|
||||
//---------------------------------------------------------------
|
||||
if(strcmp(prop, NS_GRE_DIR) == 0)
|
||||
{
|
||||
nsILocalFile* lfile = nsnull;
|
||||
nsresult rv = GRE_GetGREDirectory(&lfile);
|
||||
*_retval = lfile;
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// Implementations from nsXPCOMGlue.h and helper functions.
|
||||
//*****************************************************************************
|
||||
|
||||
PRBool
|
||||
GRE_GetCurrentProcessDirectory(char* buffer)
|
||||
{
|
||||
*buffer = '\0';
|
||||
|
||||
#ifdef XP_WIN
|
||||
DWORD bufLength = ::GetModuleFileName(0, buffer, MAXPATHLEN);
|
||||
if (bufLength == 0 || bufLength == MAXPATHLEN)
|
||||
return PR_FALSE;
|
||||
// chop of the executable name by finding the rightmost backslash
|
||||
unsigned char* lastSlash = _mbsrchr((unsigned char*) buffer, '\\');
|
||||
if (lastSlash) {
|
||||
*(lastSlash) = '\0';
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
#elif defined(XP_MACOSX)
|
||||
// Works even if we're not bundled.
|
||||
CFBundleRef appBundle = CFBundleGetMainBundle();
|
||||
if (appBundle != nsnull)
|
||||
{
|
||||
CFURLRef bundleURL = CFBundleCopyExecutableURL(appBundle);
|
||||
if (bundleURL != nsnull)
|
||||
{
|
||||
CFURLRef parentURL = CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, bundleURL);
|
||||
if (parentURL)
|
||||
{
|
||||
CFStringRef path = CFURLCopyFileSystemPath(parentURL, kCFURLPOSIXPathStyle);
|
||||
if (path)
|
||||
{
|
||||
CFStringGetCString(path, buffer, MAXPATHLEN, kCFStringEncodingUTF8);
|
||||
CFRelease(path);
|
||||
}
|
||||
CFRelease(parentURL);
|
||||
}
|
||||
CFRelease(bundleURL);
|
||||
}
|
||||
}
|
||||
if (*buffer) return PR_TRUE;
|
||||
|
||||
#elif defined(XP_UNIX)
|
||||
|
||||
// In the absence of a good way to get the executable directory let
|
||||
// us try this for unix:
|
||||
// - if MOZILLA_FIVE_HOME is defined, that is it
|
||||
// - else give the current directory
|
||||
|
||||
// The MOZ_DEFAULT_MOZILLA_FIVE_HOME variable can be set at configure time with
|
||||
// a --with-default-mozilla-five-home=foo autoconf flag.
|
||||
//
|
||||
// The idea here is to allow for builds that have a default MOZILLA_FIVE_HOME
|
||||
// regardless of the environment. This makes it easier to write apps that
|
||||
// embed mozilla without having to worry about setting up the environment
|
||||
//
|
||||
// We do this py putenv()ing the default value into the environment. Note that
|
||||
// we only do this if it is not already set.
|
||||
#ifdef MOZ_DEFAULT_MOZILLA_FIVE_HOME
|
||||
if (getenv("MOZILLA_FIVE_HOME") == nsnull)
|
||||
{
|
||||
putenv("MOZILLA_FIVE_HOME=" MOZ_DEFAULT_MOZILLA_FIVE_HOME);
|
||||
}
|
||||
#endif
|
||||
|
||||
char *moz5 = getenv("MOZILLA_FIVE_HOME");
|
||||
|
||||
if (moz5 && *moz5)
|
||||
{
|
||||
if (!realpath(moz5, buffer))
|
||||
strcpy(buffer, moz5);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(DEBUG)
|
||||
static PRBool firstWarning = PR_TRUE;
|
||||
|
||||
if(firstWarning) {
|
||||
// Warn that MOZILLA_FIVE_HOME not set, once.
|
||||
printf("Warning: MOZILLA_FIVE_HOME not set.\n");
|
||||
firstWarning = PR_FALSE;
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
// Fall back to current directory.
|
||||
if (getcwd(buffer, MAXPATHLEN))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(XP_OS2)
|
||||
PPIB ppib;
|
||||
PTIB ptib;
|
||||
char* p;
|
||||
DosGetInfoBlocks( &ptib, &ppib);
|
||||
DosQueryModuleName( ppib->pib_hmte, MAXPATHLEN, buffer);
|
||||
p = strrchr( buffer, '\\'); // XXX DBCS misery
|
||||
if (p) {
|
||||
*p = '\0';
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
#elif defined(XP_BEOS)
|
||||
// We are able to get actual path for running app.
|
||||
int32 cookie = 0;
|
||||
image_info info;
|
||||
char *lastSlash;
|
||||
*buffer = 0;
|
||||
if (get_next_image_info(0, &cookie, &info) == B_OK)
|
||||
{
|
||||
strcpy(buffer, info.name);
|
||||
if ((lastSlash = strrchr(buffer, '/')) != 0)
|
||||
{
|
||||
*lastSlash = '\0';
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* the GRE location is stored in a static buffer so that we don't have
|
||||
* to compute it multiple times.
|
||||
*/
|
||||
|
||||
static char sXPCOMPath[MAXPATHLEN] = "";
|
||||
|
||||
extern "C" char const *
|
||||
GRE_GetXPCOMPath()
|
||||
{
|
||||
// we've already done this...
|
||||
if (*sXPCOMPath)
|
||||
return sXPCOMPath;
|
||||
|
||||
char buffer[MAXPATHLEN];
|
||||
|
||||
// If the xpcom library exists in the current process directory,
|
||||
// then we will not use any GRE. The assumption here is that the
|
||||
// GRE is in the same directory as the executable.
|
||||
if (GRE_GetCurrentProcessDirectory(buffer)) {
|
||||
PRUint32 pathlen = strlen(buffer);
|
||||
strcpy(buffer + pathlen, XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL);
|
||||
|
||||
struct stat libStat;
|
||||
int statResult = stat(buffer, &libStat);
|
||||
|
||||
if (statResult != -1) {
|
||||
//found our xpcom lib in the current process directory
|
||||
strcpy(sXPCOMPath, buffer);
|
||||
return sXPCOMPath;
|
||||
}
|
||||
}
|
||||
|
||||
static const GREVersionRange version = {
|
||||
GRE_BUILD_ID, PR_TRUE,
|
||||
GRE_BUILD_ID, PR_TRUE
|
||||
};
|
||||
|
||||
GRE_GetGREPathWithProperties(&version, 1,
|
||||
nsnull, 0,
|
||||
sXPCOMPath, MAXPATHLEN);
|
||||
if (*sXPCOMPath)
|
||||
return sXPCOMPath;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
extern "C" nsresult
|
||||
GRE_GetGREDirectory(nsILocalFile* *_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
// Get the path of the GRE which is compatible with our embedding application
|
||||
// from the registry
|
||||
|
||||
const char *pGREDir = GRE_GetXPCOMPath();
|
||||
if(!pGREDir)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsILocalFile> xpcomPath;
|
||||
nsEmbedCString leaf(pGREDir);
|
||||
rv = NS_NewNativeLocalFile(leaf, PR_TRUE, getter_AddRefs(xpcomPath));
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIFile> directory;
|
||||
rv = xpcomPath->GetParent(getter_AddRefs(directory));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
return CallQueryInterface(directory, _retval);
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2003
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Sean Su <ssu@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 MPL, 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 MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsGREDirServiceProvider_h_
|
||||
#define nsGREDirServiceProvider_h_
|
||||
|
||||
#include "nsIDirectoryService.h"
|
||||
|
||||
/**
|
||||
* the directoryserviceprovider used by GRE_Startup when calling NS_InitXPCOM2
|
||||
*/
|
||||
class nsGREDirServiceProvider : public nsIDirectoryServiceProvider
|
||||
{
|
||||
public:
|
||||
nsGREDirServiceProvider() { }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
|
||||
|
||||
private:
|
||||
~nsGREDirServiceProvider() { }
|
||||
};
|
||||
|
||||
#endif // nsGREDirServiceProvider.h
|
|
@ -42,7 +42,6 @@
|
|||
#include "nspr.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsGREDirServiceProvider.h"
|
||||
#include "nsXPCOMPrivate.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include <stdlib.h>
|
||||
|
@ -518,68 +517,3 @@ NS_InvokeByIndex(nsISupports* that, PRUint32 methodIndex,
|
|||
return xpcomFunctions.invokeByIndexFunc(that, methodIndex,
|
||||
paramCount, params);
|
||||
}
|
||||
|
||||
// Default GRE startup/shutdown code
|
||||
|
||||
extern "C"
|
||||
nsresult GRE_Startup()
|
||||
{
|
||||
const char* xpcomLocation = GRE_GetXPCOMPath();
|
||||
|
||||
// Startup the XPCOM Glue that links us up with XPCOM.
|
||||
nsresult rv = XPCOMGlueStartup(xpcomLocation);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("gre: XPCOMGlueStartup failed");
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
// On windows we have legacy GRE code that does not load the GRE dependent
|
||||
// libs (seamonkey GRE, not libxul)... add the GRE to the PATH.
|
||||
// See bug 301043.
|
||||
|
||||
const char *lastSlash = strrchr(xpcomLocation, '\\');
|
||||
if (lastSlash) {
|
||||
int xpcomPathLen = lastSlash - xpcomLocation;
|
||||
DWORD pathLen = GetEnvironmentVariable("PATH", nsnull, 0);
|
||||
|
||||
char *newPath = (char*) _alloca(xpcomPathLen + pathLen + 1);
|
||||
strncpy(newPath, xpcomLocation, xpcomPathLen);
|
||||
// in case GetEnvironmentVariable fails
|
||||
newPath[xpcomPathLen] = ';';
|
||||
newPath[xpcomPathLen + 1] = '\0';
|
||||
|
||||
GetEnvironmentVariable("PATH", newPath + xpcomPathLen + 1, pathLen);
|
||||
SetEnvironmentVariable("PATH", newPath);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsGREDirServiceProvider *provider = new nsGREDirServiceProvider();
|
||||
if ( !provider ) {
|
||||
NS_WARNING("GRE_Startup failed");
|
||||
XPCOMGlueShutdown();
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIServiceManager> servMan;
|
||||
NS_ADDREF( provider );
|
||||
rv = NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, provider);
|
||||
NS_RELEASE(provider);
|
||||
|
||||
if ( NS_FAILED(rv) || !servMan) {
|
||||
NS_WARNING("gre: NS_InitXPCOM failed");
|
||||
XPCOMGlueShutdown();
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
nsresult GRE_Shutdown()
|
||||
{
|
||||
NS_ShutdownXPCOM(nsnull);
|
||||
XPCOMGlueShutdown();
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -127,45 +127,5 @@ XPCOMGlueLoadXULFunctions(const nsDynamicFunctionLoad *symbols);
|
|||
extern "C" NS_HIDDEN_(nsresult)
|
||||
XPCOMGlueShutdown();
|
||||
|
||||
|
||||
/**
|
||||
* Locate the path of the XPCOM shared library of a compatible GRE.
|
||||
* The result of this function is normally passed directly to
|
||||
* XPCOMGlueStartup. This looks for the GRE version in
|
||||
* nsBuildID.h, which is generated at build time. Unless you set
|
||||
* MOZ_MILESTONE_RELEASE this will probably not be a useful GRE version string.
|
||||
*
|
||||
* @return string buffer pointing to the XPCOM DLL path. Callers do
|
||||
* not need to free this buffer.
|
||||
* @status DEPRECATED - Use GRE_GetGREPathWithProperties
|
||||
*/
|
||||
extern "C" NS_HIDDEN_(char const *)
|
||||
GRE_GetXPCOMPath();
|
||||
|
||||
|
||||
/**
|
||||
* Locate the directory of a compatible GRE as an nsIFile
|
||||
*
|
||||
* @param _retval Ordinary XPCOM getter, returns an addrefed interface.
|
||||
*/
|
||||
extern "C" NS_HIDDEN_(nsresult)
|
||||
GRE_GetGREDirectory(nsILocalFile* *_retval);
|
||||
|
||||
|
||||
/**
|
||||
* Embedding applications which don't need a custom
|
||||
* directoryserviceprovider may use GRE_Startup to start the XPCOM
|
||||
* glue and initialize the GRE in one step.
|
||||
*/
|
||||
extern "C" NS_HIDDEN_(nsresult)
|
||||
GRE_Startup();
|
||||
|
||||
|
||||
/**
|
||||
* Shut down XPCOM and the XPCOM glue in one step.
|
||||
*/
|
||||
extern "C" NS_HIDDEN_(nsresult)
|
||||
GRE_Shutdown();
|
||||
|
||||
#endif // XPCOM_GLUE
|
||||
#endif // nsXPCOMGlue_h__
|
||||
|
|
|
@ -46,6 +46,7 @@ MODULE = xpcom
|
|||
XPIDL_MODULE = xpcom_system
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIXULAppInfo.idl \
|
||||
nsIGConfService.idl \
|
||||
nsIGnomeVFSService.idl \
|
||||
$(NULL)
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "nscore.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
#include "nsBuildID.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsInstall.h"
|
||||
|
@ -1856,8 +1855,6 @@ static JSConstDoubleSpec install_constants[] =
|
|||
{ CHROME_DELAYED, "DELAYED_CHROME" },
|
||||
{ CHROME_SELECT, "SELECT_CHROME" },
|
||||
|
||||
{ NS_BUILD_ID, "buildID" },
|
||||
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
|
@ -69,7 +69,6 @@
|
|||
#include "nsTopProgressNotifier.h"
|
||||
#include "nsLoggingProgressNotifier.h"
|
||||
|
||||
#include "nsBuildID.h"
|
||||
#include "nsProcess.h"
|
||||
|
||||
/* For Javascript Namespace Access */
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#define nsRegisterGRE_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsStringAPI.h"
|
||||
class nsIFile;
|
||||
struct GREProperty;
|
||||
|
||||
|
@ -47,9 +48,11 @@ struct GREProperty;
|
|||
*/
|
||||
NS_HIDDEN_(PRBool)
|
||||
RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen);
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen,
|
||||
const char *aGREMilestone);
|
||||
|
||||
NS_HIDDEN_(void)
|
||||
UnregisterXULRunner(PRBool aUnregisterGlobally, nsIFile* aLocation);
|
||||
UnregisterXULRunner(PRBool aUnregisterGlobally, nsIFile* aLocation,
|
||||
const char *aGREMilestone);
|
||||
|
||||
#endif // nsRegisterGRE_h__
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsIFile.h"
|
||||
#include "nsILocalFile.h"
|
||||
|
||||
#include "nsBuildID.h"
|
||||
#include "nsAppRunner.h" // for MAXPATHLEN
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsINIParser.h"
|
||||
|
@ -62,7 +61,6 @@
|
|||
|
||||
static const char kRegFileGlobal[] = "global.reginfo";
|
||||
static const char kRegFileUser[] = "user.reginfo";
|
||||
static const char kGREBuildID[] = GRE_BUILD_ID;
|
||||
|
||||
class AutoFDClose
|
||||
{
|
||||
|
@ -85,7 +83,8 @@ private:
|
|||
|
||||
static PRBool
|
||||
MakeConfFile(const char *regfile, const nsCString &greHome,
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen)
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen,
|
||||
const char *aGREMilestone)
|
||||
{
|
||||
// If the file exists, don't create it again!
|
||||
if (access(regfile, R_OK) == 0)
|
||||
|
@ -101,22 +100,17 @@ MakeConfFile(const char *regfile, const nsCString &greHome,
|
|||
|
||||
static const char kHeader[] =
|
||||
"# Registration file generated by xulrunner. Do not edit.\n\n"
|
||||
"[" GRE_BUILD_ID "]\n"
|
||||
"GRE_PATH=";
|
||||
"[%s]\n"
|
||||
"GRE_PATH=%s\n";
|
||||
|
||||
if (PR_Write(fd, kHeader, sizeof(kHeader) - 1) != sizeof(kHeader) - 1)
|
||||
ok = PR_FALSE;
|
||||
|
||||
if (PR_Write(fd, greHome.get(), greHome.Length()) != greHome.Length())
|
||||
if (PR_fprintf(fd, kHeader, aGREMilestone, greHome.get()) <= 0)
|
||||
ok = PR_FALSE;
|
||||
|
||||
for (PRUint32 i = 0; i < aPropertiesLen; ++i) {
|
||||
if (PR_fprintf(fd, "\n%s=%s",
|
||||
if (PR_fprintf(fd, "%s=%s\n",
|
||||
aProperties[i].property, aProperties[i].value) <= 0)
|
||||
ok = PR_FALSE;
|
||||
}
|
||||
|
||||
PR_Write(fd, "\n", 1);
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
|
@ -128,7 +122,8 @@ MakeConfFile(const char *regfile, const nsCString &greHome,
|
|||
|
||||
PRBool
|
||||
RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen)
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen,
|
||||
const char *aGREMilestone)
|
||||
{
|
||||
// Register ourself in /etc/gre.d or ~/.gre.d/ and record what key we created
|
||||
// for future unregistration.
|
||||
|
@ -198,19 +193,21 @@ RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PR_snprintf(regfile, MAXPATHLEN, "%s/%s.conf", root, kGREBuildID);
|
||||
if (MakeConfFile(regfile, greHome, aProperties, aPropertiesLen)) {
|
||||
PR_Write(fd, kGREBuildID, sizeof(kGREBuildID) - 1);
|
||||
PR_snprintf(regfile, MAXPATHLEN, "%s/%s.conf", root, aGREMilestone);
|
||||
if (MakeConfFile(regfile, greHome, aProperties, aPropertiesLen,
|
||||
aGREMilestone)) {
|
||||
PR_fprintf(fd, "%s", aGREMilestone);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
for (int i = 0; i < UNIQ_LOOP_LIMIT; ++i) {
|
||||
static char buildID[30];
|
||||
sprintf(buildID, "%s_%i", kGREBuildID, i);
|
||||
sprintf(buildID, "%s_%i", aGREMilestone, i);
|
||||
|
||||
PR_snprintf(regfile, MAXPATHLEN, "%s/%s.conf", root, buildID);
|
||||
|
||||
if (MakeConfFile(regfile, greHome, aProperties, aPropertiesLen)) {
|
||||
if (MakeConfFile(regfile, greHome, aProperties, aPropertiesLen,
|
||||
aGREMilestone)) {
|
||||
PR_Write(fd, buildID, strlen(buildID));
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -220,7 +217,8 @@ RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
|
|||
}
|
||||
|
||||
void
|
||||
UnregisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation)
|
||||
UnregisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
|
||||
const char *aGREMilestone)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -275,7 +273,7 @@ UnregisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation)
|
|||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
rv = p.GetString(kGREBuildID, "GRE_PATH", root, MAXPATHLEN);
|
||||
rv = p.GetString(aGREMilestone, "GRE_PATH", root, MAXPATHLEN);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
|
|
|
@ -42,14 +42,16 @@
|
|||
|
||||
int
|
||||
RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen)
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen,
|
||||
const char *aGREMilestone)
|
||||
{
|
||||
fprintf(stderr, "Registration not implemented on this platform!\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
UnregisterXULRunner(PRBool aUnregisterGlobally, nsIFile* aLocation)
|
||||
UnregisterXULRunner(PRBool aUnregisterGlobally, nsIFile* aLocation,
|
||||
const char *aGREMilestone)
|
||||
{
|
||||
fprintf(stderr, "Registration not implemented on this platform!\n");
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "nsIFile.h"
|
||||
#include "nsILocalFile.h"
|
||||
|
||||
#include "nsBuildID.h"
|
||||
#include "nsAppRunner.h" // for MAXPATHLEN
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsXPCOMGlue.h"
|
||||
|
@ -57,7 +56,8 @@ static const char kRegFileUser[] = "user.reginfo";
|
|||
|
||||
static nsresult
|
||||
MakeVersionKey(HKEY root, const char* keyname, const nsCString &grehome,
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen)
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen,
|
||||
const char *aGREMilestone)
|
||||
{
|
||||
HKEY subkey;
|
||||
DWORD disp;
|
||||
|
@ -72,8 +72,8 @@ MakeVersionKey(HKEY root, const char* keyname, const nsCString &grehome,
|
|||
|
||||
PRBool failed = PR_FALSE;
|
||||
failed |= ::RegSetValueEx(subkey, "Version", NULL, REG_SZ,
|
||||
(BYTE*) GRE_BUILD_ID,
|
||||
sizeof(GRE_BUILD_ID) - 1) != ERROR_SUCCESS;
|
||||
(BYTE*) aGREMilestone,
|
||||
strlen(aGREMilestone)) != ERROR_SUCCESS;
|
||||
failed |= ::RegSetValueEx(subkey, "GreHome", NULL, REG_SZ,
|
||||
(BYTE*) grehome.get(),
|
||||
grehome.Length()) != ERROR_SUCCESS;
|
||||
|
@ -97,7 +97,8 @@ MakeVersionKey(HKEY root, const char* keyname, const nsCString &grehome,
|
|||
|
||||
int
|
||||
RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen)
|
||||
const GREProperty *aProperties, PRUint32 aPropertiesLen,
|
||||
const char *aGREMilestone)
|
||||
{
|
||||
// Register ourself in the windows registry, and record what key we created
|
||||
// for future unregistration.
|
||||
|
@ -171,8 +172,9 @@ RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
|
|||
}
|
||||
}
|
||||
|
||||
strcpy(keyName, GRE_BUILD_ID);
|
||||
rv = MakeVersionKey(rootKey, keyName, greHome, aProperties, aPropertiesLen);
|
||||
strcpy(keyName, aGREMilestone);
|
||||
rv = MakeVersionKey(rootKey, keyName, greHome, aProperties, aPropertiesLen,
|
||||
aGREMilestone);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PR_Write(fd, keyName, strlen(keyName));
|
||||
irv = PR_TRUE;
|
||||
|
@ -180,9 +182,10 @@ RegisterXULRunner(PRBool aRegisterGlobally, nsIFile* aLocation,
|
|||
}
|
||||
|
||||
for (i = 0; i < 1000; ++i) {
|
||||
sprintf(keyName, GRE_BUILD_ID "_%i", i);
|
||||
sprintf(keyName, "%s_%i", aGREMilestone, i);
|
||||
rv = MakeVersionKey(rootKey, keyName, greHome,
|
||||
aProperties, aPropertiesLen);
|
||||
aProperties, aPropertiesLen,
|
||||
aGREMilestone);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PR_Write(fd, keyName, strlen(keyName));
|
||||
irv = PR_TRUE;
|
||||
|
@ -203,7 +206,8 @@ reg_end:
|
|||
}
|
||||
|
||||
void
|
||||
UnregisterXULRunner(PRBool aGlobal, nsIFile* aLocation)
|
||||
UnregisterXULRunner(PRBool aGlobal, nsIFile* aLocation,
|
||||
const char *aGREMilestone)
|
||||
{
|
||||
nsCOMPtr<nsIFile> savedInfoFile;
|
||||
aLocation->Clone(getter_AddRefs(savedInfoFile));
|
||||
|
|
|
@ -50,12 +50,12 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsCRTGlue.h"
|
||||
#include "nsBuildID.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "plstr.h"
|
||||
#include "prprf.h"
|
||||
#include "prenv.h"
|
||||
#include "nsINIParser.h"
|
||||
|
||||
/**
|
||||
* Output a string to the user. This method is really only meant to be used to
|
||||
|
@ -110,8 +110,46 @@ static PRBool IsArg(const char* arg, const char* s)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
static void Usage()
|
||||
static nsresult
|
||||
GetGREVersion(const char *argv0,
|
||||
nsACString *aMilestone,
|
||||
nsACString *aVersion)
|
||||
{
|
||||
if (aMilestone)
|
||||
aMilestone->Assign("<Error>");
|
||||
if (aVersion)
|
||||
aVersion->Assign("<Error>");
|
||||
|
||||
nsCOMPtr<nsILocalFile> iniFile;
|
||||
nsresult rv = XRE_GetBinaryPath(argv0, getter_AddRefs(iniFile));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
iniFile->SetNativeLeafName(NS_LITERAL_CSTRING("platform.ini"));
|
||||
|
||||
nsINIParser parser;
|
||||
rv = parser.Init(iniFile);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
if (aMilestone) {
|
||||
rv = parser.GetString("Build", "Milestone", *aMilestone);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
if (aVersion) {
|
||||
rv = parser.GetString("Build", "BuildID", *aVersion);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void Usage(const char *argv0)
|
||||
{
|
||||
nsCAutoString milestone;
|
||||
GetGREVersion(argv0, &milestone, nsnull);
|
||||
|
||||
// display additional information (XXX make localizable?)
|
||||
Output(PR_FALSE,
|
||||
"Mozilla XULRunner %s\n\n"
|
||||
|
@ -139,7 +177,7 @@ static void Usage()
|
|||
"\n"
|
||||
"APP-OPTIONS\n"
|
||||
" Application specific options.\n",
|
||||
GRE_BUILD_ID);
|
||||
milestone.get());
|
||||
}
|
||||
|
||||
static nsresult
|
||||
|
@ -242,54 +280,65 @@ int main(int argc, char* argv[])
|
|||
IsArg(argv[1], "help") ||
|
||||
IsArg(argv[1], "?")))
|
||||
{
|
||||
Usage();
|
||||
Usage(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc == 2 && (IsArg(argv[1], "v") || IsArg(argv[1], "version")))
|
||||
{
|
||||
Output(PR_FALSE, "Mozilla XULRunner %s\n", GRE_BUILD_ID);
|
||||
nsCAutoString milestone;
|
||||
nsCAutoString version;
|
||||
GetGREVersion(argv[0], &milestone, &version);
|
||||
Output(PR_FALSE, "Mozilla XULRunner %s - %s\n",
|
||||
milestone.get(), version.get());
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc > 1) {
|
||||
nsCAutoString milestone;
|
||||
nsresult rv = GetGREVersion(argv[0], &milestone, nsnull);
|
||||
if (NS_FAILED(rv))
|
||||
return 2;
|
||||
|
||||
PRBool registerGlobal = IsArg(argv[1], "register-global");
|
||||
PRBool registerUser = IsArg(argv[1], "register-user");
|
||||
if (registerGlobal || registerUser) {
|
||||
if (argc != 2) {
|
||||
Usage();
|
||||
Usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> regDir;
|
||||
nsresult rv = GetXULRunnerDir(argv[0], getter_AddRefs(regDir));
|
||||
rv = GetXULRunnerDir(argv[0], getter_AddRefs(regDir));
|
||||
if (NS_FAILED(rv))
|
||||
return 2;
|
||||
|
||||
return RegisterXULRunner(registerGlobal, regDir,
|
||||
kGREProperties,
|
||||
NS_ARRAY_LENGTH(kGREProperties)) ? 0 : 2;
|
||||
NS_ARRAY_LENGTH(kGREProperties),
|
||||
milestone.get()) ? 0 : 2;
|
||||
}
|
||||
|
||||
registerGlobal = IsArg(argv[1], "unregister-global");
|
||||
registerUser = IsArg(argv[1], "unregister-user");
|
||||
if (registerGlobal || registerUser) {
|
||||
if (argc != 2) {
|
||||
Usage();
|
||||
Usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> regDir;
|
||||
nsresult rv = GetXULRunnerDir(argv[0], getter_AddRefs(regDir));
|
||||
rv = GetXULRunnerDir(argv[0], getter_AddRefs(regDir));
|
||||
if (NS_FAILED(rv))
|
||||
return 2;
|
||||
UnregisterXULRunner(registerGlobal, regDir);
|
||||
|
||||
UnregisterXULRunner(registerGlobal, regDir, milestone.get());
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IsArg(argv[1], "find-gre")) {
|
||||
if (argc != 3) {
|
||||
Usage();
|
||||
Usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -302,9 +351,9 @@ int main(int argc, char* argv[])
|
|||
{ "xulrunner", "true" }
|
||||
};
|
||||
|
||||
nsresult rv = GRE_GetGREPathWithProperties(&vr, 1, kProperties,
|
||||
NS_ARRAY_LENGTH(kProperties),
|
||||
path, sizeof(path));
|
||||
rv = GRE_GetGREPathWithProperties(&vr, 1, kProperties,
|
||||
NS_ARRAY_LENGTH(kProperties),
|
||||
path, sizeof(path));
|
||||
if (NS_FAILED(rv))
|
||||
return 1;
|
||||
|
||||
|
@ -314,17 +363,17 @@ int main(int argc, char* argv[])
|
|||
|
||||
if (IsArg(argv[1], "gre-version")) {
|
||||
if (argc != 2) {
|
||||
Usage();
|
||||
Usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("%s\n", GRE_BUILD_ID);
|
||||
printf("%s\n", milestone.get());
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IsArg(argv[1], "install-app")) {
|
||||
if (argc < 3 || argc > 5) {
|
||||
Usage();
|
||||
Usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -345,7 +394,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIFile> regDir;
|
||||
nsresult rv = GetXULRunnerDir(argv[0], getter_AddRefs(regDir));
|
||||
rv = GetXULRunnerDir(argv[0], getter_AddRefs(regDir));
|
||||
if (NS_FAILED(rv))
|
||||
return 2;
|
||||
|
||||
|
@ -357,13 +406,13 @@ int main(int argc, char* argv[])
|
|||
|
||||
if (!(appDataFile && *appDataFile)) {
|
||||
if (argc < 2) {
|
||||
Usage();
|
||||
Usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (IsArg(argv[1], "app")) {
|
||||
if (argc == 2) {
|
||||
Usage();
|
||||
Usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
argv[1] = argv[0];
|
||||
|
|
|
@ -13,7 +13,7 @@ Version=0.1
|
|||
;
|
||||
; This field specifies your application's build ID (timestamp). This field is
|
||||
; required.
|
||||
BuildID=@BUILD_ID@
|
||||
BuildID=20070625
|
||||
;
|
||||
; This field specifies a compact copyright notice for your application. This
|
||||
; field is optional.
|
||||
|
|
Загрузка…
Ссылка в новой задаче