summaryrefslogtreecommitdiffstats
path: root/application/xulrunner
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-25 15:48:44 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-25 15:48:44 +0200
commit3ab6c7feee8126bdfc5c9ab9371db41102e12e95 (patch)
treea309c45826300b888238b6a517051fe7e71d63eb /application/xulrunner
parentb18a9cf86ea25bc52d9cfea584e3aa8bfbe81f0a (diff)
parentb069dabc91b7e0f5f8d161cdbe598276a21d6d68 (diff)
downloadUXP-3ab6c7feee8126bdfc5c9ab9371db41102e12e95.tar
UXP-3ab6c7feee8126bdfc5c9ab9371db41102e12e95.tar.gz
UXP-3ab6c7feee8126bdfc5c9ab9371db41102e12e95.tar.lz
UXP-3ab6c7feee8126bdfc5c9ab9371db41102e12e95.tar.xz
UXP-3ab6c7feee8126bdfc5c9ab9371db41102e12e95.zip
Merge branch 'master' of https://github.com/MoonchildProductions/UXP into pm_url_1
Diffstat (limited to 'application/xulrunner')
-rw-r--r--application/xulrunner/README.xulrunner13
-rw-r--r--application/xulrunner/app.mozbuild13
-rw-r--r--application/xulrunner/app/Makefile.in75
-rw-r--r--application/xulrunner/app/default16.pngbin0 -> 744 bytes
-rw-r--r--application/xulrunner/app/default32.pngbin0 -> 2084 bytes
-rw-r--r--application/xulrunner/app/default48.pngbin0 -> 3846 bytes
-rw-r--r--application/xulrunner/app/document.icobin0 -> 22486 bytes
-rw-r--r--application/xulrunner/app/install_app.py221
-rw-r--r--application/xulrunner/app/macbuild/Info.plist.in31
-rw-r--r--application/xulrunner/app/macbuild/InfoPlist.stringsbin0 -> 280 bytes
-rw-r--r--application/xulrunner/app/moz.build70
-rw-r--r--application/xulrunner/app/nsXULRunnerApp.cpp294
-rw-r--r--application/xulrunner/app/splash.rc22
-rw-r--r--application/xulrunner/app/xulrunner.exe.manifest38
-rw-r--r--application/xulrunner/app/xulrunner.icobin0 -> 22486 bytes
-rw-r--r--application/xulrunner/app/xulrunner.js26
-rw-r--r--application/xulrunner/config/mozconfig9
-rw-r--r--application/xulrunner/config/mozconfigs/common7
-rw-r--r--application/xulrunner/config/mozconfigs/common.override8
-rw-r--r--application/xulrunner/config/mozconfigs/linux32/xulrunner9
-rw-r--r--application/xulrunner/config/mozconfigs/linux32/xulrunner-qt15
-rw-r--r--application/xulrunner/config/mozconfigs/linux64/xulrunner9
-rw-r--r--application/xulrunner/config/mozconfigs/macosx-universal/xulrunner9
-rw-r--r--application/xulrunner/config/mozconfigs/win32/xulrunner16
-rw-r--r--application/xulrunner/config/mozconfigs/win64/xulrunner15
-rw-r--r--application/xulrunner/configure.in11
-rw-r--r--application/xulrunner/confvars.sh28
-rw-r--r--application/xulrunner/examples/moz.build7
-rw-r--r--application/xulrunner/examples/simple/application.ini43
-rw-r--r--application/xulrunner/examples/simple/components/moz.build7
-rw-r--r--application/xulrunner/examples/simple/components/public/moz.build13
-rw-r--r--application/xulrunner/examples/simple/components/public/nsISimpleTest.idl15
-rw-r--r--application/xulrunner/examples/simple/components/src/SimpleTest.cpp54
-rw-r--r--application/xulrunner/examples/simple/components/src/SimpleTest.js27
-rw-r--r--application/xulrunner/examples/simple/components/src/SimpleTest.manifest2
-rw-r--r--application/xulrunner/examples/simple/components/src/moz.build21
-rw-r--r--application/xulrunner/examples/simple/content/contents.rdf0
-rw-r--r--application/xulrunner/examples/simple/content/simple.js17
-rw-r--r--application/xulrunner/examples/simple/content/simple.xul20
-rw-r--r--application/xulrunner/examples/simple/icons/simple.icobin0 -> 29310 bytes
-rw-r--r--application/xulrunner/examples/simple/jar.mn12
-rw-r--r--application/xulrunner/examples/simple/locale/simple.dtd7
-rw-r--r--application/xulrunner/examples/simple/moz.build22
-rw-r--r--application/xulrunner/examples/simple/simple-prefs.js6
-rw-r--r--application/xulrunner/installer/Makefile.in148
-rw-r--r--application/xulrunner/installer/debian/changelog.in7
-rw-r--r--application/xulrunner/installer/debian/compat1
-rw-r--r--application/xulrunner/installer/debian/control48
-rw-r--r--application/xulrunner/installer/debian/icon_base6436
-rw-r--r--application/xulrunner/installer/debian/menu2
-rw-r--r--application/xulrunner/installer/debian/postinst.in42
-rw-r--r--application/xulrunner/installer/debian/prerm.in29
-rw-r--r--application/xulrunner/installer/debian/xulrunner.links.in2
-rw-r--r--application/xulrunner/installer/debian/xulrunner.service.in4
-rw-r--r--application/xulrunner/installer/libxul-embedding.pc.in10
-rw-r--r--application/xulrunner/installer/libxul.pc.in11
-rw-r--r--application/xulrunner/installer/moz.build6
-rw-r--r--application/xulrunner/installer/mozilla-js.pc.in10
-rw-r--r--application/xulrunner/installer/mozilla-nspr.pc.in11
-rw-r--r--application/xulrunner/installer/mozilla-nss.pc.in10
-rw-r--r--application/xulrunner/installer/mozilla-plugin.pc.in8
-rw-r--r--application/xulrunner/locales/all-locales39
-rw-r--r--application/xulrunner/moz.build11
-rw-r--r--application/xulrunner/moz.configure7
-rw-r--r--application/xulrunner/stub/Makefile.in11
-rw-r--r--application/xulrunner/stub/moz.build51
-rw-r--r--application/xulrunner/stub/nsXULStub.cpp445
-rw-r--r--application/xulrunner/stub/xulrunner-stub.exe.manifest38
-rw-r--r--application/xulrunner/stub/xulrunner-stub.rc6
-rw-r--r--application/xulrunner/tools/redit/Makefile.in11
-rw-r--r--application/xulrunner/tools/redit/moz.build15
-rw-r--r--application/xulrunner/tools/redit/redit.cpp187
72 files changed, 2418 insertions, 0 deletions
diff --git a/application/xulrunner/README.xulrunner b/application/xulrunner/README.xulrunner
new file mode 100644
index 000000000..424b7a615
--- /dev/null
+++ b/application/xulrunner/README.xulrunner
@@ -0,0 +1,13 @@
+XULRunner is a package which can be used to run applications written in HTML
+or XUL. It can also be used to embed the gecko rendering engine into
+binary applications.
+
+XULRunner is not a product; it is a tool which can be used to create products.
+It is a byproduct of Firefox development and the Mozilla community does not
+have a strong commitment to support XULRunner development apart from Firefox
+development.
+
+For more information about using XULRunner or how to use this binary package,
+see the Mozilla Developer Center article:
+
+https://developer.mozilla.org/en/XULRunner
diff --git a/application/xulrunner/app.mozbuild b/application/xulrunner/app.mozbuild
new file mode 100644
index 000000000..7b8316016
--- /dev/null
+++ b/application/xulrunner/app.mozbuild
@@ -0,0 +1,13 @@
+# 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/.
+
+include('/toolkit/toolkit.mozbuild')
+
+if CONFIG['MOZ_EXTENSIONS']:
+ DIRS += ['/extensions']
+
+DIRS += [
+ '/application/xulrunner',
+]
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
new file mode 100644
index 000000000..e74f5cf2e
--- /dev/null
+++ b/application/xulrunner/app/default16.png
Binary files differ
diff --git a/application/xulrunner/app/default32.png b/application/xulrunner/app/default32.png
new file mode 100644
index 000000000..914509054
--- /dev/null
+++ b/application/xulrunner/app/default32.png
Binary files differ
diff --git a/application/xulrunner/app/default48.png b/application/xulrunner/app/default48.png
new file mode 100644
index 000000000..5fd71e110
--- /dev/null
+++ b/application/xulrunner/app/default48.png
Binary files differ
diff --git a/application/xulrunner/app/document.ico b/application/xulrunner/app/document.ico
new file mode 100644
index 000000000..311116324
--- /dev/null
+++ b/application/xulrunner/app/document.ico
Binary files differ
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
new file mode 100644
index 000000000..5d9eefd51
--- /dev/null
+++ b/application/xulrunner/app/macbuild/InfoPlist.strings
Binary files differ
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
new file mode 100644
index 000000000..0518438a0
--- /dev/null
+++ b/application/xulrunner/app/xulrunner.ico
Binary files differ
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
diff --git a/application/xulrunner/config/mozconfig b/application/xulrunner/config/mozconfig
new file mode 100644
index 000000000..9fa972cac
--- /dev/null
+++ b/application/xulrunner/config/mozconfig
@@ -0,0 +1,9 @@
+# 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/.
+
+# This file specifies the build flags for XULRunner. You can use it by adding:
+# . $topsrcdir/xulrunner/config/mozconfig
+# to the top of your mozconfig file.
+
+ac_add_options --enable-application=xulrunner
diff --git a/application/xulrunner/config/mozconfigs/common b/application/xulrunner/config/mozconfigs/common
new file mode 100644
index 000000000..a6811c575
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/common
@@ -0,0 +1,7 @@
+# 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/.
+
+# This file is included at the top of all xulrunner mozconfigs
+
+. "$topsrcdir/build/mozconfig.common"
diff --git a/application/xulrunner/config/mozconfigs/common.override b/application/xulrunner/config/mozconfigs/common.override
new file mode 100644
index 000000000..8d719a5b5
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/common.override
@@ -0,0 +1,8 @@
+# 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/.
+
+# This file is included at the bottom of all xulrunner mozconfigs
+
+. "$topsrcdir/build/mozconfig.common.override"
+. "$topsrcdir/build/mozconfig.cache"
diff --git a/application/xulrunner/config/mozconfigs/linux32/xulrunner b/application/xulrunner/config/mozconfigs/linux32/xulrunner
new file mode 100644
index 000000000..171674f8c
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/linux32/xulrunner
@@ -0,0 +1,9 @@
+export MOZILLA_OFFICIAL=1
+export JAVA_HOME=/tools/jdk
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --disable-tests
+
+. $topsrcdir/build/unix/mozconfig.linux32
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/config/mozconfigs/linux32/xulrunner-qt b/application/xulrunner/config/mozconfigs/linux32/xulrunner-qt
new file mode 100644
index 000000000..54e4ecb8f
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/linux32/xulrunner-qt
@@ -0,0 +1,15 @@
+export MOZILLA_OFFICIAL=1
+export JAVA_HOME=/tools/jdk
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --disable-tests
+
+. $topsrcdir/build/unix/mozconfig.linux32
+
+# QT Options
+export PKG_CONFIG_PATH=/tools/qt-4.6.3/qt/lib/pkgconfig
+ac_add_options --with-qtdir=/tools/qt-4.6.3/qt
+ac_add_options --enable-default-toolkit=cairo-qt
+ac_add_options --disable-crashreporter
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/config/mozconfigs/linux64/xulrunner b/application/xulrunner/config/mozconfigs/linux64/xulrunner
new file mode 100644
index 000000000..c18a12f67
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/linux64/xulrunner
@@ -0,0 +1,9 @@
+export MOZILLA_OFFICIAL=1
+export JAVA_HOME=/tools/jdk
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --disable-tests
+
+. $topsrcdir/build/unix/mozconfig.linux
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/config/mozconfigs/macosx-universal/xulrunner b/application/xulrunner/config/mozconfigs/macosx-universal/xulrunner
new file mode 100644
index 000000000..ac7e24fe2
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/macosx-universal/xulrunner
@@ -0,0 +1,9 @@
+. $topsrcdir/build/macosx/universal/mozconfig
+
+export MOZILLA_OFFICIAL=1
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --disable-tests
+ac_add_options --with-xulrunner-stub-name=xulrunner-stub
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/config/mozconfigs/win32/xulrunner b/application/xulrunner/config/mozconfigs/win32/xulrunner
new file mode 100644
index 000000000..4c8b596a5
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/win32/xulrunner
@@ -0,0 +1,16 @@
+. "$topsrcdir/xulrunner/config/mozconfigs/common"
+
+export MOZILLA_OFFICIAL=1
+export JAVA_HOME=/d/jdk1.6.0_14
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --enable-jemalloc
+ac_add_options --disable-tests
+
+if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
+ . $topsrcdir/build/win32/mozconfig.vs2013-win64
+else
+ . $topsrcdir/build/win32/mozconfig.vs2010
+fi
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/config/mozconfigs/win64/xulrunner b/application/xulrunner/config/mozconfigs/win64/xulrunner
new file mode 100644
index 000000000..7dbade2bb
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/win64/xulrunner
@@ -0,0 +1,15 @@
+. "$topsrcdir/xulrunner/config/mozconfigs/common"
+
+ac_add_options --target=x86_64-pc-mingw32
+ac_add_options --host=x86_64-pc-mingw32
+
+export MOZILLA_OFFICIAL=1
+export JAVA_HOME=/d/jdk1.6.0_14
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --enable-jemalloc
+ac_add_options --disable-tests
+
+. $topsrcdir/build/win64/mozconfig.vs2013
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/configure.in b/application/xulrunner/configure.in
new file mode 100644
index 000000000..825faaddd
--- /dev/null
+++ b/application/xulrunner/configure.in
@@ -0,0 +1,11 @@
+dnl -*- Mode: Autoconf; tab-width: 2; indent-tabs-mode: nil; -*-
+dnl vi: set tabstop=2 shiftwidth=2 expandtab:
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+dnl Things we need to carry from confvars.sh
+AC_SUBST(MOZ_XULRUNNER)
+AC_DEFINE(MOZ_XULRUNNER)
+
+dnl Optional parts of the build.
diff --git a/application/xulrunner/confvars.sh b/application/xulrunner/confvars.sh
new file mode 100644
index 000000000..a317df2a6
--- /dev/null
+++ b/application/xulrunner/confvars.sh
@@ -0,0 +1,28 @@
+#! /bin/sh
+# 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/.
+
+MOZ_XULRUNNER=1
+MC_OFFICIAL=1
+
+MOZ_APP_NAME=xulrunner
+MOZ_APP_DISPLAYNAME=XULRunner
+MOZ_APP_VERSION=$MOZILLA_VERSION
+MOZ_CHROME_FILE_FORMAT=omni
+
+MOZ_UPDATER=1
+
+if test "$OS_ARCH" = "WINNT"; then
+ MOZ_MAINTENANCE_SERVICE=
+fi
+
+MOZ_PLACES=1
+MOZ_WEBRTC=1
+MOZ_WEBGL_CONFORMANT=1
+
+MOZ_EXTENSIONS_DEFAULT=" gio"
+
+MOZ_SERVICES_COMMON=1
+MOZ_SERVICES_SYNC=1
+MOZ_SERVICES_HEALTHREPORT=
diff --git a/application/xulrunner/examples/moz.build b/application/xulrunner/examples/moz.build
new file mode 100644
index 000000000..a1782b42f
--- /dev/null
+++ b/application/xulrunner/examples/moz.build
@@ -0,0 +1,7 @@
+# -*- 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/.
+
+DIRS += ['simple']
diff --git a/application/xulrunner/examples/simple/application.ini b/application/xulrunner/examples/simple/application.ini
new file mode 100644
index 000000000..39c051422
--- /dev/null
+++ b/application/xulrunner/examples/simple/application.ini
@@ -0,0 +1,43 @@
+#filter substitution
+[App]
+;
+; This field specifies your organization's name. This field is recommended,
+; but optional.
+Vendor=MozillaTest
+;
+; This field specifies your application's name. This field is required.
+Name=Simple
+;
+; This field specifies your application's version. This field is required.
+Version=0.1
+;
+; This field specifies your application's build ID (timestamp). This field is
+; required.
+BuildID=20070625
+;
+; This field specifies a compact copyright notice for your application. This
+; field is optional.
+Copyright=Copyright (c) 2004 Mozilla.org
+;
+; This ID is just an example. Every XUL app ought to have it's own unique ID.
+; You can use the microsoft "guidgen" or "uuidgen" tools, or go on
+; irc.mozilla.org and /msg botbot uuid. This field is optional.
+ID={3aea3f07-ffe3-4060-bb03-bff3a5365e90}
+
+[Gecko]
+;
+; This field is required. It specifies the minimum Gecko version that this
+; application requires.
+MinVersion=@MOZILLA_VERSION_U@
+;
+; This field is optional. It specifies the maximum Gecko version that this
+; application requires. It should be specified if your application uses
+; unfrozen interfaces.
+MaxVersion=@MOZILLA_VERSION_U@
+
+[Shell]
+;
+; This field specifies the location of your application's main icon with file
+; extension excluded. NOTE: Unix style file separators are required. This
+; field is optional.
+Icon=chrome/icons/default/simple
diff --git a/application/xulrunner/examples/simple/components/moz.build b/application/xulrunner/examples/simple/components/moz.build
new file mode 100644
index 000000000..8ff468534
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/moz.build
@@ -0,0 +1,7 @@
+# -*- 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/.
+
+DIRS += ['public', 'src']
diff --git a/application/xulrunner/examples/simple/components/public/moz.build b/application/xulrunner/examples/simple/components/public/moz.build
new file mode 100644
index 000000000..3a611f85a
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/public/moz.build
@@ -0,0 +1,13 @@
+# -*- 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/.
+
+XPIDL_SOURCES += [
+ 'nsISimpleTest.idl',
+]
+
+XPIDL_MODULE = 'simple'
+
+XPI_NAME = 'simple'
diff --git a/application/xulrunner/examples/simple/components/public/nsISimpleTest.idl b/application/xulrunner/examples/simple/components/public/nsISimpleTest.idl
new file mode 100644
index 000000000..99b9b86af
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/public/nsISimpleTest.idl
@@ -0,0 +1,15 @@
+/* vim:set ts=2 sw=2 sts=2 et cin: */
+/* 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 "nsISupports.idl"
+
+[scriptable, uuid(f2f71d91-0451-47ec-aaa0-166663a7711a)]
+interface nsISimpleTest : nsISupports
+{
+ /**
+ * This interface adds two numbers together and returns the result.
+ */
+ long add(in long a, in long b);
+};
diff --git a/application/xulrunner/examples/simple/components/src/SimpleTest.cpp b/application/xulrunner/examples/simple/components/src/SimpleTest.cpp
new file mode 100644
index 000000000..06249abdd
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/src/SimpleTest.cpp
@@ -0,0 +1,54 @@
+/* vim:set ts=2 sw=2 sts=2 et cin: */
+/* 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 <stdio.h>
+#include "nsISimpleTest.h"
+#include "mozilla/ModuleUtils.h"
+
+class SimpleTest : public nsISimpleTest
+{
+ ~SimpleTest() {}
+public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSISIMPLETEST
+};
+
+NS_IMPL_ISUPPORTS(SimpleTest, nsISimpleTest)
+
+NS_IMETHODIMP
+SimpleTest::Add(int32_t a, int32_t b, int32_t *r)
+{
+ printf("add(%d,%d) from C++\n", a, b);
+
+ *r = a + b;
+ return NS_OK;
+}
+
+NS_GENERIC_FACTORY_CONSTRUCTOR(SimpleTest)
+
+// 5e14b432-37b6-4377-923b-c987418d8429
+#define SIMPLETEST_CID \
+ { 0x5e14b432, 0x37b6, 0x4377, \
+ { 0x92, 0x3b, 0xc9, 0x87, 0x41, 0x8d, 0x84, 0x29 } }
+
+NS_DEFINE_NAMED_CID(SIMPLETEST_CID);
+
+static const mozilla::Module::CIDEntry kSimpleCIDs[] = {
+ { &kSIMPLETEST_CID, false, nullptr, SimpleTestConstructor },
+ { nullptr }
+};
+
+static const mozilla::Module::ContractIDEntry kSimpleContracts[] = {
+ { "@test.mozilla.org/simple-test;1?impl=c++", &kSIMPLETEST_CID },
+ { nullptr }
+};
+
+static const mozilla::Module kSimpleModule = {
+ mozilla::Module::kVersion,
+ kSimpleCIDs,
+ kSimpleContracts
+};
+
+NSMODULE_DEFN(SimpleTestModule) = &kSimpleModule;
diff --git a/application/xulrunner/examples/simple/components/src/SimpleTest.js b/application/xulrunner/examples/simple/components/src/SimpleTest.js
new file mode 100644
index 000000000..e6cf90660
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/src/SimpleTest.js
@@ -0,0 +1,27 @@
+/* vim:set ts=2 sw=2 sts=2 et cin: */
+/* 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/. */
+
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+function SimpleTest() {
+}
+
+SimpleTest.prototype = {
+ classID: Components.ID("{4177e257-a0dc-49b9-a774-522a000a49fa}"),
+
+ QueryInterface: function(iid) {
+ if (iid.equals(Components.interfaces.nsISimpleTest) ||
+ iid.equals(Components.interfaces.nsISupports))
+ return this;
+ throw Components.results.NS_ERROR_NO_INTERFACE;
+ },
+
+ add: function(a, b) {
+ dump("add(" + a + "," + b + ") from JS\n");
+ return a + b;
+ }
+};
+
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SimpleTest]);
diff --git a/application/xulrunner/examples/simple/components/src/SimpleTest.manifest b/application/xulrunner/examples/simple/components/src/SimpleTest.manifest
new file mode 100644
index 000000000..c7388b9d7
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/src/SimpleTest.manifest
@@ -0,0 +1,2 @@
+component {4177e257-a0dc-49b9-a774-522a000a49fa} SimpleTest.js
+contract @test.mozilla.org/simple-test;1?impl=js {4177e257-a0dc-49b9-a774-522a000a49fa}
diff --git a/application/xulrunner/examples/simple/components/src/moz.build b/application/xulrunner/examples/simple/components/src/moz.build
new file mode 100644
index 000000000..153bfdd0c
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/src/moz.build
@@ -0,0 +1,21 @@
+# -*- 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/.
+
+SOURCES += [
+ 'SimpleTest.cpp',
+]
+
+XPCOMBinaryComponent('simpletest')
+
+EXTRA_COMPONENTS += [
+ 'SimpleTest.js',
+ 'SimpleTest.manifest',
+]
+
+XPI_NAME = 'simple'
+
+if CONFIG['GNU_CXX']:
+ CXXFLAGS += ['-Wshadow']
diff --git a/application/xulrunner/examples/simple/content/contents.rdf b/application/xulrunner/examples/simple/content/contents.rdf
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/application/xulrunner/examples/simple/content/contents.rdf
diff --git a/application/xulrunner/examples/simple/content/simple.js b/application/xulrunner/examples/simple/content/simple.js
new file mode 100644
index 000000000..acf6f1029
--- /dev/null
+++ b/application/xulrunner/examples/simple/content/simple.js
@@ -0,0 +1,17 @@
+/* vim:set ts=2 sw=2 sts=2 et cin: */
+/* 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/. */
+
+function onButtonClick() {
+ var textbox = document.getElementById("textbox");
+
+ var contractid = (textbox.value % 2 == 0) ?
+ "@test.mozilla.org/simple-test;1?impl=js" :
+ "@test.mozilla.org/simple-test;1?impl=c++";
+
+ var test = Components.classes[contractid].
+ createInstance(Components.interfaces.nsISimpleTest);
+
+ textbox.value = test.add(textbox.value, 1);
+}
diff --git a/application/xulrunner/examples/simple/content/simple.xul b/application/xulrunner/examples/simple/content/simple.xul
new file mode 100644
index 000000000..6ff915d0c
--- /dev/null
+++ b/application/xulrunner/examples/simple/content/simple.xul
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+# vim:set ts=8 sw=8 sts=8 noet:
+# 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/.
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<!DOCTYPE window SYSTEM "chrome://simple/locale/simple.dtd">
+
+<window
+ id = "simple"
+ title = "&simple.title;"
+ xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://simple/content/simple.js"/>
+ <vbox>
+ <textbox id="textbox" value="&simple.textValue;" flex="1"/>
+ <button id="button" label="&simple.buttonLabel;" oncommand="onButtonClick();"/>
+ </vbox>
+</window>
diff --git a/application/xulrunner/examples/simple/icons/simple.ico b/application/xulrunner/examples/simple/icons/simple.ico
new file mode 100644
index 000000000..16bd7e9d1
--- /dev/null
+++ b/application/xulrunner/examples/simple/icons/simple.ico
Binary files differ
diff --git a/application/xulrunner/examples/simple/jar.mn b/application/xulrunner/examples/simple/jar.mn
new file mode 100644
index 000000000..7d141ad1d
--- /dev/null
+++ b/application/xulrunner/examples/simple/jar.mn
@@ -0,0 +1,12 @@
+# 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/.
+
+simple.jar:
+% content simple %content/
+ content/simple.xul (content/simple.xul)
+ content/simple.js (content/simple.js)
+
+en-US.jar:
+% locale simple en-US %locale/en-US/
+ locale/en-US/simple.dtd (locale/simple.dtd)
diff --git a/application/xulrunner/examples/simple/locale/simple.dtd b/application/xulrunner/examples/simple/locale/simple.dtd
new file mode 100644
index 000000000..2fd1c9285
--- /dev/null
+++ b/application/xulrunner/examples/simple/locale/simple.dtd
@@ -0,0 +1,7 @@
+<!-- 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/. -->
+
+<!ENTITY simple.title "Simple App">
+<!ENTITY simple.textValue "0">
+<!ENTITY simple.buttonLabel "Increment">
diff --git a/application/xulrunner/examples/simple/moz.build b/application/xulrunner/examples/simple/moz.build
new file mode 100644
index 000000000..c88c57a4b
--- /dev/null
+++ b/application/xulrunner/examples/simple/moz.build
@@ -0,0 +1,22 @@
+# -*- 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/.
+
+DIRS += ['components']
+
+XPI_NAME = 'simple'
+
+JAR_MANIFESTS += ['jar.mn']
+
+JS_PREFERENCE_FILES += [
+ 'simple-prefs.js',
+]
+
+FINAL_TARGET_PP_FILES += [
+ 'application.ini',
+]
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
+ FINAL_TARGET_FILES.chrome.icons.default += ['icons/simple.ico']
diff --git a/application/xulrunner/examples/simple/simple-prefs.js b/application/xulrunner/examples/simple/simple-prefs.js
new file mode 100644
index 000000000..fc92e0df5
--- /dev/null
+++ b/application/xulrunner/examples/simple/simple-prefs.js
@@ -0,0 +1,6 @@
+/* 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/. */
+
+pref("toolkit.defaultChromeURI", "chrome://simple/content/simple.xul");
+pref("general.useragent.extra.simple", "SimpleApp/0.1");
diff --git a/application/xulrunner/installer/Makefile.in b/application/xulrunner/installer/Makefile.in
new file mode 100644
index 000000000..04803dddb
--- /dev/null
+++ b/application/xulrunner/installer/Makefile.in
@@ -0,0 +1,148 @@
+# 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/.
+
+STANDALONE_MAKEFILE := 1
+
+NO_PKG_FILES = \
+ xulrunner-config \
+ regchrome* \
+ regxpcom* \
+ $(NULL)
+
+# We want xpcshell, run-mozilla and install_app.py in the SDK but not in the binary package.
+ifndef STAGE_SDK
+NO_PKG_FILES += \
+ xpcshell* \
+ run-mozilla* \
+ install_app.py \
+ $(NULL)
+endif
+
+# If we're on mac, we don't want an end-user-facing DMG, we want a .tar.bz2
+# which developers then use to package their application.
+
+ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
+MOZ_PKG_FORMAT = BZ2
+_APPNAME = XUL.framework
+_BINPATH = /$(_APPNAME)/Versions/Current
+_RESPATH := $(_BINPATH)
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+INSTALL_SDK = 1
+
+include $(topsrcdir)/toolkit/mozapps/installer/signing.mk
+include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
+
+# Add pkg-config files to the install:: target
+
+pkg_config_files = \
+ libxul.pc \
+ libxul-embedding.pc \
+ mozilla-js.pc \
+ mozilla-plugin.pc \
+ $(NULL)
+
+ifdef MOZ_NATIVE_NSPR
+NSPR_NAME=nspr
+NSPR_VERSION=$(shell $(NSPR_CONFIG) --version)
+else
+pkg_config_files += mozilla-nspr.pc
+NSPR_NAME=mozilla-nspr
+FULL_NSPR_CFLAGS=-I\$${includedir}
+FULL_NSPR_LIBS=$(subst $(prefix),\$${sdkdir},$(shell $(DEPTH)/nsprpub/config/nspr-config --libs))
+NSPR_VERSION=$(shell $(DEPTH)/nsprpub/config/nspr-config --version)
+endif
+
+MOZ_XUL_LINK = -lxpcomglue_s -lxul
+ifdef JS_SHARED_LIBRARY
+MOZ_JS_LINK = -lmozjs
+else
+MOZ_JS_LINK = $(MOZ_XUL_LINK)
+endif
+
+$(warning FULL_NSPR_CFLAGS=$(FULL_NSPR_CFLAGS))
+
+ifndef MOZ_NATIVE_NSS
+pkg_config_files += mozilla-nss.pc
+endif
+
+%.pc: $(srcdir)/%.pc.in $(GLOBAL_DEPS)
+ cat $< | sed \
+ -e "s|%prefix%|$(prefix)|" \
+ -e "s|%includedir%|$(includedir)|" \
+ -e "s|%idldir%|$(idldir)|" \
+ -e "s|%sdkdir%|$(sdkdir)|" \
+ -e "s|%MOZ_APP_NAME%|$(MOZ_APP_NAME)|" \
+ -e "s|%MOZILLA_VERSION%|$(MOZ_APP_VERSION)|" \
+ -e "s|%WCHAR_CFLAGS%|$(WCHAR_CFLAGS)|" \
+ -e "s|%FULL_NSPR_LIBS%|$(FULL_NSPR_LIBS)|" \
+ -e "s|%FULL_NSPR_CFLAGS%|$(FULL_NSPR_CFLAGS)|" \
+ -e "s|%NSPR_NAME%|$(NSPR_NAME)|" \
+ -e "s|%NSPR_VERSION%|$(NSPR_VERSION)|" \
+ -e "s|%MOZ_XUL_LINK%|$(MOZ_XUL_LINK)|" \
+ -e "s|%MOZ_JS_LINK%|$(MOZ_JS_LINK)|" > $@
+ chmod 644 $@
+
+install:: $(pkg_config_files)
+ @echo pkg_config_file: $(pkg_config_files)
+ $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(libdir)/pkgconfig
+
+GARBAGE += $(pkg_config_files)
+
+GARBAGE += debian/changelog
+
+DEBDESTDIR=debian/$(MOZ_BUILD_APP)
+
+GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(DIST)/bin/platform.ini Build BuildID)
+MOZ_DEB_TIMESTAMP = "$(shell date +"%a, %d %b %Y %T %z" )"
+
+DEFINES += \
+ -DGRE_MILESTONE=$(GRE_MILESTONE) \
+ -DGRE_BUILDID=$(GRE_BUILDID) \
+ -DMOZ_DEB_TIMESTAMP=$(MOZ_DEB_TIMESTAMP) \
+ -DMOZ_APP_NAME=$(MOZ_APP_NAME) \
+ -Dinstalldir=$(installdir) \
+ $(NULL)
+
+ifeq ($(OS_TARGET),Linux)
+debian/changelog: $(srcdir)/debian/changelog.in $(DIST)/bin/platform.ini
+ $(call py_action,preprocessor, \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ -o $@)
+
+debian/xulrunner.links: $(srcdir)/debian/xulrunner.links.in
+ $(call py_action,preprocessor, \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ -o $@)
+
+debian/xulrunner.service: $(srcdir)/debian/xulrunner.service.in
+ $(call py_action,preprocessor, \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ -o $@)
+
+debian/prerm: $(srcdir)/debian/prerm.in
+ $(call py_action,preprocessor, \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ -o $@)
+
+debian/postinst: $(srcdir)/debian/postinst.in
+ $(call py_action,preprocessor, \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ -o $@)
+
+package:
+ $(MAKE) package -C $(DEPTH)
+
+deb: package debian/changelog debian/xulrunner.service debian/xulrunner.links
+ $(NSINSTALL) $(topsrcdir)/$(MOZ_BUILD_APP)/installer/debian .
+ rm -fr $(DEBDESTDIR)
+ $(NSINSTALL) -D $(DEBDESTDIR)/$(installdir)
+ cp -pRL $(DEPTH)/dist/$(MOZ_BUILD_APP)/* $(DEBDESTDIR)/$(installdir)
+ $(NSINSTALL) -D $(DEBDESTDIR)/usr/share/dbus-1/services/
+ cp debian/$(MOZ_BUILD_APP).service $(DEBDESTDIR)/usr/share/dbus-1/services/org.mozilla.$(MOZ_BUILD_APP).service
+ dh_link; fakeroot dh_fixperms; fakeroot dh_installdeb; fakeroot dh_shlibdeps; fakeroot dh_gencontrol; fakeroot dh_md5sums; fakeroot dh_builddeb;
+endif
+
+DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+# package name comes from xulrunner/installer/debian/changelog.in
+DEB_PKG_NAME = $(MOZ_PKG_APPNAME)_$(GRE_MILESTONE)-$(GRE_BUILDID)_$(DEB_BUILD_ARCH).deb
+# relative to $(DIST)
+UPLOAD_EXTRA_FILES += ../xulrunner/$(DEB_PKG_NAME)
diff --git a/application/xulrunner/installer/debian/changelog.in b/application/xulrunner/installer/debian/changelog.in
new file mode 100644
index 000000000..1efd55a1d
--- /dev/null
+++ b/application/xulrunner/installer/debian/changelog.in
@@ -0,0 +1,7 @@
+# if the naming changes please modify DEB_PKG_NAME in xulrunner/installer/Makefile.in as well
+#filter substitution
+xulrunner (@GRE_MILESTONE@-@GRE_BUILDID@) unstable; urgency=low
+
+ * Mozilla Nightly (Closes: #nnnn) <nnnn is the bug number of your ITP>
+
+ -- Mozilla Runtime <mobile-feedback@mozilla.com> @MOZ_DEB_TIMESTAMP@
diff --git a/application/xulrunner/installer/debian/compat b/application/xulrunner/installer/debian/compat
new file mode 100644
index 000000000..b8626c4cf
--- /dev/null
+++ b/application/xulrunner/installer/debian/compat
@@ -0,0 +1 @@
+4
diff --git a/application/xulrunner/installer/debian/control b/application/xulrunner/installer/debian/control
new file mode 100644
index 000000000..da99aa8d4
--- /dev/null
+++ b/application/xulrunner/installer/debian/control
@@ -0,0 +1,48 @@
+Source: xulrunner
+Section: user/network
+Priority: extra
+Maintainer: Mobile Feedback <mobile-feedback@mozilla.com>
+Build-Depends: debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: xulrunner
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Web and JavaScript engine used by the Firefox Web browser
+ The Mozilla runtime is the modern browser engine, also known as "Gecko," that powers Firefox and can be embedded by other applications
+XB-Maemo-Display-Name: Mozilla Runtime
+XB-Maemo-Icon-26:
+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
+ :+Z,K%?P/&D=O=_6]@+\`````245.1*Y"8((`
+ `
diff --git a/application/xulrunner/installer/debian/icon_base64 b/application/xulrunner/installer/debian/icon_base64
new file mode 100644
index 000000000..124fb4ccc
--- /dev/null
+++ b/application/xulrunner/installer/debian/icon_base64
@@ -0,0 +1,36 @@
+begin 644 -m
+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
+:+Z,K%?P/&D=O=_6]@+\`````245.1*Y"8((`
+`
+end
diff --git a/application/xulrunner/installer/debian/menu b/application/xulrunner/installer/debian/menu
new file mode 100644
index 000000000..e1ce52201
--- /dev/null
+++ b/application/xulrunner/installer/debian/menu
@@ -0,0 +1,2 @@
+?package(xulrunner):needs="X11|text|vc|wm" section="Apps/Internet"\
+ title="xulrunner" command="/usr/bin/xulrunner"
diff --git a/application/xulrunner/installer/debian/postinst.in b/application/xulrunner/installer/debian/postinst.in
new file mode 100644
index 000000000..0f06640e2
--- /dev/null
+++ b/application/xulrunner/installer/debian/postinst.in
@@ -0,0 +1,42 @@
+#literal #! /bin/sh
+#filter substitution
+# postinst script for moz
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#ifdef MOZ_WIDGET_GTK
+gtk-update-icon-cache /usr/share/icons/hicolor
+#endif
+
+
+exit 0
+
+
diff --git a/application/xulrunner/installer/debian/prerm.in b/application/xulrunner/installer/debian/prerm.in
new file mode 100644
index 000000000..1d46d382c
--- /dev/null
+++ b/application/xulrunner/installer/debian/prerm.in
@@ -0,0 +1,29 @@
+#literal #! /bin/sh
+#filter substitution
+# prerm script for moz
+#
+# see: dh_installdeb(1)
+
+set -e
+
+case "$1" in
+ remove|upgrade|deconfigure)
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#ifdef MOZ_WIDGET_GTK
+gtk-update-icon-cache /usr/share/icons/hicolor
+#endif
+
+
+exit 0
+
+
diff --git a/application/xulrunner/installer/debian/xulrunner.links.in b/application/xulrunner/installer/debian/xulrunner.links.in
new file mode 100644
index 000000000..eabac6f51
--- /dev/null
+++ b/application/xulrunner/installer/debian/xulrunner.links.in
@@ -0,0 +1,2 @@
+#filter substitution
+@installdir@/xulrunner /usr/bin/xulrunner
diff --git a/application/xulrunner/installer/debian/xulrunner.service.in b/application/xulrunner/installer/debian/xulrunner.service.in
new file mode 100644
index 000000000..48d87a1b9
--- /dev/null
+++ b/application/xulrunner/installer/debian/xulrunner.service.in
@@ -0,0 +1,4 @@
+#filter substitution
+[D-BUS Service]
+Name=org.mozilla.@MOZ_APP_NAME@
+Exec=@installdir@/xulrunner
diff --git a/application/xulrunner/installer/libxul-embedding.pc.in b/application/xulrunner/installer/libxul-embedding.pc.in
new file mode 100644
index 000000000..100e0a763
--- /dev/null
+++ b/application/xulrunner/installer/libxul-embedding.pc.in
@@ -0,0 +1,10 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%
+idldir=%idldir%
+
+Name: libxul-embedding
+Description: Static library for version-independent embedding of the Mozilla runtime
+Version: %MOZILLA_VERSION%
+Libs: -L${sdkdir}/lib -lxpcomglue -ldl
+Cflags: -DXPCOM_GLUE -I${includedir} %WCHAR_CFLAGS%
diff --git a/application/xulrunner/installer/libxul.pc.in b/application/xulrunner/installer/libxul.pc.in
new file mode 100644
index 000000000..ccce9aa59
--- /dev/null
+++ b/application/xulrunner/installer/libxul.pc.in
@@ -0,0 +1,11 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%
+idldir=%idldir%
+
+Name: libxul
+Description: The Mozilla Runtime and Embedding Engine
+Version: %MOZILLA_VERSION%
+Requires: %NSPR_NAME% >= %NSPR_VERSION%
+Libs: -L${sdkdir}/lib %MOZ_XUL_LINK%
+Cflags: -I${includedir} %WCHAR_CFLAGS%
diff --git a/application/xulrunner/installer/moz.build b/application/xulrunner/installer/moz.build
new file mode 100644
index 000000000..895d11993
--- /dev/null
+++ b/application/xulrunner/installer/moz.build
@@ -0,0 +1,6 @@
+# -*- 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/.
+
diff --git a/application/xulrunner/installer/mozilla-js.pc.in b/application/xulrunner/installer/mozilla-js.pc.in
new file mode 100644
index 000000000..55e84ca00
--- /dev/null
+++ b/application/xulrunner/installer/mozilla-js.pc.in
@@ -0,0 +1,10 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%
+
+Name: JavaScript
+Description: The Mozilla JavaScript Library
+Version: %MOZILLA_VERSION%
+Requires: %NSPR_NAME% >= %NSPR_VERSION%
+Libs: -L${sdkdir}/lib %MOZ_JS_LINK%
+Cflags: -I${includedir} -DXP_UNIX
diff --git a/application/xulrunner/installer/mozilla-nspr.pc.in b/application/xulrunner/installer/mozilla-nspr.pc.in
new file mode 100644
index 000000000..7ebd3421c
--- /dev/null
+++ b/application/xulrunner/installer/mozilla-nspr.pc.in
@@ -0,0 +1,11 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%/nspr
+
+Name: NSPR
+Description: The Netscape Portable Runtime
+Version: %NSPR_VERSION%
+Libs: %FULL_NSPR_LIBS%
+Cflags: %FULL_NSPR_CFLAGS%
+
+
diff --git a/application/xulrunner/installer/mozilla-nss.pc.in b/application/xulrunner/installer/mozilla-nss.pc.in
new file mode 100644
index 000000000..90f14c3ae
--- /dev/null
+++ b/application/xulrunner/installer/mozilla-nss.pc.in
@@ -0,0 +1,10 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%/nss
+
+Name: NSS
+Description: Mozilla Network Security Services
+Version: %MOZILLA_VERSION%
+Requires: %NSPR_NAME% >= %NSPR_VERSION%
+Libs: -L${sdkdir}/lib -lsmime3 -lssl3 -lnss3 -lnssutil3
+Cflags: -I${includedir}
diff --git a/application/xulrunner/installer/mozilla-plugin.pc.in b/application/xulrunner/installer/mozilla-plugin.pc.in
new file mode 100644
index 000000000..7080161b3
--- /dev/null
+++ b/application/xulrunner/installer/mozilla-plugin.pc.in
@@ -0,0 +1,8 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%
+
+Name: Mozilla Plug-In API
+Description: Mozilla Plug-In API
+Version: %MOZILLA_VERSION%
+Cflags: -I${includedir} -DXP_UNIX
diff --git a/application/xulrunner/locales/all-locales b/application/xulrunner/locales/all-locales
new file mode 100644
index 000000000..85ef789a6
--- /dev/null
+++ b/application/xulrunner/locales/all-locales
@@ -0,0 +1,39 @@
+ar
+bg
+ca
+cs
+da
+de
+el
+en-GB
+es-AR
+es-ES
+eu
+fi
+fr
+ga-IE
+gu-IN
+he
+hu
+hy-AM
+it
+ja
+ja-JP-mac
+ko
+nb-NO
+nl
+nn-NO
+mk
+mn
+pa-IN
+pl
+pt-BR
+ro
+ru
+sk
+sl
+sq
+sv-SE
+tr
+zh-CN
+zh-TW
diff --git a/application/xulrunner/moz.build b/application/xulrunner/moz.build
new file mode 100644
index 000000000..371f69f5e
--- /dev/null
+++ b/application/xulrunner/moz.build
@@ -0,0 +1,11 @@
+# -*- 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/.
+
+CONFIGURE_SUBST_FILES += ['installer/Makefile']
+
+DIRS += [
+ 'app',
+]
diff --git a/application/xulrunner/moz.configure b/application/xulrunner/moz.configure
new file mode 100644
index 000000000..72236254f
--- /dev/null
+++ b/application/xulrunner/moz.configure
@@ -0,0 +1,7 @@
+# -*- Mode: python; 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/.
+
+include('../../toolkit/moz.configure')
diff --git a/application/xulrunner/stub/Makefile.in b/application/xulrunner/stub/Makefile.in
new file mode 100644
index 000000000..0fa0cccf6
--- /dev/null
+++ b/application/xulrunner/stub/Makefile.in
@@ -0,0 +1,11 @@
+# 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/.
+
+ifndef MOZ_WINCONSOLE
+ifdef MOZ_DEBUG
+MOZ_WINCONSOLE = 1
+else
+MOZ_WINCONSOLE = 0
+endif
+endif
diff --git a/application/xulrunner/stub/moz.build b/application/xulrunner/stub/moz.build
new file mode 100644
index 000000000..4fd172f72
--- /dev/null
+++ b/application/xulrunner/stub/moz.build
@@ -0,0 +1,51 @@
+# -*- 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/.
+
+# The value of XULRUNNER_STUB_NAME is generated by configure to allow XULRunner
+# apps to override it using the --with-xulrunner-stub-name=<appname> argument.
+# If this configure argument is not present then the default name is
+# 'xulrunner-stub'.
+
+# We don't want to create a dependency on mozglue.
+# Statically link against the RTL on windows
+GeckoProgram(CONFIG['XULRUNNER_STUB_NAME'], mozglue=None, msvcrt='static')
+
+SOURCES += [
+ 'nsXULStub.cpp',
+]
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+ FINAL_TARGET = 'dist/XUL.framework/Versions/%(MOZILLA_VERSION)s' % CONFIG
+
+DEFINES['XPCOM_GLUE'] = True
+
+LOCAL_INCLUDES += [
+ '/xpcom/base',
+ '/xpcom/build',
+]
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ LOCAL_INCLUDES += ['/toolkit/xre']
+ # this is an awful workaround - glandium
+ USE_LIBS += ['mfbt_staticruntime']
+
+if CONFIG['_MSC_VER']:
+ WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup']
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ DEFINES['MOZ_XULRUNNER'] = True
+ RCINCLUDE = 'xulrunner-stub.rc'
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ OS_LIBS += [
+ 'shell32',
+ ]
+
+DISABLE_STL_WRAPPING = True
+
+# Need to link with CoreFoundation on Mac
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+ OS_LIBS += CONFIG['TK_LIBS']
diff --git a/application/xulrunner/stub/nsXULStub.cpp b/application/xulrunner/stub/nsXULStub.cpp
new file mode 100644
index 000000000..8638ae43e
--- /dev/null
+++ b/application/xulrunner/stub/nsXULStub.cpp
@@ -0,0 +1,445 @@
+/* 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 "nsXPCOMGlue.h"
+#include "nsINIParser.h"
+#include "nsXPCOMPrivate.h" // for XP MAXPATHLEN
+#include "nsXULAppAPI.h"
+#include "nsIFile.h"
+
+#include <stdarg.h>
+
+#ifdef XP_WIN
+#include <windows.h>
+#include <io.h>
+#if defined(_MSC_VER) && _MSC_VER < 1900
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#endif
+#define strcasecmp _stricmp
+#define PATH_SEPARATOR_CHAR '\\'
+#define R_OK 04
+#elif defined(XP_MACOSX)
+#include <unistd.h>
+#include <sys/stat.h>
+#include <CoreFoundation/CoreFoundation.h>
+#define PATH_SEPARATOR_CHAR '/'
+#else
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#define PATH_SEPARATOR_CHAR '/'
+#endif
+
+#ifdef XP_WIN
+#define XRE_DONT_PROTECT_DLL_LOAD
+#include "nsWindowsWMain.cpp"
+#endif
+
+#define VERSION_MAXLEN 128
+
+static void Output(bool isError, 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);
+
+ UINT flags = MB_OK;
+ if (isError)
+ flags |= MB_ICONERROR;
+ else
+ flags |= MB_ICONINFORMATION;
+
+ wchar_t wide_msg[1024];
+ MultiByteToWideChar(CP_ACP,
+ 0,
+ msg,
+ -1,
+ wide_msg,
+ sizeof(wide_msg) / sizeof(wchar_t));
+
+ MessageBoxW(nullptr, wide_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;
+}
+
+/**
+ * Return true if |aDir| is a valid file/directory.
+ */
+static bool FolderExists(const char* aDir)
+{
+#ifdef XP_WIN
+ wchar_t wideDir[MAX_PATH];
+ MultiByteToWideChar(CP_UTF8, 0, aDir, -1, wideDir, MAX_PATH);
+ DWORD fileAttrs = GetFileAttributesW(wideDir);
+ return fileAttrs != INVALID_FILE_ATTRIBUTES;
+#else
+ return access(aDir, R_OK) == 0;
+#endif
+}
+
+static nsresult GetRealPath(const char* appDataFile, char* *aResult)
+{
+#ifdef XP_WIN
+ wchar_t wAppDataFile[MAX_PATH];
+ wchar_t wIniPath[MAX_PATH];
+ MultiByteToWideChar(CP_UTF8, 0, appDataFile, -1, wAppDataFile, MAX_PATH);
+ _wfullpath(wIniPath, wAppDataFile, MAX_PATH);
+ WideCharToMultiByte(CP_UTF8, 0, wIniPath, -1, *aResult, MAX_PATH, 0, 0);
+#else
+ struct stat fileStat;
+ if (!realpath(appDataFile, *aResult) || stat(*aResult, &fileStat))
+ return NS_ERROR_FAILURE;
+#endif
+ if (!*aResult || !**aResult)
+ return NS_ERROR_FAILURE;
+
+ return NS_OK;
+}
+
+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;
+};
+
+XRE_CreateAppDataType XRE_CreateAppData;
+XRE_FreeAppDataType XRE_FreeAppData;
+XRE_mainType XRE_main;
+
+int
+main(int argc, char **argv)
+{
+ nsresult rv;
+ char *lastSlash;
+
+ char iniPath[MAXPATHLEN];
+ char tmpPath[MAXPATHLEN];
+ char greDir[MAXPATHLEN];
+ bool greFound = false;
+
+#if defined(XP_MACOSX)
+ CFBundleRef appBundle = CFBundleGetMainBundle();
+ if (!appBundle)
+ return 1;
+
+ CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(appBundle);
+ if (!resourcesURL)
+ return 1;
+
+ CFURLRef absResourcesURL = CFURLCopyAbsoluteURL(resourcesURL);
+ CFRelease(resourcesURL);
+ if (!absResourcesURL)
+ return 1;
+
+ CFURLRef iniFileURL =
+ CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault,
+ absResourcesURL,
+ CFSTR("application.ini"),
+ false);
+ CFRelease(absResourcesURL);
+ if (!iniFileURL)
+ return 1;
+
+ CFStringRef iniPathStr =
+ CFURLCopyFileSystemPath(iniFileURL, kCFURLPOSIXPathStyle);
+ CFRelease(iniFileURL);
+ if (!iniPathStr)
+ return 1;
+
+ CFStringGetCString(iniPathStr, iniPath, sizeof(iniPath),
+ kCFStringEncodingUTF8);
+ CFRelease(iniPathStr);
+
+#else
+
+#ifdef XP_WIN
+ wchar_t wide_path[MAX_PATH];
+ if (!::GetModuleFileNameW(nullptr, wide_path, MAX_PATH))
+ return 1;
+
+ WideCharToMultiByte(CP_UTF8, 0, wide_path,-1,
+ iniPath, MAX_PATH, nullptr, nullptr);
+
+#else
+ // on unix, there is no official way to get the path of the current binary.
+ // instead of using the MOZILLA_FIVE_HOME hack, which doesn't scale to
+ // multiple applications, we will try a series of techniques:
+ //
+ // 1) use realpath() on argv[0], which works unless we're loaded from the
+ // PATH
+ // 2) manually walk through the PATH and look for ourself
+ // 3) give up
+
+ struct stat fileStat;
+ strncpy(tmpPath, argv[0], sizeof(tmpPath));
+ lastSlash = strrchr(tmpPath, '/');
+ if (lastSlash) {
+ *lastSlash = 0;
+ realpath(tmpPath, iniPath);
+ } else {
+ const char *path = getenv("PATH");
+ if (!path)
+ return 1;
+
+ char *pathdup = strdup(path);
+ if (!pathdup)
+ return 1;
+
+ bool found = false;
+ char *token = strtok(pathdup, ":");
+ while (token) {
+ sprintf(tmpPath, "%s/%s", token, argv[0]);
+ if (stat(tmpPath, &fileStat) == 0) {
+ found = true;
+ lastSlash = strrchr(tmpPath, '/');
+ *lastSlash = 0;
+ realpath(tmpPath, iniPath);
+ break;
+ }
+ token = strtok(nullptr, ":");
+ }
+ free (pathdup);
+ if (!found)
+ return 1;
+ }
+ lastSlash = iniPath + strlen(iniPath);
+ *lastSlash = '/';
+#endif
+
+#ifndef XP_UNIX
+ lastSlash = strrchr(iniPath, PATH_SEPARATOR_CHAR);
+ if (!lastSlash)
+ return 1;
+#endif
+
+ *(++lastSlash) = '\0';
+
+ // On Linux/Win, look for XULRunner in appdir/xulrunner
+
+ snprintf(greDir, sizeof(greDir),
+ "%sxulrunner" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL,
+ iniPath);
+
+ greFound = FolderExists(greDir);
+
+#ifdef XP_UNIX
+ if (greFound) {
+ char resolved_greDir[MAXPATHLEN] = "";
+ if (realpath(greDir, resolved_greDir) && *resolved_greDir) {
+ strncpy(greDir, resolved_greDir, MAXPATHLEN);
+ }
+ }
+#endif
+
+ strncpy(lastSlash, "application.ini", sizeof(iniPath) - (lastSlash - iniPath));
+
+#endif
+
+ // If -app parameter was passed in, it is now time to take it under
+ // consideration.
+ const char *appDataFile;
+ appDataFile = getenv("XUL_APP_FILE");
+ if (!appDataFile || !*appDataFile)
+ if (argc > 1 && IsArg(argv[1], "app")) {
+ if (argc == 2) {
+ Output(false, "specify APP-FILE (optional)\n");
+ return 1;
+ }
+ argv[1] = argv[0];
+ ++argv;
+ --argc;
+
+ appDataFile = argv[1];
+ argv[1] = argv[0];
+ ++argv;
+ --argc;
+
+ char kAppEnv[MAXPATHLEN];
+ snprintf(kAppEnv, MAXPATHLEN, "XUL_APP_FILE=%s", appDataFile);
+ if (putenv(kAppEnv))
+ Output(false, "Couldn't set %s.\n", kAppEnv);
+
+ char *result = (char*) calloc(sizeof(char), MAXPATHLEN);
+ if (NS_FAILED(GetRealPath(appDataFile, &result))) {
+ Output(true, "Invalid application.ini path.\n");
+ return 1;
+ }
+
+ // We have a valid application.ini path passed in to the -app parameter
+ // but not yet a valid greDir, so lets look for it also on the same folder
+ // as the stub.
+ if (!greFound) {
+ lastSlash = strrchr(iniPath, PATH_SEPARATOR_CHAR);
+ if (!lastSlash)
+ return 1;
+
+ *(++lastSlash) = '\0';
+
+ snprintf(greDir, sizeof(greDir), "%s" XPCOM_DLL, iniPath);
+ greFound = FolderExists(greDir);
+ }
+
+ // copy it back.
+ strcpy(iniPath, result);
+ }
+
+ nsINIParser parser;
+ rv = parser.Init(iniPath);
+ if (NS_FAILED(rv)) {
+ fprintf(stderr, "Could not read application.ini\n");
+ return 1;
+ }
+
+ if (!greFound) {
+#ifdef XP_MACOSX
+ // The bundle can be found next to the executable, in the MacOS dir.
+ CFURLRef exurl = CFBundleCopyExecutableURL(appBundle);
+ CFURLRef absexurl = nullptr;
+ if (exurl) {
+ absexurl = CFURLCopyAbsoluteURL(exurl);
+ CFRelease(exurl);
+ }
+
+ if (absexurl) {
+ char tbuffer[MAXPATHLEN];
+
+ if (CFURLGetFileSystemRepresentation(absexurl, true,
+ (UInt8*) tbuffer,
+ sizeof(tbuffer)) &&
+ access(tbuffer, R_OK | X_OK) == 0) {
+ if (realpath(tbuffer, greDir)) {
+ greFound = true;
+ }
+ else {
+ greDir[0] = '\0';
+ }
+ }
+
+ CFRelease(absexurl);
+ }
+#endif
+ if (!greFound) {
+ Output(false, "Could not find the Mozilla runtime.\n");
+ return 1;
+ }
+ }
+
+ rv = XPCOMGlueStartup(greDir);
+ if (NS_FAILED(rv)) {
+ if (rv == NS_ERROR_OUT_OF_MEMORY) {
+ char applicationName[2000] = "this application";
+ parser.GetString("App", "Name", applicationName, sizeof(applicationName));
+ Output(true, "Not enough memory available to start %s.\n",
+ applicationName);
+ } else {
+ Output(true, "Couldn't load XPCOM.\n");
+ }
+ return 1;
+ }
+
+ static const nsDynamicFunctionLoad kXULFuncs[] = {
+ { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
+ { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
+ { "XRE_main", (NSFuncPtr*) &XRE_main },
+ { nullptr, nullptr }
+ };
+
+ rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
+ if (NS_FAILED(rv)) {
+ Output(true, "Couldn't load XRE functions.\n");
+ return 1;
+ }
+
+ NS_LogInit();
+
+ int retval;
+
+ { // Scope COMPtr and AutoAppData
+ nsCOMPtr<nsIFile> iniFile;
+#ifdef XP_WIN
+ // On Windows iniPath is UTF-8 encoded so we need to convert it.
+ rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(iniPath), false,
+ getter_AddRefs(iniFile));
+#else
+ rv = NS_NewNativeLocalFile(nsDependentCString(iniPath), false,
+ getter_AddRefs(iniFile));
+#endif
+ if (NS_FAILED(rv)) {
+ Output(true, "Couldn't find application.ini file.\n");
+ return 1;
+ }
+
+ AutoAppData appData(iniFile);
+ if (!appData) {
+ Output(true, "Error: couldn't parse application.ini.\n");
+ return 1;
+ }
+
+ NS_ASSERTION(appData->directory, "Failed to get app directory.");
+
+ if (!appData->xreDirectory) {
+ // chop "libxul.so" off the GRE path
+ lastSlash = strrchr(greDir, PATH_SEPARATOR_CHAR);
+ if (lastSlash) {
+ *lastSlash = '\0';
+ }
+#ifdef XP_WIN
+ // same as iniPath.
+ NS_NewLocalFile(NS_ConvertUTF8toUTF16(greDir), false,
+ &appData->xreDirectory);
+#else
+ NS_NewNativeLocalFile(nsDependentCString(greDir), false,
+ &appData->xreDirectory);
+#endif
+ }
+
+ retval = XRE_main(argc, argv, appData, 0);
+ }
+
+ NS_LogTerm();
+
+ return retval;
+}
diff --git a/application/xulrunner/stub/xulrunner-stub.exe.manifest b/application/xulrunner/stub/xulrunner-stub.exe.manifest
new file mode 100644
index 000000000..57c2a7070
--- /dev/null
+++ b/application/xulrunner/stub/xulrunner-stub.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.Stub"
+ type="win32"
+/>
+<description>Mozilla XULRunner Stub</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/stub/xulrunner-stub.rc b/application/xulrunner/stub/xulrunner-stub.rc
new file mode 100644
index 000000000..84c3e47ed
--- /dev/null
+++ b/application/xulrunner/stub/xulrunner-stub.rc
@@ -0,0 +1,6 @@
+/* -*- 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/. */
+
+1 24 "xulrunner-stub.exe.manifest"
diff --git a/application/xulrunner/tools/redit/Makefile.in b/application/xulrunner/tools/redit/Makefile.in
new file mode 100644
index 000000000..31c253be8
--- /dev/null
+++ b/application/xulrunner/tools/redit/Makefile.in
@@ -0,0 +1,11 @@
+# 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/. */
+
+ifeq ($(OS_ARCH),WINNT)
+
+SDK_BINARY = \
+ $(PROGRAM) \
+ $(NULL)
+
+endif
diff --git a/application/xulrunner/tools/redit/moz.build b/application/xulrunner/tools/redit/moz.build
new file mode 100644
index 000000000..812a56578
--- /dev/null
+++ b/application/xulrunner/tools/redit/moz.build
@@ -0,0 +1,15 @@
+# -*- 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/.
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ GeckoProgram('redit')
+ SOURCES += [
+ 'redit.cpp',
+ ]
+ for var in ('WIN32_LEAN_AND_MEAN', 'UNICODE', '_UNICODE'):
+ DEFINES[var] = True
+ if CONFIG['GNU_CC']:
+ WIN32_EXE_LDFLAGS += ['-municode']
diff --git a/application/xulrunner/tools/redit/redit.cpp b/application/xulrunner/tools/redit/redit.cpp
new file mode 100644
index 000000000..8a96358b2
--- /dev/null
+++ b/application/xulrunner/tools/redit/redit.cpp
@@ -0,0 +1,187 @@
+/* -*- 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/. */
+
+// System headers (alphabetical)
+#include <fcntl.h>
+#include <io.h>
+#include <share.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <windows.h>
+
+// Mozilla headers (alphabetical)
+#include "mozilla/FileUtils.h" // ScopedClose
+#include "mozilla/UniquePtrExtensions.h"
+
+/*
+Icon files are made up of:
+
+IconHeader
+IconDirEntry1
+IconDirEntry2
+...
+IconDirEntryN
+IconData1
+IconData2
+...
+IconDataN
+
+Each IconData must be added as a new RT_ICON resource to the exe. Then
+an RT_GROUP_ICON resource must be added that contains an equivalent
+header:
+
+IconHeader
+IconResEntry1
+IconResEntry2
+...
+IconResEntryN
+*/
+
+#pragma pack(push, 2)
+typedef struct
+{
+ WORD Reserved;
+ WORD ResourceType;
+ WORD ImageCount;
+} IconHeader;
+
+typedef struct
+{
+ BYTE Width;
+ BYTE Height;
+ BYTE Colors;
+ BYTE Reserved;
+ WORD Planes;
+ WORD BitsPerPixel;
+ DWORD ImageSize;
+ DWORD ImageOffset;
+} IconDirEntry;
+
+typedef struct
+{
+ BYTE Width;
+ BYTE Height;
+ BYTE Colors;
+ BYTE Reserved;
+ WORD Planes;
+ WORD BitsPerPixel;
+ DWORD ImageSize;
+ WORD ResourceID; // This field is the one difference to above
+} IconResEntry;
+#pragma pack(pop)
+
+namespace {
+ /**
+ * ScopedResourceUpdate is a RAII wrapper for Windows resource updating
+ *
+ * Instances |EndUpdateResourceW()| their handles when they go out of scope.
+ * They pass |TRUE| as the second argument to |EndUpdateResourceW()|, which
+ * causes the resource update to be aborted (changes are discarded).
+ */
+ struct ScopedResourceUpdateTraits
+ {
+ typedef HANDLE type;
+ static type empty() { return nullptr; }
+ static void release(type handle) {
+ if(nullptr != handle) {
+ EndUpdateResourceW(handle, TRUE); // Discard changes
+ }
+ }
+ };
+
+ typedef mozilla::Scoped<ScopedResourceUpdateTraits> ScopedResourceUpdate;
+};
+
+#ifdef __MINGW32__
+extern "C"
+#endif
+int
+wmain(int argc, wchar_t** argv)
+{
+ if (argc != 3) {
+ printf("Usage: redit <exe file> <icon file>\n");
+ return 1;
+ }
+
+ mozilla::ScopedClose file;
+ if (0 != _wsopen_s(&file.rwget(),
+ argv[2],
+ _O_BINARY | _O_RDONLY,
+ _SH_DENYWR,
+ _S_IREAD)
+ || (-1 == file)) {
+ fprintf(stderr, "Unable to open icon file.\n");
+ return 1;
+ }
+
+ // Load all the data from the icon file
+ long filesize = _filelength(file);
+ auto data = MakeUniqueFallible<BYTE[]>(filesize);
+ if(!data) {
+ fprintf(stderr, "Failed to allocate memory for icon file.\n");
+ return 1;
+ }
+ _read(file, data.get(), filesize);
+
+ IconHeader* header = reinterpret_cast<IconHeader*>(data.get());
+
+ // Open the target library for updating
+ ScopedResourceUpdate updateRes(BeginUpdateResourceW(argv[1], FALSE));
+ if (nullptr == updateRes) {
+ fprintf(stderr, "Unable to open library for modification.\n");
+ return 1;
+ }
+
+ // Allocate the group resource entry
+ long groupSize = sizeof(IconHeader)
+ + header->ImageCount * sizeof(IconResEntry);
+ auto group = MakeUniqueFallible<BYTE[]>(groupSize);
+ if(!group) {
+ fprintf(stderr, "Failed to allocate memory for new images.\n");
+ return 1;
+ }
+ memcpy(group.get(), data.get(), sizeof(IconHeader));
+
+ IconDirEntry* sourceIcon =
+ reinterpret_cast<IconDirEntry*>(data.get()
+ + sizeof(IconHeader));
+ IconResEntry* targetIcon =
+ reinterpret_cast<IconResEntry*>(group.get()
+ + sizeof(IconHeader));
+
+ for (int id = 1; id <= header->ImageCount; id++) {
+ // Add the individual icon
+ if (!UpdateResourceW(updateRes, RT_ICON, MAKEINTRESOURCE(id),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
+ data + sourceIcon->ImageOffset,
+ sourceIcon->ImageSize)) {
+ fprintf(stderr, "Unable to update resource (RT_ICON).\n");
+ return 1;
+ }
+ // Copy the data for this icon
+ // (note that the structs have different sizes)
+ memcpy(targetIcon, sourceIcon, sizeof(IconResEntry));
+ targetIcon->ResourceID = id;
+ sourceIcon++;
+ targetIcon++;
+ }
+
+ if (!UpdateResourceW(updateRes, RT_GROUP_ICON, L"MAINICON",
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
+ group, groupSize)) {
+ fprintf(stderr, "Unable to update resource (RT_GROUP_ICON).\n");
+ return 1;
+ }
+
+ // Save the modifications
+ if(!EndUpdateResourceW(updateRes.forget(), FALSE)) {
+ fprintf(stderr, "Unable to write changes to library.\n");
+ return 1;
+ }
+
+ return 0;
+}