diff options
Diffstat (limited to 'application/xulrunner/app')
-rw-r--r-- | application/xulrunner/app/Makefile.in | 75 | ||||
-rw-r--r-- | application/xulrunner/app/default16.png | bin | 0 -> 744 bytes | |||
-rw-r--r-- | application/xulrunner/app/default32.png | bin | 0 -> 2084 bytes | |||
-rw-r--r-- | application/xulrunner/app/default48.png | bin | 0 -> 3846 bytes | |||
-rw-r--r-- | application/xulrunner/app/document.ico | bin | 0 -> 22486 bytes | |||
-rw-r--r-- | application/xulrunner/app/install_app.py | 221 | ||||
-rw-r--r-- | application/xulrunner/app/macbuild/Info.plist.in | 31 | ||||
-rw-r--r-- | application/xulrunner/app/macbuild/InfoPlist.strings | bin | 0 -> 280 bytes | |||
-rw-r--r-- | application/xulrunner/app/moz.build | 70 | ||||
-rw-r--r-- | application/xulrunner/app/nsXULRunnerApp.cpp | 294 | ||||
-rw-r--r-- | application/xulrunner/app/splash.rc | 22 | ||||
-rw-r--r-- | application/xulrunner/app/xulrunner.exe.manifest | 38 | ||||
-rw-r--r-- | application/xulrunner/app/xulrunner.ico | bin | 0 -> 22486 bytes | |||
-rw-r--r-- | application/xulrunner/app/xulrunner.js | 26 |
14 files changed, 777 insertions, 0 deletions
diff --git a/application/xulrunner/app/Makefile.in b/application/xulrunner/app/Makefile.in new file mode 100644 index 000000000..98e377d69 --- /dev/null +++ b/application/xulrunner/app/Makefile.in @@ -0,0 +1,75 @@ +# vim:set ts=8 sw=8 sts=8 et: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/,xulrunner.js) + +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) +TK_LIBS := -framework Cocoa $(TK_LIBS) +endif + +ifndef MOZ_WINCONSOLE +ifdef MOZ_DEBUG +MOZ_WINCONSOLE = 1 +else +MOZ_WINCONSOLE = 0 +endif +endif + +# This switches $(INSTALL) to copy mode, like $(SYSINSTALL), so things that +# shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall. +NSDISTMODE = copy + +include $(topsrcdir)/config/config.mk + +include $(topsrcdir)/config/rules.mk + +DEFINES += -DXULRUNNER_ICO='"$(DIST)/branding/xulrunner.ico"' -DDOCUMENT_ICO='"$(DIST)/branding/document.ico"' + +ifdef MOZ_WIDGET_GTK +libs:: + $(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default + $(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png $(DIST)/bin/chrome/icons/default + $(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(DIST)/bin/chrome/icons/default +endif + +# XXX applications would need to supply this file +#export:: brand.dtd.in +# $(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $^ -o brand.dtd) + +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) + +FRAMEWORK_NAME = XUL +FRAMEWORK_VERSION = $(MOZILLA_VERSION) + +FRAMEWORK_DIR = \ + $(DIST)/$(FRAMEWORK_NAME).framework/Versions/$(FRAMEWORK_VERSION) + +$(FRAMEWORK_DIR)/Resources: + $(NSINSTALL) -D $@ + +tools:: $(PROGRAM) $(FRAMEWORK_DIR)/Resources + $(NSINSTALL) $(srcdir)/macbuild/InfoPlist.strings $(FRAMEWORK_DIR)/Resources + sed -e 's/APP_VERSION/$(APP_VERSION)/' $(srcdir)/macbuild/Info.plist.in > $(FRAMEWORK_DIR)/Info.plist + rsync -av $(DIST)/bin/ $(FRAMEWORK_DIR) --exclude mangle --exclude shlibsign + rm -f $(DIST)/$(FRAMEWORK_NAME).framework/Versions/Current \ + $(DIST)/$(FRAMEWORK_NAME).framework/libxpcom.dylib \ + $(DIST)/$(FRAMEWORK_NAME).framework/XUL \ + $(DIST)/$(FRAMEWORK_NAME).framework/xulrunner + ln -s $(FRAMEWORK_VERSION) $(DIST)/$(FRAMEWORK_NAME).framework/Versions/Current + ln -s Versions/Current/libxpcom.dylib $(DIST)/$(FRAMEWORK_NAME).framework/libxpcom.dylib + ln -s Versions/Current/XUL $(DIST)/$(FRAMEWORK_NAME).framework/XUL + ln -s Versions/Current/xulrunner $(DIST)/$(FRAMEWORK_NAME).framework/xulrunner + +clean clobber:: + rm -rf $(DIST)/$(FRAMEWORK_NAME).framework +endif + +README_FILE = $(srcdir)/../README.xulrunner + +libs:: + $(INSTALL) $(IFLAGS1) $(README_FILE) $(DIST)/bin + $(INSTALL) $(IFLAGS1) $(topsrcdir)/LICENSE $(DIST)/bin + $(INSTALL) $(IFLAGS1) $(srcdir)/install_app.py $(DIST)/bin + diff --git a/application/xulrunner/app/default16.png b/application/xulrunner/app/default16.png Binary files differnew file mode 100644 index 000000000..e74f5cf2e --- /dev/null +++ b/application/xulrunner/app/default16.png diff --git a/application/xulrunner/app/default32.png b/application/xulrunner/app/default32.png Binary files differnew file mode 100644 index 000000000..914509054 --- /dev/null +++ b/application/xulrunner/app/default32.png diff --git a/application/xulrunner/app/default48.png b/application/xulrunner/app/default48.png Binary files differnew file mode 100644 index 000000000..5fd71e110 --- /dev/null +++ b/application/xulrunner/app/default48.png diff --git a/application/xulrunner/app/document.ico b/application/xulrunner/app/document.ico Binary files differnew file mode 100644 index 000000000..311116324 --- /dev/null +++ b/application/xulrunner/app/document.ico diff --git a/application/xulrunner/app/install_app.py b/application/xulrunner/app/install_app.py new file mode 100644 index 000000000..6be8c5ecb --- /dev/null +++ b/application/xulrunner/app/install_app.py @@ -0,0 +1,221 @@ +#!/usr/bin/env python + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +# Min version of python is 2.7 +import sys +if ((sys.version_info.major != 2) or (sys.version_info.minor < 7)): + raise Exception("You need to use Python version 2.7 or higher") + +import os, shutil, re, zipfile +from ConfigParser import SafeConfigParser + +# Platform-specific support +# see https://developer.mozilla.org/en/XULRunner/Deploying_XULRunner_1.8 +if sys.platform.startswith('linux') or sys.platform == "win32": + def installApp(appLocation, installDir, appName, greDir): + zipApp, iniParser, appName = validateArguments(appLocation, installDir, appName, greDir) + if (zipApp): + zipApp.extractAll(installDir) + else: + shutil.copytree(appLocation, installDir) + shutil.copy2(os.path.join(greDir, xulrunnerStubName), + os.path.join(installDir, appName)) + copyGRE(greDir, os.path.join(installDir, "xulrunner")) + +if sys.platform.startswith('linux'): + xulrunnerStubName = "xulrunner-stub" + + def makeAppName(leafName): + return leafName.lower() + +elif sys.platform == "win32": + xulrunnerStubName = "xulrunner-stub.exe" + + def makeAppName(leafName): + return leafName + ".exe" + +elif sys.platform == "darwin": + xulrunnerStubName = "xulrunner-stub" + + def installApp(appLocation, installDir, appName, greDir): + zipApp, iniparser, appName = validateArguments(appLocation, installDir, appName, greDir) + installDir += "/" + appName + ".app" + resourcesDir = os.path.join(installDir, "Contents/Resources") + if (zipApp): + zipApp.extractAll(resourcesDir) + else: + shutil.copytree(appLocation, resourcesDir) + MacOSDir = os.path.join(installDir, "Contents/MacOS") + os.makedirs(MacOSDir) + shutil.copy2(os.path.join(greDir, xulrunnerStubName), MacOSDir) + copyGRE(greDir, + os.path.join(installDir, "Contents/Frameworks/XUL.framework")) + + # Contents/Info.plist + contents = """<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> +<key>CFBundleInfoDictionaryVersion</key> +<string>6.0</string> +<key>CFBundlePackageType</key> +<string>APPL</string> +<key>CFBundleSignature</key> +<string>????</string> +<key>CFBundleExecutable</key> +<string>xulrunner</string> +<key>NSAppleScriptEnabled</key> +<true/> +<key>CFBundleGetInfoString</key> +<string>$infoString</string> +<key>CFBundleName</key> +<string>$appName</string> +<key>CFBundleShortVersionString</key> +<string>$version</string> +<key>CFBundleVersion</key> +<string>$version.$buildID</string> +<key>CFBundleIdentifier</key> +<string>$reverseVendor</string> +</dict> +</plist> +""" + version = iniparser.get("App", "Version") + buildID = iniparser.get("App", "BuildID") + infoString = appName + " " + version + reverseVendor = "com.vendor.unknown" + appID = iniparser.get("App", "ID") + colonIndex = appID.find("@") + 1 + if (colonIndex != 0): + vendor = appID[colonIndex:] + reverseVendor = ".".join(vendor.split(".")[::-1]) + contents = contents.replace("$infoString", infoString) + contents = contents.replace("$appName", appName) + contents = contents.replace("$version", version) + contents = contents.replace("$buildID", buildID) + contents = contents.replace("$reverseVendor", reverseVendor) + infoPList = open(os.path.join(installDir, "Contents/Info.plist"), "w+b") + infoPList.write(contents) + infoPList.close() + + def makeAppName(leafName): + return leafName + +else: + # Implement xulrunnerStubName, installApp and makeAppName as above. + raise Exception("This operating system isn't supported for install_app.py yet!") +# End platform-specific support + +def resolvePath(path): + return os.path.realpath(path) + +def requireINIOption(iniparser, section, option): + if not (iniparser.has_option(section, option)): + raise Exception("application.ini must have a " + option + " option under the " + section + " section") + +def checkAppINI(appLocation): + if (os.path.isdir(appLocation)): + zipApp = None + appINIPath = os.path.join(appLocation, "application.ini") + if not (os.path.isfile(appINIPath)): + raise Exception(appINIPath + " does not exist") + appINI = open(appINIPath) + elif (zipfile.is_zipfile(appLocation)): + zipApp = zipfile.ZipFile(appLocation) + if not ("application.ini" in zipApp.namelist()): + raise Exception("jar:" + appLocation + "!/application.ini does not exist") + appINI = zipApp.open("application.ini") + else: + raise Exception("appLocation must be a directory containing application.ini or a zip file with application.ini at its root") + + # application.ini verification + iniparser = SafeConfigParser() + iniparser.readfp(appINI) + if not (iniparser.has_section("App")): + raise Exception("application.ini must have an App section") + if not (iniparser.has_section("Gecko")): + raise Exception("application.ini must have a Gecko section") + requireINIOption(iniparser, "App", "Name") + requireINIOption(iniparser, "App", "Version") + requireINIOption(iniparser, "App", "BuildID") + requireINIOption(iniparser, "App", "ID") + requireINIOption(iniparser, "Gecko", "MinVersion") + + return zipApp, iniparser + pass + +def copyGRE(greDir, targetDir): + shutil.copytree(greDir, targetDir, symlinks=True) + +def validateArguments(appLocation, installDir, appName, greDir): + # application directory / zip verification + appLocation = resolvePath(appLocation) + + # target directory + installDir = resolvePath(installDir) + + if (os.path.exists(installDir)): + raise Exception("installDir must not exist: " + cmds.installDir) + + greDir = resolvePath(greDir) + xulrunnerStubPath = os.path.isfile(os.path.join(greDir, xulrunnerStubName)) + if not xulrunnerStubPath: + raise Exception("XULRunner stub executable not found: " + os.path.join(greDir, xulrunnerStubName)) + + # appName + zipApp, iniparser = checkAppINI(appLocation) + if not appName: + appName = iniparser.get("App", "Name") + appName = makeAppName(appName) + pattern = re.compile("[\\\/\:*?\"<>|\x00]") + if pattern.search(appName): + raise Exception("App name has illegal characters for at least one operating system") + return zipApp, iniparser, appName + +def handleCommandLine(): + import argparse + + # Argument parsing. + parser = argparse.ArgumentParser( + description="XULRunner application installer", + usage="""install_app.py appLocation installDir greDir [--appName APPNAME] + install_app.py -h + install_app.py --version + """ + ) + parser.add_argument( + "appLocation", + action="store", + help="The directory or ZIP file containing application.ini as a top-level child file" + ) + parser.add_argument( + "installDir", + action="store", + help="The directory to install the application to" + ) + parser.add_argument( + "--greDir", + action="store", + help="The directory containing the Gecko SDK (usually where this Python script lives)", + default=os.path.dirname(sys.argv[0]) + ) + parser.add_argument( + "--appName", + action="store", + help="The name of the application to install" + ) + parser.add_argument("--version", action="version", version="%(prog)s 1.0") + + # The command code. + cmds = parser.parse_args() + try: + installApp(cmds.appLocation, cmds.installDir, cmds.appName, cmds.greDir) + except exn: + shutil.rmtree(cmds.installDir) + raise exn + print cmds.appName + " application installed to " + cmds.installDir + +if __name__ == '__main__': + handleCommandLine() diff --git a/application/xulrunner/app/macbuild/Info.plist.in b/application/xulrunner/app/macbuild/Info.plist.in new file mode 100644 index 000000000..69676b80c --- /dev/null +++ b/application/xulrunner/app/macbuild/Info.plist.in @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>xulrunner-bin</string> + <key>CFBundleIdentifier</key> + <string>org.mozilla.xulrunner</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>XULRunner</string> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleSignature</key> + <string>MOZB</string> + <key>CFBundleVersion</key> + <string>APP_VERSION</string> + <key>LSMinimumSystemVersion</key> + <string>10.5</string> + <key>LSMinimumSystemVersionByArchitecture</key> + <dict> + <key>i386</key> + <string>10.5.0</string> + <key>x86_64</key> + <string>10.6.0</string> + </dict> +</dict> +</plist> diff --git a/application/xulrunner/app/macbuild/InfoPlist.strings b/application/xulrunner/app/macbuild/InfoPlist.strings Binary files differnew file mode 100644 index 000000000..5d9eefd51 --- /dev/null +++ b/application/xulrunner/app/macbuild/InfoPlist.strings diff --git a/application/xulrunner/app/moz.build b/application/xulrunner/app/moz.build new file mode 100644 index 000000000..1c9cb117c --- /dev/null +++ b/application/xulrunner/app/moz.build @@ -0,0 +1,70 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +GeckoProgram('xulrunner') + +SOURCES += [ + 'nsXULRunnerApp.cpp', +] + +DEFINES['XULRUNNER_PROGNAME'] = '"xulrunner"' +if CONFIG['MOZ_DEBUG']: + DEFINES['DEBUG'] = True + +LOCAL_INCLUDES += [ + '/toolkit/profile', + '/toolkit/xre', + '/xpcom/base', + '/xpcom/build', +] + +if CONFIG['_MSC_VER']: + # Always enter a Windows program through wmain, whether or not we're + # a console application. + WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup'] + +# Control the default heap size. +# This is the heap returned by GetProcessHeap(). +# As we use the CRT heap, the default size is too large and wastes VM. +# +# The default heap size is 1MB on Win32. +# The heap will grow if need be. +# +# Set it to 256k. See bug 127069. +if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']: + LDFLAGS += ['/HEAP:0x40000'] + +if CONFIG['OS_ARCH'] == 'WINNT': + RCINCLUDE = 'splash.rc' + OS_LIBS += [ + 'comctl32', + 'comdlg32', + 'uuid', + 'shell32', + 'ole32', + 'oleaut32', + 'version', + 'winspool', + ] + +DISABLE_STL_WRAPPING = True + +JS_PREFERENCE_PP_FILES += [ + 'xulrunner.js', +] + +if CONFIG['OS_ARCH'] == 'WINNT': + BRANDING_FILES += [ + 'document.ico', + 'xulrunner.ico', + ] + +if CONFIG['MOZ_WIDGET_GTK']: + BRANDING_FILES += [ + 'default16.png', + 'default32.png', + 'default48.png', + ] diff --git a/application/xulrunner/app/nsXULRunnerApp.cpp b/application/xulrunner/app/nsXULRunnerApp.cpp new file mode 100644 index 000000000..d86317a85 --- /dev/null +++ b/application/xulrunner/app/nsXULRunnerApp.cpp @@ -0,0 +1,294 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsXULAppAPI.h" +#include "nsXPCOMGlue.h" +#include <stdio.h> +#include <stdlib.h> +#ifdef XP_WIN +#include <windows.h> +#if defined(_MSC_VER) && _MSC_VER < 1900 +#define snprintf _snprintf +#endif +#define strcasecmp _stricmp +#endif + +#include "nsAppRunner.h" +#include "nsIFile.h" +#include "nsCOMPtr.h" +#include "nsMemory.h" +#include "nsCRTGlue.h" +#include "nsStringAPI.h" +#include "nsServiceManagerUtils.h" +#include "plstr.h" +#include "prprf.h" +#include "prenv.h" +#include "nsINIParser.h" + +#ifdef XP_WIN +#define XRE_DONT_SUPPORT_XPSP2 // See https://bugzil.la/1023941#c32 +#include "nsWindowsWMain.cpp" +#endif + +#include "BinaryPath.h" + +#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL + +using namespace mozilla; + +/** + * Output a string to the user. This method is really only meant to be used to + * output last-ditch error messages designed for developers NOT END USERS. + * + * @param isError + * Pass true to indicate severe errors. + * @param fmt + * printf-style format string followed by arguments. + */ +static void Output(bool isError, const char *fmt, ... ) +{ + va_list ap; + va_start(ap, fmt); + +#if (defined(XP_WIN) && !MOZ_WINCONSOLE) + wchar_t msg[2048]; + _vsnwprintf(msg, sizeof(msg)/sizeof(msg[0]), NS_ConvertUTF8toUTF16(fmt).get(), ap); + + UINT flags = MB_OK; + if (isError) + flags |= MB_ICONERROR; + else + flags |= MB_ICONINFORMATION; + + MessageBoxW(nullptr, msg, L"XULRunner", flags); +#else + vfprintf(stderr, fmt, ap); +#endif + + va_end(ap); +} + +/** + * Return true if |arg| matches the given argument name. + */ +static bool IsArg(const char* arg, const char* s) +{ + if (*arg == '-') + { + if (*++arg == '-') + ++arg; + return !strcasecmp(arg, s); + } + +#if defined(XP_WIN) + if (*arg == '/') + return !strcasecmp(++arg, s); +#endif + + return false; +} + +static nsresult +GetGREVersion(const char *argv0, + nsACString *aMilestone, + nsACString *aVersion) +{ + if (aMilestone) + aMilestone->AssignLiteral("<Error>"); + if (aVersion) + aVersion->AssignLiteral("<Error>"); + + nsCOMPtr<nsIFile> iniFile; + nsresult rv = BinaryPath::GetFile(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) +{ + nsAutoCString milestone; + GetGREVersion(argv0, &milestone, nullptr); + + // display additional information (XXX make localizable?) + Output(false, + "Mozilla XULRunner %s\n\n" + "Usage: " XULRUNNER_PROGNAME " [OPTIONS]\n" + " " XULRUNNER_PROGNAME " APP-FILE [APP-OPTIONS...]\n" + "\n" + "OPTIONS\n" + " --app specify APP-FILE (optional)\n" + " -h, --help show this message\n" + " -v, --version show version\n" + " --gre-version print the GRE version string on stdout\n" + "\n" + "APP-FILE\n" + " Application initialization file.\n" + "\n" + "APP-OPTIONS\n" + " Application specific options.\n", + milestone.get()); +} + +XRE_GetFileFromPathType XRE_GetFileFromPath; +XRE_CreateAppDataType XRE_CreateAppData; +XRE_FreeAppDataType XRE_FreeAppData; +XRE_mainType XRE_main; + +static const nsDynamicFunctionLoad kXULFuncs[] = { + { "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath }, + { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData }, + { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData }, + { "XRE_main", (NSFuncPtr*) &XRE_main }, + { nullptr, nullptr } +}; + +class AutoAppData +{ +public: + AutoAppData(nsIFile* aINIFile) : mAppData(nullptr) { + nsresult rv = XRE_CreateAppData(aINIFile, &mAppData); + if (NS_FAILED(rv)) + mAppData = nullptr; + } + ~AutoAppData() { + if (mAppData) + XRE_FreeAppData(mAppData); + } + + operator nsXREAppData*() const { return mAppData; } + nsXREAppData* operator -> () const { return mAppData; } + +private: + nsXREAppData* mAppData; +}; + +int main(int argc, char* argv[]) +{ + char exePath[MAXPATHLEN]; + nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath); + if (NS_FAILED(rv)) { + Output(true, "Couldn't calculate the application directory.\n"); + return 255; + } + + char *lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]); + if (!lastSlash || (size_t(lastSlash - exePath) > MAXPATHLEN - sizeof(XPCOM_DLL) - 1)) + return 255; + + strcpy(++lastSlash, XPCOM_DLL); + + rv = XPCOMGlueStartup(exePath); + if (NS_FAILED(rv)) { + Output(true, "Couldn't load XPCOM.\n"); + return 255; + } + + if (argc > 1 && (IsArg(argv[1], "h") || + IsArg(argv[1], "help") || + IsArg(argv[1], "?"))) + { + Usage(argv[0]); + return 0; + } + + if (argc == 2 && (IsArg(argv[1], "v") || IsArg(argv[1], "version"))) + { + nsAutoCString milestone; + nsAutoCString version; + GetGREVersion(argv[0], &milestone, &version); + Output(false, "Mozilla XULRunner %s - %s\n", + milestone.get(), version.get()); + return 0; + } + + rv = XPCOMGlueLoadXULFunctions(kXULFuncs); + if (NS_FAILED(rv)) { + Output(true, "Couldn't load XRE functions.\n"); + return 255; + } + + if (argc > 1) { + nsAutoCString milestone; + rv = GetGREVersion(argv[0], &milestone, nullptr); + if (NS_FAILED(rv)) + return 2; + + if (IsArg(argv[1], "gre-version")) { + if (argc != 2) { + Usage(argv[0]); + return 1; + } + + printf("%s\n", milestone.get()); + return 0; + } + + if (IsArg(argv[1], "install-app")) { + Output(true, "--install-app support has been removed. Use 'python install-app.py' instead.\n"); + return 1; + } + } + + const char *appDataFile = getenv("XUL_APP_FILE"); + + if (!(appDataFile && *appDataFile)) { + if (argc < 2) { + Usage(argv[0]); + return 1; + } + + if (IsArg(argv[1], "app")) { + if (argc == 2) { + Usage(argv[0]); + return 1; + } + argv[1] = argv[0]; + ++argv; + --argc; + } + + appDataFile = argv[1]; + argv[1] = argv[0]; + ++argv; + --argc; + + static char kAppEnv[MAXPATHLEN]; + snprintf(kAppEnv, MAXPATHLEN, "XUL_APP_FILE=%s", appDataFile); + putenv(kAppEnv); + } + + nsCOMPtr<nsIFile> appDataLF; + rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appDataLF)); + if (NS_FAILED(rv)) { + Output(true, "Error: unrecognized application.ini path.\n"); + return 2; + } + + AutoAppData appData(appDataLF); + if (!appData) { + Output(true, "Error: couldn't parse application.ini.\n"); + return 2; + } + + return XRE_main(argc, argv, appData, 0); +} diff --git a/application/xulrunner/app/splash.rc b/application/xulrunner/app/splash.rc new file mode 100644 index 000000000..4374383ba --- /dev/null +++ b/application/xulrunner/app/splash.rc @@ -0,0 +1,22 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include <windows.h> +#include "nsNativeAppSupportWin.h" + +1 24 "xulrunner.exe.manifest" + +IDI_APPICON ICON XULRUNNER_ICO +IDI_DOCUMENT ICON DOCUMENT_ICO +IDI_APPLICATION ICON XULRUNNER_ICO + +STRINGTABLE DISCARDABLE +BEGIN +#ifdef DEBUG + IDS_STARTMENU_APPNAME, "Firefox Debug" +#else + IDS_STARTMENU_APPNAME, "Firefox" +#endif +END diff --git a/application/xulrunner/app/xulrunner.exe.manifest b/application/xulrunner/app/xulrunner.exe.manifest new file mode 100644 index 000000000..b08eea074 --- /dev/null +++ b/application/xulrunner/app/xulrunner.exe.manifest @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> +<assemblyIdentity + version="1.0.0.0" + processorArchitecture="*" + name="Mozilla.XULRunner" + type="win32" +/> +<description>Mozilla XULRunner</description> +<dependency> + <dependentAssembly> + <assemblyIdentity + type="win32" + name="Microsoft.Windows.Common-Controls" + version="6.0.0.0" + processorArchitecture="*" + publicKeyToken="6595b64144ccf1df" + language="*" + /> + </dependentAssembly> +</dependency> +<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3"> + <ms_asmv3:security> + <ms_asmv3:requestedPrivileges> + <ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" /> + </ms_asmv3:requestedPrivileges> + </ms_asmv3:security> +</ms_asmv3:trustInfo> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> + <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> + </application> + </compatibility> +</assembly> diff --git a/application/xulrunner/app/xulrunner.ico b/application/xulrunner/app/xulrunner.ico Binary files differnew file mode 100644 index 000000000..0518438a0 --- /dev/null +++ b/application/xulrunner/app/xulrunner.ico diff --git a/application/xulrunner/app/xulrunner.js b/application/xulrunner/app/xulrunner.js new file mode 100644 index 000000000..509bb48a5 --- /dev/null +++ b/application/xulrunner/app/xulrunner.js @@ -0,0 +1,26 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#filter substitution + +// We need to override the default values of these preferences since all.js +// assumes these are in the navigator package, which for us is nonexistent. +// XXX(darin): perhaps all.js should not be seamonkey specific +pref("general.useragent.locale", "@AB_CD@"); +pref("xpinstall.dialog.confirm", "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul"); +pref("xpinstall.dialog.progress.chrome", "chrome://mozapps/content/extensions/extensions.xul"); +pref("xpinstall.dialog.progress.skin", "chrome://mozapps/content/extensions/extensions.xul"); +pref("xpinstall.dialog.progress.type.chrome", "Extension:Manager"); +pref("xpinstall.dialog.progress.type.skin", "Extension:Manager"); +pref("xpinstall.enabled", true); +#ifdef XP_WIN +pref("browser.preferences.instantApply", false); +#else +pref("browser.preferences.instantApply", true); +#endif +#ifdef XP_MACOSX +pref("browser.preferences.animateFadeIn", true); +#else +pref("browser.preferences.animateFadeIn", false); +#endif |