bug 746156 - isolate webapp runtime files into subdirectory of Firefox package; r=bsmedberg, a=akeybl

This commit is contained in:
Myk Melez 2012-04-19 00:39:52 -07:00
parent 776c72f571
commit 4f307cae98
22 changed files with 116 additions and 126 deletions

View File

@ -503,9 +503,6 @@
#ifdef MOZ_SERVICES_SYNC
@BINPATH@/@PREF_DIR@/services-sync.js
#endif
#ifdef MOZ_WEBAPP_RUNTIME
@BINPATH@/@PREF_DIR@/webapprt@mozilla.org/prefs.js
#endif
@BINPATH@/greprefs.js
@BINPATH@/defaults/autoconfig/platform.js
@BINPATH@/defaults/autoconfig/prefcalls.js
@ -629,12 +626,15 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
#endif
#ifdef MOZ_WEBAPP_RUNTIME
; [Webapp Runtime]
[WebappRuntime]
@BINPATH@/webapprt-stub@BIN_SUFFIX@
@BINPATH@/chrome/webapprt@JAREXT@
@BINPATH@/chrome/webapprt.manifest
@BINPATH@/components/WebappRTComponents.manifest
@BINPATH@/components/WebappRTDirectoryProvider.js
@BINPATH@/components/WebappRTCommandLineHandler.js
@BINPATH@/webapprt.ini
@BINPATH@/webapprt/application.ini
@BINPATH@/webapprt/chrome.manifest
@BINPATH@/webapprt/chrome/webapprt@JAREXT@
@BINPATH@/webapprt/chrome/webapprt.manifest
@BINPATH@/webapprt/components/CommandLineHandler.js
@BINPATH@/webapprt/components/DirectoryProvider.js
@BINPATH@/webapprt/components/components.manifest
@BINPATH@/webapprt/defaults/preferences/prefs.js
@BINPATH@/webapprt/modules/WebappRT.jsm
#endif

View File

@ -211,7 +211,7 @@ endif
clobber-zip:
$(RM) $(STAGEDIST)/chrome/$(AB_CD).jar \
$(STAGEDIST)/chrome/$(AB_CD).manifest \
$(STAGEDIST)/defaults/pref/firefox-l10n.js
$(STAGEDIST)/$(PREF_DIR)/firefox-l10n.js
$(RM) -rf $(STAGEDIST)/searchplugins \
$(STAGEDIST)/dictionaries \
$(STAGEDIST)/hyphenation \

View File

@ -1371,7 +1371,7 @@ $(foreach namespace,$(EXPORTS_NAMESPACES),$(eval $(EXPORT_NAMESPACE_RULE)))
ifdef GRE_MODULE
PREF_DIR = greprefs
else
ifneq (,$(XPI_NAME)$(LIBXUL_SDK))
ifneq (,$(XPI_NAME)$(LIBXUL_SDK)$(MOZ_PHOENIX))
PREF_DIR = defaults/preferences
else
PREF_DIR = defaults/pref

View File

@ -1371,7 +1371,7 @@ $(foreach namespace,$(EXPORTS_NAMESPACES),$(eval $(EXPORT_NAMESPACE_RULE)))
ifdef GRE_MODULE
PREF_DIR = greprefs
else
ifneq (,$(XPI_NAME)$(LIBXUL_SDK))
ifneq (,$(XPI_NAME)$(LIBXUL_SDK)$(MOZ_PHOENIX))
PREF_DIR = defaults/preferences
else
PREF_DIR = defaults/pref

View File

