diff --git a/MozillaFirefox.changes b/MozillaFirefox.changes index dab4b95..7936b17 100644 --- a/MozillaFirefox.changes +++ b/MozillaFirefox.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Tue May 31 06:53:55 UTC 2011 - wr@rosenauer.org + +- update to 5.0b3 +- transformed to standalone Firefox (not xulrunner based) + (with new Firefox rapid release cycle it makes no sense anymore) + * imported all relevant xulrunner patches +- do not compile in build timestamp + ------------------------------------------------------------------- Fri Apr 15 07:08:53 UTC 2011 - wr@rosenauer.org diff --git a/MozillaFirefox.spec b/MozillaFirefox.spec index 4fd6945..ead851b 100644 --- a/MozillaFirefox.spec +++ b/MozillaFirefox.spec @@ -19,27 +19,30 @@ # norootforbuild %define major 4 -%define mainver %major.0 +%define mainver %major.99 Name: MozillaFirefox -%define use_xulrunner 1 -%define xulrunner mozilla-xulrunner20 -BuildRequires: Mesa-devel autoconf213 fdupes gcc-c++ libcurl-devel libgnomeui-devel libidl-devel libnotify-devel python unzip update-desktop-files yasm zip +BuildRequires: autoconf213 gcc-c++ libcurl-devel libgnomeui-devel libidl-devel libnotify-devel python unzip update-desktop-files zip fdupes Mesa-devel yasm %if %suse_version > 1110 BuildRequires: libiw-devel +BuildRequires: libproxy-devel %else BuildRequires: wireless-tools %endif -%if 0%{?use_xulrunner} -BuildRequires: %{xulrunner}-devel = 2.0.1 -%endif +BuildRequires: mozilla-nspr-devel >= 4.8.6 +BuildRequires: mozilla-nss-devel >= 3.12.8 +BuildRequires: nss-shared-helper-devel License: MPLv1.1 or GPLv2+ or LGPLv2+ -Version: %{mainver}.1 +Version: %{mainver} Release: 1 +%define releasedate 2011053000 Provides: web_browser Provides: firefox = %{version}-%{release} Provides: firefox = %{mainver} -%define releasedate 2011041400 +# this is needed to match this package with the kde4 helper package without the main package +# having a hard requirement on the kde4 package +%define kde_helper_version 6 +Provides: mozilla-kde4-version = %{kde_helper_version} Summary: Mozilla Firefox Web Browser Url: http://www.mozilla.org/ Group: Productivity/Networking/Web/Browsers @@ -48,39 +51,43 @@ Source1: MozillaFirefox.desktop Source2: MozillaFirefox-rpmlintrc Source3: mozilla.sh.in Source4: find-external-requires.sh -Source5: firefox.schemas Source6: kde.js Source7: l10n-%{version}.tar.bz2 Source8: firefox-mimeinfo.xml -Source9: firefox-lockdown.js Source10: compare-locales.tar.bz2 Source11: firefox.1 Source12: mozilla-get-app-id +Source13: add-plugins.sh.in +Source14: create-tar.sh +# Gecko/Toolkit Patch1: toolkit-download-folder.patch -Patch2: firefox-linkorder.patch -Patch3: firefox-browser-css.patch -Patch4: firefox-cross-desktop.patch -Patch5: firefox-kde.patch -Patch6: firefox-kde-114.patch -Patch7: firefox-ui-lockdown.patch -Patch8: firefox-no-sync-l10n.patch -Patch9: firefox-libxulsdk-locales.patch -Patch10: firefox-no-default-ualocale.patch -Patch11: firefox-multilocale-chrome.patch -Patch12: firefox-shellservice.patch -Patch13: firefox-branded-icons.patch +Patch2: mozilla-nongnome-proxies.patch +Patch3: mozilla-prefer_plugin_pref.patch +Patch4: mozilla-shared-nss-db.patch +Patch5: mozilla-kde.patch +Patch6: mozilla-cairo-lcd.patch +Patch7: mozilla-language.patch +Patch8: mozilla-gio.patch +Patch9: mozilla-cairo-return.patch +Patch10: mozilla-ntlm-full-path.patch +Patch11: mozilla-ppc-ipc.patch +# Firefox/browser +Patch30: firefox-linkorder.patch +Patch31: firefox-browser-css.patch +Patch32: firefox-cross-desktop.patch +Patch33: firefox-kde.patch +Patch34: firefox-kde-114.patch +Patch36: firefox-no-sync-l10n.patch +Patch38: firefox-no-default-ualocale.patch +Patch39: firefox-multilocale-chrome.patch +Patch40: firefox-shellservice.patch +Patch41: firefox-branded-icons.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Requires(post): coreutils shared-mime-info desktop-file-utils Requires(postun): shared-mime-info desktop-file-utils -%if 0%{?use_xulrunner} -Requires: %{xulrunner} >= %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' %{xulrunner}) -%requires_eq %{xulrunner} -%ifarch %ix86 -Requires: %{xulrunner}-32bit >= %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' %{xulrunner}) -Requires: %{xulrunner}-32bit = %(rpm -q --queryformat '%{VERSION}' %{xulrunner}) -%endif -%endif -Requires: %{name}-branding >= 4.0 +Requires: mozilla-nspr >= %(rpm -q --queryformat '%{VERSION}' mozilla-nspr) +Requires: mozilla-nss >= %(rpm -q --queryformat '%{VERSION}' mozilla-nss) +Requires: %{name}-branding > 4.0 %define firefox_appid \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\} %define _use_internal_dependency_generator 0 %define __find_requires sh %{SOURCE4} @@ -122,7 +129,6 @@ Requires: perl(Archive::Zip) Development files for Firefox to make packaging of addons easier. %if %localize - %package translations-common Summary: Common translations for MozillaFirefox License: MPLv1.1 or GPLv2+ or LGPLv2+ @@ -160,8 +166,6 @@ Supplements: packageand(%{name}:branding-upstream) #BRAND: default homepage and some other default configuration options #BRAND: /usr/lib/firefox/defaults/profile/bookmarks.html that contains #BRAND: the list of default bookmarks -#BRAND: /etc/gconf/schemas/firefox.schemas -#BRAND: for mapping some Firefox prefs to gconf #BRAND: It's also possible to create a file #BRAND: /usr/lib/firefox/defaults/preferences/firefox-$vendor.js to set #BRAND: custom preference overrides. @@ -171,6 +175,18 @@ Supplements: packageand(%{name}:branding-upstream) This package provides upstream look and feel for MozillaFirefox. +%if %crashreporter +%package buildsymbols +License: MPLv1.1 or GPLv2+ or LGPLv2+ +Summary: Breakpad buildsymbols for %{name} +Group: Development/Debug + +%description buildsymbols +This subpackage contains the Breakpad created and compatible debugging +symbols meant for upload to Mozilla's crash collector database. +%endif + + %prep %setup -q -n mozilla -b 7 -b 10 cd $RPM_BUILD_DIR/mozilla @@ -178,30 +194,52 @@ cd $RPM_BUILD_DIR/mozilla %patch2 -p1 %patch3 -p1 %patch4 -p1 -%if %suse_version >= 1110 %patch5 -p1 -# install kde.js -install -m 644 %{SOURCE6} browser/app/profile/kde.js -%endif -%if %suse_version >= 1140 %patch6 -p1 -%endif -#%patch7 -p1 +%patch7 -p1 %patch8 -p1 %patch9 -p1 %patch10 -p1 %patch11 -p1 -%patch12 -p1 -%patch13 -p1 +# +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%if %suse_version >= 1110 +%patch33 -p1 +# install kde.js +install -m 644 %{SOURCE6} browser/app/profile/kde.js +%endif +%if %suse_version >= 1140 +%patch34 -p1 +%endif +%patch36 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 %build +# no need to add build time to binaries +modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{_sourcedir}/%{name}.changes")" +DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\"" +TIME="\"$(date -d "${modified}" "+%%R")\"" +find . -regex ".*\.c\|.*\.cpp\|.*\.h" -exec sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g" {} + +# +kdehelperversion=$(cat toolkit/xre/nsKDEUtils.cpp | grep '#define KMOZILLAHELPER_VERSION' | cut -d ' ' -f 3) +if test "$kdehelperversion" != %{kde_helper_version}; then + echo fix kde helper version in the .spec file + exit 1 +fi export MOZ_BUILD_DATE=%{releasedate} export MOZILLA_OFFICIAL=1 export BUILD_OFFICIAL=1 export CFLAGS="$RPM_OPT_FLAGS -Os -fno-strict-aliasing" +%ifarch ppc64 +export CFLAGS="$CFLAGS -mminimal-toc" +%endif export CXXFLAGS="$CFLAGS" export MOZCONFIG=$RPM_BUILD_DIR/mozconfig -SDKDIR=$(pkg-config --variable=sdkdir libxul) cat << EOF > $MOZCONFIG mk_add_options MOZILLA_OFFICIAL=1 mk_add_options BUILD_OFFICIAL=1 @@ -216,19 +254,20 @@ ac_add_options --includedir=%{_includedir} ac_add_options --with-system-nspr ac_add_options --with-system-nss ac_add_options --with-l10n-base=$RPM_BUILD_DIR/l10n -ac_add_options --with-system-jpeg +#ac_add_options --with-system-jpeg # libjpeg-turbo is used internally #ac_add_options --with-system-png # doesn't work because of missing APNG support ac_add_options --with-system-zlib ac_add_options --disable-installer ac_add_options --disable-updater ac_add_options --disable-tests ac_add_options --disable-debug -#ac_add_options --enable-update-channel=beta +#ac_add_options --enable-chrome-format=jar +ac_add_options --enable-update-channel=beta EOF -%if 0%{?use_xulrunner} +%if %suse_version > 1130 cat << EOF >> $MOZCONFIG -ac_add_options --with-libxul-sdk=$SDKDIR -ac_add_options --enable-chrome-format=jar +ac_add_options --disable-gnomevfs +ac_add_options --enable-gio EOF %endif %if %branding @@ -236,18 +275,21 @@ cat << EOF >> $MOZCONFIG ac_add_options --enable-official-branding EOF %endif -%ifarch ppc ppc64 s390 s390x +%if %suse_version > 1110 cat << EOF >> $MOZCONFIG -ac_add_options --disable-ipc +ac_add_options --enable-libproxy +EOF +%endif +%if ! %crashreporter +cat << EOF >> $MOZCONFIG +ac_add_options --disable-crashreporter EOF %endif make -f client.mk build %install cd $RPM_BUILD_DIR/obj -# FIXME (will be needed once lockdown is integrated; needs omni.jar adoption) -#cp %{SOURCE9} dist/bin/defaults/preferences/lockdown.js -rm dist/bin/defaults/preferences/firefox-l10n.js +rm dist/bin/defaults/pref/firefox-l10n.js make -C browser/installer STRIP=/bin/true # copy tree into RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{progdir} @@ -257,6 +299,10 @@ mkdir -p $RPM_BUILD_ROOT/%{progdir}/distribution/extensions find $RPM_BUILD_ROOT%{progdir} \ -name "*.js" -o -name "*.jsm" -o -name "*.rdf" | xargs chmod a-x mkdir -p $RPM_BUILD_ROOT%{progdir}/searchplugins +# install add-plugins.sh +sed "s:%%PROGDIR:%{progdir}:g" \ + %{SOURCE13} > $RPM_BUILD_ROOT%{progdir}/add-plugins.sh +chmod 755 $RPM_BUILD_ROOT%{progdir}/add-plugins.sh # install additional locales %if %localize rm -f %{_tmppath}/translations.* @@ -317,11 +363,13 @@ ln -sf %{progdir}/icons/mozicon128.png $RPM_BUILD_ROOT/usr/share/pixmaps/%{progn ln -sf %{progdir}/icons/mozicon128.png $RPM_BUILD_ROOT/usr/share/pixmaps/%{progname}-gnome.png %if %branding for size in 16 22 24 32 48 256; do +%else +for size in 16 32 48; do +%endif mkdir -p $RPM_BUILD_ROOT%{gnome_dir}/share/icons/hicolor/${size}x${size}/apps/ ln -sf %{progdir}/chrome/icons/default/default$size.png \ $RPM_BUILD_ROOT%{gnome_dir}/share/icons/hicolor/${size}x${size}/apps/%{progname}.png done -%endif %suse_update_desktop_file %{desktop_file_name} Network WebBrowser GTK # excludes rm -f $RPM_BUILD_ROOT%{progdir}/updater.ini @@ -330,6 +378,9 @@ rm -f $RPM_BUILD_ROOT%{progdir}/README.txt rm -f $RPM_BUILD_ROOT%{progdir}/old-homepage-default.properties rm -f $RPM_BUILD_ROOT%{progdir}/run-mozilla.sh rm -f $RPM_BUILD_ROOT%{progdir}/LICENSE +rm -f $RPM_BUILD_ROOT%{progdir}/precomplete +rm -f $RPM_BUILD_ROOT%{progdir}/dictionaries/en-US* +rm -f $RPM_BUILD_ROOT%{progdir}/firefox # devel mkdir -p %{buildroot}%{_bindir} install -m 755 %SOURCE12 %{buildroot}%{_bindir} @@ -341,8 +392,6 @@ cat <<'FIN' >%{buildroot}/etc/rpm/macros.%{progname} %%firefox_version %{version} %%firefox_mainver %{mainver} %%firefox_mozillapath %%{_libdir}/%{progname} -%%firefox_xulrunner %{xulrunner} -%%firefox_xulrunner_version %(rpm -q --queryformat '%{VERSION}' %{xulrunner}) %%firefox_pluginsdir %%{_libdir}/browser-plugins %%firefox_appid \{ec8030f7-c20a-464f-9b0e-13a3a9e97384\} %%firefox_extdir %%(if [ "%%_target_cpu" = "noarch" ]; then echo %%{_datadir}/mozilla/extensions/%%{firefox_appid}; else echo %%{_libdir}/mozilla/extensions/%%{firefox_appid}; fi) @@ -362,6 +411,18 @@ FIN # fdupes %fdupes $RPM_BUILD_ROOT%{progdir} %fdupes $RPM_BUILD_ROOT%{_datadir} +# create breakpad debugsymbols +%if %crashreporter +SYMBOLS_NAME="firefox-%{version}-%{release}.%{_arch}-%{suse_version}-symbols" +make buildsymbols \ + SYMBOL_INDEX_NAME="$SYMBOLS_NAME.txt" \ + SYMBOL_FULL_ARCHIVE_BASENAME="$SYMBOLS_NAME-full" \ + SYMBOL_ARCHIVE_BASENAME="$SYMBOLS_NAME" +if [ -e dist/*symbols.zip ]; then + mkdir -p $RPM_BUILD_ROOT%{_datadir}/mozilla/ + cp dist/*symbols.zip $RPM_BUILD_ROOT%{_datadir}/mozilla/ +fi +%endif %clean rm -rf $RPM_BUILD_ROOT @@ -383,6 +444,7 @@ if [ -f usr/bin/update-desktop-database ] ; then usr/bin/update-desktop-database > /dev/null || : fi %endif +%{progdir}/add-plugins.sh > /dev/null 2>&1 exit 0 %postun @@ -400,31 +462,47 @@ fi %endif exit 0 +%posttrans +[ -e %{progdir}/add-plugins.sh ] && \ + %{progdir}/add-plugins.sh > /dev/null 2>&1 +exit 0 + +%preun +rm -f %{progdir}/dictionaries/* +exit 0 + %files %defattr(-,root,root) %dir %{progdir} %dir %{progdir}/chrome/ %dir %{progdir}/distribution/ -%{progdir}/chrome/browser.* -%{progdir}/chrome/localized.manifest -%{progdir}/chrome/nonlocalized.manifest -%{progdir}/chrome/en-US.* %{progdir}/chrome/icons %{progdir}/components/ -%exclude %{progdir}/defaults/profile/bookmarks.html +#%exclude %{progdir}/defaults/profile/bookmarks.html %{progdir}/defaults/ +%{progdir}/dictionaries/ %dir %{progdir}/extensions/ %{progdir}/distribution/extensions/ %{progdir}/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd} %{progdir}/icons/ -%{progdir}/modules/ %{progdir}/searchplugins/ %attr(755,root,root) %{progdir}/%{progname}.sh -%{progdir}/firefox +%{progdir}/firefox-bin +%{progdir}/add-plugins.sh %{progdir}/application.ini %{progdir}/blocklist.xml +%{progdir}/dependentlibs.list +#%{progdir}/greprefs.js +%{progdir}/*.so +%{progdir}/mozilla-xremote-client +%{progdir}/omni.jar +%{progdir}/platform.ini +%{progdir}/plugin-container %if %crashreporter %{progdir}/crashreporter-override.ini +%{progdir}/crashreporter +%{progdir}/crashreporter.ini +%{progdir}/Throbber-small.gif %endif %{progdir}/chrome.manifest %{_datadir}/applications/%{desktop_file_name}.desktop @@ -436,9 +514,7 @@ exit 0 %dir %{_libdir}/mozilla %dir %{_libdir}/mozilla/extensions %dir %{_libdir}/mozilla/extensions/%{firefox_appid} -%if %branding %{gnome_dir}/share/icons/hicolor/ -%endif %{_bindir}/%{progname} %doc %{_mandir}/man1/%{progname}.1.gz @@ -448,7 +524,6 @@ exit 0 %config /etc/rpm/macros.%{progname} %if %localize - %files translations-common -f %{_tmppath}/translations.common %defattr(-,root,root) %dir %{progdir} @@ -460,10 +535,16 @@ exit 0 %dir %{progdir}/extensions/ %endif -%files branding-upstream +#%files branding-upstream +#%defattr(-,root,root) +#%dir %{progdir} +#%dir %{progdir}/defaults/ +#%{progdir}/defaults/profile/bookmarks.html + +%if %crashreporter +%files buildsymbols %defattr(-,root,root) -%dir %{progdir} -%dir %{progdir}/defaults/ -%{progdir}/defaults/profile/bookmarks.html +%{_datadir}/mozilla/*.zip +%endif %changelog diff --git a/add-plugins.sh.in b/add-plugins.sh.in new file mode 100644 index 0000000..32a0422 --- /dev/null +++ b/add-plugins.sh.in @@ -0,0 +1,57 @@ +#! /bin/sh +# Copyright (c) 2008 Wolfgang Rosenauer. All rights reserved. +# + +# check if we are started as root +# only one of UID and USER must be set correctly +if test "$UID" != 0 -a "$USER" != root; then + echo "You must be root to start $0." + exit 1 +fi + +PREFIX="%PROGDIR" + +# dictionaries +MYSPELL=/usr/share/myspell +MOZ_SPELL=$PREFIX/dictionaries +if [ -d $MOZ_SPELL ] ; then + if [ -d $MYSPELL ] ; then + for dict in $MYSPELL/??[-_]??.aff ; do + + # check is it is really the file or it is a string which contain '??_??' + if ! [ -e $dict ] ; then + continue + fi + + # the dict file name + dict_file=`echo ${dict##*/}` + + # the dict file has a valid name + lang=`echo ${dict_file:0:2}` + country=`echo ${dict_file:3:2}` + + # check for .dic file + if [ ! -r $MYSPELL/${lang}[-_]${country}.dic ] ; then + continue + fi + + # create links + if [ ! -r $MOZ_SPELL/${lang}[-_]${country}.aff ] ; then + ln -sf $MYSPELL/${lang}[-_]${country}.aff \ + $MOZ_SPELL/${lang}-${country}.aff + fi + if [ ! -r $MOZ_SPELL/${lang}[-_]${country}.dic ] ; then + ln -sf $MYSPELL/${lang}[-_]${country}.dic \ + $MOZ_SPELL/${lang}-${country}.dic + fi + done + echo "-> added myspell dictionaries" + fi + + # remove broken links + for dict in $MOZ_SPELL/*.{aff,dic} ; do + if ! [ -r $dict ] ; then + rm -f $dict + fi + done +fi diff --git a/compare-locales.tar.bz2 b/compare-locales.tar.bz2 index 31d9b9b..9c82233 100644 --- a/compare-locales.tar.bz2 +++ b/compare-locales.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:90f1442dcf8998b69e1d890e9accb88e648785ce9ddbf393d604d7cf0d67aae8 -size 25673 +oid sha256:f451b9247ea93e75a1d2d0baf8643ec2f09c7aaef030ff56e98e15256a233a4d +size 25657 diff --git a/create-tar.sh b/create-tar.sh new file mode 100644 index 0000000..4f1f9d3 --- /dev/null +++ b/create-tar.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +BRANCH="mozilla-beta" +RELEASE_TAG="FIREFOX_5_0b3_RELEASE" +VERSION="4.99" + +# mozilla +hg clone http://hg.mozilla.org/$BRANCH mozilla +pushd mozilla +[ "$RELEASE_TAG" == "default" ] || hg update -r $RELEASE_TAG +popd +tar cjf firefox-$VERSION-source.tar.bz2 --exclude=.hgtags --exclude=.hgignore --exclude=.hg --exclude=CVS mozilla + +# l10n +test ! -d l10n && mkdir l10n +for locale in $(awk '{ print $1; }' mozilla/browser/locales/shipped-locales); do + case $locale in + ja-JP-mac|en-US) + ;; + *) + hg clone http://hg.mozilla.org/releases/l10n/mozilla-beta/$locale l10n/$locale + [ "$RELEASE_TAG" == "default" ] || hg -R l10n/$locale up -C -r $RELEASE_TAG + ;; + esac +done +tar cjf l10n-$VERSION.tar.bz2 --exclude=.hgtags --exclude=.hgignore --exclude=.hg l10n + +# compare-locales +hg clone http://hg.mozilla.org/build/compare-locales +tar cjf compare-locales.tar.bz2 --exclude=.hgtags --exclude=.hgignore --exclude=.hg compare-locales + diff --git a/firefox-4.0.1-source.tar.bz2 b/firefox-4.0.1-source.tar.bz2 deleted file mode 100644 index 836f48c..0000000 --- a/firefox-4.0.1-source.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3db0870fe1220652f77931365afa88505cd1e7499bcf80b6379f70f606a194fb -size 65958832 diff --git a/firefox-4.99-source.tar.bz2 b/firefox-4.99-source.tar.bz2 new file mode 100644 index 0000000..da0fc25 --- /dev/null +++ b/firefox-4.99-source.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43042fdc36e9c0449bbf7db56d320b789f806780e85e6fcaa82c1a24b5be4931 +size 68684588 diff --git a/firefox-branded-icons.patch b/firefox-branded-icons.patch index a087c81..6a09912 100644 --- a/firefox-branded-icons.patch +++ b/firefox-branded-icons.patch @@ -1,9 +1,10 @@ # HG changeset patch -# Parent 33dfbc62844ac4883fbedb77d782a1b9ef5596c4 +# Parent 20b50e5bd650d19c30c308bb3b10f9903c83f581 + diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in --- a/browser/app/Makefile.in +++ b/browser/app/Makefile.in -@@ -281,16 +281,21 @@ endif +@@ -277,16 +277,21 @@ endif ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) libs:: @@ -29,7 +30,7 @@ diff --git a/browser/installer/package-manifest.in b/browser/installer/package-m --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -423,18 +423,21 @@ - #if MOZ_UPDATE_CHANNEL == beta + #ifdef SHIP_FEEDBACK @BINPATH@/distribution/extensions/testpilot@labs.mozilla.com.xpi #endif @BINPATH@/chrome/toolkit@JAREXT@ diff --git a/firefox-kde.patch b/firefox-kde.patch index 5c588dc..4f7e924 100644 --- a/firefox-kde.patch +++ b/firefox-kde.patch @@ -23,7 +23,7 @@ diff --git a/browser/base/content/browser-kde.xul b/browser/base/content/browser new file mode 100644 --- /dev/null +++ b/browser/base/content/browser-kde.xul -@@ -0,0 +1,1077 @@ +@@ -0,0 +1,1078 @@ +#filter substitution + +# -*- Mode: HTML -*- @@ -819,6 +819,7 @@ new file mode 100644 + + + -# Parent e3da64303bf904a8da2410754026b7a00480a589 +# Parent ec1efb28a1fea666f22730689d811fc67720f2db Add searchplugins to chrome packaging for proper localization diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js -@@ -321,16 +321,20 @@ pref("browser.download.manager.scanWhenD +@@ -327,16 +327,20 @@ pref("browser.download.manager.scanWhenD pref("browser.download.manager.resumeOnWakeDelay", 10000); // search engines URL @@ -30,16 +30,16 @@ diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in --- a/browser/locales/Makefile.in +++ b/browser/locales/Makefile.in -@@ -169,31 +169,44 @@ libs:: $(addprefix $(LOCALE_SRCDIR)/prof +@@ -167,31 +167,43 @@ libs:: $(call MERGE_FILES,$(addprefix pr install:: $(DESTDIR)$(mozappdir)/defaults/profile/bookmarks.html ; install:: $(addprefix generic/profile/,$(PROFILE_FILES)) $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile - install:: $(addprefix $(LOCALE_SRCDIR)/profile/chrome/,$(PROFILE_CHROME)) + install:: $(call MERGE_FILES,$(addprefix profile/chrome/,$(PROFILE_CHROME))) $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile/chrome --SEARCH_PLUGINS = $(shell cat $(LOCALE_SRCDIR)/searchplugins/list.txt) +-SEARCH_PLUGINS = $(shell cat $(call MERGE_FILE,/searchplugins/list.txt)) +SEARCH_PLUGINS = $(shell cat \ + $(firstword $(wildcard $(LOCALE_SRCDIR)/searchplugins/list.txt) \ + @srcdir@/en-US/searchplugins/list.txt ) ) @@ -59,12 +59,11 @@ diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in + -s $(topsrcdir)/$(relativesrcdir)/en-US/searchplugins \ + -s $(LOCALE_SRCDIR)/searchplugins \ + $(MAKE_JARS_FLAGS) tmp-search.jar.mn -+ + +export:: searchplugins + +GARBAGE += tmp-search.jar.mn - libs-%: $(NSINSTALL) -D $(DIST)/install @$(MAKE) -C ../../toolkit/locales libs-$* BOTH_MANIFESTS=1 @@ -77,8 +76,8 @@ diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in @$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1 - repackage-win32-installer: WIN32_INSTALLER_OUT="$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe" - repackage-win32-installer: $(WIN32_INSTALLER_IN) $(SUBMAKEFILES) + repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe + repackage-win32-installer: $(call ESCAPE_SPACE,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD) @echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)." diff --git a/browser/locales/jar.mn b/browser/locales/jar.mn --- a/browser/locales/jar.mn diff --git a/firefox-no-sync-l10n.patch b/firefox-no-sync-l10n.patch index e4faf3c..cbe4bf4 100644 --- a/firefox-no-sync-l10n.patch +++ b/firefox-no-sync-l10n.patch @@ -1,10 +1,10 @@ # HG changeset patch -# Parent e386d64898cac5a2e10bc4fbce606ffeefe1f210 +# Parent 0266a8a602473a4fa13393628be0b2fd50d0efc6 diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in --- a/browser/locales/Makefile.in +++ b/browser/locales/Makefile.in -@@ -181,17 +181,19 @@ libs:: $(addsuffix .xml,$(SEARCH_PLUGINS +@@ -179,17 +179,19 @@ libs:: $(addsuffix .xml,$(SEARCH_PLUGINS install:: $(addsuffix .xml,$(SEARCH_PLUGINS)) $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/searchplugins @@ -21,6 +21,6 @@ diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in @$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1 - repackage-win32-installer: WIN32_INSTALLER_OUT="$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe" - repackage-win32-installer: $(WIN32_INSTALLER_IN) $(SUBMAKEFILES) + repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe + repackage-win32-installer: $(call ESCAPE_SPACE,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD) @echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)." diff --git a/firefox-ui-lockdown.patch b/firefox-ui-lockdown.patch deleted file mode 100644 index e12d515..0000000 --- a/firefox-ui-lockdown.patch +++ /dev/null @@ -1,380 +0,0 @@ -From: various contributors -Subject: Firefox chrome lockdown hooks - -diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js ---- a/browser/base/content/browser.js -+++ b/browser/base/content/browser.js -@@ -1180,32 +1180,186 @@ function prepareForStartup() { - // setup our MozApplicationManifest listener - gBrowser.addEventListener("MozApplicationManifest", - OfflineApps, false); - - // setup simple gestures support - gGestureSupport.init(true); - } - -+function lockdownElement(ident, disable, hideCompletely) -+{ -+ var e = document.getElementById(ident); -+ if (!e) return; -+ if (hideCompletely) { -+ e.setAttribute("style", (disable) ? "display: none;" : ""); -+ } else if (disable) { -+ e.setAttribute("disabled", "true"); -+ } else { -+ e.removeAttribute("disabled"); -+ } -+} -+ -+function applyLockdown(isStartup) -+{ -+ // It is important to check that Firefox code does not change the -+ // "disabled" state of these UI elements. Fortunately it mostly hides -+ // elements rather than disables them. -+ var disablePrinting = gPrefService.getBoolPref("config.lockdown.printing"); -+ var disablePrintSetup = gPrefService.getBoolPref("config.lockdown.printsetup"); -+ if (!isStartup || disablePrintSetup || disablePrintSetup) { -+ lockdownElement("cmd_pageSetup", disablePrinting || disablePrintSetup); -+ lockdownElement("menu_printPreview", disablePrinting || disablePrintSetup); -+ lockdownElement("cmd_print", disablePrinting); -+ } -+ -+ var disableSave = gPrefService.getBoolPref("config.lockdown.savepage"); -+ if (!isStartup || disableSave) { -+ lockdownElement("Browser:SavePage", disableSave); -+ lockdownElement("Browser:SaveFrame", disableSave); -+ lockdownElement("context-savepage", disableSave); -+ lockdownElement("context-saveframe", disableSave); -+ lockdownElement("context-savelink", disableSave); -+ lockdownElement("context-saveimage", disableSave); -+ lockdownElement("View:PageSource", disableSave); -+ lockdownElement("context-viewpartialsource-selection", disableSave); -+ lockdownElement("context-viewpartialsource-mathml", disableSave); -+ lockdownElement("context-viewsource", disableSave); -+ lockdownElement("context-viewframesource", disableSave); -+ lockdownElement("View:PageInfo", disableSave); -+ lockdownElement("context-viewinfo", disableSave); -+ lockdownElement("context-viewframeinfo", disableSave); -+ lockdownElement("Tasks:InspectPage", disableSave); // from DOMInspector extension -+ } -+ -+ var disableBookmarks = gPrefService.getBoolPref("config.lockdown.hidebookmark"); -+ var disableBookmarkEditing = gPrefService.getBoolPref("config.lockdown.bookmark"); -+ if (!isStartup || disableBookmarks || disableBookmarkEditing) { -+ lockdownElement("bookmarksMenu", disableBookmarks, true); -+ lockdownElement("viewBookmarksSidebar", disableBookmarks); -+ lockdownElement("PersonalToolbar", disableBookmarks); // XXX check -+ lockdownElement("Browser:AddBookmarkAs", disableBookmarks || disableBookmarkEditing); -+ lockdownElement("Browser:ShowAllBookmarks", disableBookmarks || disableBookmarkEditing); -+ lockdownElement("manBookmark", disableBookmarks || disableBookmarkEditing); -+ lockdownElement("context-bookmarkpage", disableBookmarks || disableBookmarkEditing); -+ lockdownElement("context-bookmarklink", disableBookmarks || disableBookmarkEditing); -+ -+ // hide the personal bookmarks toolbar if necessary -+ if (disableBookmarks) { -+ document.getElementById("PersonalToolbar").setAttribute("collapsed", "true"); -+ } -+ } -+ -+ var disableHistory = gPrefService.getBoolPref("config.lockdown.history"); -+ if (!isStartup || disableHistory) { -+ lockdownElement("history-menu", disableHistory, true); -+ lockdownElement("viewHistorySidebar", disableHistory); -+ lockdownElement("Browser:ShowAllHistory", disableHistory); -+ gURLBar.setAttribute("enablehistory", disableHistory ? "false" : "true"); -+ gURLBar.disableAutoComplete = disableHistory; -+ } -+ -+ var defaultPrefs = Cc["@mozilla.org/preferences-service;1"] -+ .getService(Ci.nsIPrefService).getDefaultBranch(null); -+ if (isStartup && disableHistory) { -+ if (!defaultPrefs.prefIsLocked("browser.history_expire_days")) { -+ defaultPrefs.setIntPref("browser.history_expire_days", 0); -+ defaultPrefs.lockPref("browser.history_expire_days"); -+ } -+ if (!defaultPrefs.prefIsLocked("browser.formfill.enable")) { -+ defaultPrefs.setBoolPref("browser.formfill.enable", false); -+ defaultPrefs.lockPref("browser.formfill.enable"); -+ } -+ if (!defaultPrefs.prefIsLocked("browser.download.manager.retention")) { -+ defaultPrefs.setIntPref("browser.download.manager.retention", 0); -+ defaultPrefs.lockPref("browser.download.manager.retention"); -+ } -+ gPrefService.setBoolPref("config.lockdown.history.set", true); -+ } else if (isStartup && gPrefService.prefHasUserValue("config.lockdown.history.set")) { -+ if (!defaultPrefs.prefIsLocked("browser.history_expire_days")) { -+ defaultPrefs.clearUserPref("browser.history_expire_days"); -+ } -+ if (!defaultPrefs.prefIsLocked("browser.formfill.enable")) { -+ defaultPrefs.clearUserPref("browser.formfill.enable"); -+ } -+ if (!defaultPrefs.prefIsLocked("browser.download.manager.retention")) { -+ defaultPrefs.clearUserPref("browser.download.manager.retention"); -+ } -+ gPrefService.clearUserPref("config.lockdown.history.set"); -+ } -+ -+ var disableURLBar = gPrefService.getBoolPref("config.lockdown.urlbar"); -+ if (!isStartup || disableURLBar) { -+ lockdownElement("urlbar", disableURLBar); -+ lockdownElement("Browser:OpenLocation", disableURLBar); -+ lockdownElement("Browser:OpenFile", disableURLBar); -+ } -+ -+ var disableSearchBar = gPrefService.getBoolPref("config.lockdown.searchbar"); -+ if (!isStartup || disableSearchBar) { -+ document.getElementById("search-container") -+ .setAttribute("style", (disableSearchBar) ? "display: none;" : ""); -+ } -+ -+ var disableToolbarEditing = gPrefService.getBoolPref("config.lockdown.toolbarediting"); -+ if (!isStartup || disableToolbarEditing) { -+ var e = document.getElementById("cmd_CustomizeToolbars"); -+ if (!e.getAttribute("inCustomization")) { -+ lockdownElement("cmd_CustomizeToolbars", disableToolbarEditing); -+ } -+ } -+ -+ // Close sidebar if we disabled the command that's currently in use -+ var sidebarBox = document.getElementById("sidebar-box"); -+ var cmd = sidebarBox.getAttribute("sidebarcommand"); -+ if (cmd) { -+ var elt = document.getElementById(cmd); -+ if (elt && elt.getAttribute("disabled") == "true") { -+ toggleSidebar(cmd, false); -+ gMustLoadSidebar = false; -+ } -+ } -+} -+ -+var lockdownObserver = { -+ observe: function(aSubject, aTopic, aPrefName) -+ { -+ try { -+ applyLockdown(false); -+ } catch (ex) { -+ dump("Failed lockdown: " + ex + "\n"); -+ } -+ } -+}; -+ - function delayedStartup(isLoadingBlank, mustLoadSidebar) { - var os = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService); - os.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false); - os.addObserver(gXPInstallObserver, "xpinstall-install-blocked", false); - -+ try { -+ // do lockdown stuff in an exception handler so that if it fails -+ // catastrophically, the browser should still come up and function -+ applyLockdown(true); -+ gPrefService.addObserver("config.lockdown.", lockdownObserver, false); -+ } catch (ex) { -+ dump("Failed lockdown: " + ex + "\n"); -+ } -+ - BrowserOffline.init(); - OfflineApps.init(); - - gBrowser.addEventListener("pageshow", function(evt) { setTimeout(pageShowEventHandlers, 0, evt); }, true); - - // Ensure login manager is up and running. - Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager); - - if (mustLoadSidebar) { -+ let sidebarBox = document.getElementById("sidebar-box"); - let sidebar = document.getElementById("sidebar"); -- let sidebarBox = document.getElementById("sidebar-box"); - sidebar.setAttribute("src", sidebarBox.getAttribute("src")); - } - - UpdateUrlbarSearchSplitterState(); - - PlacesStarButton.init(); - - // called when we go into full screen, even if it is -@@ -1406,16 +1560,18 @@ function BrowserShutdown() - } - - var os = Components.classes["@mozilla.org/observer-service;1"] - .getService(Components.interfaces.nsIObserverService); - os.removeObserver(gSessionHistoryObserver, "browser:purge-session-history"); - os.removeObserver(gXPInstallObserver, "xpinstall-install-blocked"); - os.removeObserver(gMissingPluginInstaller, "plugin-crashed"); - -+ gPrefService.removeObserver("config.lockdown.", lockdownObserver); -+ - try { - gBrowser.removeProgressListener(window.XULBrowserWindow); - gBrowser.removeTabsProgressListener(window.TabsProgressListener); - } catch (ex) { - } - - PlacesStarButton.uninit(); - -@@ -3216,16 +3372,23 @@ function FillHistoryMenu(aParent) { - - // Remove old entries if any - var children = aParent.childNodes; - for (var i = children.length - 1; i >= 0; --i) { - if (children[i].hasAttribute("index")) - aParent.removeChild(children[i]); - } - -+ // lockdown. Don't display anything if locked down. -+ try { -+ var disableHistory = gPrefService.getBoolPref("config.lockdown.history"); -+ if (disableHistory) -+ return false; -+ } catch (ex) {} -+ - var webNav = getWebNavigation(); - var sessionHistory = webNav.sessionHistory; - - var count = sessionHistory.count; - if (count <= 1) // don't display the popup for a single item - return false; - - const MAX_HISTORY_MENU_ITEMS = 15; -@@ -3365,16 +3528,17 @@ function BrowserCustomizeToolbar() - { - // Disable the toolbar context menu items - var menubar = document.getElementById("main-menubar"); - for (var i = 0; i < menubar.childNodes.length; ++i) - menubar.childNodes[i].setAttribute("disabled", true); - - var cmd = document.getElementById("cmd_CustomizeToolbars"); - cmd.setAttribute("disabled", "true"); -+ cmd.setAttribute("inCustomization", "true"); - - var splitter = document.getElementById("urlbar-search-splitter"); - if (splitter) - splitter.parentNode.removeChild(splitter); - - var customizeURL = "chrome://global/content/customizeToolbar.xul"; - gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false); - -@@ -3402,16 +3566,31 @@ function BrowserCustomizeToolbar() - } else { - return window.openDialog(customizeURL, - "CustomizeToolbar", - "chrome,titlebar,toolbar,location,resizable,dependent", - gNavToolbox); - } - } - -+function BrowserRestoreCustomizationDisabledState() -+{ -+ var cmd = document.getElementById("cmd_CustomizeToolbars"); -+ try { -+ var disableToolBarEditing = -+ gPrefService.getBoolPref("config.lockdown.toolbarediting"); -+ } catch (ex) { -+ var disableToolBarEditing = false; -+ } -+ if (!disableToolBarEditing) { -+ cmd.removeAttribute("disabled", "true"); -+ } -+ cmd.removeAttribute("inCustomization"); -+} -+ - function BrowserToolboxCustomizeDone(aToolboxChanged) { - if (gCustomizeSheet) { - document.getElementById("customizeToolbarSheetIFrame").hidden = true; - document.getElementById("customizeToolbarSheetPopup").hidePopup(); - } - - // Update global UI elements that may have been added or removed - if (aToolboxChanged) { -@@ -3419,16 +3598,27 @@ function BrowserToolboxCustomizeDone(aTo - if (gURLBar) - gURLBar.emptyText = gURLBarEmptyText.value; - - gProxyFavIcon = document.getElementById("page-proxy-favicon"); - gHomeButton.updateTooltip(); - gIdentityHandler._cacheElements(); - window.XULBrowserWindow.init(); - -+ // make sure the search bar is not put back if locked down -+ try { -+ var disableSearchBar = gPrefService.getBoolPref("config.lockdown.searchbar"); -+ } catch (ex) { -+ var disableSearchBar = false; -+ } -+ if (disableSearchBar) { -+ document.getElementById("search-container") -+ .setAttribute("style", (disableSearchBar) ? "display: none;" : ""); -+ } -+ - var backForwardDropmarker = document.getElementById("back-forward-dropmarker"); - if (backForwardDropmarker) - backForwardDropmarker.disabled = - document.getElementById('Browser:Back').hasAttribute('disabled') && - document.getElementById('Browser:Forward').hasAttribute('disabled'); - - // support downgrading to Firefox 2.0 - var navBar = document.getElementById("nav-bar"); -@@ -3453,18 +3643,17 @@ function BrowserToolboxCustomizeDone(aTo - XULBrowserWindow.asyncUpdateUI(); - PlacesStarButton.updateState(); - } - - // Re-enable parts of the UI we disabled during the dialog - var menubar = document.getElementById("main-menubar"); - for (var i = 0; i < menubar.childNodes.length; ++i) - menubar.childNodes[i].setAttribute("disabled", false); -- var cmd = document.getElementById("cmd_CustomizeToolbars"); -- cmd.removeAttribute("disabled"); -+ BrowserRestoreCustomizationDisabledState(); - - #ifdef XP_MACOSX - // make sure to re-enable click-and-hold - if (!getBoolPref("ui.click_hold_context_menus", false)) - SetClickAndHoldHandlers(); - #endif - - // XXX Shouldn't have to do this, but I do -@@ -4552,16 +4741,19 @@ function onViewToolbarsPopupShowing(aEve - var toolbarName = toolbar.getAttribute("toolbarname"); - if (toolbarName) { - let menuItem = document.createElement("menuitem"); - let hidingAttribute = toolbar.getAttribute("type") == "menubar" ? - "autohide" : "collapsed"; - menuItem.setAttribute("toolbarindex", i); - menuItem.setAttribute("type", "checkbox"); - menuItem.setAttribute("label", toolbarName); -+ if (toolbar.getAttribute("disabled") == "true") { -+ menuItem.setAttribute("disabled", "true"); -+ } - menuItem.setAttribute("accesskey", toolbar.getAttribute("accesskey")); - menuItem.setAttribute("checked", toolbar.getAttribute(hidingAttribute) != "true"); - popup.insertBefore(menuItem, firstMenuItem); - - menuItem.addEventListener("command", onViewToolbarCommand, false); - } - toolbar = toolbar.nextSibling; - } -@@ -6737,17 +6929,23 @@ BookmarkAllTabsHandler.prototype = { - - _updateCommandState: function BATH__updateCommandState(aTabClose) { - var numTabs = gBrowser.tabContainer.childNodes.length; - - // The TabClose event is fired before the tab is removed from the DOM - if (aTabClose) - numTabs--; - -- if (numTabs > 1) -+ try { -+ var disableBookmarks = -+ gPrefService.getBoolPref("config.lockdown.bookmark"); -+ } catch (ex) { -+ var disableBookmarks = false; -+ } -+ if (numTabs > 1 && !disableBookmarks) - this._command.removeAttribute("disabled"); - else - this._command.setAttribute("disabled", "true"); - }, - - doCommand: function BATH_doCommand() { - PlacesCommandHook.bookmarkCurrentPages(); - }, diff --git a/firefox.schemas b/firefox.schemas deleted file mode 100644 index 5dc78b5..0000000 --- a/firefox.schemas +++ /dev/null @@ -1,289 +0,0 @@ - - - - /schemas/apps/firefox/lockdown/disable_history - /apps/firefox/lockdown/disable_history - firefox - bool - false - - Disable the browser history - Prevent the browser from keeping a history of visited sites - - - - /schemas/apps/firefox/lockdown/disable_toolbar_editing - /apps/firefox/lockdown/disable_toolbar_editing - firefox - bool - false - - Disable toolbar editing - Prevent the user from editing the toolbar - - - - /schemas/apps/firefox/lockdown/disable_themes - /apps/firefox/lockdown/disable_themes - firefox - bool - false - - Disable installing themes - To prevent the user from installing themes - - - - /schemas/apps/firefox/lockdown/disable_extensions - /apps/firefox/lockdown/disable_extensions - firefox - bool - false - - Disable installing extensions - Prevent the user from installing extensions - - - - /schemas/apps/firefox/web/disable_popups - /apps/firefox/web/disable_popups - firefox - bool - false - - Enable popup blocker - Enable popup blocker without warning about blocked popups - - - - /schemas/apps/firefox/web/java_enabled - /apps/firefox/web/java_enabled - firefox - bool - true - - Enable java - Enable java - - - - /schemas/apps/firefox/web/javascript_enabled - /apps/firefox/web/javascript_enabled - firefox - bool - true - - Enable javascript - Enable javascript - - - - /schemas/apps/firefox/lockdown/disable_url_bar - /apps/firefox/lockdown/disable_url_bar - firefox - bool - false - - Disable location bar - Prevent the user from entering URLs in the location bar - - - - /schemas/apps/firefox/lockdown/disable_searchbar - /apps/firefox/lockdown/disable_searchbar - firefox - bool - false - - Disable search bar - Prevent the user from using the search bar - - - - /schemas/apps/firefox/web/disable_cookies - /apps/firefox/web/disable_cookies - firefox - bool - false - - Disable cookies - Prevent the browser from storing cookies - - - - /schemas/apps/firefox/web/disable_save_password - /apps/firefox/web/disable_save_password - firefox - bool - false - - Disable saved passwords - Prevent the browser from storing saved passwords - - - - /schemas/apps/firefox/web/cache_size - /apps/firefox/web/cache_size - firefox - int - 50000 - - Disk cache size in KB - Disk cache size in KB - - - - /schemas/apps/firefox/general/homepage_url - /apps/firefox/general/homepage_url - firefox - string - www.novell.com/linux - - Home Page URL - Home Page URL - - - - /schemas/apps/firefox/web/download_defaultfolder - /apps/firefox/web/download_defaultfolder - firefox - string - Desktop - - Default download location - Default download location. Possible values include: "Desktop", "My Downloads", and "Home" - - - - /schemas/apps/firefox/lockdown/disable_unsafe_protocol - /apps/firefox/lockdown/disable_unsafe_protocol - firefox - bool - false - - Disable unsafe protocols - Disable non-builtin protocols not explicitly enabled - - - - /schemas/apps/firefox/lockdown/disable_bookmark_editing - /apps/firefox/lockdown/disable_bookmark_editing - firefox - bool - false - - Disable editing bookmarks - Prevent the user from editing browser bookmarks - - - - /schemas/apps/firefox/lockdown/hide_bookmark - /apps/firefox/lockdown/hide_bookmark - firefox - bool - false - - Disable bookmarks feature - Prevent the user from editing or viewing bookmarks - - - - /schemas/apps/firefox/lockdown/disable_show_passwords - /apps/firefox/lockdown/disable_show_passwords - firefox - bool - false - - Disable display of stored web passwords - Disable plain text display of stored web passwords in Preferences dialog - - - - /schemas/apps/firefox/lockdown/disable_javascript_chrome - /apps/firefox/lockdown/disable_javascript_chrome - firefox - bool - false - - Prevent javascript windows from hiding chrome - Prevent windows opened by javascript from hiding window chrome (location bar, status bar, etc.) - - - - /schemas/apps/firefox/web/cookie_accept - /apps/firefox/web/cookie_accept - firefox - int - 0 - - Cookie Lifetime Policy - Cookie Lifetime Policy: 0 = Accept cookies normally; 1 = Prompt for each cookie; 2 = Accept for current session only; 3 = Accept for N days - - - - /schemas/apps/firefox/web/images_load - /apps/firefox/web/images_load - firefox - int - 0 - - Image loading policy - Image loading policy: 0 = load all images; 1 = exclude third-party image loading; 2 = exclude all image loading - - - - /schemas/apps/firefox/lockdown/additional_safe_protocols - /apps/firefox/lockdown/additional_safe_protocols - firefox - string - - - Additional Safe Protocols - Additional Safe Protocols - - - - /schemas/apps/firefox/general/trusted_URIs - /apps/firefox/general/trusted_URIs - firefox - list - string - [] - - List of URIs for which Kerberos/NTLM is enabled - A comma-separated list of URI keys, of the form - [scheme "://"] [host [":" port]], for which login should be allowed - via SPNEGO Kerberos or NTLM authentication. - - - - - /schemas/apps/firefox/general/delegated_URIs - /apps/firefox/general/delegated_URIs - firefox - list - string - [] - - List of URIs for which Kerberos/NTLM delegation is enabled - A comma-separated list of URI keys, of the form - [scheme "://"] [host [":" port]], for which delegation should be allowed - using SPNEGO Kerberos or NTLM authentication. - - - - - /schemas/apps/firefox/general/allowed_indirect_gnomevfs_loads - /apps/firefox/general/allowed_indirect_gnomevfs_loads - firefox - string - "" - - A list of protocols, handled by gnome-vfs, that are permitted - A comma-separated list of protocols, handled by - gnome-vfs and of the form [scheme "://"], whose loads are - allowed. - - - - diff --git a/l10n-4.0.1.tar.bz2 b/l10n-4.0.1.tar.bz2 deleted file mode 100644 index 673500c..0000000 --- a/l10n-4.0.1.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:855964956f25f94824942c6b8e8e71efe79ba632d7477713d4384ee0af09df8f -size 42958955 diff --git a/l10n-4.99.tar.bz2 b/l10n-4.99.tar.bz2 new file mode 100644 index 0000000..3a9b017 --- /dev/null +++ b/l10n-4.99.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:879a144c7edd0481109fb3b4dd9ff268caceca8777c2ef256200f1e9f84ebe40 +size 37818146 diff --git a/mozilla-cairo-lcd.patch b/mozilla-cairo-lcd.patch new file mode 100644 index 0000000..68d8981 --- /dev/null +++ b/mozilla-cairo-lcd.patch @@ -0,0 +1,1333 @@ +Description: Add a Cairo LCD filter to use FreeType LCD colour filtering features +Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=404637 +Bug-Cairo: http://bugs.freedesktop.org/show_bug.cgi?id=10301 + +diff --git a/config/system-headers b/config/system-headers +--- a/config/system-headers ++++ b/config/system-headers +@@ -267,16 +267,17 @@ Font.h + Fonts.h + fp.h + fpieee.h + frame/log.h + frame/req.h + freetype/freetype.h + freetype/ftcache.h + freetype/ftglyph.h ++freetype/ftlcdfil.h + freetype/ftsynth.h + freetype/ftoutln.h + freetype/ttnameid.h + freetype/tttables.h + freetype/t1tables.h + fribidi/fribidi.h + FSp_fopen.h + fstream +diff --git a/gfx/cairo/cairo/src/cairo-font-options.c b/gfx/cairo/cairo/src/cairo-font-options.c +--- a/gfx/cairo/cairo/src/cairo-font-options.c ++++ b/gfx/cairo/cairo/src/cairo-font-options.c +@@ -34,41 +34,44 @@ + * Owen Taylor + */ + + #include "cairoint.h" + + static const cairo_font_options_t _cairo_font_options_nil = { + CAIRO_ANTIALIAS_DEFAULT, + CAIRO_SUBPIXEL_ORDER_DEFAULT, ++ CAIRO_LCD_FILTER_DEFAULT, + CAIRO_HINT_STYLE_DEFAULT, + CAIRO_HINT_METRICS_DEFAULT + }; + + /** + * _cairo_font_options_init_default: + * @options: a #cairo_font_options_t + * + * Initializes all fields of the font options object to default values. + **/ + void + _cairo_font_options_init_default (cairo_font_options_t *options) + { + options->antialias = CAIRO_ANTIALIAS_DEFAULT; + options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; ++ options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT; + options->hint_style = CAIRO_HINT_STYLE_DEFAULT; + options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT; + } + + void + _cairo_font_options_init_copy (cairo_font_options_t *options, + const cairo_font_options_t *other) + { + options->antialias = other->antialias; + options->subpixel_order = other->subpixel_order; ++ options->lcd_filter = other->lcd_filter; + options->hint_style = other->hint_style; + options->hint_metrics = other->hint_metrics; + } + + /** + * cairo_font_options_create: + * + * Allocates a new font options object with all options initialized +@@ -184,16 +187,18 @@ cairo_font_options_merge (cairo_font_opt + + if (cairo_font_options_status ((cairo_font_options_t *) other)) + return; + + if (other->antialias != CAIRO_ANTIALIAS_DEFAULT) + options->antialias = other->antialias; + if (other->subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT) + options->subpixel_order = other->subpixel_order; ++ if (other->lcd_filter != CAIRO_LCD_FILTER_DEFAULT) ++ options->lcd_filter = other->lcd_filter; + if (other->hint_style != CAIRO_HINT_STYLE_DEFAULT) + options->hint_style = other->hint_style; + if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT) + options->hint_metrics = other->hint_metrics; + } + slim_hidden_def (cairo_font_options_merge); + + /** +@@ -216,16 +221,17 @@ cairo_font_options_equal (const cairo_fo + if (cairo_font_options_status ((cairo_font_options_t *) other)) + return FALSE; + + if (options == other) + return TRUE; + + return (options->antialias == other->antialias && + options->subpixel_order == other->subpixel_order && ++ options->lcd_filter == other->lcd_filter && + options->hint_style == other->hint_style && + options->hint_metrics == other->hint_metrics); + } + slim_hidden_def (cairo_font_options_equal); + + /** + * cairo_font_options_hash: + * @options: a #cairo_font_options_t +@@ -241,17 +247,18 @@ slim_hidden_def (cairo_font_options_equa + unsigned long + cairo_font_options_hash (const cairo_font_options_t *options) + { + if (cairo_font_options_status ((cairo_font_options_t *) options)) + options = &_cairo_font_options_nil; /* force default values */ + + return ((options->antialias) | + (options->subpixel_order << 4) | +- (options->hint_style << 8) | ++ (options->lcd_filter << 8) | ++ (options->hint_style << 12) | + (options->hint_metrics << 16)); + } + slim_hidden_def (cairo_font_options_hash); + + /** + * cairo_font_options_set_antialias: + * @options: a #cairo_font_options_t + * @antialias: the new antialiasing mode +@@ -323,16 +330,58 @@ cairo_font_options_get_subpixel_order (c + { + if (cairo_font_options_status ((cairo_font_options_t *) options)) + return CAIRO_SUBPIXEL_ORDER_DEFAULT; + + return options->subpixel_order; + } + + /** ++ * _cairo_font_options_set_lcd_filter: ++ * @options: a #cairo_font_options_t ++ * @lcd_filter: the new LCD filter ++ * ++ * Sets the LCD filter for the font options object. The LCD filter ++ * specifies how pixels are filtered when rendered with an antialiasing ++ * mode of %CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for ++ * #cairo_lcd_filter_t for full details. ++ * ++ * Since: 1.8 ++ **/ ++void ++_cairo_font_options_set_lcd_filter (cairo_font_options_t *options, ++ cairo_lcd_filter_t lcd_filter) ++{ ++ if (cairo_font_options_status (options)) ++ return; ++ ++ options->lcd_filter = lcd_filter; ++} ++ ++/** ++ * _cairo_font_options_get_lcd_filter: ++ * @options: a #cairo_font_options_t ++ * ++ * Gets the LCD filter for the font options object. ++ * See the documentation for #cairo_lcd_filter_t for full details. ++ * ++ * Return value: the LCD filter for the font options object ++ * ++ * Since: 1.8 ++ **/ ++cairo_lcd_filter_t ++_cairo_font_options_get_lcd_filter (const cairo_font_options_t *options) ++{ ++ if (cairo_font_options_status ((cairo_font_options_t *) options)) ++ return CAIRO_LCD_FILTER_DEFAULT; ++ ++ return options->lcd_filter; ++} ++ ++/** + * cairo_font_options_set_hint_style: + * @options: a #cairo_font_options_t + * @hint_style: the new hint style + * + * Sets the hint style for font outlines for the font options object. + * This controls whether to fit font outlines to the pixel grid, + * and if so, whether to optimize for fidelity or contrast. + * See the documentation for #cairo_hint_style_t for full details. +diff --git a/gfx/cairo/cairo/src/cairo-ft-font.c b/gfx/cairo/cairo/src/cairo-ft-font.c +--- a/gfx/cairo/cairo/src/cairo-ft-font.c ++++ b/gfx/cairo/cairo/src/cairo-ft-font.c +@@ -54,16 +54,38 @@ + #include FT_FREETYPE_H + #include FT_OUTLINE_H + #include FT_IMAGE_H + #include FT_TRUETYPE_TABLES_H + #if HAVE_FT_GLYPHSLOT_EMBOLDEN + #include FT_SYNTHESIS_H + #endif + ++#include FT_LCD_FILTER_H ++ ++/* Fontconfig version older than 2.6 didn't have these options */ ++#ifndef FC_LCD_FILTER ++#define FC_LCD_FILTER "lcdfilter" ++#endif ++/* Some Ubuntu versions defined FC_LCD_FILTER without defining the following */ ++#ifndef FC_LCD_NONE ++#define FC_LCD_NONE 0 ++#define FC_LCD_DEFAULT 1 ++#define FC_LCD_LIGHT 2 ++#define FC_LCD_LEGACY 3 ++#endif ++ ++/* FreeType version older than 2.3.5(?) didn't have these options */ ++#ifndef FT_LCD_FILTER_NONE ++#define FT_LCD_FILTER_NONE 0 ++#define FT_LCD_FILTER_DEFAULT 1 ++#define FT_LCD_FILTER_LIGHT 2 ++#define FT_LCD_FILTER_LEGACY 16 ++#endif ++ + #define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0)) + #define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0) + #define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0)) + #define DOUBLE_FROM_16_16(t) ((double)(t) / 65536.0) + + /* This is the max number of FT_face objects we keep open at once + */ + #define MAX_OPEN_FACES 10 +@@ -774,45 +796,309 @@ _cairo_ft_unscaled_font_set_scale (cairo + unscaled->face->available_sizes[best_i].height); + if (error) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + } + + return CAIRO_STATUS_SUCCESS; + } + +-/* Empirically-derived subpixel filtering values thanks to Keith +- * Packard and libXft. */ +-static const int filters[3][3] = { +- /* red */ +-#if 0 +- { 65538*4/7,65538*2/7,65538*1/7 }, +- /* green */ +- { 65536*1/4, 65536*2/4, 65537*1/4 }, +- /* blue */ +- { 65538*1/7,65538*2/7,65538*4/7 }, ++/* we sometimes need to convert the glyph bitmap in a FT_GlyphSlot ++ * into a different format. For example, we want to convert a ++ * FT_PIXEL_MODE_LCD or FT_PIXEL_MODE_LCD_V bitmap into a 32-bit ++ * ARGB or ABGR bitmap. ++ * ++ * this function prepares a target descriptor for this operation. ++ * ++ * input :: target bitmap descriptor. The function will set its ++ * 'width', 'rows' and 'pitch' fields, and only these ++ * ++ * slot :: the glyph slot containing the source bitmap. this ++ * function assumes that slot->format == FT_GLYPH_FORMAT_BITMAP ++ * ++ * mode :: the requested final rendering mode. supported values are ++ * MONO, NORMAL (i.e. gray), LCD and LCD_V ++ * ++ * the function returns the size in bytes of the corresponding buffer, ++ * it's up to the caller to allocate the corresponding memory block ++ * before calling _fill_xrender_bitmap ++ * ++ * it also returns -1 in case of error (e.g. incompatible arguments, ++ * like trying to convert a gray bitmap into a monochrome one) ++ */ ++static int ++_compute_xrender_bitmap_size(FT_Bitmap *target, ++ FT_GlyphSlot slot, ++ FT_Render_Mode mode) ++{ ++ FT_Bitmap *ftbit; ++ int width, height, pitch; ++ ++ if (slot->format != FT_GLYPH_FORMAT_BITMAP) ++ return -1; ++ ++ /* compute the size of the final bitmap */ ++ ftbit = &slot->bitmap; ++ ++ width = ftbit->width; ++ height = ftbit->rows; ++ pitch = (width + 3) & ~3; ++ ++ switch (ftbit->pixel_mode) { ++ case FT_PIXEL_MODE_MONO: ++ if (mode == FT_RENDER_MODE_MONO) { ++ pitch = (((width + 31) & ~31) >> 3); ++ break; ++ } ++ /* fall-through */ ++ ++ case FT_PIXEL_MODE_GRAY: ++ if (mode == FT_RENDER_MODE_LCD || ++ mode == FT_RENDER_MODE_LCD_V) ++ { ++ /* each pixel is replicated into a 32-bit ARGB value */ ++ pitch = width * 4; ++ } ++ break; ++ ++ case FT_PIXEL_MODE_LCD: ++ if (mode != FT_RENDER_MODE_LCD) ++ return -1; ++ ++ /* horz pixel triplets are packed into 32-bit ARGB values */ ++ width /= 3; ++ pitch = width * 4; ++ break; ++ ++ case FT_PIXEL_MODE_LCD_V: ++ if (mode != FT_RENDER_MODE_LCD_V) ++ return -1; ++ ++ /* vert pixel triplets are packed into 32-bit ARGB values */ ++ height /= 3; ++ pitch = width * 4; ++ break; ++ ++ default: /* unsupported source format */ ++ return -1; ++ } ++ ++ target->width = width; ++ target->rows = height; ++ target->pitch = pitch; ++ target->buffer = NULL; ++ ++ return pitch * height; ++} ++ ++/* this functions converts the glyph bitmap found in a FT_GlyphSlot ++ * into a different format (see _compute_xrender_bitmap_size) ++ * ++ * you should call this function after _compute_xrender_bitmap_size ++ * ++ * target :: target bitmap descriptor. Note that its 'buffer' pointer ++ * must point to memory allocated by the caller ++ * ++ * slot :: the glyph slot containing the source bitmap ++ * ++ * mode :: the requested final rendering mode ++ * ++ * bgr :: boolean, set if BGR or VBGR pixel ordering is needed ++ */ ++static void ++_fill_xrender_bitmap(FT_Bitmap *target, ++ FT_GlyphSlot slot, ++ FT_Render_Mode mode, ++ int bgr) ++{ ++ FT_Bitmap *ftbit = &slot->bitmap; ++ unsigned char *srcLine = ftbit->buffer; ++ unsigned char *dstLine = target->buffer; ++ int src_pitch = ftbit->pitch; ++ int width = target->width; ++ int height = target->rows; ++ int pitch = target->pitch; ++ int subpixel; ++ int h; ++ ++ subpixel = (mode == FT_RENDER_MODE_LCD || ++ mode == FT_RENDER_MODE_LCD_V); ++ ++ if (src_pitch < 0) ++ srcLine -= src_pitch * (ftbit->rows - 1); ++ ++ target->pixel_mode = ftbit->pixel_mode; ++ ++ switch (ftbit->pixel_mode) { ++ case FT_PIXEL_MODE_MONO: ++ if (subpixel) { ++ /* convert mono to ARGB32 values */ ++ ++ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) { ++ int x; ++ ++ for (x = 0; x < width; x++) { ++ if (srcLine[(x >> 3)] & (0x80 >> (x & 7))) ++ ((unsigned int *) dstLine)[x] = 0xffffffffU; ++ } ++ } ++ target->pixel_mode = FT_PIXEL_MODE_LCD; ++ ++ } else if (mode == FT_RENDER_MODE_NORMAL) { ++ /* convert mono to 8-bit gray */ ++ ++ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) { ++ int x; ++ ++ for (x = 0; x < width; x++) { ++ if (srcLine[(x >> 3)] & (0x80 >> (x & 7))) ++ dstLine[x] = 0xff; ++ } ++ } ++ target->pixel_mode = FT_PIXEL_MODE_GRAY; ++ ++ } else { ++ /* copy mono to mono */ ++ ++ int bytes = (width + 7) >> 3; ++ ++ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) ++ memcpy (dstLine, srcLine, bytes); ++ } ++ break; ++ ++ case FT_PIXEL_MODE_GRAY: ++ if (subpixel) { ++ /* convert gray to ARGB32 values */ ++ ++ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) { ++ int x; ++ unsigned int *dst = (unsigned int *) dstLine; ++ ++ for (x = 0; x < width; x++) { ++ unsigned int pix = srcLine[x]; ++ ++ pix |= (pix << 8); ++ pix |= (pix << 16); ++ ++ dst[x] = pix; ++ } ++ } ++ target->pixel_mode = FT_PIXEL_MODE_LCD; ++ } else { ++ /* copy gray into gray */ ++ ++ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) ++ memcpy (dstLine, srcLine, width); ++ } ++ break; ++ ++ case FT_PIXEL_MODE_LCD: ++ if (!bgr) { ++ /* convert horizontal RGB into ARGB32 */ ++ ++ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) { ++ int x; ++ unsigned char *src = srcLine; ++ unsigned int *dst = (unsigned int *) dstLine; ++ ++ for (x = 0; x < width; x++, src += 3) { ++ unsigned int pix; ++ ++ pix = ((unsigned int)src[0] << 16) | ++ ((unsigned int)src[1] << 8) | ++ ((unsigned int)src[2] ) | ++ ((unsigned int)src[1] << 24) ; ++ ++ dst[x] = pix; ++ } ++ } ++ } else { ++ /* convert horizontal BGR into ARGB32 */ ++ ++ for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) { ++ ++ int x; ++ unsigned char *src = srcLine; ++ unsigned int *dst = (unsigned int *) dstLine; ++ ++ for (x = 0; x < width; x++, src += 3) { ++ unsigned int pix; ++ ++ pix = ((unsigned int)src[2] << 16) | ++ ((unsigned int)src[1] << 8) | ++ ((unsigned int)src[0] ) | ++ ((unsigned int)src[1] << 24) ; ++ ++ dst[x] = pix; ++ } ++ } ++ } ++ break; ++ ++ default: /* FT_PIXEL_MODE_LCD_V */ ++ /* convert vertical RGB into ARGB32 */ ++ if (!bgr) { ++ ++ for (h = height; h > 0; h--, srcLine += 3 * src_pitch, dstLine += pitch) { ++ int x; ++ unsigned char* src = srcLine; ++ unsigned int* dst = (unsigned int *) dstLine; ++ ++ for (x = 0; x < width; x++, src += 1) { ++ unsigned int pix; ++#if 1 ++ pix = ((unsigned int)src[0] << 16) | ++ ((unsigned int)src[src_pitch] << 8) | ++ ((unsigned int)src[src_pitch*2] ) | ++ 0xFF000000 ; ++#else ++ pix = ((unsigned int)src[0] << 16) | ++ ((unsigned int)src[src_pitch] << 8) | ++ ((unsigned int)src[src_pitch*2] ) | ++ ((unsigned int)src[src_pitch] << 24) ; + #endif +- { 65538*9/13,65538*3/13,65538*1/13 }, +- /* green */ +- { 65538*1/6, 65538*4/6, 65538*1/6 }, +- /* blue */ +- { 65538*1/13,65538*3/13,65538*9/13 }, +-}; ++ dst[x] = pix; ++ } ++ } ++ } else { ++ ++ for (h = height; h > 0; h--, srcLine += 3*src_pitch, dstLine += pitch) { ++ int x; ++ unsigned char *src = srcLine; ++ unsigned int *dst = (unsigned int *) dstLine; ++ ++ for (x = 0; x < width; x++, src += 1) { ++ unsigned int pix; ++ ++ pix = ((unsigned int)src[src_pitch * 2] << 16) | ++ ((unsigned int)src[src_pitch] << 8) | ++ ((unsigned int)src[0] ) | ++ ((unsigned int)src[src_pitch] << 24) ; ++ ++ dst[x] = pix; ++ } ++ } ++ } ++ } ++} ++ + + /* Fills in val->image with an image surface created from @bitmap + */ + static cairo_status_t + _get_bitmap_surface (FT_Bitmap *bitmap, + cairo_bool_t own_buffer, + cairo_font_options_t *font_options, + cairo_image_surface_t **surface) + { + int width, height, stride; + unsigned char *data; + int format = CAIRO_FORMAT_A8; ++ cairo_image_surface_t *image; + + width = bitmap->width; + height = bitmap->rows; + + if (width == 0 || height == 0) { + *surface = (cairo_image_surface_t *) + cairo_image_surface_create_for_data (NULL, format, 0, 0, 0); + return (*surface)->base.status; +@@ -859,150 +1145,63 @@ _get_bitmap_surface (FT_Bitmap *bi + } + #endif + format = CAIRO_FORMAT_A1; + break; + + case FT_PIXEL_MODE_LCD: + case FT_PIXEL_MODE_LCD_V: + case FT_PIXEL_MODE_GRAY: +- switch (font_options->antialias) { +- case CAIRO_ANTIALIAS_DEFAULT: +- case CAIRO_ANTIALIAS_GRAY: +- case CAIRO_ANTIALIAS_NONE: +- default: ++ if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) { + stride = bitmap->pitch; + if (own_buffer) { + data = bitmap->buffer; + } else { + data = _cairo_malloc_ab (height, stride); + if (!data) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + + memcpy (data, bitmap->buffer, stride * height); + } + format = CAIRO_FORMAT_A8; +- break; +- case CAIRO_ANTIALIAS_SUBPIXEL: { +- int x, y; +- unsigned char *in_line, *out_line, *in; +- unsigned int *out; +- unsigned int red, green, blue; +- int rf, gf, bf; +- int s; +- int o, os; +- unsigned char *data_rgba; +- unsigned int width_rgba, stride_rgba; +- int vmul = 1; +- int hmul = 1; +- +- switch (font_options->subpixel_order) { +- case CAIRO_SUBPIXEL_ORDER_DEFAULT: +- case CAIRO_SUBPIXEL_ORDER_RGB: +- case CAIRO_SUBPIXEL_ORDER_BGR: +- default: +- width /= 3; +- hmul = 3; +- break; +- case CAIRO_SUBPIXEL_ORDER_VRGB: +- case CAIRO_SUBPIXEL_ORDER_VBGR: +- vmul = 3; +- height /= 3; +- break; +- } +- /* +- * Filter the glyph to soften the color fringes +- */ +- width_rgba = width; ++ } else { ++ /* if we get there, the data from the source bitmap ++ * really comes from _fill_xrender_bitmap, and is ++ * made of 32-bit ARGB or ABGR values */ ++ assert (own_buffer != 0); ++ assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY); ++ ++ data = bitmap->buffer; + stride = bitmap->pitch; +- stride_rgba = (width_rgba * 4 + 3) & ~3; +- data_rgba = calloc (stride_rgba, height); +- if (unlikely (data_rgba == NULL)) { +- if (own_buffer) +- free (bitmap->buffer); +- return _cairo_error (CAIRO_STATUS_NO_MEMORY); +- } +- +- os = 1; +- switch (font_options->subpixel_order) { +- case CAIRO_SUBPIXEL_ORDER_VRGB: +- os = stride; +- case CAIRO_SUBPIXEL_ORDER_DEFAULT: +- case CAIRO_SUBPIXEL_ORDER_RGB: +- default: +- rf = 0; +- gf = 1; +- bf = 2; +- break; +- case CAIRO_SUBPIXEL_ORDER_VBGR: +- os = stride; +- case CAIRO_SUBPIXEL_ORDER_BGR: +- bf = 0; +- gf = 1; +- rf = 2; +- break; +- } +- in_line = bitmap->buffer; +- out_line = data_rgba; +- for (y = 0; y < height; y++) +- { +- in = in_line; +- out = (unsigned int *) out_line; +- in_line += stride * vmul; +- out_line += stride_rgba; +- for (x = 0; x < width * hmul; x += hmul) +- { +- red = green = blue = 0; +- o = 0; +- for (s = 0; s < 3; s++) +- { +- red += filters[rf][s]*in[x+o]; +- green += filters[gf][s]*in[x+o]; +- blue += filters[bf][s]*in[x+o]; +- o += os; +- } +- red = red / 65536; +- green = green / 65536; +- blue = blue / 65536; +- *out++ = (green << 24) | (red << 16) | (green << 8) | blue; +- } +- } +- +- /* Images here are stored in native format. The +- * backend must convert to its own format as needed +- */ +- +- if (own_buffer) +- free (bitmap->buffer); +- data = data_rgba; +- stride = stride_rgba; + format = CAIRO_FORMAT_ARGB32; +- break; +- } + } + break; + case FT_PIXEL_MODE_GRAY2: + case FT_PIXEL_MODE_GRAY4: + /* These could be triggered by very rare types of TrueType fonts */ + default: + if (own_buffer) + free (bitmap->buffer); + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + } + +- *surface = (cairo_image_surface_t *) ++ /* XXX */ ++ *surface = image = (cairo_image_surface_t *) + cairo_image_surface_create_for_data (data, + format, + width, height, stride); +- if ((*surface)->base.status) { ++ if (image->base.status) { + free (data); + return (*surface)->base.status; + } + +- _cairo_image_surface_assume_ownership_of_data ((*surface)); ++ if (font_options->antialias == CAIRO_ANTIALIAS_SUBPIXEL) ++ pixman_image_set_component_alpha (image->pixman_image, TRUE); ++ ++ _cairo_image_surface_assume_ownership_of_data ((image)); + + _cairo_debug_check_image_surface_is_defined (&(*surface)->base); + + return CAIRO_STATUS_SUCCESS; + } + + /* Converts an outline FT_GlyphSlot into an image + * +@@ -1019,129 +1218,169 @@ _get_bitmap_surface (FT_Bitmap *bi + * when we add subpixel support. If so, we may want to eliminate + * this version of the code path entirely. + */ + static cairo_status_t + _render_glyph_outline (FT_Face face, + cairo_font_options_t *font_options, + cairo_image_surface_t **surface) + { ++ int rgba = FC_RGBA_UNKNOWN; ++ int lcd_filter = FT_LCD_FILTER_LEGACY; + FT_GlyphSlot glyphslot = face->glyph; + FT_Outline *outline = &glyphslot->outline; + FT_Bitmap bitmap; + FT_BBox cbox; +- FT_Matrix matrix; +- int hmul = 1; +- int vmul = 1; +- unsigned int width, height, stride; +- cairo_bool_t subpixel = FALSE; ++ unsigned int width, height; + cairo_status_t status; ++ FT_Error fterror; ++ FT_Library library = glyphslot->library; ++ FT_Render_Mode render_mode = FT_RENDER_MODE_NORMAL; ++ ++ switch (font_options->antialias) { ++ case CAIRO_ANTIALIAS_NONE: ++ render_mode = FT_RENDER_MODE_MONO; ++ break; ++ ++ case CAIRO_ANTIALIAS_SUBPIXEL: ++ switch (font_options->subpixel_order) { ++ case CAIRO_SUBPIXEL_ORDER_DEFAULT: ++ case CAIRO_SUBPIXEL_ORDER_RGB: ++ case CAIRO_SUBPIXEL_ORDER_BGR: ++ render_mode = FT_RENDER_MODE_LCD; ++ break; ++ ++ case CAIRO_SUBPIXEL_ORDER_VRGB: ++ case CAIRO_SUBPIXEL_ORDER_VBGR: ++ render_mode = FT_RENDER_MODE_LCD_V; ++ break; ++ } ++ ++ switch (font_options->lcd_filter) { ++ case CAIRO_LCD_FILTER_NONE: ++ lcd_filter = FT_LCD_FILTER_NONE; ++ break; ++ case CAIRO_LCD_FILTER_DEFAULT: ++ case CAIRO_LCD_FILTER_INTRA_PIXEL: ++ lcd_filter = FT_LCD_FILTER_LEGACY; ++ break; ++ case CAIRO_LCD_FILTER_FIR3: ++ lcd_filter = FT_LCD_FILTER_LIGHT; ++ break; ++ case CAIRO_LCD_FILTER_FIR5: ++ lcd_filter = FT_LCD_FILTER_DEFAULT; ++ break; ++ } ++ ++ break; ++ ++ case CAIRO_ANTIALIAS_DEFAULT: ++ case CAIRO_ANTIALIAS_GRAY: ++ render_mode = FT_RENDER_MODE_NORMAL; ++ } + + FT_Outline_Get_CBox (outline, &cbox); + + cbox.xMin &= -64; + cbox.yMin &= -64; + cbox.xMax = (cbox.xMax + 63) & -64; + cbox.yMax = (cbox.yMax + 63) & -64; + + width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6); + height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6); +- stride = (width * hmul + 3) & ~3; + + if (width * height == 0) { + cairo_format_t format; + /* Looks like fb handles zero-sized images just fine */ +- switch (font_options->antialias) { +- case CAIRO_ANTIALIAS_NONE: ++ switch (render_mode) { ++ case FT_RENDER_MODE_MONO: + format = CAIRO_FORMAT_A1; + break; +- case CAIRO_ANTIALIAS_SUBPIXEL: ++ case FT_RENDER_MODE_LCD: ++ case FT_RENDER_MODE_LCD_V: + format= CAIRO_FORMAT_ARGB32; + break; +- case CAIRO_ANTIALIAS_DEFAULT: +- case CAIRO_ANTIALIAS_GRAY: ++ case FT_RENDER_MODE_LIGHT: ++ case FT_RENDER_MODE_NORMAL: ++ case FT_RENDER_MODE_MAX: + default: + format = CAIRO_FORMAT_A8; + break; + } + + (*surface) = (cairo_image_surface_t *) + cairo_image_surface_create_for_data (NULL, format, 0, 0, 0); + if ((*surface)->base.status) + return (*surface)->base.status; + } else { + +- matrix.xx = matrix.yy = 0x10000L; +- matrix.xy = matrix.yx = 0; +- +- switch (font_options->antialias) { +- case CAIRO_ANTIALIAS_NONE: +- bitmap.pixel_mode = FT_PIXEL_MODE_MONO; +- bitmap.num_grays = 1; +- stride = ((width + 31) & -32) >> 3; ++ int bitmap_size; ++ ++ switch (render_mode) { ++ case FT_RENDER_MODE_LCD: ++ if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_BGR) { ++ rgba = FC_RGBA_BGR; ++ } else { ++ rgba = FC_RGBA_RGB; ++ } + break; +- case CAIRO_ANTIALIAS_DEFAULT: +- case CAIRO_ANTIALIAS_GRAY: +- bitmap.pixel_mode = FT_PIXEL_MODE_GRAY; +- bitmap.num_grays = 256; +- stride = (width + 3) & -4; ++ case FT_RENDER_MODE_LCD_V: ++ if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_VBGR) { ++ rgba = FC_RGBA_VBGR; ++ } else { ++ rgba = FC_RGBA_VRGB; ++ } + break; +- case CAIRO_ANTIALIAS_SUBPIXEL: +- switch (font_options->subpixel_order) { +- case CAIRO_SUBPIXEL_ORDER_RGB: +- case CAIRO_SUBPIXEL_ORDER_BGR: +- case CAIRO_SUBPIXEL_ORDER_DEFAULT: +- default: +- matrix.xx *= 3; +- hmul = 3; +- subpixel = TRUE; +- break; +- case CAIRO_SUBPIXEL_ORDER_VRGB: +- case CAIRO_SUBPIXEL_ORDER_VBGR: +- matrix.yy *= 3; +- vmul = 3; +- subpixel = TRUE; +- break; +- } +- FT_Outline_Transform (outline, &matrix); +- +- bitmap.pixel_mode = FT_PIXEL_MODE_GRAY; +- bitmap.num_grays = 256; +- stride = (width * hmul + 3) & -4; ++ case FT_RENDER_MODE_MONO: ++ case FT_RENDER_MODE_LIGHT: ++ case FT_RENDER_MODE_NORMAL: ++ case FT_RENDER_MODE_MAX: ++ default: ++ break; + } + +- bitmap.pitch = stride; +- bitmap.width = width * hmul; +- bitmap.rows = height * vmul; +- bitmap.buffer = calloc (stride, bitmap.rows); ++ FT_Library_SetLcdFilter (library, lcd_filter); ++ ++ fterror = FT_Render_Glyph (face->glyph, render_mode); ++ ++ FT_Library_SetLcdFilter (library, FT_LCD_FILTER_NONE); ++ ++ if (fterror != 0) ++ return _cairo_error (CAIRO_STATUS_NO_MEMORY); ++ ++ bitmap_size = _compute_xrender_bitmap_size (&bitmap, ++ face->glyph, ++ render_mode); ++ if (bitmap_size < 0) ++ return _cairo_error (CAIRO_STATUS_NO_MEMORY); ++ ++ bitmap.buffer = calloc (1, bitmap_size); + if (unlikely (bitmap.buffer == NULL)) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + +- FT_Outline_Translate (outline, -cbox.xMin*hmul, -cbox.yMin*vmul); +- +- if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) { +- free (bitmap.buffer); +- return _cairo_error (CAIRO_STATUS_NO_MEMORY); +- } +- ++ _fill_xrender_bitmap (&bitmap, face->glyph, render_mode, ++ (rgba == FC_RGBA_BGR || rgba == FC_RGBA_VBGR)); ++ ++ /* Note: ++ * _get_bitmap_surface will free bitmap.buffer if there is an error ++ */ + status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface); + if (unlikely (status)) + return status; ++ ++ /* Note: the font's coordinate system is upside down from ours, so the ++ * Y coordinate of the control box needs to be negated. Moreover, device ++ * offsets are position of glyph origin relative to top left while xMin ++ * and yMax are offsets of top left relative to origin. Another negation. ++ */ ++ cairo_surface_set_device_offset (&(*surface)->base, ++ (double)-glyphslot->bitmap_left, ++ (double)+glyphslot->bitmap_top); + } + +- /* +- * Note: the font's coordinate system is upside down from ours, so the +- * Y coordinate of the control box needs to be negated. Moreover, device +- * offsets are position of glyph origin relative to top left while xMin +- * and yMax are offsets of top left relative to origin. Another negation. +- */ +- cairo_surface_set_device_offset (&(*surface)->base, +- floor (-(double) cbox.xMin / 64.0), +- floor (+(double) cbox.yMax / 64.0)); +- + return CAIRO_STATUS_SUCCESS; + } + + /* Converts a bitmap (or other) FT_GlyphSlot into an image */ + static cairo_status_t + _render_glyph_bitmap (FT_Face face, + cairo_font_options_t *font_options, + cairo_image_surface_t **surface) +@@ -1350,16 +1589,17 @@ _get_pattern_ft_options (FcPattern *patt + + /* disable antialiasing if requested */ + if (FcPatternGetBool (pattern, + FC_ANTIALIAS, 0, &antialias) != FcResultMatch) + antialias = FcTrue; + + if (antialias) { + cairo_subpixel_order_t subpixel_order; ++ int lcd_filter; + + /* disable hinting if requested */ + if (FcPatternGetBool (pattern, + FC_HINTING, 0, &hinting) != FcResultMatch) + hinting = FcTrue; + + if (FcPatternGetInteger (pattern, + FC_RGBA, 0, &rgba) != FcResultMatch) +@@ -1385,16 +1625,35 @@ _get_pattern_ft_options (FcPattern *patt + break; + } + + if (subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT) { + ft_options.base.subpixel_order = subpixel_order; + ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL; + } + ++ if (FcPatternGetInteger (pattern, ++ FC_LCD_FILTER, 0, &lcd_filter) == FcResultMatch) ++ { ++ switch (lcd_filter) { ++ case FC_LCD_NONE: ++ ft_options.base.lcd_filter = CAIRO_LCD_FILTER_NONE; ++ break; ++ case FC_LCD_DEFAULT: ++ ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR5; ++ break; ++ case FC_LCD_LIGHT: ++ ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR3; ++ break; ++ case FC_LCD_LEGACY: ++ ft_options.base.lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL; ++ break; ++ } ++ } ++ + #ifdef FC_HINT_STYLE + if (FcPatternGetInteger (pattern, + FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch) + hintstyle = FC_HINT_FULL; + + if (!hinting) + hintstyle = FC_HINT_NONE; + +@@ -1486,16 +1745,22 @@ _cairo_ft_options_merge (cairo_ft_option + } + + if (options->base.hint_style == CAIRO_HINT_STYLE_DEFAULT) + options->base.hint_style = other->base.hint_style; + + if (other->base.hint_style == CAIRO_HINT_STYLE_NONE) + options->base.hint_style = CAIRO_HINT_STYLE_NONE; + ++ if (options->base.lcd_filter == CAIRO_LCD_FILTER_DEFAULT) ++ options->base.lcd_filter = other->base.lcd_filter; ++ ++ if (other->base.lcd_filter == CAIRO_LCD_FILTER_NONE) ++ options->base.lcd_filter = CAIRO_LCD_FILTER_NONE; ++ + if (options->base.antialias == CAIRO_ANTIALIAS_NONE) { + if (options->base.hint_style == CAIRO_HINT_STYLE_NONE) + load_flags |= FT_LOAD_NO_HINTING; + else + load_target = FT_LOAD_TARGET_MONO; + load_flags |= FT_LOAD_MONOCHROME; + } else { + switch (options->base.hint_style) { +@@ -1509,21 +1774,21 @@ _cairo_ft_options_merge (cairo_ft_option + break; + case CAIRO_HINT_STYLE_FULL: + case CAIRO_HINT_STYLE_DEFAULT: + if (options->base.antialias == CAIRO_ANTIALIAS_SUBPIXEL) { + switch (options->base.subpixel_order) { + case CAIRO_SUBPIXEL_ORDER_DEFAULT: + case CAIRO_SUBPIXEL_ORDER_RGB: + case CAIRO_SUBPIXEL_ORDER_BGR: +- load_target |= FT_LOAD_TARGET_LCD; ++ load_target = FT_LOAD_TARGET_LCD; + break; + case CAIRO_SUBPIXEL_ORDER_VRGB: + case CAIRO_SUBPIXEL_ORDER_VBGR: +- load_target |= FT_LOAD_TARGET_LCD_V; ++ load_target = FT_LOAD_TARGET_LCD_V; + break; + } + } + break; + } + } + + options->load_flags = load_flags | load_target; +@@ -2512,16 +2777,44 @@ _cairo_ft_font_options_substitute (const + rgba = FC_RGBA_NONE; + } + + if (! FcPatternAddInteger (pattern, FC_RGBA, rgba)) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); + } + } + ++ if (options->lcd_filter != CAIRO_LCD_FILTER_DEFAULT) ++ { ++ if (FcPatternGet (pattern, FC_LCD_FILTER, 0, &v) == FcResultNoMatch) ++ { ++ int lcd_filter; ++ ++ switch (options->lcd_filter) { ++ case CAIRO_LCD_FILTER_NONE: ++ lcd_filter = FT_LCD_FILTER_NONE; ++ break; ++ case CAIRO_LCD_FILTER_DEFAULT: ++ case CAIRO_LCD_FILTER_INTRA_PIXEL: ++ lcd_filter = FT_LCD_FILTER_LEGACY; ++ break; ++ case CAIRO_LCD_FILTER_FIR3: ++ lcd_filter = FT_LCD_FILTER_LIGHT; ++ break; ++ default: ++ case CAIRO_LCD_FILTER_FIR5: ++ lcd_filter = FT_LCD_FILTER_DEFAULT; ++ break; ++ } ++ ++ if (! FcPatternAddInteger (pattern, FC_LCD_FILTER, lcd_filter)) ++ return _cairo_error (CAIRO_STATUS_NO_MEMORY); ++ } ++ } ++ + if (options->hint_style != CAIRO_HINT_STYLE_DEFAULT) + { + if (FcPatternGet (pattern, FC_HINTING, 0, &v) == FcResultNoMatch) + { + if (! FcPatternAddBool (pattern, + FC_HINTING, + options->hint_style != CAIRO_HINT_STYLE_NONE)) + return _cairo_error (CAIRO_STATUS_NO_MEMORY); +diff --git a/gfx/cairo/cairo/src/cairo-surface.c b/gfx/cairo/cairo/src/cairo-surface.c +--- a/gfx/cairo/cairo/src/cairo-surface.c ++++ b/gfx/cairo/cairo/src/cairo-surface.c +@@ -68,16 +68,17 @@ const cairo_surface_t name = { \ + NULL, /* snapshot_detach */ \ + { 0, /* size */ \ + 0, /* num_elements */ \ + 0, /* element_size */ \ + NULL, /* elements */ \ + }, /* snapshots */ \ + { CAIRO_ANTIALIAS_DEFAULT, /* antialias */ \ + CAIRO_SUBPIXEL_ORDER_DEFAULT, /* subpixel_order */ \ ++ CAIRO_LCD_FILTER_DEFAULT, /* lcd_filter */ \ + CAIRO_HINT_STYLE_DEFAULT, /* hint_style */ \ + CAIRO_HINT_METRICS_DEFAULT /* hint_metrics */ \ + } /* font_options */ \ + } + + /* XXX error object! */ + + static DEFINE_NIL_SURFACE(CAIRO_STATUS_NO_MEMORY, _cairo_surface_nil); +diff --git a/gfx/cairo/cairo/src/cairo-types-private.h b/gfx/cairo/cairo/src/cairo-types-private.h +--- a/gfx/cairo/cairo/src/cairo-types-private.h ++++ b/gfx/cairo/cairo/src/cairo-types-private.h +@@ -112,19 +112,45 @@ struct _cairo_array { + unsigned int size; + unsigned int num_elements; + unsigned int element_size; + char **elements; + + cairo_bool_t is_snapshot; + }; + ++ ++/** ++ * cairo_lcd_filter_t: ++ * @CAIRO_LCD_FILTER_DEFAULT: Use the default LCD filter for ++ * font backend and target device ++ * @CAIRO_LCD_FILTER_NONE: Do not perform LCD filtering ++ * @CAIRO_LCD_FILTER_INTRA_PIXEL: Intra-pixel filter ++ * @CAIRO_LCD_FILTER_FIR3: FIR filter with a 3x3 kernel ++ * @CAIRO_LCD_FILTER_FIR5: FIR filter with a 5x5 kernel ++ * ++ * The LCD filter specifies the low-pass filter applied to LCD-optimized ++ * bitmaps generated with an antialiasing mode of %CAIRO_ANTIALIAS_SUBPIXEL. ++ * ++ * Note: This API was temporarily made available in the public ++ * interface during the 1.7.x development series, but was made private ++ * before 1.8. ++ **/ ++typedef enum _cairo_lcd_filter { ++ CAIRO_LCD_FILTER_DEFAULT, ++ CAIRO_LCD_FILTER_NONE, ++ CAIRO_LCD_FILTER_INTRA_PIXEL, ++ CAIRO_LCD_FILTER_FIR3, ++ CAIRO_LCD_FILTER_FIR5 ++} cairo_lcd_filter_t; ++ + struct _cairo_font_options { + cairo_antialias_t antialias; + cairo_subpixel_order_t subpixel_order; ++ cairo_lcd_filter_t lcd_filter; + cairo_hint_style_t hint_style; + cairo_hint_metrics_t hint_metrics; + }; + + /* XXX: Right now, the _cairo_color structure puts unpremultiplied + color in the doubles and premultiplied color in the shorts. Yes, + this is crazy insane, (but at least we don't export this + madness). I'm still working on a cleaner API, but in the meantime, +diff --git a/gfx/cairo/cairo/src/cairo-xlib-screen.c b/gfx/cairo/cairo/src/cairo-xlib-screen.c +--- a/gfx/cairo/cairo/src/cairo-xlib-screen.c ++++ b/gfx/cairo/cairo/src/cairo-xlib-screen.c +@@ -56,16 +56,23 @@ + + #include "cairo-xlib-private.h" + #include "cairo-xlib-xrender-private.h" + + #include "cairo-xlib-surface-private.h" + + #include + ++#ifndef FC_LCD_NONE ++#define FC_LCD_NONE 0 ++#define FC_LCD_DEFAULT 1 ++#define FC_LCD_LIGHT 2 ++#define FC_LCD_LEGACY 3 ++#endif ++ + static int + parse_boolean (const char *v) + { + char c0, c1; + + c0 = *v; + if (c0 == 't' || c0 == 'T' || c0 == 'y' || c0 == 'Y' || c0 == '1') + return 1; +@@ -145,23 +152,32 @@ get_integer_default (Display *dpy, + static void + _cairo_xlib_init_screen_font_options (Display *dpy, + cairo_xlib_screen_t *info) + { + cairo_bool_t xft_hinting; + cairo_bool_t xft_antialias; + int xft_hintstyle; + int xft_rgba; ++ int xft_lcdfilter; + cairo_antialias_t antialias; + cairo_subpixel_order_t subpixel_order; ++ cairo_lcd_filter_t lcd_filter; + cairo_hint_style_t hint_style; + + if (!get_boolean_default (dpy, "antialias", &xft_antialias)) + xft_antialias = TRUE; + ++ if (!get_integer_default (dpy, "lcdfilter", &xft_lcdfilter)) { ++ /* -1 is an non-existant Fontconfig constant used to differentiate ++ * the case when no lcdfilter property is available. ++ */ ++ xft_lcdfilter = -1; ++ } ++ + if (!get_boolean_default (dpy, "hinting", &xft_hinting)) + xft_hinting = TRUE; + + if (!get_integer_default (dpy, "hintstyle", &xft_hintstyle)) + xft_hintstyle = FC_HINT_FULL; + + if (!get_integer_default (dpy, "rgba", &xft_rgba)) + { +@@ -234,28 +250,47 @@ _cairo_xlib_init_screen_font_options (Di + subpixel_order = CAIRO_SUBPIXEL_ORDER_VBGR; + break; + case FC_RGBA_UNKNOWN: + case FC_RGBA_NONE: + default: + subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; + } + ++ switch (xft_lcdfilter) { ++ case FC_LCD_NONE: ++ lcd_filter = CAIRO_LCD_FILTER_NONE; ++ break; ++ case FC_LCD_DEFAULT: ++ lcd_filter = CAIRO_LCD_FILTER_FIR5; ++ break; ++ case FC_LCD_LIGHT: ++ lcd_filter = CAIRO_LCD_FILTER_FIR3; ++ break; ++ case FC_LCD_LEGACY: ++ lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL; ++ break; ++ default: ++ lcd_filter = CAIRO_LCD_FILTER_DEFAULT; ++ break; ++ } ++ + if (xft_antialias) { + if (subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT) + antialias = CAIRO_ANTIALIAS_GRAY; + else + antialias = CAIRO_ANTIALIAS_SUBPIXEL; + } else { + antialias = CAIRO_ANTIALIAS_NONE; + } + + cairo_font_options_set_hint_style (&info->font_options, hint_style); + cairo_font_options_set_antialias (&info->font_options, antialias); + cairo_font_options_set_subpixel_order (&info->font_options, subpixel_order); ++ _cairo_font_options_set_lcd_filter (&info->font_options, lcd_filter); + cairo_font_options_set_hint_metrics (&info->font_options, CAIRO_HINT_METRICS_ON); + } + + cairo_xlib_screen_t * + _cairo_xlib_screen_reference (cairo_xlib_screen_t *info) + { + assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&info->ref_count)); + +diff --git a/gfx/cairo/cairo/src/cairoint.h b/gfx/cairo/cairo/src/cairoint.h +--- a/gfx/cairo/cairo/src/cairoint.h ++++ b/gfx/cairo/cairo/src/cairoint.h +@@ -1400,16 +1400,23 @@ extern const cairo_private uint16_t _cai + + cairo_private void + _cairo_font_options_init_default (cairo_font_options_t *options); + + cairo_private void + _cairo_font_options_init_copy (cairo_font_options_t *options, + const cairo_font_options_t *other); + ++cairo_private void ++_cairo_font_options_set_lcd_filter (cairo_font_options_t *options, ++ cairo_lcd_filter_t lcd_filter); ++ ++cairo_private cairo_lcd_filter_t ++_cairo_font_options_get_lcd_filter (const cairo_font_options_t *options); ++ + /* cairo-hull.c */ + cairo_private cairo_status_t + _cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices); + + /* cairo-lzw.c */ + cairo_private unsigned char * + _cairo_lzw_compress (unsigned char *data, unsigned long *size_in_out); + +diff --git a/js/src/config/system-headers b/js/src/config/system-headers +--- a/js/src/config/system-headers ++++ b/js/src/config/system-headers +@@ -267,16 +267,17 @@ Font.h + Fonts.h + fp.h + fpieee.h + frame/log.h + frame/req.h + freetype/freetype.h + freetype/ftcache.h + freetype/ftglyph.h ++freetype/ftlcdfil.h + freetype/ftsynth.h + freetype/ftoutln.h + freetype/ttnameid.h + freetype/tttables.h + freetype/t1tables.h + fribidi/fribidi.h + FSp_fopen.h + fstream diff --git a/mozilla-cairo-return.patch b/mozilla-cairo-return.patch new file mode 100644 index 0000000..cb2c6d1 --- /dev/null +++ b/mozilla-cairo-return.patch @@ -0,0 +1,21 @@ +# HG changeset patch +# User Wolfgang Rosenauer +# Parent e36e1a20cb5e1ba0e4bc3facac58029544d92e0a +Bug 631155 - undefined return value in function '_cairo_surface_wrapper_flush' + +diff --git a/gfx/cairo/cairo/src/cairo-surface-wrapper.c b/gfx/cairo/cairo/src/cairo-surface-wrapper.c +--- a/gfx/cairo/cairo/src/cairo-surface-wrapper.c ++++ b/gfx/cairo/cairo/src/cairo-surface-wrapper.c +@@ -526,9 +526,12 @@ _cairo_surface_wrapper_fini (cairo_surfa + } + + cairo_status_t + _cairo_surface_wrapper_flush (cairo_surface_wrapper_t *wrapper) + { + if (wrapper->target->backend->flush) { + return wrapper->target->backend->flush(wrapper->target); + } ++ ++ // this is preliminary to cool down gcc and build checks ++ return CAIRO_STATUS_SUCCESS; + } diff --git a/mozilla-gio.patch b/mozilla-gio.patch new file mode 100644 index 0000000..650b86f --- /dev/null +++ b/mozilla-gio.patch @@ -0,0 +1,284 @@ +# HG changeset patch +# User Chris Coulson +# Parent 0ebe30f9eacfe67fa0b699457e524d5a9c96359e +Bug 611953 - GNOME 3.0 readiness (patch 2 + 3) + +diff --git a/toolkit/system/gnome/nsGIOService.cpp b/toolkit/system/gnome/nsGIOService.cpp +--- a/toolkit/system/gnome/nsGIOService.cpp ++++ b/toolkit/system/gnome/nsGIOService.cpp +@@ -101,25 +101,25 @@ nsGIOMimeApp::GetName(nsACString& aName) + return NS_OK; + } + + NS_IMETHODIMP + nsGIOMimeApp::GetCommand(nsACString& aCommand) + { + get_commandline_t g_app_info_get_commandline_ptr; + +- void *libHandle = dlopen("libgio-2.0.so", RTLD_LAZY); ++ void *libHandle = dlopen("libgio-2.0.so.0", RTLD_LAZY); + if (!libHandle) { + return NS_ERROR_FAILURE; + } + dlerror(); /* clear any existing error */ + g_app_info_get_commandline_ptr = + (get_commandline_t) dlsym(libHandle, "g_app_info_get_commandline"); +- if (dlerror() != NULL) { +- const char cmd = *g_app_info_get_commandline_ptr(mApp); ++ if (dlerror() == NULL) { ++ const char *cmd = g_app_info_get_commandline_ptr(mApp); + if (!cmd) { + dlclose(libHandle); + return NS_ERROR_FAILURE; + } + aCommand.Assign(cmd); + } + dlclose(libHandle); + return NS_OK; +@@ -277,16 +277,43 @@ nsGIOMimeApp::SetAsDefaultForFileExtensi + } else { + *ext_pos = '\0'; + } + } + g_free(extensions); + return NS_OK; + } + ++/** ++ * Set default application for URI's of a particular scheme ++ * @param aURIScheme string containing the URI scheme ++ * @return NS_OK when application was set as default for URI scheme, ++ * NS_ERROR_FAILURE otherwise ++ */ ++NS_IMETHODIMP ++nsGIOMimeApp::SetAsDefaultForURIScheme(nsACString const& aURIScheme) ++{ ++ GError *error = NULL; ++ nsCAutoString contentType("x-scheme-handler/"); ++ contentType.Append(aURIScheme); ++ ++ g_app_info_set_as_default_for_type(mApp, ++ contentType.get(), ++ &error); ++ if (error) { ++ g_warning("Cannot set application as default for URI scheme (%s): %s", ++ PromiseFlatCString(aURIScheme).get(), ++ error->message); ++ g_error_free(error); ++ return NS_ERROR_FAILURE; ++ } ++ ++ return NS_OK; ++} ++ + nsresult + nsGIOService::Init() + { + // do nothing, gvfs/gio does not init. + return NS_OK; + } + + NS_IMPL_ISUPPORTS1(nsGIOService, nsIGIOService) +@@ -317,29 +344,45 @@ nsGIOService::GetMimeTypeFromExtension(c + g_free(mime_type); + g_free(content_type); + + return NS_OK; + } + // used in nsGNOMERegistry + // ----------------------------------------------------------------------------- + NS_IMETHODIMP ++nsGIOService::GetAppForURIScheme(const nsACString& aURIScheme, ++ nsIGIOMimeApp** aApp) ++{ ++ *aApp = nsnull; ++ ++ GAppInfo *app_info = g_app_info_get_default_for_uri_scheme( ++ PromiseFlatCString(aURIScheme).get()); ++ if (app_info) { ++ nsGIOMimeApp *mozApp = new nsGIOMimeApp(app_info); ++ NS_ADDREF(*aApp = mozApp); ++ } else { ++ return NS_ERROR_FAILURE; ++ } ++ return NS_OK; ++} ++ ++NS_IMETHODIMP + nsGIOService::GetAppForMimeType(const nsACString& aMimeType, + nsIGIOMimeApp** aApp) + { + *aApp = nsnull; + char *content_type = + get_content_type_from_mime_type(PromiseFlatCString(aMimeType).get()); + if (!content_type) + return NS_ERROR_FAILURE; + + GAppInfo *app_info = g_app_info_get_default_for_type(content_type, false); + if (app_info) { + nsGIOMimeApp *mozApp = new nsGIOMimeApp(app_info); +- NS_ENSURE_TRUE(mozApp, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(*aApp = mozApp); + } else { + g_free(content_type); + return NS_ERROR_FAILURE; + } + g_free(content_type); + return NS_OK; + } +@@ -414,75 +457,46 @@ nsGIOService::CreateAppFromCommand(nsACS + nsIGIOMimeApp** appInfo) + { + GError *error = NULL; + *appInfo = nsnull; + + GAppInfo *app_info = NULL, *app_info_from_list = NULL; + GList *apps = g_app_info_get_all(); + GList *apps_p = apps; +- get_commandline_t g_app_info_get_commandline_ptr; +- +- void *libHandle = dlopen("libgio-2.0.so", RTLD_LAZY); +- if (!libHandle) { +- return NS_ERROR_FAILURE; +- } +- dlerror(); /* clear any existing error */ +- g_app_info_get_commandline_ptr = +- (get_commandline_t) dlsym(libHandle, "g_app_info_get_commandline"); +- if (dlerror() != NULL) { +- g_app_info_get_commandline_ptr = NULL; +- } + + // Try to find relevant and existing GAppInfo in all installed application ++ // We do this by comparing each GAppInfo's executable with out own + while (apps_p) { + app_info_from_list = (GAppInfo*) apps_p->data; +- /* This is a silly test. It just compares app names but not +- * commands. This is due to old version of Glib/Gio. The required +- * function which allows to do a regular check of existence of desktop file +- * is possible by using function g_app_info_get_commandline. This function +- * has been introduced in Glib 2.20. */ +- if (app_info_from_list && strcmp(g_app_info_get_name(app_info_from_list), +- PromiseFlatCString(appName).get()) == 0 ) +- { +- if (g_app_info_get_commandline_ptr) +- { +- /* Following test is only possible with Glib >= 2.20. +- * Compare path only by using strncmp */ +- if (strncmp(g_app_info_get_commandline_ptr(app_info_from_list), +- PromiseFlatCString(cmd).get(), +- strlen(PromiseFlatCString(cmd).get())) == 0) +- { +- app_info = app_info_from_list; +- break; +- } else { +- g_object_unref(app_info_from_list); +- } +- } else { ++ if (!app_info) { ++ // If the executable is not absolute, get it's full path ++ char *executable = g_find_program_in_path(g_app_info_get_executable(app_info_from_list)); ++ ++ if (executable && strcmp(executable, PromiseFlatCString(cmd).get()) == 0) { ++ g_object_ref (app_info_from_list); + app_info = app_info_from_list; +- break; + } +- } else { +- g_object_unref(app_info_from_list); ++ g_free(executable); + } ++ ++ g_object_unref(app_info_from_list); + apps_p = apps_p->next; + } + g_list_free(apps); + + if (!app_info) { + app_info = g_app_info_create_from_commandline(PromiseFlatCString(cmd).get(), + PromiseFlatCString(appName).get(), + G_APP_INFO_CREATE_SUPPORTS_URIS, + &error); + } + + if (!app_info) { + g_warning("Cannot create application info from command: %s", error->message); + g_error_free(error); +- dlclose(libHandle); + return NS_ERROR_FAILURE; + } + nsGIOMimeApp *mozApp = new nsGIOMimeApp(app_info); + NS_ENSURE_TRUE(mozApp, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(*appInfo = mozApp); +- dlclose(libHandle); + return NS_OK; + } +diff --git a/xpcom/system/nsIGIOService.idl b/xpcom/system/nsIGIOService.idl +--- a/xpcom/system/nsIGIOService.idl ++++ b/xpcom/system/nsIGIOService.idl +@@ -39,17 +39,17 @@ + + #include "nsISupports.idl" + + interface nsIUTF8StringEnumerator; + interface nsIURI; + + /* nsIGIOMimeApp holds information about an application that is looked up + with nsIGIOService::GetAppForMimeType. */ +-// 66009894-9877-405b-9321-bf30420e34e6 prev uuid ++// e77021b4-4012-407d-b686-7a1f18050109 prev uuid + + [scriptable, uuid(e77021b4-4012-407d-b686-7a1f18050109)] + interface nsIGIOMimeApp : nsISupports + { + const long EXPECTS_URIS = 0; + const long EXPECTS_PATHS = 1; + const long EXPECTS_URIS_FOR_NON_FILES = 2; + +@@ -57,41 +57,45 @@ interface nsIGIOMimeApp : nsISupports + readonly attribute AUTF8String name; + readonly attribute AUTF8String command; + readonly attribute long expectsURIs; // see constants above + readonly attribute nsIUTF8StringEnumerator supportedURISchemes; + + void launch(in AUTF8String uri); + void setAsDefaultForMimeType(in AUTF8String mimeType); + void setAsDefaultForFileExtensions(in AUTF8String extensions); ++ void setAsDefaultForURIScheme(in AUTF8String uriScheme); + }; + + /* + * The VFS service makes use of two distinct registries. + * + * The application registry holds information about applications (uniquely + * identified by id), such as which MIME types and URI schemes they are + * capable of handling, whether they run in a terminal, etc. + * + * The MIME registry holds information about MIME types, such as which + * extensions map to a given MIME type. The MIME registry also stores the + * id of the application selected to handle each MIME type. + */ + +-// prev id dea20bf0-4e4d-48c5-b932-dc3e116dc64b +-[scriptable, uuid(47e372c2-78bb-4899-8114-56aa7d9cdac5)] ++// prev id 47e372c2-78bb-4899-8114-56aa7d9cdac5 ++[scriptable, uuid(74ca8791-330d-4786-9569-2a2a19f0b486)] + interface nsIGIOService : nsISupports + { + + /*** MIME registry methods ***/ + + /* Obtain the MIME type registered for an extension. The extension + should not include a leading dot. */ + AUTF8String getMimeTypeFromExtension(in AUTF8String extension); + ++ /* Obtain the preferred application for opening a given URI scheme */ ++ nsIGIOMimeApp getAppForURIScheme(in AUTF8String aURIScheme); ++ + /* Obtain the preferred application for opening a given MIME type */ + nsIGIOMimeApp getAppForMimeType(in AUTF8String mimeType); + + /* Obtain the preferred application for opening a given MIME type */ + nsIGIOMimeApp createAppFromCommand(in AUTF8String cmd, + in AUTF8String appName); + + /* Obtain a description for the given MIME type */ diff --git a/mozilla-kde.patch b/mozilla-kde.patch new file mode 100644 index 0000000..a3fe697 --- /dev/null +++ b/mozilla-kde.patch @@ -0,0 +1,3776 @@ +diff --git a/modules/libpref/src/Makefile.in b/modules/libpref/src/Makefile.in +--- a/modules/libpref/src/Makefile.in ++++ b/modules/libpref/src/Makefile.in +@@ -90,14 +90,16 @@ GREPREF_FILES = $(topsrcdir)/netwerk/bas + # Optimizer bug with GCC 3.2.2 on OS/2 + ifeq ($(OS_ARCH), OS2) + nsPrefService.$(OBJ_SUFFIX): nsPrefService.cpp + $(REPORT_BUILD) + @$(MAKE_DEPS_AUTO_CXX) + $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS:-O2=-O1) $(_VPATH_SRCS) + endif + ++LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre ++ + + greprefs.js: $(GREPREF_FILES) + $(PYTHON) $(topsrcdir)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $^ > $@ + + libs:: greprefs.js + $(INSTALL) $^ $(DIST)/bin/ +diff --git a/modules/libpref/src/nsPrefService.cpp b/modules/libpref/src/nsPrefService.cpp +--- a/modules/libpref/src/nsPrefService.cpp ++++ b/modules/libpref/src/nsPrefService.cpp +@@ -53,16 +53,17 @@ + #include "nsIStringEnumerator.h" + #include "nsIZipReader.h" + #include "nsPrefBranch.h" + #include "nsXPIDLString.h" + #include "nsCRT.h" + #include "nsCOMArray.h" + #include "nsXPCOMCID.h" + #include "nsAutoPtr.h" ++#include "nsKDEUtils.h" + + #include "nsQuickSort.h" + #include "prmem.h" + #include "pldhash.h" + + #include "prefapi.h" + #include "prefread.h" + #include "prefapi_private_data.h" +@@ -758,30 +759,48 @@ pref_LoadPrefsInDir(nsIFile* aDir, char + } + + static nsresult pref_LoadPrefsInDirList(const char *listId) + { + nsresult rv; + nsCOMPtr dirSvc(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv)); + if (NS_FAILED(rv)) return rv; + ++ // make sure we load these special files after all the others ++ static const char* specialFiles[] = { ++#if defined(XP_UNIX) ++ "" ++#endif ++ }; ++ ++ if (nsKDEUtils::kdeSession()) { ++ for(int i = 0; ++ i < NS_ARRAY_LENGTH(specialFiles); ++ ++i ) { ++ if (*specialFiles[ i ] == '\0') { ++ specialFiles[ i ] = "kde.js"; ++ break; ++ } ++ } ++ } ++ + nsCOMPtr dirList; + dirSvc->Get(listId, + NS_GET_IID(nsISimpleEnumerator), + getter_AddRefs(dirList)); + if (dirList) { + PRBool hasMore; + while (NS_SUCCEEDED(dirList->HasMoreElements(&hasMore)) && hasMore) { + nsCOMPtr elem; + dirList->GetNext(getter_AddRefs(elem)); + if (elem) { + nsCOMPtr dir = do_QueryInterface(elem); + if (dir) { + // Do we care if a file provided by this process fails to load? +- pref_LoadPrefsInDir(dir, nsnull, 0); ++ pref_LoadPrefsInDir(dir, specialFiles, NS_ARRAY_LENGTH(specialFiles)); + } + } + } + } + return NS_OK; + } + + //---------------------------------------------------------------------------------------- +@@ -876,24 +895,36 @@ static nsresult pref_InitInitialObjects( + /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */ + static const char* specialFiles[] = { + #if defined(XP_MAC) || defined(XP_MACOSX) + "macprefs.js" + #elif defined(XP_WIN) + "winpref.js" + #elif defined(XP_UNIX) + "unix.js" ++ , "" // placeholder for KDE (empty is otherwise harmless) + #if defined(_AIX) + , "aix.js" + #endif + #elif defined(XP_OS2) + "os2pref.js" + #endif + }; + ++ if(nsKDEUtils::kdeSession()) { // TODO what if some setup actually requires the helper? ++ for( int i = 0; ++ i < NS_ARRAY_LENGTH(specialFiles); ++ ++i ) { ++ if( *specialFiles[ i ] == '\0' ) { ++ specialFiles[ i ] = "kde.js"; ++ break; ++ } ++ } ++ } ++ + rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles)); + if (NS_FAILED(rv)) { + NS_WARNING("Error parsing application default preferences."); + } + + rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST); + NS_ENSURE_SUCCESS(rv, rv); + +diff --git a/toolkit/components/downloads/Makefile.in b/toolkit/components/downloads/Makefile.in +--- a/toolkit/components/downloads/Makefile.in ++++ b/toolkit/components/downloads/Makefile.in +@@ -79,8 +79,10 @@ endif + + ifdef ENABLE_TESTS + DIRS += test + endif + + include $(topsrcdir)/config/rules.mk + + EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) ++ ++LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre +diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp +--- a/toolkit/components/downloads/nsDownloadManager.cpp ++++ b/toolkit/components/downloads/nsDownloadManager.cpp +@@ -71,16 +71,20 @@ + + #if defined(XP_WIN) && !defined(WINCE) + #include + #ifdef DOWNLOAD_SCANNER + #include "nsDownloadScanner.h" + #endif + #endif + ++#if defined(XP_UNIX) && !defined(XP_MACOSX) ++#include "nsKDEUtils.h" ++#endif ++ + #ifdef XP_MACOSX + #include + #endif + + #ifdef ANDROID + #include "AndroidBridge.h" + #endif + +@@ -2203,16 +2207,25 @@ nsDownload::SetState(DownloadState aStat + nsCOMPtr pref(do_GetService(NS_PREFSERVICE_CONTRACTID)); + + // Master pref to control this function. + PRBool showTaskbarAlert = PR_TRUE; + if (pref) + pref->GetBoolPref(PREF_BDM_SHOWALERTONCOMPLETE, &showTaskbarAlert); + + if (showTaskbarAlert) { ++ if( nsKDEUtils::kdeSupport()) { ++ nsCStringArray command; ++ command.AppendCString( NS_LITERAL_CSTRING( "DOWNLOADFINISHED" )); ++ nsAutoString displayName; ++ GetDisplayName( displayName ); ++ command.AppendCString( nsCAutoString( ToNewUTF8String( displayName ))); ++ nsKDEUtils::command( command ); ++ } else { ++ // begin non-KDE block + PRInt32 alertInterval = 2000; + if (pref) + pref->GetIntPref(PREF_BDM_SHOWALERTINTERVAL, &alertInterval); + + PRInt64 alertIntervalUSec = alertInterval * PR_USEC_PER_MSEC; + PRInt64 goat = PR_Now() - mStartTime; + showTaskbarAlert = goat > alertIntervalUSec; + +@@ -2236,18 +2249,19 @@ nsDownload::SetState(DownloadState aStat + // If downloads are automatically removed per the user's + // retention policy, there's no reason to make the text clickable + // because if it is, they'll click open the download manager and + // the items they downloaded will have been removed. + alerts->ShowAlertNotification( + NS_LITERAL_STRING(DOWNLOAD_MANAGER_ALERT_ICON), title, + message, !removeWhenDone, EmptyString(), mDownloadManager, + EmptyString()); +- } ++ } + } ++ } // end non-KDE block + } + + #if (defined(XP_WIN) && !defined(WINCE)) || defined(XP_MACOSX) || defined(ANDROID) + nsCOMPtr fileURL = do_QueryInterface(mTarget); + nsCOMPtr file; + nsAutoString path; + + if (fileURL && +diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn +--- a/toolkit/content/jar.mn ++++ b/toolkit/content/jar.mn +@@ -40,29 +40,33 @@ toolkit.jar: + *+ content/global/viewZoomOverlay.js (viewZoomOverlay.js) + *+ content/global/bindings/autocomplete.xml (widgets/autocomplete.xml) + *+ content/global/bindings/browser.xml (widgets/browser.xml) + *+ content/global/bindings/button.xml (widgets/button.xml) + *+ content/global/bindings/checkbox.xml (widgets/checkbox.xml) + *+ content/global/bindings/colorpicker.xml (widgets/colorpicker.xml) + *+ content/global/bindings/datetimepicker.xml (widgets/datetimepicker.xml) + *+ content/global/bindings/dialog.xml (widgets/dialog.xml) ++*+ content/global/bindings/dialog-kde.xml (widgets/dialog-kde.xml) ++% override chrome://global/content/bindings/dialog.xml chrome://global/content/bindings/dialog-kde.xml desktop=kde + *+ content/global/bindings/editor.xml (widgets/editor.xml) + * content/global/bindings/expander.xml (widgets/expander.xml) + * content/global/bindings/filefield.xml (widgets/filefield.xml) + *+ content/global/bindings/findbar.xml (widgets/findbar.xml) + *+ content/global/bindings/general.xml (widgets/general.xml) + *+ content/global/bindings/groupbox.xml (widgets/groupbox.xml) + *+ content/global/bindings/listbox.xml (widgets/listbox.xml) + *+ content/global/bindings/menu.xml (widgets/menu.xml) + *+ content/global/bindings/menulist.xml (widgets/menulist.xml) + *+ content/global/bindings/notification.xml (widgets/notification.xml) + *+ content/global/bindings/numberbox.xml (widgets/numberbox.xml) + *+ content/global/bindings/popup.xml (widgets/popup.xml) + *+ content/global/bindings/preferences.xml (widgets/preferences.xml) ++*+ content/global/bindings/preferences-kde.xml (widgets/preferences-kde.xml) ++% override chrome://global/content/bindings/preferences.xml chrome://global/content/bindings/preferences-kde.xml desktop=kde + *+ content/global/bindings/progressmeter.xml (widgets/progressmeter.xml) + *+ content/global/bindings/radio.xml (widgets/radio.xml) + *+ content/global/bindings/resizer.xml (widgets/resizer.xml) + *+ content/global/bindings/richlistbox.xml (widgets/richlistbox.xml) + *+ content/global/bindings/scale.xml (widgets/scale.xml) + *+ content/global/bindings/scrollbar.xml (widgets/scrollbar.xml) + *+ content/global/bindings/scrollbox.xml (widgets/scrollbox.xml) + *+ content/global/bindings/splitter.xml (widgets/splitter.xml) +diff --git a/toolkit/content/widgets/dialog-kde.xml b/toolkit/content/widgets/dialog-kde.xml +new file mode 100644 +--- /dev/null ++++ b/toolkit/content/widgets/dialog-kde.xml +@@ -0,0 +1,447 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ null ++ (function(event) { ++ if (!document.documentElement.cancelDialog()) ++ event.preventDefault(); ++ }) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ (screen.availLeft + screen.availWidth)) ++ newX = (screen.availLeft + screen.availWidth) - window.outerWidth - 20; ++ ++ if (newY < screen.availTop) ++ newY = screen.availTop + 20; ++ if ((newY + window.outerHeight) > (screen.availTop + screen.availHeight)) ++ newY = (screen.availTop + screen.availHeight) - window.outerHeight - 60; ++ ++ window.moveTo( newX, newY ); ++ ]]> ++ ++ ++ ++ ++ ++ 0 ? xOffset : 0; ++ yOffset = yOffset > 0 ? yOffset : 0; ++ window.moveTo(xOffset, yOffset); ++ ]]> ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ // see bug 63370 for details ++ this._mStrBundle = Components.classes["@mozilla.org/intl/stringbundle;1"] ++ .getService(Components.interfaces.nsIStringBundleService) ++ .createBundle("chrome://global/locale/dialog.properties"); ++ } ++ return this._mStrBundle; ++ ]]> ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ if (!event.getPreventDefault()) ++ this.cancelDialog(); ++ ++#ifdef XP_MACOSX ++ ++#else ++ ++ var btn = this.getButton(this.defaultButton); ++ if (btn) ++ btn.setAttribute("default", event.originalTarget == btn || !(event.originalTarget instanceof Components.interfaces.nsIDOMXULButtonElement)); ++ ++#endif ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/toolkit/content/widgets/preferences-kde.xml b/toolkit/content/widgets/preferences-kde.xml +new file mode 100644 +--- /dev/null ++++ b/toolkit/content/widgets/preferences-kde.xml +@@ -0,0 +1,1371 @@ ++ ++ ++ ++ %preferencesDTD; ++ ++ %globalKeysDTD; ++]> ++ ++ ++ ++# ++# = Preferences Window Framework ++# ++# The syntax for use looks something like: ++# ++# ++# ++# ++# ++# ++# ++# ++# ++# ++# ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Components.classes["@mozilla.org/preferences-service;1"] ++ .getService(Components.interfaces.nsIPrefService); ++ ++ ++ Components.classes["@mozilla.org/preferences-service;1"] ++ .getService(Components.interfaces.nsIPrefBranch); ++ ++ ++ this.service.getDefaultBranch(""); ++ ++ ++ Components.classes["@mozilla.org/preferences-service;1"] ++ .getService(Components.interfaces.nsIPrefBranchInternal); ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ this.preferences.rootBranchInternal ++ .removeObserver(this.name, this.preferences); ++ ++ ++ ++ ++ return this.getAttribute("instantApply") == "true" || this.preferences.instantApply; ++ ++ ++ ++ ++ ++ ++ if (val == this.name) ++ return val; ++ ++ this.preferences.rootBranchInternal ++ .removeObserver(this.name, this.preferences); ++ this.setAttribute('name', val); ++ this.preferences.rootBranchInternal ++ .addObserver(val, this.preferences, false); ++ ++ return val; ++ ++ ++ ++ ++ ++ ++ null ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ return this.preferences.rootBranch.prefIsLocked(this.name); ++ ++ ++ ++ ++ ++ return this.getAttribute("disabled") == "true"; ++ ++ ++ ++ ++ ++ ++ ++ ++ return parseInt(this.getAttribute("tabindex")); ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ // defer reset until preference update ++ this.value = undefined; ++ ++ ++ ++ false ++ ++ ++ ++ ++ ++ ++ ++ ++ return this._useDefault ? this.preferences.defaultBranch : this.preferences.rootBranch; ++ ++ ++ ++ false ++ ++ ++ ++ with id='" + this.id + "' and name='" + ++ this.name + "' has unknown type '" + this.type + "'."; ++ consoleService.logStringMessage(msg); ++ ]]> ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ this.updateElements(); ++ ++ ++ ++ ++ ++ ++ ++ ++ ++#else ++ title="&preferencesDefaultTitleMac.title;"> ++#endif ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ false ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ this.setAttribute("lastSelected", val); ++ document.persist(this.id, "lastSelected"); ++ return val; ++ ++ ++ ++ ++ if (!this._currentPane) ++ this._currentPane = this.preferencePanes[0]; ++ ++ return this._currentPane; ++ ++ ++ null ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ false ++ ++ ++ ++ 1) ++ aPaneElement.removeAttribute("flex"); ++ // Calling sizeToContent after the first prefpane is loaded ++ // will size the windows contents so style information is ++ // available to calculate correct sizing. ++ if (!this._initialized && prefpanes.length > 1) { ++ if (this._shouldAnimate) ++ this.style.minHeight = 0; ++ window.sizeToContent(); ++ } ++ ++ var oldPane = this.lastSelected ? document.getElementById(this.lastSelected) : this.preferencePanes[0]; ++ oldPane.selected = !(aPaneElement.selected = true); ++ this.lastSelected = aPaneElement.id; ++ this.currentPane = aPaneElement; ++ this._initialized = true; ++ ++ // Only animate if we've switched between prefpanes ++ if (this._shouldAnimate && oldPane.id != aPaneElement.id) { ++ aPaneElement.style.opacity = 0.0; ++ this.animate(oldPane, aPaneElement); ++ } ++ else if (!this._shouldAnimate && prefpanes.length > 1) { ++ var targetHeight = parseInt(window.getComputedStyle(this._paneDeckContainer, "").height); ++ var verticalPadding = parseInt(window.getComputedStyle(aPaneElement, "").paddingTop); ++ verticalPadding += parseInt(window.getComputedStyle(aPaneElement, "").paddingBottom); ++ if (aPaneElement.contentHeight > targetHeight - verticalPadding) { ++ // To workaround the bottom border of a groupbox from being ++ // cutoff an hbox with a class of bottomBox may enclose it. ++ // This needs to include its padding to resize properly. ++ // See bug 394433 ++ var bottomPadding = 0; ++ var bottomBox = aPaneElement.getElementsByAttribute("class", "bottomBox")[0]; ++ if (bottomBox) ++ bottomPadding = parseInt(window.getComputedStyle(bottomBox, "").paddingBottom); ++ window.innerHeight += bottomPadding + verticalPadding + aPaneElement.contentHeight - targetHeight; ++ } ++ ++ // XXX rstrong - extend the contents of the prefpane to ++ // prevent elements from being cutoff (see bug 349098). ++ if (aPaneElement.contentHeight + verticalPadding < targetHeight) ++ aPaneElement._content.style.height = targetHeight - verticalPadding + "px"; ++ } ++ } ++ break; ++ } ++ } ++ ]]> ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ oldHeight ? 1 : -1; ++ var sizeDelta = Math.abs(oldHeight - aNewPane.contentHeight); ++ this._animateRemainder = sizeDelta % this._animateIncrement; ++ ++ this._setUpAnimationTimer(oldHeight); ++ ]]> ++ ++ ++ ++ ++ ++ 0 && this._currentHeight >= lastSelectedPane.contentHeight) || ++ (this._multiplier < 0 && this._currentHeight <= lastSelectedPane.contentHeight)) ++ return 0; ++ ++ if ((this._multiplier > 0 && newHeight > lastSelectedPane.contentHeight) || ++ (this._multiplier < 0 && newHeight < lastSelectedPane.contentHeight)) ++ increment = this._animateRemainder * this._multiplier; ++ return increment; ++ ]]> ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ null ++ null ++ 15 ++ 40 ++ 5 ++ 0.40 ++ 0 ++ 0 ++ 0 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ return openDialog(aURL, "", "modal,centerscreen,resizable=no" + (aFeatures != "" ? ("," + aFeatures) : ""), aParams); ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ if (event.originalTarget.hasAttribute("pane")) { ++ var pane = document.getElementById(event.originalTarget.getAttribute("pane")); ++ this.showPane(pane); ++ } ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ false ++ ++ ++ ++ ++ ++ return document.getElementById(aElement.getAttribute("preference")); ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ var targetHeight = parseInt(window.getComputedStyle(this._content, "").height); ++ targetHeight += parseInt(window.getComputedStyle(this._content, "").marginTop); ++ targetHeight += parseInt(window.getComputedStyle(this._content, "").marginBottom); ++ return targetHeight; ++ ++ ++ ++ document.getAnonymousElementByAttribute(this, "class", "content-box"); ++ ++ ++ ++ ++ // This "command" event handler tracks changes made to preferences by ++ // the user in this window. ++ this.userChangedValue(event.target); ++ ++ ++ // This "select" event handler tracks changes made to colorpicker ++ // preferences by the user in this window. ++ if (event.target.localName == "colorpicker") ++ this.userChangedValue(event.target); ++ ++ ++ // This "change" event handler tracks changes made to preferences by ++ // the user in this window. ++ this.userChangedValue(event.target); ++ ++ ++ // This "input" event handler tracks changes made to preferences by ++ // the user in this window. ++ this.userChangedValue(event.target); ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- ++# ***** BEGIN LICENSE BLOCK ***** ++# Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++# ++# The contents of this file are subject to the Mozilla Public License Version ++# 1.1 (the "License"); you may not use this file except in compliance with ++# the License. You may obtain a copy of the License at ++# http://www.mozilla.org/MPL/ ++# ++# Software distributed under the License is distributed on an "AS IS" basis, ++# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++# for the specific language governing rights and limitations under the ++# License. ++# ++# The Original Code is the Preferences System. ++# ++# The Initial Developer of the Original Code is ++# Ben Goodger. ++# Portions created by the Initial Developer are Copyright (C) 2005 ++# the Initial Developer. All Rights Reserved. ++# ++# Contributor(s): ++# Ben Goodger ++# Josh Aas ++# ++# Alternatively, the contents of this file may be used under the terms of ++# either the GNU General Public License Version 2 or later (the "GPL"), or ++# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++# in which case the provisions of the GPL or the LGPL are applicable instead ++# of those above. If you wish to allow use of your version of this file only ++# under the terms of either the GPL or the LGPL, and not to allow others to ++# use your version of this file under the terms of the MPL, indicate your ++# decision by deleting the provisions above and replace them with the notice ++# and other provisions required by the GPL or the LGPL. If you do not delete ++# the provisions above, a recipient may use your version of this file under ++# the terms of any one of the MPL, the GPL or the LGPL. ++# ++# ***** END LICENSE BLOCK ***** ++ ++# ++# This is PrefWindow 6. The Code Could Well Be Ready, Are You? ++# ++# Historical References: ++# PrefWindow V (February 1, 2003) ++# PrefWindow IV (April 24, 2000) ++# PrefWindow III (January 6, 2000) ++# PrefWindow II (???) ++# PrefWindow I (June 4, 1999) ++# +diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp +--- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp ++++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp +@@ -44,32 +44,35 @@ + #include "nsIURI.h" + #include "nsReadableUtils.h" + #include "nsArrayUtils.h" + #include "prnetdb.h" + #include "prenv.h" + #include "nsPrintfCString.h" + #include "nsNetUtil.h" + #include "nsISupportsPrimitives.h" ++#include "nsVoidArray.h" ++#include "nsKDEUtils.h" + + class nsUnixSystemProxySettings : public nsISystemProxySettings { + public: + NS_DECL_ISUPPORTS + NS_DECL_NSISYSTEMPROXYSETTINGS + + nsUnixSystemProxySettings() {} + nsresult Init(); + + private: + ~nsUnixSystemProxySettings() {} + + nsCOMPtr mGConf; + PRBool IsProxyMode(const char* aMode); + nsresult SetProxyResultFromGConf(const char* aKeyBase, const char* aType, nsACString& aResult); + nsresult GetProxyFromGConf(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); ++ nsresult GetProxyFromKDE(const nsACString& aScheme, const nsACString& aHost, PRInt32 aPort, nsACString& aResult); + }; + + NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) + + nsresult + nsUnixSystemProxySettings::Init() + { + // If this is a GNOME session, load gconf and try to use its preferences. +@@ -407,16 +410,19 @@ nsUnixSystemProxySettings::GetProxyForUR + nsCAutoString host; + rv = aURI->GetHost(host); + NS_ENSURE_SUCCESS(rv, rv); + + PRInt32 port; + rv = aURI->GetPort(&port); + NS_ENSURE_SUCCESS(rv, rv); + ++ if( nsKDEUtils::kdeSupport()) ++ return GetProxyFromKDE( scheme, host, port, aResult ); ++ + if (!mGConf) + return GetProxyFromEnvironment(scheme, host, port, aResult); + + return GetProxyFromGConf(scheme, host, port, aResult); + } + + #define NS_UNIXSYSTEMPROXYSERVICE_CID /* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */\ + { 0x0fa3158c, 0xd5a7, 0x43de, \ +diff --git a/toolkit/xre/Makefile.in b/toolkit/xre/Makefile.in +--- a/toolkit/xre/Makefile.in ++++ b/toolkit/xre/Makefile.in +@@ -94,17 +94,18 @@ EXPORTS = nsWindowsDllInterceptor.h + else + ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) + CMMSRCS = nsNativeAppSupportCocoa.mm + else + ifeq ($(MOZ_WIDGET_TOOLKIT),os2) + CPPSRCS += nsNativeAppSupportOS2.cpp + else + ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) +-CPPSRCS += nsNativeAppSupportUnix.cpp ++CPPSRCS += nsNativeAppSupportUnix.cpp nsKDEUtils.cpp ++EXPORTS += nsKDEUtils.h + else + ifeq ($(MOZ_WIDGET_TOOLKIT),qt) + CPPSRCS += nsNativeAppSupportQt.cpp + CPPSRCS += nsQAppInstance.cpp + EXPORTS += nsQAppInstance.h + else + CPPSRCS += nsNativeAppSupportDefault.cpp + endif +diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp +new file mode 100644 +--- /dev/null ++++ b/toolkit/xre/nsKDEUtils.cpp +@@ -0,0 +1,328 @@ ++/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is Unix Native App Support. ++ * ++ * The Initial Developer of the Original Code is ++ * Mozilla Corporation. ++ * Portions created by the Initial Developer are Copyright (C) 2007 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "nsKDEUtils.h" ++#include "nsIWidget.h" ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++//#define DEBUG_KDE ++#ifdef DEBUG_KDE ++#define KMOZILLAHELPER "kmozillahelper" ++#else ++// not need for lib64, it's a binary ++#define KMOZILLAHELPER "/usr/lib/mozilla/kmozillahelper" ++#endif ++ ++#define KMOZILLAHELPER_VERSION 6 ++#define MAKE_STR2( n ) #n ++#define MAKE_STR( n ) MAKE_STR2( n ) ++ ++static bool getKdeSession() ++ { ++ Display* dpy = XOpenDisplay( NULL ); ++ if( dpy == NULL ) ++ return false; ++ Atom kde_full_session = XInternAtom( dpy, "KDE_FULL_SESSION", True ); ++ bool kde = false; ++ if( kde_full_session != None ) ++ { ++ int cnt; ++ if( Atom* props = XListProperties( dpy, DefaultRootWindow( dpy ), &cnt )) ++ { ++ for( int i = 0; ++ i < cnt; ++ ++i ) ++ { ++ if( props[ i ] == kde_full_session ) ++ { ++ kde = true; ++#ifdef DEBUG_KDE ++ fprintf( stderr, "KDE SESSION %d\n", kde ); ++#endif ++ break; ++ } ++ } ++ XFree( props ); ++ } ++ } ++ XCloseDisplay( dpy ); ++ return kde; ++ } ++ ++static bool getKdeSupport() ++ { ++ nsCStringArray command; ++ command.AppendCString( NS_LITERAL_CSTRING( "CHECK" )); ++ command.AppendCString( NS_LITERAL_CSTRING( MAKE_STR( KMOZILLAHELPER_VERSION ))); ++ bool kde = nsKDEUtils::command( command ); ++#ifdef DEBUG_KDE ++ fprintf( stderr, "KDE RUNNING %d\n", kde ); ++#endif ++ return kde; ++ } ++ ++nsKDEUtils::nsKDEUtils() ++ : commandFile( NULL ) ++ , replyFile( NULL ) ++ { ++ } ++ ++nsKDEUtils::~nsKDEUtils() ++ { ++// closeHelper(); not actually useful, exiting will close the fd too ++ } ++ ++nsKDEUtils* nsKDEUtils::self() ++ { ++ static nsKDEUtils s; ++ return &s; ++ } ++ ++static bool helperRunning = false; ++static bool helperFailed = false; ++ ++bool nsKDEUtils::kdeSession() ++ { ++ static bool session = getKdeSession(); ++ return session; ++ } ++ ++bool nsKDEUtils::kdeSupport() ++ { ++ static bool support = kdeSession() && getKdeSupport(); ++ return support && helperRunning; ++ } ++ ++struct nsKDECommandData ++ { ++ FILE* file; ++ nsCStringArray* output; ++ GMainLoop* loop; ++ bool success; ++ }; ++ ++static gboolean kdeReadFunc( GIOChannel*, GIOCondition, gpointer data ) ++ { ++ nsKDECommandData* p = static_cast< nsKDECommandData* >( data ); ++ char buf[ 8192 ]; // TODO big enough ++ bool command_done = false; ++ bool command_failed = false; ++ while( !command_done && !command_failed && fgets( buf, 8192, p->file ) != NULL ) ++ { // TODO what if the kernel splits a line into two chunks? ++//#ifdef DEBUG_KDE ++// fprintf( stderr, "READ: %s %d\n", buf, feof( p->file )); ++//#endif ++ if( char* eol = strchr( buf, '\n' )) ++ *eol = '\0'; ++ command_done = ( strcmp( buf, "\\1" ) == 0 ); ++ command_failed = ( strcmp( buf, "\\0" ) == 0 ); ++ nsCAutoString line( buf ); ++ line.ReplaceSubstring( "\\n", "\n" ); ++ line.ReplaceSubstring( "\\" "\\", "\\" ); // \\ -> \ , i.e. unescape ++ if( p->output && !( command_done || command_failed )) ++ p->output->AppendCString( nsCString( buf )); // TODO utf8? ++ } ++ bool quit = false; ++ if( feof( p->file ) || command_failed ) ++ { ++ quit = true; ++ p->success = false; ++ } ++ if( command_done ) ++ { // reading one reply finished ++ quit = true; ++ p->success = true; ++ } ++ if( quit ) ++ { ++ if( p->loop ) ++ g_main_loop_quit( p->loop ); ++ return FALSE; ++ } ++ return TRUE; ++ } ++ ++bool nsKDEUtils::command( const nsCStringArray& command, nsCStringArray* output ) ++ { ++ return self()->internalCommand( command, NULL, false, output ); ++ } ++ ++bool nsKDEUtils::commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output ) ++ { ++ return self()->internalCommand( command, parent, true, output ); ++ } ++ ++bool nsKDEUtils::internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool blockUi, ++ nsCStringArray* output ) ++ { ++ if( !startHelper()) ++ return false; ++ feedCommand( command ); ++ // do not store the data in 'this' but in extra structure, just in case there ++ // is reentrancy (can there be? the event loop is re-entered) ++ nsKDECommandData data; ++ data.file = replyFile; ++ data.output = output; ++ data.success = false; ++ if( blockUi ) ++ { ++ data.loop = g_main_loop_new( NULL, FALSE ); ++ GtkWidget* window = gtk_window_new( GTK_WINDOW_TOPLEVEL ); ++ if( parent && parent->group ) ++ gtk_window_group_add_window( parent->group, GTK_WINDOW( window )); ++ gtk_widget_realize( window ); ++ gtk_widget_set_sensitive( window, TRUE ); ++ gtk_grab_add( window ); ++ GIOChannel* channel = g_io_channel_unix_new( fileno( data.file )); ++ g_io_add_watch( channel, static_cast< GIOCondition >( G_IO_IN | G_IO_ERR | G_IO_HUP ), kdeReadFunc, &data ); ++ g_io_channel_unref( channel ); ++ g_main_loop_run( data.loop ); ++ g_main_loop_unref( data.loop ); ++ gtk_grab_remove( window ); ++ gtk_widget_destroy( window ); ++ } ++ else ++ { ++ data.loop = NULL; ++ while( kdeReadFunc( NULL, static_cast< GIOCondition >( 0 ), &data )) ++ ; ++ } ++ return data.success; ++ } ++ ++bool nsKDEUtils::startHelper() ++ { ++ if( helperRunning ) ++ return true; ++ if( helperFailed ) ++ return false; ++ helperFailed = true; ++ int fdcommand[ 2 ]; ++ int fdreply[ 2 ]; ++ if( pipe( fdcommand ) < 0 ) ++ return false; ++ if( pipe( fdreply ) < 0 ) ++ { ++ close( fdcommand[ 0 ] ); ++ close( fdcommand[ 1 ] ); ++ return false; ++ } ++ char* args[ 2 ] = { const_cast< char* >( KMOZILLAHELPER ), NULL }; ++ switch( fork()) ++ { ++ case -1: ++ { ++ close( fdcommand[ 0 ] ); ++ close( fdcommand[ 1 ] ); ++ close( fdreply[ 0 ] ); ++ close( fdreply[ 1 ] ); ++ return false; ++ } ++ case 0: // child ++ { ++ if( dup2( fdcommand[ 0 ], STDIN_FILENO ) < 0 ) ++ _exit( 1 ); ++ if( dup2( fdreply[ 1 ], STDOUT_FILENO ) < 0 ) ++ _exit( 1 ); ++ int maxfd = 1024; // close all other fds ++ struct rlimit rl; ++ if( getrlimit( RLIMIT_NOFILE, &rl ) == 0 ) ++ maxfd = rl.rlim_max; ++ for( int i = 3; ++ i < maxfd; ++ ++i ) ++ close( i ); ++#ifdef DEBUG_KDE ++ execvp( KMOZILLAHELPER, args ); ++#else ++ execv( KMOZILLAHELPER, args ); ++#endif ++ _exit( 1 ); // failed ++ } ++ default: // parent ++ { ++ commandFile = fdopen( fdcommand[ 1 ], "w" ); ++ replyFile = fdopen( fdreply[ 0 ], "r" ); ++ close( fdcommand[ 0 ] ); ++ close( fdreply[ 1 ] ); ++ if( commandFile == NULL || replyFile == NULL ) ++ { ++ closeHelper(); ++ return false; ++ } ++ // ok, helper ready, getKdeRunning() will check if it works ++ } ++ } ++ helperFailed = false; ++ helperRunning = true; ++ return true; ++ } ++ ++void nsKDEUtils::closeHelper() ++ { ++ if( commandFile != NULL ) ++ fclose( commandFile ); // this will also make the helper quit ++ if( replyFile != NULL ) ++ fclose( replyFile ); ++ helperRunning = false; ++ } ++ ++void nsKDEUtils::feedCommand( const nsCStringArray& command ) ++ { ++ for( int i = 0; ++ i < command.Count(); ++ ++i ) ++ { ++ nsCString line = *command[ i ]; ++ line.ReplaceSubstring( "\\", "\\" "\\" ); // \ -> \\ , i.e. escape ++ line.ReplaceSubstring( "\n", "\\n" ); ++#ifdef DEBUG_KDE ++ fprintf( stderr, "COMM: %s\n", line.get()); ++#endif ++ fputs( line.get(), commandFile ); ++ fputs( "\n", commandFile ); ++ } ++ fputs( "\\E\n", commandFile ); // done as \E, so it cannot happen in normal data ++ fflush( commandFile ); ++ } +diff --git a/toolkit/xre/nsKDEUtils.h b/toolkit/xre/nsKDEUtils.h +new file mode 100644 +--- /dev/null ++++ b/toolkit/xre/nsKDEUtils.h +@@ -0,0 +1,77 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- ++ * ++ * ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is Mozilla Communicator client code. ++ * ++ * The Initial Developer of the Original Code is ++ * Netscape Communications Corporation. ++ * Portions created by the Initial Developer are Copyright (C) 1998 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either of the GNU General Public License Version 2 or later (the "GPL"), ++ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#ifndef nsKDEUtils_h__ ++#define nsKDEUtils_h__ ++ ++#include "nsStringGlue.h" ++#include "nsVoidArray.h" ++#include ++ ++typedef struct _GtkWindow GtkWindow; ++ ++class NS_EXPORT nsKDEUtils ++ { ++ public: ++ /* Returns true if running inside a KDE session (regardless of whether there is KDE ++ support available for Firefox). This should be used e.g. when determining ++ dialog button order but not for code that requires the KDE support. */ ++ static bool kdeSession(); ++ /* Returns true if running inside a KDE session and KDE support is available ++ for Firefox. This should be used everywhere where the external helper is needed. */ ++ static bool kdeSupport(); ++ /* Executes the given helper command, returns true if helper returned success. */ ++ static bool command( const nsCStringArray& command, nsCStringArray* output = NULL ); ++ /* Like command(), but additionally blocks the parent widget like if there was ++ a modal dialog shown and enters the event loop (i.e. there are still paint updates, ++ this is for commands that take long). */ ++ static bool commandBlockUi( const nsCStringArray& command, const GtkWindow* parent, nsCStringArray* output = NULL ); ++ private: ++ nsKDEUtils(); ++ ~nsKDEUtils(); ++ static nsKDEUtils* self(); ++ bool startHelper(); ++ void closeHelper(); ++ void feedCommand( const nsCStringArray& command ); ++ bool internalCommand( const nsCStringArray& command, const GtkWindow* parent, bool isParent, ++ nsCStringArray* output ); ++ FILE* commandFile; ++ FILE* replyFile; ++ }; ++ ++#endif // nsKDEUtils +diff --git a/uriloader/exthandler/Makefile.in b/uriloader/exthandler/Makefile.in +--- a/uriloader/exthandler/Makefile.in ++++ b/uriloader/exthandler/Makefile.in +@@ -88,18 +88,19 @@ LOCAL_INCLUDES = -I$(srcdir) + LOCAL_INCLUDES += -I$(topsrcdir)/dom/base \ + -I$(topsrcdir)/dom/ipc \ + -I$(topsrcdir)/content/base/src \ + -I$(topsrcdir)/content/events/src \ + -I$(topsrcdir)/netwerk/base/src \ + -I$(topsrcdir)/netwerk/protocol/http + + ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) +-OSHELPER += nsGNOMERegistry.cpp ++OSHELPER += nsCommonRegistry.cpp nsGNOMERegistry.cpp nsKDERegistry.cpp + OSHELPER += nsMIMEInfoUnix.cpp ++LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre + endif + + ifeq ($(MOZ_WIDGET_TOOLKIT),android) + OSHELPER += nsMIMEInfoAndroid.cpp + OSHELPER += nsAndroidHandlerApp.cpp + OSHELPER += nsExternalSharingAppService.cpp + EXPORTS += nsExternalSharingAppService.h + OSHELPER += nsExternalURLHandlerService.cpp +diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp +new file mode 100644 +--- /dev/null ++++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp +@@ -0,0 +1,87 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is the GNOME helper app implementation. ++ * ++ * The Initial Developer of the Original Code is ++ * IBM Corporation. ++ * Portions created by the Initial Developer are Copyright (C) 2003 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Brian Ryner (Original Author) ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "nsCommonRegistry.h" ++ ++#include "nsGNOMERegistry.h" ++#include "nsKDERegistry.h" ++#include "nsString.h" ++#include "nsVoidArray.h" ++#include "nsKDEUtils.h" ++ ++/* static */ PRBool ++nsCommonRegistry::HandlerExists(const char *aProtocolScheme) ++{ ++ if( nsKDEUtils::kdeSupport()) ++ return nsKDERegistry::HandlerExists( aProtocolScheme ); ++ return nsGNOMERegistry::HandlerExists( aProtocolScheme ); ++} ++ ++/* static */ nsresult ++nsCommonRegistry::LoadURL(nsIURI *aURL) ++{ ++ if( nsKDEUtils::kdeSupport()) ++ return nsKDERegistry::LoadURL( aURL ); ++ return nsGNOMERegistry::LoadURL( aURL ); ++} ++ ++/* static */ void ++nsCommonRegistry::GetAppDescForScheme(const nsACString& aScheme, ++ nsAString& aDesc) ++{ ++ if( nsKDEUtils::kdeSupport()) ++ return nsKDERegistry::GetAppDescForScheme( aScheme, aDesc ); ++ return nsGNOMERegistry::GetAppDescForScheme( aScheme, aDesc ); ++} ++ ++ ++/* static */ already_AddRefed ++nsCommonRegistry::GetFromExtension(const nsACString& aFileExt) ++{ ++ if( nsKDEUtils::kdeSupport()) ++ return nsKDERegistry::GetFromExtension( aFileExt ); ++ return nsGNOMERegistry::GetFromExtension( aFileExt ); ++} ++ ++/* static */ already_AddRefed ++nsCommonRegistry::GetFromType(const nsACString& aMIMEType) ++{ ++ if( nsKDEUtils::kdeSupport()) ++ return nsKDERegistry::GetFromType( aMIMEType ); ++ return nsGNOMERegistry::GetFromType( aMIMEType ); ++} +diff --git a/uriloader/exthandler/unix/nsCommonRegistry.h b/uriloader/exthandler/unix/nsCommonRegistry.h +new file mode 100644 +--- /dev/null ++++ b/uriloader/exthandler/unix/nsCommonRegistry.h +@@ -0,0 +1,56 @@ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is the GNOME helper app implementation. ++ * ++ * The Initial Developer of the Original Code is ++ * IBM Corporation. ++ * Portions created by the Initial Developer are Copyright (C) 2003 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Brian Ryner (Original Author) ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "nsIURI.h" ++#include "nsCOMPtr.h" ++ ++class nsMIMEInfoBase; ++ ++class nsCommonRegistry ++{ ++ public: ++ static PRBool HandlerExists(const char *aProtocolScheme); ++ ++ static nsresult LoadURL(nsIURI *aURL); ++ ++ static void GetAppDescForScheme(const nsACString& aScheme, ++ nsAString& aDesc); ++ ++ static already_AddRefed GetFromExtension(const nsACString& aFileExt); ++ ++ static already_AddRefed GetFromType(const nsACString& aMIMEType); ++}; +diff --git a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/unix/nsKDERegistry.cpp +new file mode 100644 +--- /dev/null ++++ b/uriloader/exthandler/unix/nsKDERegistry.cpp +@@ -0,0 +1,119 @@ ++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is the GNOME helper app implementation. ++ * ++ * The Initial Developer of the Original Code is ++ * IBM Corporation. ++ * Portions created by the Initial Developer are Copyright (C) 2003 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Brian Ryner (Original Author) ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "nsKDERegistry.h" ++#include "prlink.h" ++#include "prmem.h" ++#include "nsString.h" ++#include "nsILocalFile.h" ++#include "nsMIMEInfoUnix.h" ++#include "nsAutoPtr.h" ++#include "nsKDEUtils.h" ++ ++/* static */ PRBool ++nsKDERegistry::HandlerExists(const char *aProtocolScheme) ++{ ++ nsCStringArray command; ++ command.AppendCString( NS_LITERAL_CSTRING( "HANDLEREXISTS" )); ++ command.AppendCString( nsCAutoString( aProtocolScheme )); ++ return nsKDEUtils::command( command ); ++} ++ ++/* static */ nsresult ++nsKDERegistry::LoadURL(nsIURI *aURL) ++{ ++ nsCStringArray command; ++ command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); ++ nsCString url; ++ aURL->GetSpec( url ); ++ command.AppendCString( url ); ++ return nsKDEUtils::command( command ); ++} ++ ++/* static */ void ++nsKDERegistry::GetAppDescForScheme(const nsACString& aScheme, ++ nsAString& aDesc) ++{ ++ nsCStringArray command; ++ command.AppendCString( NS_LITERAL_CSTRING( "GETAPPDESCFORSCHEME" )); ++ command.AppendCString( aScheme ); ++ nsCStringArray output; ++ if( nsKDEUtils::command( command, &output ) && output.Count() == 1 ) ++ CopyUTF8toUTF16( *output[ 0 ], aDesc ); ++} ++ ++ ++/* static */ already_AddRefed ++nsKDERegistry::GetFromExtension(const nsACString& aFileExt) ++{ ++ NS_ASSERTION(aFileExt[0] != '.', "aFileExt shouldn't start with a dot"); ++ nsCStringArray command; ++ command.AppendCString( NS_LITERAL_CSTRING( "GETFROMEXTENSION" )); ++ command.AppendCString( aFileExt ); ++ return GetFromHelper( command ); ++} ++ ++/* static */ already_AddRefed ++nsKDERegistry::GetFromType(const nsACString& aMIMEType) ++{ ++ nsCStringArray command; ++ command.AppendCString( NS_LITERAL_CSTRING( "GETFROMTYPE" )); ++ command.AppendCString( aMIMEType ); ++ return GetFromHelper( command ); ++} ++ ++/* static */ already_AddRefed ++nsKDERegistry::GetFromHelper(const nsCStringArray& command) ++{ ++ nsCStringArray output; ++ if( nsKDEUtils::command( command, &output ) && output.Count() == 3 ) ++ { ++ nsCString mimetype = *output[ 0 ]; ++ nsRefPtr mimeInfo = new nsMIMEInfoUnix( mimetype ); ++ NS_ENSURE_TRUE(mimeInfo, nsnull); ++ nsCString description = *output[ 1 ]; ++ mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description)); ++ nsCString handlerAppName = *output[ 2 ]; ++ mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName)); ++ mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); ++ nsMIMEInfoBase* retval; ++ NS_ADDREF((retval = mimeInfo)); ++ return retval; ++ } ++ return nsnull; ++} +diff --git a/uriloader/exthandler/unix/nsKDERegistry.h b/uriloader/exthandler/unix/nsKDERegistry.h +new file mode 100644 +--- /dev/null ++++ b/uriloader/exthandler/unix/nsKDERegistry.h +@@ -0,0 +1,61 @@ ++/* ***** BEGIN LICENSE BLOCK ***** ++ * Version: MPL 1.1/GPL 2.0/LGPL 2.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License Version ++ * 1.1 (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * Software distributed under the License is distributed on an "AS IS" basis, ++ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License ++ * for the specific language governing rights and limitations under the ++ * License. ++ * ++ * The Original Code is the GNOME helper app implementation. ++ * ++ * The Initial Developer of the Original Code is ++ * IBM Corporation. ++ * Portions created by the Initial Developer are Copyright (C) 2003 ++ * the Initial Developer. All Rights Reserved. ++ * ++ * Contributor(s): ++ * Brian Ryner (Original Author) ++ * ++ * Alternatively, the contents of this file may be used under the terms of ++ * either the GNU General Public License Version 2 or later (the "GPL"), or ++ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), ++ * in which case the provisions of the GPL or the LGPL are applicable instead ++ * of those above. If you wish to allow use of your version of this file only ++ * under the terms of either the GPL or the LGPL, and not to allow others to ++ * use your version of this file under the terms of the MPL, indicate your ++ * decision by deleting the provisions above and replace them with the notice ++ * and other provisions required by the GPL or the LGPL. If you do not delete ++ * the provisions above, a recipient may use your version of this file under ++ * the terms of any one of the MPL, the GPL or the LGPL. ++ * ++ * ***** END LICENSE BLOCK ***** */ ++ ++#include "nsIURI.h" ++#include "nsCOMPtr.h" ++ ++class nsMIMEInfoBase; ++class nsCAutoString; ++class nsCStringArray; ++ ++class nsKDERegistry ++{ ++ public: ++ static PRBool HandlerExists(const char *aProtocolScheme); ++ ++ static nsresult LoadURL(nsIURI *aURL); ++ ++ static void GetAppDescForScheme(const nsACString& aScheme, ++ nsAString& aDesc); ++ ++ static already_AddRefed GetFromExtension(const nsACString& aFileExt); ++ ++ static already_AddRefed GetFromType(const nsACString& aMIMEType); ++ private: ++ static already_AddRefed GetFromHelper(const nsCStringArray& command); ++ ++}; +diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp +--- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp ++++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp +@@ -50,30 +50,33 @@ + #include + #if (MOZ_ENABLE_CONTENTACTION) + #include + #include "nsContentHandlerApp.h" + #endif + #endif + + #include "nsMIMEInfoUnix.h" +-#include "nsGNOMERegistry.h" ++#include "nsCommonRegistry.h" + #include "nsIGIOService.h" + #include "nsNetCID.h" + #include "nsIIOService.h" + #include "nsIGnomeVFSService.h" + #include "nsAutoPtr.h" + #ifdef MOZ_ENABLE_DBUS + #include "nsDBusHandlerApp.h" + #endif ++#if defined(XP_UNIX) && !defined(XP_MACOSX) ++#include "nsKDEUtils.h" ++#endif + + nsresult + nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI) + { +- nsresult rv = nsGNOMERegistry::LoadURL(aURI); ++ nsresult rv = nsCommonRegistry::LoadURL(aURI); + + #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS) + if (NS_FAILED(rv)){ + HildonURIAction *action = hildon_uri_get_default_action(mSchemeOrType.get(), nsnull); + if (action) { + nsCAutoString spec; + aURI->GetAsciiSpec(spec); + if (hildon_uri_open(spec.get(), action, nsnull)) +@@ -95,22 +98,22 @@ nsMIMEInfoUnix::LoadUriInternal(nsIURI * + + return rv; + } + + NS_IMETHODIMP + nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval) + { + *_retval = PR_FALSE; +- nsRefPtr mimeInfo = nsGNOMERegistry::GetFromType(mSchemeOrType); ++ nsRefPtr mimeInfo = nsCommonRegistry::GetFromType(mSchemeOrType); + if (!mimeInfo) { + nsCAutoString ext; + nsresult rv = GetPrimaryExtension(ext); + if (NS_SUCCEEDED(rv)) { +- mimeInfo = nsGNOMERegistry::GetFromExtension(ext); ++ mimeInfo = nsCommonRegistry::GetFromExtension(ext); + } + } + if (mimeInfo) + *_retval = PR_TRUE; + + if (*_retval) + return NS_OK; + +@@ -153,16 +156,33 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns + ContentAction::Action::defaultActionForFile(uri, QString(mSchemeOrType.get())); + if (action.isValid()) { + action.trigger(); + return NS_OK; + } + return NS_ERROR_FAILURE; + #endif + ++ if( nsKDEUtils::kdeSupport()) { ++ PRBool supports; ++ if( NS_SUCCEEDED( GetHasDefaultHandler( &supports )) && supports ) { ++ nsCStringArray command; ++ command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); ++ command.AppendCString( nativePath ); ++ command.AppendCString( NS_LITERAL_CSTRING( "MIMETYPE" )); ++ command.AppendCString( mSchemeOrType ); ++ if( nsKDEUtils::command( command )) ++ return NS_OK; ++ } ++ if (!mDefaultApplication) ++ return NS_ERROR_FILE_NOT_FOUND; ++ ++ return LaunchWithIProcess(mDefaultApplication, nativePath); ++ } ++ + nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); + nsCAutoString uriSpec; + if (giovfs) { + // nsGIOMimeApp->Launch wants a URI string instead of local file + nsresult rv; + nsCOMPtr ioservice = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr uri; +@@ -180,17 +200,17 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns + /* Fallback to GnomeVFS */ + nsCOMPtr app; + if (NS_SUCCEEDED(gnomevfs->GetAppForMimeType(mSchemeOrType, getter_AddRefs(app))) && app) + return app->Launch(nativePath); + } + + // If we haven't got an app we try to get a valid one by searching for the + // extension mapped type +- nsRefPtr mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath); ++ nsRefPtr mimeInfo = nsCommonRegistry::GetFromExtension(nativePath); + if (mimeInfo) { + nsCAutoString type; + mimeInfo->GetType(type); + if (giovfs) { + nsCOMPtr app; + if (NS_SUCCEEDED(giovfs->GetAppForMimeType(type, getter_AddRefs(app))) && app) + return app->Launch(uriSpec); + } else if (gnomevfs) { +diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp +--- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp ++++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp +@@ -44,17 +44,17 @@ + #if defined(MOZ_ENABLE_CONTENTACTION) + #include + #include + #endif + + #include "nsOSHelperAppService.h" + #include "nsMIMEInfoUnix.h" + #ifdef MOZ_WIDGET_GTK2 +-#include "nsGNOMERegistry.h" ++#include "nsCommonRegistry.h" + #endif + #include "nsISupports.h" + #include "nsString.h" + #include "nsReadableUtils.h" + #include "nsUnicharUtils.h" + #include "nsXPIDLString.h" + #include "nsIURL.h" + #include "nsIFileStreams.h" +@@ -1219,29 +1219,29 @@ nsresult nsOSHelperAppService::OSProtoco + ContentAction::Action::defaultActionForScheme(QString(aProtocolScheme) + ':'); + + if (action.isValid()) + *aHandlerExists = PR_TRUE; + #endif + + #ifdef MOZ_WIDGET_GTK2 + // Check the GConf registry for a protocol handler +- *aHandlerExists = nsGNOMERegistry::HandlerExists(aProtocolScheme); ++ *aHandlerExists = nsCommonRegistry::HandlerExists(aProtocolScheme); + #if (MOZ_PLATFORM_MAEMO == 5) && defined (MOZ_ENABLE_GNOMEVFS) + *aHandlerExists = nsMIMEInfoUnix::HandlerExists(aProtocolScheme); + #endif + #endif + + return NS_OK; + } + + NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString& aScheme, nsAString& _retval) + { + #ifdef MOZ_WIDGET_GTK2 +- nsGNOMERegistry::GetAppDescForScheme(aScheme, _retval); ++ nsCommonRegistry::GetAppDescForScheme(aScheme, _retval); + return _retval.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK; + #else + return NS_ERROR_NOT_AVAILABLE; + #endif + } + + nsresult nsOSHelperAppService::GetFileTokenForPath(const PRUnichar * platformAppPath, nsIFile ** aFile) + { +@@ -1327,17 +1327,17 @@ nsOSHelperAppService::GetFromExtension(c + minorType, + mime_types_description, + PR_TRUE); + + if (NS_FAILED(rv) || majorType.IsEmpty()) { + + #ifdef MOZ_WIDGET_GTK2 + LOG(("Looking in GNOME registry\n")); +- nsMIMEInfoBase *gnomeInfo = nsGNOMERegistry::GetFromExtension(aFileExt).get(); ++ nsMIMEInfoBase *gnomeInfo = nsCommonRegistry::GetFromExtension(aFileExt).get(); + if (gnomeInfo) { + LOG(("Got MIMEInfo from GNOME registry\n")); + return gnomeInfo; + } + #endif + + rv = LookUpTypeAndDescription(NS_ConvertUTF8toUTF16(aFileExt), + majorType, +@@ -1453,17 +1453,17 @@ nsOSHelperAppService::GetFromType(const + #ifdef MOZ_WIDGET_GTK2 + nsMIMEInfoBase *gnomeInfo = nsnull; + if (handler.IsEmpty()) { + // No useful data yet. Check the GNOME registry. Unfortunately, newer + // GNOME versions no longer have type-to-extension mappings, so we might + // get back a MIMEInfo without any extensions set. In that case we'll have + // to look in our mime.types files for the extensions. + LOG(("Looking in GNOME registry\n")); +- gnomeInfo = nsGNOMERegistry::GetFromType(aMIMEType).get(); ++ gnomeInfo = nsCommonRegistry::GetFromType(aMIMEType).get(); + if (gnomeInfo && gnomeInfo->HasExtensions()) { + LOG(("Got MIMEInfo from GNOME registry, and it has extensions set\n")); + return gnomeInfo; + } + } + #endif + + // Now look up our extensions +diff --git a/widget/src/gtk2/Makefile.in b/widget/src/gtk2/Makefile.in +--- a/widget/src/gtk2/Makefile.in ++++ b/widget/src/gtk2/Makefile.in +@@ -157,11 +157,14 @@ endif + + DEFINES += -DCAIRO_GFX + + INCLUDES += \ + -I$(srcdir)/../xpwidgets \ + -I$(srcdir)/../shared \ + -I$(topsrcdir)/other-licenses/atk-1.0 \ + $(NULL) ++ ++LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre ++ + ifdef MOZ_X11 + INCLUDES += -I$(srcdir)/../shared/x11 + endif +diff --git a/widget/src/gtk2/nsFilePicker.cpp b/widget/src/gtk2/nsFilePicker.cpp +--- a/widget/src/gtk2/nsFilePicker.cpp ++++ b/widget/src/gtk2/nsFilePicker.cpp +@@ -31,16 +31,17 @@ + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + + #include ++#include + + #include "nsIFileURL.h" + #include "nsIURI.h" + #include "nsIWidget.h" + #include "nsILocalFile.h" + #include "nsIStringBundle.h" + + #include "nsArrayEnumerator.h" +@@ -50,16 +51,17 @@ + #include "nsReadableUtils.h" + #include "mozcontainer.h" + + #include "prmem.h" + #include "prlink.h" + + #include "nsFilePicker.h" + #include "nsAccessibilityHelper.h" ++#include "nsKDEUtils.h" + + #if (MOZ_PLATFORM_MAEMO == 5) + #include + #endif + + #define MAX_PREVIEW_SIZE 180 + + nsILocalFile *nsFilePicker::mPrevDisplayDirectory = nsnull; +@@ -271,17 +273,19 @@ nsFilePicker::AppendFilters(PRInt32 aFil + return nsBaseFilePicker::AppendFilters(aFilterMask); + } + + NS_IMETHODIMP + nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) + { + if (aFilter.EqualsLiteral("..apps")) { + // No platform specific thing we can do here, really.... +- return NS_OK; ++ // Unless it's KDE. ++ if( mMode != modeOpen || !nsKDEUtils::kdeSupport()) ++ return NS_OK; + } + + nsCAutoString filter, name; + CopyUTF16toUTF8(aFilter, filter); + CopyUTF16toUTF8(aTitle, name); + + mFilters.AppendElement(filter); + mFilterNames.AppendElement(name); +@@ -419,16 +423,19 @@ confirm_overwrite_file(GtkWidget *parent + gtk_widget_destroy(dialog); + + return result; + } + + NS_IMETHODIMP + nsFilePicker::Show(PRInt16 *aReturn) + { ++ if( nsKDEUtils::kdeSupport()) ++ return kdeFileDialog( aReturn ); ++ + NS_ENSURE_ARG_POINTER(aReturn); + + nsXPIDLCString title; + title.Adopt(ToNewUTF8String(mTitle)); + + GtkWindow *parent_widget = get_gtk_window_for_nsiwidget(mParentWidget); + + GtkFileChooserAction action = GetGtkFileChooserAction(mMode); +@@ -569,8 +576,234 @@ nsFilePicker::Show(PRInt16 *aReturn) + *aReturn = nsIFilePicker::returnCancel; + break; + } + + gtk_widget_destroy(file_chooser); + + return NS_OK; + } ++ ++nsCString nsFilePicker::kdeMakeFilter( int index ) ++ { ++ nsCString buf = mFilters[ index ]; ++ for( PRUint32 i = 0; ++ i < buf.Length(); ++ ++i ) ++ if( buf[ i ] == ';' ) // KDE separates just using spaces ++ buf.SetCharAt( ' ', i ); ++ if (!mFilterNames[index].IsEmpty()) ++ { ++ buf += "|"; ++ buf += mFilterNames[index].get(); ++ } ++ return buf; ++ } ++ ++static PRInt32 windowToXid( nsIWidget* widget ) ++ { ++ GtkWindow *parent_widget = get_gtk_window_for_nsiwidget( widget ); ++ GdkWindow* gdk_window = gtk_widget_get_window( gtk_widget_get_toplevel( GTK_WIDGET( parent_widget ))); ++ return GDK_WINDOW_XID( gdk_window ); ++ } ++ ++NS_IMETHODIMP nsFilePicker::kdeFileDialog(PRInt16 *aReturn) ++ { ++ NS_ENSURE_ARG_POINTER(aReturn); ++ ++ if( mMode == modeOpen && mFilters.Length() == 1 && mFilters[ 0 ].EqualsLiteral( "..apps" )) ++ return kdeAppsDialog( aReturn ); ++ ++ nsXPIDLCString title; ++ title.Adopt(ToNewUTF8String(mTitle)); ++ ++ const char* arg = NULL; ++ if( mAllowURLs ) ++ { ++ switch( mMode ) ++ { ++ case nsIFilePicker::modeOpen: ++ case nsIFilePicker::modeOpenMultiple: ++ arg = "GETOPENURL"; ++ break; ++ case nsIFilePicker::modeSave: ++ arg = "GETSAVEURL"; ++ break; ++ case nsIFilePicker::modeGetFolder: ++ arg = "GETDIRECTORYURL"; ++ break; ++ } ++ } ++ else ++ { ++ switch( mMode ) ++ { ++ case nsIFilePicker::modeOpen: ++ case nsIFilePicker::modeOpenMultiple: ++ arg = "GETOPENFILENAME"; ++ break; ++ case nsIFilePicker::modeSave: ++ arg = "GETSAVEFILENAME"; ++ break; ++ case nsIFilePicker::modeGetFolder: ++ arg = "GETDIRECTORYFILENAME"; ++ break; ++ } ++ } ++ ++ nsCAutoString directory; ++ if (mDisplayDirectory) { ++ mDisplayDirectory->GetNativePath(directory); ++ } else if (mPrevDisplayDirectory) { ++ mPrevDisplayDirectory->GetNativePath(directory); ++ } ++ ++ nsCAutoString startdir; ++ if (!directory.IsEmpty()) { ++ startdir = directory; ++ } ++ if (mMode == nsIFilePicker::modeSave) { ++ if( !startdir.IsEmpty()) ++ { ++ startdir += "/"; ++ startdir += ToNewUTF8String(mDefault); ++ } ++ else ++ startdir = ToNewUTF8String(mDefault); ++ } ++ if( startdir.IsEmpty()) ++ startdir = "."; ++ ++ nsCAutoString filters; ++ PRInt32 count = mFilters.Length(); ++ if( count == 0 ) //just in case ++ filters = "*"; ++ else ++ { ++ filters = kdeMakeFilter( 0 ); ++ for (PRInt32 i = 1; i < count; ++i) ++ { ++ filters += "\n"; ++ filters += kdeMakeFilter( i ); ++ } ++ } ++ ++ nsCStringArray command; ++ command.AppendCString( nsCAutoString( arg )); ++ command.AppendCString( startdir ); ++ if( mMode != nsIFilePicker::modeGetFolder ) ++ { ++ command.AppendCString( filters ); ++ nsCAutoString selected; ++ selected.AppendInt( mSelectedType ); ++ command.AppendCString( selected ); ++ } ++ command.AppendCString( title ); ++ if( mMode == nsIFilePicker::modeOpenMultiple ) ++ command.AppendCString( NS_LITERAL_CSTRING( "MULTIPLE" )); ++ if( PRInt32 xid = windowToXid( mParentWidget )) ++ { ++ command.AppendCString( NS_LITERAL_CSTRING( "PARENT" )); ++ nsCAutoString parent; ++ parent.AppendInt( xid ); ++ command.AppendCString( parent ); ++ } ++ ++ nsCStringArray output; ++ if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) ++ { ++ *aReturn = nsIFilePicker::returnOK; ++ mFiles.Clear(); ++ if( mMode != nsIFilePicker::modeGetFolder ) ++ { ++ mSelectedType = atoi( output[ 0 ]->get()); ++ output.RemoveCStringAt( 0 ); ++ } ++ if (mMode == nsIFilePicker::modeOpenMultiple) ++ { ++ mFileURL.Truncate(); ++ PRUint32 count = output.Count(); ++ for( PRUint32 i = 0; ++ i < count; ++ ++i ) ++ { ++ nsCOMPtr localfile; ++ nsresult rv = NS_NewNativeLocalFile( *output[ i ], ++ PR_FALSE, ++ getter_AddRefs(localfile)); ++ if (NS_SUCCEEDED(rv)) ++ mFiles.AppendObject(localfile); ++ } ++ } ++ else ++ { ++ if( output.Count() == 0 ) ++ mFileURL = nsCString(); ++ else if( mAllowURLs ) ++ mFileURL = *output[ 0 ]; ++ else // GetFile() actually requires it to be url even for local files :-/ ++ { ++ mFileURL = nsCString( "file://" ); ++ mFileURL.Append( *output[ 0 ] ); ++ } ++ } ++ // Remember last used directory. ++ nsCOMPtr file; ++ GetFile(getter_AddRefs(file)); ++ if (file) { ++ nsCOMPtr dir; ++ file->GetParent(getter_AddRefs(dir)); ++ nsCOMPtr localDir(do_QueryInterface(dir)); ++ if (localDir) { ++ localDir.swap(mPrevDisplayDirectory); ++ } ++ } ++ if (mMode == nsIFilePicker::modeSave) ++ { ++ nsCOMPtr file; ++ GetFile(getter_AddRefs(file)); ++ if (file) ++ { ++ PRBool exists = PR_FALSE; ++ file->Exists(&exists); ++ if (exists) // TODO do overwrite check in the helper app ++ *aReturn = nsIFilePicker::returnReplace; ++ } ++ } ++ } ++ else ++ { ++ *aReturn = nsIFilePicker::returnCancel; ++ } ++ return NS_OK; ++ } ++ ++ ++NS_IMETHODIMP nsFilePicker::kdeAppsDialog(PRInt16 *aReturn) ++ { ++ NS_ENSURE_ARG_POINTER(aReturn); ++ ++ nsXPIDLCString title; ++ title.Adopt(ToNewUTF8String(mTitle)); ++ ++ nsCStringArray command; ++ command.AppendCString( NS_LITERAL_CSTRING( "APPSDIALOG" )); ++ command.AppendCString( title ); ++ if( PRInt32 xid = windowToXid( mParentWidget )) ++ { ++ command.AppendCString( NS_LITERAL_CSTRING( "PARENT" )); ++ nsCAutoString parent; ++ parent.AppendInt( xid ); ++ command.AppendCString( parent ); ++ } ++ ++ nsCStringArray output; ++ if( nsKDEUtils::commandBlockUi( command, get_gtk_window_for_nsiwidget( mParentWidget ), &output )) ++ { ++ *aReturn = nsIFilePicker::returnOK; ++ mFileURL = output.Count() > 0 ? *output[ 0 ] : nsCString(); ++ } ++ else ++ { ++ *aReturn = nsIFilePicker::returnCancel; ++ } ++ return NS_OK; ++ } +diff --git a/widget/src/gtk2/nsFilePicker.h b/widget/src/gtk2/nsFilePicker.h +--- a/widget/src/gtk2/nsFilePicker.h ++++ b/widget/src/gtk2/nsFilePicker.h +@@ -89,11 +89,17 @@ protected: + nsString mDefault; + nsString mDefaultExtension; + + nsTArray mFilters; + nsTArray mFilterNames; + + private: + static nsILocalFile *mPrevDisplayDirectory; ++ ++ bool kdeRunning(); ++ bool getKdeRunning(); ++ NS_IMETHODIMP kdeFileDialog(PRInt16 *aReturn); ++ NS_IMETHODIMP kdeAppsDialog(PRInt16 *aReturn); ++ nsCString kdeMakeFilter( int index ); + }; + + #endif +diff --git a/xpcom/components/Makefile.in b/xpcom/components/Makefile.in +--- a/xpcom/components/Makefile.in ++++ b/xpcom/components/Makefile.in +@@ -94,10 +94,11 @@ FORCE_STATIC_LIB = 1 + + # Force use of PIC + FORCE_USE_PIC = 1 + include $(topsrcdir)/config/rules.mk + + DEFINES += -D_IMPL_NS_COM + + ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT))) ++LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre + CXXFLAGS += $(MOZ_GTK2_CFLAGS) + endif +diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp +--- a/xpcom/components/ManifestParser.cpp ++++ b/xpcom/components/ManifestParser.cpp +@@ -55,16 +55,17 @@ + #include "nsTextFormatter.h" + #include "nsVersionComparator.h" + #include "nsXPCOMCIDInternal.h" + + #include "nsIConsoleService.h" + #include "nsIScriptError.h" + #include "nsIXULAppInfo.h" + #include "nsIXULRuntime.h" ++#include "nsKDEUtils.h" + + struct ManifestDirective + { + const char* directive; + int argc; + + // Some directives should only be delivered for NS_COMPONENT_LOCATION + // manifests. +@@ -422,16 +423,17 @@ ParseManifestCommon(NSLocationType aType + + NS_NAMED_LITERAL_STRING(kPlatform, "platform"); + NS_NAMED_LITERAL_STRING(kContentAccessible, "contentaccessible"); + NS_NAMED_LITERAL_STRING(kApplication, "application"); + NS_NAMED_LITERAL_STRING(kAppVersion, "appversion"); + NS_NAMED_LITERAL_STRING(kOs, "os"); + NS_NAMED_LITERAL_STRING(kOsVersion, "osversion"); + NS_NAMED_LITERAL_STRING(kABI, "abi"); ++ NS_NAMED_LITERAL_STRING(kDesktop, "desktop"); + + // Obsolete + NS_NAMED_LITERAL_STRING(kXPCNativeWrappers, "xpcnativewrappers"); + + nsAutoString appID; + nsAutoString appVersion; + nsAutoString osTarget; + nsAutoString abi; +@@ -461,35 +463,39 @@ ParseManifestCommon(NSLocationType aType + CopyUTF8toUTF16(s, abi); + abi.Insert(PRUnichar('_'), 0); + abi.Insert(osTarget, 0); + } + } + } + + nsAutoString osVersion; ++ nsAutoString desktop; + #if defined(XP_WIN) + OSVERSIONINFO info = { sizeof(OSVERSIONINFO) }; + if (GetVersionEx(&info)) { + nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(), + info.dwMajorVersion, + info.dwMinorVersion); + } ++ desktop = NS_LITERAL_STRING("win"); + #elif defined(XP_MACOSX) + SInt32 majorVersion, minorVersion; + if ((Gestalt(gestaltSystemVersionMajor, &majorVersion) == noErr) && + (Gestalt(gestaltSystemVersionMinor, &minorVersion) == noErr)) { + nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(), + majorVersion, + minorVersion); + } ++ desktop = NS_LITERAL_STRING("macosx"); + #elif defined(MOZ_WIDGET_GTK2) + nsTextFormatter::ssprintf(osVersion, NS_LITERAL_STRING("%ld.%ld").get(), + gtk_major_version, + gtk_minor_version); ++ desktop = nsKDEUtils::kdeSession() ? NS_LITERAL_STRING("kde") : NS_LITERAL_STRING("gnome"); + #endif + + // Because contracts must be registered after CIDs, we save and process them + // at the end. + nsTArray contracts; + + char *token; + char *newline = buf; +@@ -558,24 +564,26 @@ ParseManifestCommon(NSLocationType aType + bool ok = true; + TriState stAppVersion = eUnspecified; + TriState stApp = eUnspecified; + TriState stOsVersion = eUnspecified; + TriState stOs = eUnspecified; + TriState stABI = eUnspecified; + bool platform = false; + bool contentAccessible = false; ++ TriState stDesktop = eUnspecified; + + while (NULL != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) && ok) { + ToLowerCase(token); + NS_ConvertASCIItoUTF16 wtoken(token); + + if (CheckStringFlag(kApplication, wtoken, appID, stApp) || + CheckStringFlag(kOs, wtoken, osTarget, stOs) || + CheckStringFlag(kABI, wtoken, abi, stABI) || ++ CheckStringFlag(kDesktop, wtoken, desktop, stDesktop) || + CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) || + CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion)) + continue; + + if (directive->contentflags && + (CheckFlag(kPlatform, wtoken, platform) || + CheckFlag(kContentAccessible, wtoken, contentAccessible))) + continue; +@@ -594,16 +602,17 @@ ParseManifestCommon(NSLocationType aType + ok = false; + } + + if (!ok || + stApp == eBad || + stAppVersion == eBad || + stOs == eBad || + stOsVersion == eBad || ++ stDesktop == eBad || + stABI == eBad) + continue; + + if (directive->regfunc) { + if (GeckoProcessType_Default != XRE_GetProcessType()) + continue; + + if (!nsChromeRegistry::gChromeRegistry) { +diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in +--- a/xpcom/io/Makefile.in ++++ b/xpcom/io/Makefile.in +@@ -192,17 +192,17 @@ include $(topsrcdir)/ipc/chromium/chromi + DEFINES += -D_IMPL_NS_COM + + ifeq ($(OS_ARCH),Linux) + ifneq (,$(findstring lib64,$(libdir))) + DEFINES += -DHAVE_USR_LIB64_DIR + endif + endif + +-LOCAL_INCLUDES += -I.. ++LOCAL_INCLUDES += -I.. -I$(topsrcdir)/toolkit/xre + + ifeq ($(MOZ_PLATFORM_MAEMO),5) + CFLAGS += $(MOZ_DBUS_CFLAGS) + CXXFLAGS += $(MOZ_DBUS_CFLAGS) + endif + + ifdef MOZ_PLATFORM_MAEMO + CFLAGS += $(MOZ_PLATFORM_MAEMO_CFLAGS) $(MOZ_QT_CFLAGS) +diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp +--- a/xpcom/io/nsLocalFileUnix.cpp ++++ b/xpcom/io/nsLocalFileUnix.cpp +@@ -88,16 +88,17 @@ + #include "prproces.h" + #include "nsIDirectoryEnumerator.h" + #include "nsISimpleEnumerator.h" + #include "nsITimelineService.h" + + #ifdef MOZ_WIDGET_GTK2 + #include "nsIGIOService.h" + #include "nsIGnomeVFSService.h" ++#include "nsKDEUtils.h" + #endif + + #ifdef XP_MACOSX + #include + #include "CocoaFileUtils.h" + #include "prmem.h" + #include "plbase64.h" + +@@ -1730,44 +1731,50 @@ nsLocalFile::SetPersistentDescriptor(con + return InitWithNativePath(aPersistentDescriptor); + #endif + } + + NS_IMETHODIMP + nsLocalFile::Reveal() + { + #ifdef MOZ_WIDGET_GTK2 +- nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); +- nsCOMPtr gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); +- if (!giovfs && !gnomevfs) +- return NS_ERROR_FAILURE; +- ++ nsCAutoString url; + PRBool isDirectory; + if (NS_FAILED(IsDirectory(&isDirectory))) + return NS_ERROR_FAILURE; + + if (isDirectory) { +- if (giovfs) +- return giovfs->ShowURIForInput(mPath); +- else +- /* Fallback to GnomeVFS */ +- return gnomevfs->ShowURIForInput(mPath); ++ url = mPath; + } else { + nsCOMPtr parentDir; + nsCAutoString dirPath; + if (NS_FAILED(GetParent(getter_AddRefs(parentDir)))) + return NS_ERROR_FAILURE; + if (NS_FAILED(parentDir->GetNativePath(dirPath))) + return NS_ERROR_FAILURE; + +- if (giovfs) +- return giovfs->ShowURIForInput(dirPath); +- else +- return gnomevfs->ShowURIForInput(dirPath); ++ url = dirPath; + } ++ ++ if(nsKDEUtils::kdeSupport()) { ++ nsCStringArray command; ++ command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); ++ command.AppendCString( url ); ++ return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; ++ } ++ ++ nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); ++ nsCOMPtr gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); ++ if (!giovfs && !gnomevfs) ++ return NS_ERROR_FAILURE; ++ ++ if (giovfs) ++ return giovfs->ShowURIForInput(url); ++ else ++ return gnomevfs->ShowURIForInput(url); + #elif defined(XP_MACOSX) + CFURLRef url; + if (NS_SUCCEEDED(GetCFURL(&url))) { + nsresult rv = CocoaFileUtils::RevealFileInFinder(url); + ::CFRelease(url); + return rv; + } + return NS_ERROR_FAILURE; +@@ -1793,16 +1800,23 @@ nsLocalFile::Launch() + + if (nsnull == connection) + return NS_ERROR_FAILURE; + + if (hildon_mime_open_file(connection, mPath.get()) != kHILDON_SUCCESS) + return NS_ERROR_FAILURE; + return NS_OK; + #else ++ if( nsKDEUtils::kdeSupport()) { ++ nsCStringArray command; ++ command.AppendCString( NS_LITERAL_CSTRING( "OPEN" )); ++ command.AppendCString( mPath ); ++ return nsKDEUtils::command( command ) ? NS_OK : NS_ERROR_FAILURE; ++ } ++ + nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); + nsCOMPtr gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); + if (giovfs) { + return giovfs->ShowURIForInput(mPath); + } else if (gnomevfs) { + /* GnomeVFS fallback */ + return gnomevfs->ShowURIForInput(mPath); + } diff --git a/mozilla-language.patch b/mozilla-language.patch new file mode 100644 index 0000000..76e0e29 --- /dev/null +++ b/mozilla-language.patch @@ -0,0 +1,48 @@ +# HG changeset patch +# User Wolfgang Rosenauer +# Parent db620d83124746201970dcf50c661957df979eca +Bug 583793 - Firefox interface language set to LANG, ignores LANGUAGE + +diff --git a/intl/locale/src/nsLocaleService.cpp b/intl/locale/src/nsLocaleService.cpp +--- a/intl/locale/src/nsLocaleService.cpp ++++ b/intl/locale/src/nsLocaleService.cpp +@@ -181,16 +181,17 @@ nsLocaleService::nsLocaleService(void) + } + + + #ifdef MOZ_WIDGET_QT + const char* lang = QLocale::system().name().toAscii(); + #else + // Get system configuration + const char* lang = getenv("LANG"); ++ const char* language = getenv("LANGUAGE"); + #endif + + for( i = 0; i < LocaleListLength; i++ ) { + nsresult result; + // setlocale( , "") evaluates LC_* and LANG + char* lc_temp = setlocale(posix_locale_category[i], ""); + CopyASCIItoUTF16(LocaleList[i], category); + category_platform = category; +@@ -206,16 +207,21 @@ nsLocaleService::nsLocaleService(void) + else { + CopyASCIItoUTF16(lang, platformLocale); + result = posixConverter->GetXPLocale(lang, xpLocale); + } + } + if (NS_FAILED(result)) { + return; + } ++ // LANGUAGE is overriding LC_MESSAGES ++ if (i == LC_MESSAGES && language && *language) { ++ CopyASCIItoUTF16(language, platformLocale); ++ result = posixConverter->GetXPLocale(language, xpLocale); ++ } + resultLocale->AddCategory(category, xpLocale); + resultLocale->AddCategory(category_platform, platformLocale); + } + mSystemLocale = do_QueryInterface(resultLocale); + mApplicationLocale = do_QueryInterface(resultLocale); + } // if ( NS_SUCCEEDED )... + + #endif // XP_UNIX diff --git a/mozilla-nongnome-proxies.patch b/mozilla-nongnome-proxies.patch new file mode 100644 index 0000000..01018a0 --- /dev/null +++ b/mozilla-nongnome-proxies.patch @@ -0,0 +1,31 @@ +From: Wolfgang Rosenauer +Subject: Do not use gconf for proxy settings if not running within Gnome + +Index: toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp +=================================================================== +RCS file: /cvsroot/mozilla/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp,v +retrieving revision 1.1 +diff -u -p -6 -r1.1 nsUnixSystemProxySettings.cpp +--- toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp 29 Jan 2008 15:58:41 -0000 1.1 ++++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp 17 Apr 2008 19:02:19 -0000 +@@ -69,13 +69,19 @@ private: + + NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) + + nsresult + nsUnixSystemProxySettings::Init() + { +- mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); ++ // If this is a GNOME session, load gconf and try to use its preferences. ++ // If gconf is not available (which would be stupid) we'll proceed as if ++ // this was not a GNOME session, using *_PROXY environment variables. ++ const char* sessionType = PR_GetEnv("DESKTOP_SESSION"); ++ if (sessionType && !strcmp(sessionType, "gnome")) { ++ mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); ++ } + return NS_OK; + } + + PRBool + nsUnixSystemProxySettings::IsProxyMode(const char* aMode) + { diff --git a/mozilla-ntlm-full-path.patch b/mozilla-ntlm-full-path.patch new file mode 100644 index 0000000..b1abd04 --- /dev/null +++ b/mozilla-ntlm-full-path.patch @@ -0,0 +1,27 @@ +# HG changeset patch +# User Petr Cerny +# Parent 971259052418fda3b7fc81da75be4557ea5d82bc +Bug 634334 - call to the ntlm_auth helper fails + +diff --git a/extensions/auth/nsAuthSambaNTLM.cpp b/extensions/auth/nsAuthSambaNTLM.cpp +--- a/extensions/auth/nsAuthSambaNTLM.cpp ++++ b/extensions/auth/nsAuthSambaNTLM.cpp +@@ -200,17 +200,17 @@ static PRUint8* ExtractMessage(const nsA + nsresult + nsAuthSambaNTLM::SpawnNTLMAuthHelper() + { + const char* username = PR_GetEnv("USER"); + if (!username) + return NS_ERROR_FAILURE; + + char* args[] = { +- "ntlm_auth", ++ "/usr/bin/ntlm_auth", + "--helper-protocol", "ntlmssp-client-1", + "--use-cached-creds", + "--username", const_cast(username), + nsnull + }; + + PRBool isOK = SpawnIOChild(args, &mChildPID, &mFromChildFD, &mToChildFD); + if (!isOK) diff --git a/mozilla-ppc-ipc.patch b/mozilla-ppc-ipc.patch new file mode 100644 index 0000000..9c6b135 --- /dev/null +++ b/mozilla-ppc-ipc.patch @@ -0,0 +1,222 @@ +# HG changeset patch +# Parent f6996f95c7f8007fd7bf759092488ead6843441a +Bug 587188 - Failed to build firefox from trunk on PPC (fixed m-c) + +diff --git a/ipc/chromium/Makefile.in b/ipc/chromium/Makefile.in +--- a/ipc/chromium/Makefile.in ++++ b/ipc/chromium/Makefile.in +@@ -241,17 +241,16 @@ CPPSRCS += \ + + endif # } OS_MACOSX + + ifdef OS_LINUX # { + + CPPSRCS += \ + atomicops_internals_x86_gcc.cc \ + base_paths_linux.cc \ +- data_pack.cc \ + file_util_linux.cc \ + file_version_info_linux.cc \ + idle_timer_none.cc \ + process_util_linux.cc \ + time_posix.cc \ + $(NULL) + + ifdef MOZ_ENABLE_GTK2 +diff --git a/ipc/chromium/src/base/atomicops.h b/ipc/chromium/src/base/atomicops.h +--- a/ipc/chromium/src/base/atomicops.h ++++ b/ipc/chromium/src/base/atomicops.h +@@ -127,13 +127,15 @@ Atomic64 Release_Load(volatile const Ato + #if defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY) + #include "base/atomicops_internals_x86_msvc.h" + #elif defined(OS_MACOSX) && defined(ARCH_CPU_X86_FAMILY) + #include "base/atomicops_internals_x86_macosx.h" + #elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY) + #include "base/atomicops_internals_x86_gcc.h" + #elif defined(COMPILER_GCC) && defined(ARCH_CPU_ARM_FAMILY) + #include "base/atomicops_internals_arm_gcc.h" ++//#elif defined(COMPILER_GCC) && defined(ARCH_CPU_PPC_FAMILY) ++//#include "base/atomicops_internals_ppc_gcc.h" + #else + #include "base/atomicops_internals_mutex.h" + #endif + + #endif // BASE_ATOMICOPS_H_ +diff --git a/ipc/chromium/src/base/atomicops_internals_ppc_gcc.h b/ipc/chromium/src/base/atomicops_internals_ppc_gcc.h +new file mode 100644 +--- /dev/null ++++ b/ipc/chromium/src/base/atomicops_internals_ppc_gcc.h +@@ -0,0 +1,148 @@ ++// Copyright (c) 2010 JJDaNiMoTh . All rights reserved. ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++// This file is an internal atomic implementation, use base/atomicops.h instead. ++ ++#ifndef BASE_ATOMICOPS_INTERNALS_PPC_GCC_H_ ++#define BASE_ATOMICOPS_INTERNALS_PPC_GCC_H_ ++#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") ++ ++#define PPC_ACQUIRE_BARRIER "\nisync\n" ++#define PPC_RELEASE_BARRIER "\nlwsync\n" ++ ++namespace base { ++namespace subtle { ++ ++// 32-bit low-level operations on any platform. ++ ++/* ++ * Compare and exchange - if *ptr == old, set it to new, ++ * and return the old value of *p. ++ */ ++inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, ++ Atomic32 old_value, ++ Atomic32 new_value) { ++ Atomic32 prev; ++ ++ __asm__ __volatile__ ( ++ "1: lwarx %0,0,%2\n" ++ "cmpw 0,%0,%3\n" ++ "bne- 2f\n" ++ "stwcx. %4,0,%2\n" ++ "bne- 1b\n" ++ "2:\n" ++ : "=&r" (prev), "+m" (*ptr) ++ : "r" (ptr), "r" (old_value), "r" (new_value) ++ : "cc", "memory"); ++ ++ return prev; ++} ++ ++/* ++* Atomic exchange ++* ++* Changes the memory location '*ptr' to be new_value and returns ++* the previous value stored there. ++*/ ++inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, ++ Atomic32 new_value) { ++ Atomic32 prev; ++ ++ __asm__ __volatile__( ++"1: lwarx %0,0,%2 \n" ++" stwcx. %3,0,%2 \n\ ++ bne- 1b" ++ : "=&r" (prev), "+m" (*ptr) ++ : "r" (ptr), "r" (new_value) ++ : "cc", "memory"); ++ ++ return prev; ++} ++ ++inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, ++ Atomic32 increment) { ++ Atomic32 temp; ++ ++ __asm__ __volatile__( ++"1: lwarx %0,0,%2\n\ ++ add %0,%1,%0\n" ++" stwcx. %0,0,%2 \n\ ++ bne- 1b" ++ : "=&r" (temp) ++ : "r" (increment), "r" (ptr) ++ : "cc", "memory"); ++ ++ return temp; ++} ++ ++inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, ++ Atomic32 increment) { ++ Atomic32 temp; ++ ++ __asm__ __volatile__( ++ PPC_RELEASE_BARRIER ++"1: lwarx %0,0,%2\n\ ++ add %0,%1,%0\n" ++" stwcx. %0,0,%2 \n\ ++ bne- 1b" ++ PPC_ACQUIRE_BARRIER ++ : "=&r" (temp) ++ : "r" (increment), "r" (ptr) ++ : "cc", "memory"); ++ ++ return temp; ++} ++ ++inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, ++ Atomic32 old_value, ++ Atomic32 new_value) { ++ return NoBarrier_CompareAndSwap(ptr, old_value, new_value); ++} ++ ++inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, ++ Atomic32 old_value, ++ Atomic32 new_value) { ++ return NoBarrier_CompareAndSwap(ptr, old_value, new_value); ++} ++ ++inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { ++ *ptr = value; ++} ++ ++inline void MemoryBarrier() { ++ __asm__ __volatile__("sync" : : : "memory"); ++} ++ ++inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { ++ *ptr = value; ++ MemoryBarrier(); ++} ++ ++inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { ++ MemoryBarrier(); ++ *ptr = value; ++} ++ ++inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { ++ return *ptr; ++} ++ ++inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { ++ Atomic32 value = *ptr; ++ MemoryBarrier(); ++ return value; ++ ++} ++ ++inline Atomic32 Release_Load(volatile const Atomic32* ptr) { ++ MemoryBarrier(); ++ return *ptr; ++} ++ ++} // namespace base::subtle ++} // namespace base ++ ++#undef ATOMICOPS_COMPILER_BARRIER ++ ++#endif // BASE_ATOMICOPS_INTERNALS_PPC_GCC_H_ +diff --git a/ipc/chromium/src/build/build_config.h b/ipc/chromium/src/build/build_config.h +--- a/ipc/chromium/src/build/build_config.h ++++ b/ipc/chromium/src/build/build_config.h +@@ -52,19 +52,20 @@ + #define ARCH_CPU_X86_FAMILY 1 + #define ARCH_CPU_X86 1 + #define ARCH_CPU_32_BITS 1 + #elif defined(__ARMEL__) + #define ARCH_CPU_ARM_FAMILY 1 + #define ARCH_CPU_ARMEL 1 + #define ARCH_CPU_32_BITS 1 + #define WCHAR_T_IS_UNSIGNED 1 +-#elif defined(__ppc__) ++#elif defined(__ppc__) || defined(__powerpc) || defined(__PPC__) + #define ARCH_CPU_PPC 1 + #define ARCH_CPU_32_BITS 1 ++#define ARCH_CPU_PPC_FAMILY 1 + #else + #error Please add support for your architecture in build/build_config.h + #endif + + // Type detection for wchar_t. + #ifndef CHROMIUM_MOZILLA_BUILD + + #if defined(OS_WIN) diff --git a/mozilla-prefer_plugin_pref.patch b/mozilla-prefer_plugin_pref.patch new file mode 100644 index 0000000..fe4a8b9 --- /dev/null +++ b/mozilla-prefer_plugin_pref.patch @@ -0,0 +1,54 @@ +From: Ubuntu +Subject: introduce a pref to prefer certain plugins for mime-types + +diff --git a/modules/plugin/base/src/nsPluginHost.cpp b/modules/plugin/base/src/nsPluginHost.cpp +--- a/modules/plugin/base/src/nsPluginHost.cpp ++++ b/modules/plugin/base/src/nsPluginHost.cpp +@@ -1620,17 +1620,47 @@ nsPluginHost::FindPluginForType(const ch + nsPluginTag *plugins = nsnull; + PRInt32 variants, cnt; + + LoadPlugins(); + + // if we have a mimetype passed in, search the mPlugins + // linked list for a match + if (aMimeType) { ++ nsresult res; ++ nsCOMPtr prefB (do_QueryInterface(mPrefService)); ++ ++ char *preferredPluginPath = NULL; ++ nsCAutoString mimetypePrefString ("modules.plugins.mimetype."); ++ mimetypePrefString.Append(aMimeType); ++ const char *mimetypePrefChar = mimetypePrefString.get(); ++ res = prefB->GetCharPref(mimetypePrefChar, &preferredPluginPath); ++ ++ if(!NS_SUCCEEDED(res)) preferredPluginPath = NULL; ++ + plugins = mPlugins; ++ if(preferredPluginPath) { ++ while (nsnull != plugins) { ++ if (0 == PL_strcasecmp(plugins->mFileName.get(), preferredPluginPath) || ++ 0 == PL_strcasecmp(plugins->mFullPath.get(), preferredPluginPath)) { ++ return plugins; ++ } ++ plugins = plugins->mNext; ++ } ++ ++ // now lets search for substrings ++ plugins=mPlugins; ++ while (nsnull != plugins) { ++ if (nsnull != PL_strstr(plugins->mFileName.get(), preferredPluginPath) || ++ nsnull != PL_strstr(plugins->mFullPath.get(), preferredPluginPath)) { ++ return plugins; ++ } ++ plugins = plugins->mNext; ++ } ++ } + + while (plugins) { + variants = plugins->mVariants; + for (cnt = 0; cnt < variants; cnt++) { + if ((!aCheckEnabled || plugins->IsEnabled()) && + plugins->mMimeTypeArray[cnt] && + (0 == PL_strcasecmp(plugins->mMimeTypeArray[cnt], aMimeType))) { + return plugins; diff --git a/mozilla-shared-nss-db.patch b/mozilla-shared-nss-db.patch new file mode 100644 index 0000000..922ce68 --- /dev/null +++ b/mozilla-shared-nss-db.patch @@ -0,0 +1,176 @@ +From: Hans Petter Jansson + Wolfgang Rosenauer +Subject: use libnsssharedhelper if available at compile time + (can be disabled by exporting MOZ_XRE_NO_NSSHELPER=1) +References: + +diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in +--- a/config/autoconf.mk.in ++++ b/config/autoconf.mk.in +@@ -571,16 +571,20 @@ MOZ_ALSA_LIBS = @MOZ_ALSA_LIBS + + GLIB_CFLAGS = @GLIB_CFLAGS@ + GLIB_LIBS = @GLIB_LIBS@ + GLIB_GMODULE_LIBS = @GLIB_GMODULE_LIBS@ + LIBIDL_CFLAGS = @LIBIDL_CFLAGS@ + LIBIDL_LIBS = @LIBIDL_LIBS@ + STATIC_LIBIDL = @STATIC_LIBIDL@ + ++MOZ_ENABLE_NSSHELPER = @MOZ_ENABLE_NSSHELPER@ ++NSSHELPER_CFLAGS = @NSSHELPER_CFLAGS@ ++NSSHELPER_LIBS = @NSSHELPER_LIBS@ ++ + MOZ_NATIVE_MAKEDEPEND = @SYSTEM_MAKEDEPEND@ + + export CL_INCLUDES_PREFIX = @CL_INCLUDES_PREFIX@ + + MOZ_AUTO_DEPS = @MOZ_AUTO_DEPS@ + COMPILER_DEPEND = @COMPILER_DEPEND@ + MDDEPDIR := @MDDEPDIR@ + CC_WRAPPER = @CC_WRAPPER@ +diff --git a/configure.in b/configure.in +--- a/configure.in ++++ b/configure.in +@@ -8610,16 +8610,31 @@ AC_SUBST(QCMS_LIBS) + + dnl ======================================================== + dnl HarfBuzz + dnl ======================================================== + MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)' + AC_SUBST(MOZ_HARFBUZZ_LIBS) + + dnl ======================================================== ++dnl Check for nss-shared-helper ++dnl ======================================================== ++ ++ PKG_CHECK_MODULES(NSSHELPER, nss-shared-helper, ++ [MOZ_ENABLE_NSSHELPER=1], ++ [MOZ_ENABLE_NSSHELPER=]) ++ ++if test "$MOZ_ENABLE_NSSHELPER"; then ++ AC_DEFINE(MOZ_ENABLE_NSSHELPER) ++fi ++AC_SUBST(MOZ_ENABLE_NSSHELPER) ++AC_SUBST(NSSHELPER_CFLAGS) ++AC_SUBST(NSSHELPER_LIBS) ++ ++dnl ======================================================== + dnl OTS + dnl ======================================================== + MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)' + AC_SUBST(MOZ_OTS_LIBS) + + dnl ======================================================== + dnl disable xul + dnl ======================================================== +diff --git a/security/manager/ssl/src/Makefile.in b/security/manager/ssl/src/Makefile.in +--- a/security/manager/ssl/src/Makefile.in ++++ b/security/manager/ssl/src/Makefile.in +@@ -117,19 +117,20 @@ CSRCS += md4.c + + + EXTRA_DEPS = $(NSS_DEP_LIBS) + + DEFINES += -DNSS_ENABLE_ECC + + # Use local includes because they are inserted before INCLUDES + # so that Mozilla's nss.h is used, not glibc's +-LOCAL_INCLUDES += $(NSS_CFLAGS) ++LOCAL_INCLUDES += $(NSS_CFLAGS) $(NSSHELPER_CFLAGS) + + EXTRA_DSO_LDOPTS += \ + $(MOZ_UNICHARUTIL_LIBS) \ + $(MOZ_COMPONENT_LIBS) \ + $(MOZ_JS_LIBS) \ ++ $(NSSHELPER_LIBS) \ + $(NSS_LIBS) \ + $(NULL) + + include $(topsrcdir)/config/rules.mk + +diff --git a/security/manager/ssl/src/nsNSSComponent.cpp b/security/manager/ssl/src/nsNSSComponent.cpp +--- a/security/manager/ssl/src/nsNSSComponent.cpp ++++ b/security/manager/ssl/src/nsNSSComponent.cpp +@@ -39,16 +39,23 @@ + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + ++#ifdef MOZ_ENABLE_NSSHELPER ++#pragma GCC visibility push(default) ++#include ++#pragma GCC visibility pop ++#include "prenv.h" ++#endif ++ + #include "nsNSSComponent.h" + #include "nsNSSCallbacks.h" + #include "nsNSSIOLayer.h" + #include "nsSSLThread.h" + #include "nsCertVerificationThread.h" + + #include "nsNetUtil.h" + #include "nsAppDirectoryServiceDefs.h" +@@ -1658,18 +1665,34 @@ nsNSSComponent::InitializeNSS(PRBool sho + ConfigureInternalPKCS11Token(); + + // The NSS_INIT_NOROOTINIT flag turns off the loading of the root certs + // module by NSS_Initialize because we will load it in InstallLoadableRoots + // later. It also allows us to work around a bug in the system NSS in + // Ubuntu 8.04, which loads any nonexistent "/libnssckbi.so" as + // "/usr/lib/nss/libnssckbi.so". + PRUint32 init_flags = NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE; +- SECStatus init_rv = ::NSS_Initialize(profileStr.get(), "", "", +- SECMOD_DB, init_flags); ++ SECStatus init_rv = SECFailure; ++#ifdef MOZ_ENABLE_NSSHELPER ++ if (PR_GetEnv("MOZ_XRE_NO_NSSHELPER")) { ++ init_rv = ::NSS_Initialize(profileStr.get(), "", "", ++ SECMOD_DB, init_flags); ++ } else { ++ init_rv = ::nsshelp_open_db ("mozilla-xul", profileStr.get(), init_flags); ++ ++ if (init_rv != SECSuccess) { ++ PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can not init NSS using nsshelp_open_db in %s\n", profileStr.get())); ++ init_rv = ::NSS_Initialize(profileStr.get(), "", "", ++ SECMOD_DB, init_flags); ++ } ++ } ++#else ++ init_rv = ::NSS_Initialize(profileStr.get(), "", "", ++ SECMOD_DB, init_flags); ++#endif + + if (init_rv != SECSuccess) { + PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("can not init NSS r/w in %s\n", profileStr.get())); + + if (supress_warning_preference) { + which_nss_problem = problem_none; + } + else { +diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in +--- a/toolkit/library/Makefile.in ++++ b/toolkit/library/Makefile.in +@@ -169,17 +169,17 @@ ifndef MOZ_ENABLE_LIBXUL + EXTRA_DSO_LDOPTS += \ + $(MOZ_COMPONENT_LIBS) \ + $(MOZ_JS_LIBS) \ + $(NULL) + endif + + DEFINES += -DIMPL_XREAPI + +-EXTRA_DSO_LDOPTS += $(NSPR_LIBS) $(MOZALLOC_LIB) ++EXTRA_DSO_LDOPTS += $(NSPR_LIBS) $(MOZALLOC_LIB) $(NSSHELPER_LIBS) + + ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) + CXXFLAGS += $(TK_CFLAGS) + OS_LIBS += \ + -framework SystemConfiguration \ + -framework QuickTime \ + -framework IOKit \ + -lcrypto \ diff --git a/mozilla.sh.in b/mozilla.sh.in index a69ca0f..ce68e37 100644 --- a/mozilla.sh.in +++ b/mozilla.sh.in @@ -57,7 +57,7 @@ cmdname=`basename $0` MOZ_DIST_BIN="%PREFIX" MOZ_DIST_LIB="%PROGDIR" MOZ_APPNAME="%APPNAME" -MOZ_PROGRAM="$MOZ_DIST_LIB/$MOZ_APPNAME" +MOZ_PROGRAM="$MOZ_DIST_LIB/$MOZ_APPNAME-bin" MOZ_APP_LAUNCHER="$MOZ_DIST_LIB/$MOZ_APPNAME.sh" if [ "$0" = "$MOZ_APP_LAUNCHER" ]; then @@ -79,6 +79,11 @@ if [ ! -d $BROWSER_PLUGIN_DIR ]; then BROWSER_PLUGIN_DIR=/opt/netscape/plugins fi +MOZILLA_FIVE_HOME="$MOZ_DIST_LIB" +export MOZILLA_FIVE_HOME +LD_LIBRARY_PATH=$MOZ_DIST_LIB${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} +export LD_LIBRARY_PATH + # ignore composite extension (needed for Flash) export XLIB_SKIP_ARGB_VISUALS=1 diff --git a/toolkit-download-folder.patch b/toolkit-download-folder.patch index f27350f..821e4d3 100644 --- a/toolkit-download-folder.patch +++ b/toolkit-download-folder.patch @@ -15,9 +15,9 @@ diff --git a/browser/components/preferences/main.js b/browser/components/prefere iconUrlSpec = fph.getURLSpecFromFile(this._indexToFolder(1)); } else { // 'Desktop' -diff --git a/toolkit/components/downloads/src/nsDownloadManager.cpp b/toolkit/components/downloads/src/nsDownloadManager.cpp ---- a/toolkit/components/downloads/src/nsDownloadManager.cpp -+++ b/toolkit/components/downloads/src/nsDownloadManager.cpp +diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp +--- a/toolkit/components/downloads/nsDownloadManager.cpp ++++ b/toolkit/components/downloads/nsDownloadManager.cpp @@ -1269,8 +1269,10 @@ nsDownloadManager::GetDefaultDownloadsDi // XDG user dir spec, with a fallback to Home/Downloads