@ -43,7 +43,6 @@
#include "mozilla/HashFunctions.h"
#include "nsXULAppAPI.h"
#include "nsIXULAppInfo.h"
#include "mozilla/Preferences.h"
#include "nsAppDirectoryServiceDefs.h"
@ -85,8 +84,6 @@ namespace mozilla {
#define INITIAL_PREF_FILES 10
static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
#define WEBAPPRT_APPID "webapprt@mozilla.org"
// Prototypes
static nsresult openPrefFile(nsIFile* aFile);
static nsresult pref_InitInitialObjects(void);
@ -861,7 +858,7 @@ pref_LoadPrefsInDir(nsIFile* aDir, char const *const *aSpecialFiles, PRUint32 aS
if (NS_FAILED(rv)) {
// If the directory doesn't exist, then we have no reason to complain. We
// loaded everything (and nothing) successfully.
if (rv == NS_ERROR_FILE_NOT_FOUND)
if (rv == NS_ERROR_FILE_NOT_FOUND || rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)
rv = NS_OK;
return rv;
}
@ -1018,14 +1015,10 @@ static nsresult pref_InitInitialObjects()
// - $app/defaults/preferences/*.js
// and in non omni.jar case:
// - $app/defaults/preferences/*.js
//
// When we're running WebappRT (i.e. $app == WEBAPPRT_APPID), in omni.jar
// case, we also load:
// - jar:$gre/omni.jar!/defaults/pref/$WEBAPPRT_APPID/*.js
// This allows WebappRT-specific prefs to override those of another app
// with whom it shares an app dir (i.e. Firefox).
// (A $WEBAPPRT_APPID dir is similarly hardcoded into the app pref dir list
// in nsXREDirProvider for when we're running WebappRT in non omni.jar case.)
// When $app == $gre, we additionally load, in omni.jar case:
// - jar:$gre/omni.jar!/defaults/preferences/*.js
// Thus, in omni.jar case, we always load app-specific default preferences
// from omni.jar, whether or not $app == $gre.
nsZipFind *findPtr;
nsAutoPtr<nsZipFind> find;
@ -1049,30 +1042,6 @@ static nsresult pref_InitInitialObjects()
}
prefEntries.Sort();
// Load jar:$gre/omni.jar!/defaults/pref/$WEBAPPRT_APPID/*.js
// if we're running WebappRT.
nsCOMPtr<nsIXULAppInfo> appInfo =
do_GetService("@mozilla.org/xre/app-info;1", &rv);
if (NS_SUCCEEDED(rv)) {
nsCAutoString appID;
if (NS_SUCCEEDED(appInfo->GetID(appID)) && appID.Equals(WEBAPPRT_APPID)) {
nsCAutoString prefsPath("defaults/pref/");
prefsPath.Append(appID);
prefsPath.AppendLiteral("/*.js$");
rv = jarReader->FindInit(prefsPath.get(), &findPtr);
NS_ENSURE_SUCCESS(rv, rv);
// Make sure the files get read last by putting them at the beginning
// of the list of pref entries (which is processed backwards), so prefs
// in these app-specific files override those in non-app-specific ones.
find = findPtr;
while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) {
prefEntries.InsertElementAt(0, Substring(entryName, entryNameLen));
}
}
}
for (PRUint32 i = prefEntries.Length(); i--; ) {
rv = pref_ReadPrefFromJar(jarReader, prefEntries[i].get());
if (NS_FAILED(rv))
@ -1123,7 +1092,12 @@ static nsresult pref_InitInitialObjects()
NS_WARNING("Error parsing application default preferences.");
// Load jar:$app/omni.jar!/defaults/preferences/*.js
// or jar:$gre/omni.jar!/defaults/preferences/*.js.
nsRefPtr<nsZipArchive> appJarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::APP);
// GetReader(mozilla::Omnijar::APP) returns null when $app == $gre, in which
// case we look for app-specific default preferences in $gre.
if (!appJarReader)
appJarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE);
if (appJarReader) {
rv = appJarReader->FindInit("defaults/preferences/*.js$", &findPtr);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -172,6 +172,9 @@ endif
endif
ifdef MOZ_OMNIJAR
@(cd $(STAGEDIST) && $(UNPACK_OMNIJAR))
ifdef MOZ_WEBAPP_RUNTIME
@(cd $(STAGEDIST)/webapprt && $(UNPACK_OMNIJAR_WEBAPP_RUNTIME))
endif
endif
$(MAKE) clobber-zip AB_CD=$(AB_CD)
$(NSINSTALL) -D $(DIST)/$(PKG_PATH)

View File

@ -234,7 +234,10 @@ sub do_copyfile
# set the destination path, if alternate destination given, use it.
if ($flat) {
if ($srcsuffix eq ".manifest" && $srcpath =~ m'/(chrome|components)/$') {
# WebappRuntime has manifests that shouldn't be flattened, even though it
# gets packaged with Firefox, which does get flattened, so special-case it.
if ($srcsuffix eq ".manifest" && $srcpath =~ m'/(chrome|components)/$' &&
$component ne "WebappRuntime") {
my $subdir = $1;
if ($component eq "") {
die ("Manifest file was not part of a component.");

View File

@ -547,13 +547,34 @@ UNPACK_OMNIJAR = \
mv tmp.manifest $$m; \
done
ifdef MOZ_WEBAPP_RUNTIME
# It's simpler to pack the webapp runtime, because it doesn't have any
# binary components. We also don't pre-generate the startup cache, which seems
# unnecessary, given the small size of the runtime, although it might become
# more valuable over time.
PACK_OMNIJAR_WEBAPP_RUNTIME = \
rm -f $(OMNIJAR_NAME); \
$(ZIP) -r9m $(OMNIJAR_NAME) $(OMNIJAR_FILES) -x $(NON_OMNIJAR_FILES) && \
$(OPTIMIZE_JARS_CMD) --optimize $(JARLOG_DIR_AB_CD) ./ ./
UNPACK_OMNIJAR_WEBAPP_RUNTIME = \
$(OPTIMIZE_JARS_CMD) --deoptimize $(JARLOG_DIR_AB_CD) ./ ./ && \
$(UNZIP) -o $(OMNIJAR_NAME)
PREPARE_PACKAGE = (cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(PACK_OMNIJAR)) && \
(cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/webapprt && $(PACK_OMNIJAR_WEBAPP_RUNTIME)) && \
(cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(CREATE_PRECOMPLETE_CMD))
UNMAKE_PACKAGE = $(INNER_UNMAKE_PACKAGE) && \
(cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(UNPACK_OMNIJAR)) && \
(cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/webapprt && $(UNPACK_OMNIJAR_WEBAPP_RUNTIME))
else # ndef MOZ_WEBAPP_RUNTIME
PREPARE_PACKAGE = (cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(PACK_OMNIJAR)) && \
(cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(CREATE_PRECOMPLETE_CMD))
UNMAKE_PACKAGE = $(INNER_UNMAKE_PACKAGE) && (cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(UNPACK_OMNIJAR))
else
endif # def MOZ_WEBAPP_RUNTIME
else # ndef MOZ_OMNIJAR
PREPARE_PACKAGE = (cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(CREATE_PRECOMPLETE_CMD))
UNMAKE_PACKAGE = $(INNER_UNMAKE_PACKAGE)
endif
endif # def MOZ_OMNIJAR
ifdef MOZ_INTERNAL_SIGNING_FORMAT
MOZ_SIGN_PREPARED_PACKAGE_CMD=$(MOZ_SIGN_CMD) $(foreach f,$(MOZ_INTERNAL_SIGNING_FORMAT),-f $(f)) $(foreach i,$(SIGN_INCLUDES),-i $(i)) $(foreach x,$(SIGN_EXCLUDES),-x $(x)) --nsscmd "$(SIGN_CMD)"
@ -720,6 +741,9 @@ endif
@$(NSINSTALL) -D $(DEPTH)/installer-stage/core
ifdef MOZ_OMNIJAR
@(cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(PACK_OMNIJAR))
ifdef MOZ_WEBAPP_RUNTIME
@(cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/webapprt && $(PACK_OMNIJAR_WEBAPP_RUNTIME))
endif
endif
@cp -av $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/. $(DEPTH)/installer-stage/core
@(cd $(DEPTH)/installer-stage/core && $(CREATE_PRECOMPLETE_CMD))
@ -873,6 +897,9 @@ ifeq (bundle,$(MOZ_FS_LAYOUT))
endif
ifdef MOZ_OMNIJAR
cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && $(PACK_OMNIJAR)
ifdef MOZ_WEBAPP_RUNTIME
cd $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/webapprt && $(PACK_OMNIJAR_WEBAPP_RUNTIME))
endif
endif
$(NSINSTALL) -D $(DESTDIR)$(installdir)
(cd $(DIST)/$(MOZ_PKG_DIR) && tar $(TAR_CREATE_FLAGS) - .) | \

View File

@ -113,6 +113,6 @@ webapp_uninstaller::
$(INSTALL) $(addprefix $(MOZILLA_DIR)/toolkit/mozapps/installer/windows/nsis/,$(TOOLKIT_NSIS_FILES)) $(CONFIG_DIR)
$(INSTALL) $(addprefix $(MOZILLA_DIR)/other-licenses/nsis/Plugins/,$(CUSTOM_NSIS_PLUGINS)) $(CONFIG_DIR)
cd $(CONFIG_DIR) && $(MAKENSISU) webapp-uninstaller.nsi
$(NSINSTALL) -D $(DIST)/bin/
cp $(CONFIG_DIR)/webapp-uninstaller.exe $(DIST)/bin
$(NSINSTALL) -D $(FINAL_TARGET)
cp $(CONFIG_DIR)/webapp-uninstaller.exe $(FINAL_TARGET)
endif

View File

@ -99,8 +99,6 @@
#define PREF_OVERRIDE_DIRNAME "preferences"
#define WEBAPPRT_APPID "webapprt@mozilla.org"
static already_AddRefed<nsILocalFile>
CloneAndAppend(nsIFile* aFile, const char* name)
{
@ -650,13 +648,6 @@ nsXREDirProvider::GetFilesInternal(const char* aProperty,
LoadDirsIntoArray(mAppBundleDirectories,
kAppendPrefDir, directories);
// Include the WebappRT-specific prefs dir if we're running WebappRT.
if (gAppData && !strcmp(gAppData->ID, WEBAPPRT_APPID)) {
const char *const kAppendAppIDPrefDir[] =
{ "defaults", "pref", gAppData->ID, nsnull };
LoadDirIntoArray(mXULAppDir, kAppendAppIDPrefDir, directories);
}
rv = NS_NewArrayEnumerator(aResult, directories);
}
else if (!strcmp(aProperty, NS_EXT_PREFS_DEFAULTS_DIR_LIST)) {

View File

@ -11,7 +11,7 @@ const NS_APP_CHROME_DIR_LIST = "AChromDL";
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/WebappRT.jsm");
Cu.import("resource://webapprt/modules/WebappRT.jsm");
function DirectoryProvider() {}

View File

@ -9,6 +9,10 @@ VPATH = @srcdir@
include $(topsrcdir)/config/config.mk
# config.mk sets FINAL_TARGET to $(DIST)/bin, but we want to copy build products
# into a WebappRT-specific subdirectory, so we redefine it here.
FINAL_TARGET = $(DIST)/bin/webapprt
DIRS = $(NULL)
ifneq (,$(filter WINNT,$(OS_ARCH)))
@ -20,29 +24,32 @@ endif # mac
endif # windows
EXTRA_PP_COMPONENTS = \
WebappRTComponents.manifest \
WebappRTCommandLineHandler.js \
WebappRTDirectoryProvider.js \
components.manifest \
CommandLineHandler.js \
DirectoryProvider.js \
$(NULL)
EXTRA_JS_MODULES = \
WebappRT.jsm \
$(NULL)
WebappRT.jsm \
$(NULL)
include $(topsrcdir)/config/rules.mk
libs::
$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "resource webapprt ./"
libs:: prefs.js
$(NSINSTALL) -D $(DIST)/bin/defaults/pref/webapprt@mozilla.org
$(INSTALL) $^ $(DIST)/bin/defaults/pref/webapprt@mozilla.org
$(NSINSTALL) -D $(FINAL_TARGET)/defaults/preferences
$(INSTALL) $^ $(FINAL_TARGET)/defaults/preferences
GRE_MILESTONE := $(shell tail -n 1 $(topsrcdir)/config/milestone.txt 2>/dev/null || tail -1 $(topsrcdir)/config/milestone.txt)
GRE_BUILDID := $(shell cat $(DEPTH)/config/buildid)
DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DGRE_BUILDID=$(GRE_BUILDID)
webapprt.ini: webapprt.ini.in $(DEPTH)/config/buildid $(topsrcdir)/config/milestone.txt
application.ini: application.ini.in $(DEPTH)/config/buildid $(topsrcdir)/config/milestone.txt
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $< > $@
libs:: webapprt.ini
$(INSTALL) webapprt.ini $(DIST)/bin
libs:: application.ini
$(INSTALL) application.ini $(FINAL_TARGET)
GARBAGE += webapprt.ini
GARBAGE += application.ini

View File

@ -1,9 +1,9 @@
# WebappRTCommandLineHandler.js
component {6d69c782-40a3-469b-8bfd-3ee366105a4a} WebappRTCommandLineHandler.js application=webapprt@mozilla.org
# CommandLineHandler.js
component {6d69c782-40a3-469b-8bfd-3ee366105a4a} CommandLineHandler.js application=webapprt@mozilla.org
contract @mozilla.org/webapprt/clh;1 {6d69c782-40a3-469b-8bfd-3ee366105a4a} application=webapprt@mozilla.org
category command-line-handler x-default @mozilla.org/webapprt/clh;1 application=webapprt@mozilla.org
# WebappRTDirectoryProvider.js
component {e1799fda-4b2f-4457-b671-e0641d95698d} WebappRTDirectoryProvider.js application=webapprt@mozilla.org
# DirectoryProvider.js
component {e1799fda-4b2f-4457-b671-e0641d95698d} DirectoryProvider.js application=webapprt@mozilla.org
contract @mozilla.org/webapprt/directory-provider;1 {e1799fda-4b2f-4457-b671-e0641d95698d} application=webapprt@mozilla.org
category xpcom-directory-providers webapprt-directory-provider @mozilla.org/webapprt/directory-provider;1 application=webapprt@mozilla.org

View File

@ -6,7 +6,7 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://gre/modules/WebappRT.jsm");
Cu.import("resource://webapprt/modules/WebappRT.jsm");
Cu.import("resource://gre/modules/Services.jsm");
function onLoad() {

View File

@ -1,4 +1,4 @@
webapprt.jar:
% content webapprt %content/
* content/webapp.js (content/webapp.js)
* content/webapp.xul (content/webapp.xul)
% content webapprt %content/
* content/webapp.js (content/webapp.js)
* content/webapp.xul (content/webapp.xul)

View File

@ -32,11 +32,14 @@
const char WEBAPPRT_EXECUTABLE[] = "webapprt-stub";
const char FXAPPINI_NAME[] = "application.ini";
const char WEBAPPINI_NAME[] = "webapp.ini";
const char WEBRTINI_NAME[] = "webapprt.ini";
const char WEBRTINI_NAME[] = "application.ini";
//need the correct relative path here
const char APP_CONTENTS_PATH[] = "/Contents/MacOS/";
//the path to the WebappRT subdir within the Firefox app contents dir
const char WEBAPPRT_PATH[] = "webapprt/";
void ExecNewBinary(NSString* launchPath);
NSString *PathToWebRT(NSString* alternateBinaryID);
@ -212,10 +215,14 @@ main(int argc, char **argv)
@throw MakeException(@"Error", @"Unable to parse environment files for application startup");
}
// Get the path to the runtime's INI file. This should be in the
// same directory as the GRE.
snprintf(rtINIPath, MAXPATHLEN, "%s%s%s", [firefoxPath UTF8String], APP_CONTENTS_PATH, WEBRTINI_NAME);
NSLog(@"webapprt.ini path: %s", rtINIPath);
// Get the path to the runtime directory.
char rtDir[MAXPATHLEN];
snprintf(rtDir, MAXPATHLEN, "%s%s%s", [firefoxPath UTF8String], APP_CONTENTS_PATH, WEBAPPRT_PATH);
// Get the path to the runtime's INI file. This is in the runtime
// directory.
snprintf(rtINIPath, MAXPATHLEN, "%s%s%s%s", [firefoxPath UTF8String], APP_CONTENTS_PATH, WEBAPPRT_PATH, WEBRTINI_NAME);
NSLog(@"WebappRT application.ini path: %s", rtINIPath);
if (![[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%s", rtINIPath]]) {
NSString* msg = [NSString stringWithFormat: @"This copy of Firefox (%@) cannot run web applications, because it is missing important files", firefoxVersion];
@throw MakeException(@"Missing WebRT Files", msg);
@ -229,13 +236,13 @@ main(int argc, char **argv)
}
if (!rtINI) {
NSLog(@"Error: missing webapprt.ini");
NSLog(@"Error: missing WebappRT application.ini");
@throw MakeException(@"Error", @"Missing base INI file.");
}
nsXREAppData *webShellAppData;
if (NS_FAILED(XRE_CreateAppData(rtINI, &webShellAppData))) {
NSLog(@"Couldn't read webapprt.ini: %s", rtINIPath);
NSLog(@"Couldn't read WebappRT application.ini: %s", rtINIPath);
@throw MakeException(@"Error", @"Unable to parse base INI file.");
}
@ -248,7 +255,7 @@ main(int argc, char **argv)
SetAllocatedString(webShellAppData->profile, profile);
nsCOMPtr<nsILocalFile> directory;
if (NS_FAILED(XRE_GetFileFromPath(greDir, getter_AddRefs(directory)))) {
if (NS_FAILED(XRE_GetFileFromPath(rtDir, getter_AddRefs(directory)))) {
NSLog(@"Unable to open app dir");
@throw MakeException(@"Error", @"Unable to open application directory.");
}

View File

@ -3,11 +3,3 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
pref("browser.chromeURL", "chrome://webapprt/content/webapp.xul");
// We set this to the value of DEFAULT_HIDDENWINDOW_URL in nsAppShellService.cpp
// so our app is treated as not having an application-provided hidden window.
// Ideally, we could just leave it out, but because we are being distributed
// in a unified directory with Firefox, Firefox's preferences are being read
// before ours, which means this preference is being set by Firefox, and we need
// to set it here to override the Firefox-provided value.
pref("browser.hiddenWindowChromeURL", "resource://gre-resources/hiddenWindow.html");

View File

@ -7,7 +7,7 @@ topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
# Build a binary bootstrapping with XRE_main
PROGRAM = webapprt-stub$(BIN_SUFFIX)
@ -51,8 +51,6 @@ SFX_MODULE = $(topsrcdir)/other-licenses/7zstub/firefox/7zSD.sfx
APP_VERSION := $(shell cat $(topsrcdir)/browser/config/version.txt)
DEFINES += -DAPP_VERSION=$(APP_VERSION)
include $(topsrcdir)/config/config.mk
ifdef _MSC_VER
# Always enter a Windows program through wmain, whether or not we're
# a console application.

View File

@ -27,7 +27,7 @@ XRE_mainType XRE_main;
namespace {
const char kAPP_INI[] = "application.ini";
const char kWEBAPP_INI[] = "webapp.ini";
const char kWEBAPPRT_INI[] = "webapprt.ini";
const char kWEBAPPRT_PATH[] = "webapprt";
const char kAPP_ENV_PREFIX[] = "XUL_APP_FILE=";
const char kAPP_RT[] = "webapprt-stub.exe";
@ -262,10 +262,14 @@ namespace {
ScopedLogging log;
// Get the path to the runtime's INI file. This should be in the
// same directory as the GRE.
// Get the path to the runtime.
char rtPath[MAXPATHLEN];
rv = joinPath(rtPath, greDir, kWEBAPPRT_PATH, MAXPATHLEN);
NS_ENSURE_SUCCESS(rv, rv);
// Get the path to the runtime's INI file.
char rtIniPath[MAXPATHLEN];
rv = joinPath(rtIniPath, greDir, kWEBAPPRT_INI, MAXPATHLEN);
rv = joinPath(rtIniPath, rtPath, kAPP_INI, MAXPATHLEN);
NS_ENSURE_SUCCESS(rv, false);
// Load the runtime's INI from its path.
@ -284,13 +288,11 @@ namespace {
SetAllocatedString(webShellAppData->profile, profile);
nsCOMPtr<nsILocalFile> directory;
rv = XRE_GetFileFromPath(greDir,
getter_AddRefs(directory));
rv = XRE_GetFileFromPath(rtPath, getter_AddRefs(directory));
NS_ENSURE_SUCCESS(rv, false);
nsCOMPtr<nsILocalFile> xreDir;
rv = XRE_GetFileFromPath(greDir,
getter_AddRefs(xreDir));
rv = XRE_GetFileFromPath(greDir, getter_AddRefs(xreDir));
NS_ENSURE_SUCCESS(rv, false);
xreDir.forget(&webShellAppData->xreDirectory);

View File

@ -121,22 +121,8 @@ nsAppShellService::CreateHiddenWindow()
PRUint32 chromeMask = 0;
nsAdoptingCString prefVal =
Preferences::GetCString("browser.hiddenWindowChromeURL");
// Set mApplicationProvidedHiddenWindow to true only if there is a hidden
// window chrome URL in preferences AND it is set to a non-default value.
// This enables an app that doesn't have a hidden window (like WebappRT)
// to share an app directory with one that does (like Firefox), the former
// taking advantage of this behavior to "unset" the latter's hidden window
// pref by setting it to the default value.
//
// (Ideally, the former would be able to simply unset the latter's pref,
// but there is no way to do that; even more ideally, the two apps would not
// share an app directory, but in the case of WebappRT and Firefox that's
// a longer-term fix.)
//
mApplicationProvidedHiddenWindow = prefVal.get() && strcmp(prefVal.get(), DEFAULT_HIDDENWINDOW_URL) ? true : false;
const char* hiddenWindowURL = mApplicationProvidedHiddenWindow ? prefVal.get() : DEFAULT_HIDDENWINDOW_URL;
const char* hiddenWindowURL = prefVal.get() ? prefVal.get() : DEFAULT_HIDDENWINDOW_URL;
mApplicationProvidedHiddenWindow = prefVal.get() ? true : false;
#else
static const char hiddenWindowURL[] = DEFAULT_HIDDENWINDOW_URL;
PRUint32 chromeMask = nsIWebBrowserChrome::CHROME_ALL;