diff options
-rw-r--r-- | bluegriffon-dev.spec | 368 | ||||
-rw-r--r-- | bluegriffon.spec | 154 | ||||
-rw-r--r-- | crashreporter-remove-static.patch | 11 | ||||
-rw-r--r-- | mozilla-193-pkgconfig.patch | 73 | ||||
-rw-r--r-- | mozilla-build-sbrk.patch (renamed from firefox4-build-sbrk.patch) | 0 | ||||
-rw-r--r-- | mozilla-build.patch (renamed from firefox4-build.patch) | 0 | ||||
-rw-r--r-- | mozilla-libjpeg-turbo.patch (renamed from firefox4-libjpeg-turbo.patch) | 0 | ||||
-rw-r--r-- | mozilla-malloc.patch | 12 | ||||
-rw-r--r-- | mozilla-notify.patch | 40 | ||||
-rw-r--r-- | wmclass.patch | 29 | ||||
-rw-r--r-- | xulrunner-2.0-NetworkManager09.patch | 51 | ||||
-rw-r--r-- | xulrunner-2.0-network-link-service.patch | 271 | ||||
-rw-r--r-- | xulrunner-2.0-system-cairo-tee.patch | 29 | ||||
-rw-r--r-- | xulrunner-2.0-system-cairo.patch | 137 | ||||
-rw-r--r-- | xulrunner-omnijar.patch | 1737 | ||||
-rw-r--r-- | xulrunner-version.patch | 13 |
16 files changed, 2305 insertions, 620 deletions
diff --git a/bluegriffon-dev.spec b/bluegriffon-dev.spec deleted file mode 100644 index a88c4f9..0000000 --- a/bluegriffon-dev.spec +++ /dev/null @@ -1,368 +0,0 @@ -%global nspr_version 4.8.7 -%global nss_version 3.12.9 -%global cairo_version 1.10 -%global freetype_version 2.1.9 -%global lcms_version 1.18 -%global sqlite_version 3.7.1 - -%global mozappdir %{_libdir}/bluegriffon -%global tarballdir mozilla-central -%global svnmain 0 -%global svnlocales 23 - -%global withxulrunner 1 -%global gecko_version 2.0-beta12 -%global srcversion 4.0b12 - -Summary: The next-generation Web Editor -Summary(fr): La nouvelle génération d'éditeur web -Name: bluegriffon -Version: 0.9 -%if %{svnmain} -Release: 0.6.svn%{svnmain}%{?dist} -%else -Release: 1%{?dist}.1 -%endif -URL: http://bluegriffon.org/ -License: MPLv1.1 or GPLv2+ or LGPLv2+ -Group: Applications/Editors - -Source0: ftp://ftp.mozilla.org/pub/firefox/releases/%{version}/source/firefox-%{srcversion}.source.tar.bz2 - -%if %{svnmain} -# svn checkout http://sources.disruptive-innovations.com/bluegriffon/trunk bluegriffon -# tar cjf bluegriffon-553.tar.bz2 --exclude .svn bluegriffon -Source1: %{name}-%{svnmain}.tar.bz2 - -# svn checkout http://sources.disruptive-innovations.com/bluegriffon-l10n locales -# tar cjf bluegriffon-l10n-23.tar.bz2 --exclude .svn locales -Source2: %{name}-l10n-%{svnlocales}.tar.bz2 -%else -Source1: %{name}-%{version}.tar.bz2 -Source2: %{name}-l10n-%{version}.tar.bz2 -%endif - -Source10: %{name}.sh.in -Source11: %{name}.sh -Source12: %{name}.desktop - -Patch1: firefox4-build.patch -Patch2: firefox4-build-sbrk.patch -Patch3: mozilla-malloc.patch -Patch4: firefox4-libjpeg-turbo.patch -Patch5: mozilla-notify.patch - -Patch12: xulrunner-2.0-64bit-big-endian.patch -Patch13: xulrunner-2.0-secondary-jit.patch -Patch14: xulrunner-2.0-chromium-types.patch -Patch15: xulrunner-2.0-system-cairo.patch -Patch16: xulrunner-2.0-system-cairo-tee.patch - -BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) - -BuildRequires: desktop-file-utils -BuildRequires: system-bookmarks -BuildRequires: yasm - -%if %{withxulrunner} -BuildRequires: gecko-devel = %{gecko_version} -Requires: gecko-libs%{?_isa} = %{gecko_version} -%else -BuildRequires: zip -BuildRequires: libIDL-devel -BuildRequires: gtk2-devel -BuildRequires: gnome-vfs2-devel -BuildRequires: libgnomeui-devel -BuildRequires: krb5-devel -BuildRequires: pango-devel -BuildRequires: freetype-devel >= 2.1.9 -BuildRequires: libXt-devel -BuildRequires: libXrender-devel -BuildRequires: startup-notification-devel -BuildRequires: wireless-tools-devel - -# BR from Xulrunner -%if %{fedora} >= 15 -BuildRequires: sqlite-devel >= %{sqlite_version} -%endif -%if %{fedora} >= 14 -BuildRequires: nspr-devel >= %{nspr_version} -BuildRequires: nss-devel >= %{nss_version} -%endif -%if %{fedora} >= 11 -BuildRequires: hunspell-devel -%endif -%if %{fedora} >= 15 -BuildRequires: cairo-devel >= %{cairo_version} -%endif -%if %{fedora} >= 10 -BuildRequires: libnotify-devel -%endif -%if %{fedora} >= 9 -BuildRequires: lcms-devel >= %{lcms_version} -%endif -BuildRequires: libpng-devel -BuildRequires: libjpeg-devel -BuildRequires: zip -BuildRequires: bzip2-devel -BuildRequires: zlib-devel -BuildRequires: libIDL-devel -BuildRequires: gtk2-devel -BuildRequires: gnome-vfs2-devel -BuildRequires: libgnome-devel -BuildRequires: libgnomeui-devel -BuildRequires: krb5-devel -BuildRequires: pango-devel -BuildRequires: freetype-devel >= %{freetype_version} -BuildRequires: libXt-devel -BuildRequires: libXrender-devel -BuildRequires: startup-notification-devel -BuildRequires: alsa-lib-devel -BuildRequires: autoconf213 -BuildRequires: mesa-libGL-devel - -%if 0%{?fedora} >= 14 -Requires: nss >= %{nss_version} -Requires: nspr >= %{nspr_version} -%endif -%if %{fedora} >= 9 -BuildRequires: lcms-devel >= %{lcms_version} -%endif -# endif %{withxulrunner} -%endif - - -%description -BlueGriffon is a new WYSIWYG content editor for the World Wide Web. - -Powered by Gecko, the rendering engine of Firefox 4, it's a modern -and robust solution to edit Web pages in conformance to the latest -Web Standards. - -%description -l fr -BlueGriffon est un nouvel éditeur de page web WYSIWYG. - -Basé sur Gecko, le moteur de rendu de Firefox 4, c'est une solution -moderne et fiable pour éditer des pages Web conformes aux dernières -normes w3c. - - -%prep -%setup -q -n %{tarballdir} - -tar xjf %{SOURCE1} -tar xjf %{SOURCE2} --directory %{name} - -patch -p1 < bluegriffon/config/content.patch - -%patch1 -p2 -b .build -%patch2 -p2 -b .sbrk -%patch3 -p2 -b .malloc -%if %{fedora} >= 14 -%patch4 -p2 -b .jpeg-turbo -%endif -%if %{fedora} >= 15 -# when libnotify >= 0.7.0 -%patch5 -p1 -b .notify -%endif - -%patch12 -p2 -b .64bit-big-endian -%patch13 -p2 -b .secondary-jit -%patch14 -p2 -b .chromium-types -%if %{fedora} >= 15 -%patch15 -p1 -b .system-cairo -%patch16 -p1 -b .system-cairo-tee -%endif - -%if 0%{?fedora} >= 15 -# For xulrunner-2.0-system-cairo-tee.patch -autoconf-2.13 -%endif - -#See http://bluegriffon.org/pages/Build-BlueGriffon -cat <<EOF_MOZCONFIG > .mozconfig -mk_add_options MOZ_OBJDIR=@TOPSRCDIR@ - -ac_add_options --enable-application=%{name} - -# --with-system-png is disabled because Mozilla requires APNG support in libpng -#ac_add_options --with-system-png -ac_add_options --prefix="\$PREFIX" -ac_add_options --libdir="\$LIBDIR" -%if %{fedora} >= 15 -ac_add_options --enable-system-sqlite -%endif -%if %{fedora} >= 14 -ac_add_options --with-system-nspr -ac_add_options --with-system-nss -%endif -%if %{fedora} >= 11 -ac_add_options --enable-system-hunspell -%endif -%if %{fedora} >= 15 -ac_add_options --enable-system-cairo -%endif -%if %{fedora} >= 10 -ac_add_options --enable-libnotify -%else -ac_add_options --disable-libnotify -%endif -%if %{fedora} >= 9 -ac_add_options --enable-system-lcms -%endif -%ifarch ppc ppc64 -ac_add_options --disable-necko-wifi -ac_add_options --disable-ipc -%endif -ac_add_options --with-system-jpeg -ac_add_options --with-system-zlib -ac_add_options --with-system-bz2 -ac_add_options --with-pthreads -ac_add_options --disable-strip -ac_add_options --disable-activex -ac_add_options --disable-activex-scripting -ac_add_options --disable-tests -ac_add_options --disable-airbag -ac_add_options --enable-places -ac_add_options --enable-storage -ac_add_options --enable-shared -ac_add_options --disable-static -ac_add_options --disable-mochitest -ac_add_options --disable-installer -ac_add_options --disable-debug -ac_add_options --enable-optimize="\$MOZ_OPT_FLAGS" -ac_add_options --enable-xinerama -ac_add_options --enable-default-toolkit=cairo-gtk2 -ac_add_options --disable-xprint -ac_add_options --enable-pango -ac_add_options --enable-svg -ac_add_options --enable-canvas -ac_add_options --enable-startup-notification -ac_add_options --disable-javaxpcom -ac_add_options --disable-crashreporter -ac_add_options --enable-safe-browsing -ac_add_options --disable-updater -EOF_MOZCONFIG - -%if %{withxulrunner} -echo "ac_add_options --enable-libxul" >> .mozconfig -echo "ac_add_options --with-libxul-sdk=\ -$(pkg-config --variable=sdkdir libxul)" >> .mozconfig -%endif - - -%build -export MOZ_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | \ - %{__sed} -e 's/-Wall//' -e 's/-fexceptions//g') - -export CFLAGS=$MOZ_OPT_FLAGS -export CXXFLAGS="$MOZ_OPT_FLAGS -fpermissive" - -export PREFIX='%{_prefix}' -export LIBDIR='%{_libdir}' - -MOZ_SMP_FLAGS=-j1 -[ -z "$RPM_BUILD_NCPUS" ] && \ - RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`" -[ "$RPM_BUILD_NCPUS" -gt 1 ] && MOZ_SMP_FLAGS=-j$RPM_BUILD_NCPUS - -MOZ_APP_DIR=%{_libdir}/%{name} - -export LDFLAGS="-Wl,-rpath,${MOZ_APP_DIR}" -make -f client.mk build STRIP="/bin/true" MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" - - -%install -%{__rm} -rf $RPM_BUILD_ROOT - -# No Make install for now :( -mkdir -p $RPM_BUILD_ROOT/%{mozappdir} -tar --create --file - --dereference --directory=dist/bin --exclude xulrunner . \ - | tar --extract --file - --directory $RPM_BUILD_ROOT/%{mozappdir} - -# Launcher -%if %{withxulrunner} -install -d -m 755 $RPM_BUILD_ROOT%{_bindir} -XULRUNNER_DIR=`pkg-config --variable=libdir libxul | %{__sed} -e "s,%{_libdir},,g"` -%{__cat} %{SOURCE10} | %{__sed} -e "s,XULRUNNER_DIRECTORY,$XULRUNNER_DIR,g" > \ - $RPM_BUILD_ROOT%{_bindir}/%{name} -%{__chmod} 755 $RPM_BUILD_ROOT%{_bindir}/%{name} -%else -install -D -m 755 %{SOURCE11} $RPM_BUILD_ROOT%{_bindir}/%{name} -%endif - -# Shortcut -desktop-file-install \ - --dir $RPM_BUILD_ROOT%{_datadir}/applications \ - --add-category Development \ - --add-category Network \ - %{SOURCE12} - -# Icons -install -D -m 644 bluegriffon/app/icons/default16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/%{name}.png -install -D -m 644 bluegriffon/app/icons/default32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/%{name}.png -install -D -m 644 bluegriffon/app/icons/default48.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/%{name}.png -install -D -m 644 bluegriffon/app/icons/default50.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/%{name}.png -install -D -m 644 bluegriffon/app/icons/%{name}128.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/128x128/apps/%{name}.png - -# Use the system hunspell dictionaries -%{__rm} -rf $RPM_BUILD_ROOT/%{mozappdir}/dictionaries -ln -s %{_datadir}/myspell $RPM_BUILD_ROOT%{mozappdir}/dictionaries - - -%post -update-desktop-database &> /dev/null || : -touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : -if [ -x %{_bindir}/gtk-update-icon-cache ]; then - %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || : -fi - - -%postun -if [ $1 -eq 0 ] ; then - touch --no-create %{_datadir}/icons/hicolor &>/dev/null - gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : -fi -update-desktop-database &> /dev/null || : - - -%files -%defattr(-,root,root,-) -%{_bindir}/%{name} -%{mozappdir} -%{_datadir}/applications/%{name}.desktop -%{_datadir}/icons/hicolor/16x16/apps/%{name}.png -%{_datadir}/icons/hicolor/32x32/apps/%{name}.png -%{_datadir}/icons/hicolor/48x48/apps/%{name}.png -%{_datadir}/icons/hicolor/128x128/apps/%{name}.png - - -%changelog -* Fri Feb 23 2011 Remi Collet <rpms@famillecollet.com> - 0.9-1.1 -- rebuild against xulrunnner 2.0b12 - -* Fri Feb 11 2011 Remi Collet <rpms@famillecollet.com> - 0.9-1 -- BlueGriffon 0.9 "Cape Town" (svn = 560, locales = 25) - http://bluegriffon.org/post/2011/02/11/BlueGriffon-0.9-Cape-Town - -* Wed Feb 09 2011 Remi Collet <rpms@famillecollet.com> - 0.9-0.6.svn554 -- bluegriffon svn 554 - -* Wed Feb 09 2011 Remi Collet <rpms@famillecollet.com> - 0.9-0.5.svn553 -- bluegriffon svn 553, locales svn 23 -- rebuild against xulrunnner 2.0b11 - -* Sat Feb 05 2011 Remi Collet <rpms@famillecollet.com> - 0.9-0.4.svn541 -- rebuild - -* Fri Feb 04 2011 Remi Collet <rpms@famillecollet.com> - 0.9-0.3.svn540 -- add stuff to build against system xulrunner2 - -* Mon Jan 31 2011 Remi Collet <rpms@famillecollet.com> - 0.9-0.2.svn540 -- split sources -- more patches from Firefox (fix rawhide build) -- add french sumnary/description - -* Fri Jan 28 2011 Remi Collet <rpms@famillecollet.com> - 0.9-0.1.hg20110128 -- first work on RPM - BlueGriffon 0.9rc1 - diff --git a/bluegriffon.spec b/bluegriffon.spec index 2eea81d..789e5a5 100644 --- a/bluegriffon.spec +++ b/bluegriffon.spec @@ -8,10 +8,14 @@ %global mozappdir %{_libdir}/bluegriffon %global tarballdir mozilla-2.0 %global svnmain 0 -%global svnlocales 58 -#global prever pre1 +%global svnlocales 0 +# According to upstream 1.0RC4 is the 1.0 finale +%global prever RC4 -%global gecko_version 2.0.1-1 +# gecko version, else to use bundled version +#global gecko_version 2.0.1-1 + +# Firefox version of sources used %global srcversion 4.0.1 Summary: The next-generation Web Editor @@ -21,7 +25,7 @@ Version: 1.0 %if %{?svnmain} Release: 0.2.svn%{svnmain}%{?dist} %else -Release: 1%{?dist} +Release: 3%{?dist} %endif URL: http://bluegriffon.org/ License: MPLv1.1 or GPLv2+ or LGPLv2+ @@ -34,16 +38,18 @@ Source0: ftp://ftp.mozilla.org/pub/firefox/releases/%{version}/source/fir # tar cjf bluegriffon-553.tar.bz2 bluegriffon Source1: %{name}-%{svnmain}.tar.bz2 %else -# svn export http://sources.disruptive-innovations.com/bluegriffon/tags/1.0 bluegriffon -# tar cjf bluegriffon-1.0.tar.bz2 bluegriffon +# svn export http://sources.disruptive-innovations.com/bluegriffon/tags/1.0RC4 bluegriffon +# tar cjf bluegriffon-1.0RC4.tar.bz2 bluegriffon Source1: %{name}-%{version}%{?prever}.tar.bz2 %endif %if %{?svnlocales} -# svn export -r 58 http://sources.disruptive-innovations.com/bluegriffon-l10n locales +# svn export -r 58 http://sources.disruptive-innovations.com/bluegriffon-l10n/trunk locales # tar cjf bluegriffon-l10n-58.tar.bz2 locales Source2: %{name}-l10n-%{svnlocales}.tar.bz2 %else +# svn export http://sources.disruptive-innovations.com/bluegriffon-l10n/tags/1.0RC4 locales +# tar cjf bluegriffon-l10n-1.0RC4.tar.bz2 locales Source2: %{name}-l10n-%{version}%{?prever}.tar.bz2 %endif @@ -51,27 +57,84 @@ Source10: %{name}.sh.in Source11: %{name}.sh Source12: %{name}.desktop -Patch0: %{name}-build.patch -# Upstream Firefox patches -Patch30: firefox-4.0-moz-app-launcher.patch -Patch31: firefox-4.0-gnome3.patch +# build patches +Patch0: xulrunner-version.patch +Patch1: mozilla-build.patch +Patch9: mozilla-build-sbrk.patch +Patch12: xulrunner-2.0-64bit-big-endian.patch +Patch13: xulrunner-2.0-secondary-jit.patch +Patch14: xulrunner-2.0-chromium-types.patch + +# Fedora specific patches +Patch20: mozilla-193-pkgconfig.patch +Patch21: mozilla-libjpeg-turbo.patch +Patch23: wmclass.patch +Patch24: crashreporter-remove-static.patch + +# Upstream patches +Patch32: firefox-4.0-moz-app-launcher.patch +Patch33: firefox-4.0-gnome3.patch +Patch34: xulrunner-2.0-network-link-service.patch +Patch35: xulrunner-2.0-NetworkManager09.patch +Patch36: xulrunner-omnijar.patch + +# BlueGriffon patches +Patch100: bluegriffon-build.patch + BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) BuildRequires: desktop-file-utils -BuildRequires: system-bookmarks BuildRequires: yasm -BuildRequires: gecko-devel = %{gecko_version} +%if 0%{?gecko_version:1} %if %{fedora} >= 15 %global xulbin xulrunner %global grecnf gre %else %global xulbin xulrunner2 %global grecnf gre2 -%endif +BuildRequires: gecko-devel = %{gecko_version} Requires: gecko-libs%{?_isa} = %{gecko_version} +%endif +%else +%if %{fedora} >= 13 +BuildRequires: nspr-devel >= %{nspr_version} +BuildRequires: nss-devel >= %{nss_version} +%endif +%if %{fedora} >= 15 +BuildRequires: cairo-devel >= %{cairo_version} +%endif +BuildRequires: libpng-devel +BuildRequires: libjpeg-devel +BuildRequires: zip +BuildRequires: bzip2-devel +BuildRequires: zlib-devel +BuildRequires: libIDL-devel +BuildRequires: gtk2-devel +BuildRequires: krb5-devel +BuildRequires: pango-devel +BuildRequires: freetype-devel >= %{freetype_version} +BuildRequires: libXt-devel +BuildRequires: libXrender-devel +%if %{fedora} >= 11 +BuildRequires: hunspell-devel +%endif +%if %{fedora} >= 15 +BuildRequires: sqlite-devel >= %{sqlite_version} +%endif +BuildRequires: startup-notification-devel +BuildRequires: alsa-lib-devel +BuildRequires: libnotify-devel +BuildRequires: mesa-libGL-devel +BuildRequires: yasm +BuildRequires: libcurl-devel +BuildRequires: lcms-devel >= %{lcms_version} +%if %{fedora} >= 13 +BuildRequires: libvpx-devel +%endif +%endif %description BlueGriffon is a new WYSIWYG content editor for the World Wide Web. @@ -90,16 +153,41 @@ normes w3c. %prep echo TARGET %{name}-%{version}-%{release} +%if 0%{?gecko_version:1} +echo use GECKO %{gecko_version} +%else +echo use Bundled GECKO +%endif %setup -q -n %{tarballdir} tar xjf %{SOURCE1} tar xjf %{SOURCE2} --directory %{name} -%patch0 -p0 -b .build +sed -e 's/__RPM_VERSION_INTERNAL__/%{gecko_dir_ver}/' %{P:%%PATCH0} \ + > version.patch +%{__patch} -p1 -b --suffix .version --fuzz=0 < version.patch -# Upstream patches -%patch30 -p1 -b .moz-app-launcher -%patch31 -p1 -b .gnome3 +%patch1 -p2 -b .build +%patch9 -p2 -b .sbrk +%patch12 -p2 -b .64bit-big-endian +%patch13 -p2 -b .secondary-jit +%patch14 -p2 -b .chromium-types + +%patch20 -p2 -b .pk +%patch21 -p2 -b .jpeg-turbo +%patch23 -p1 -b .wmclass +%patch24 -p1 -b .static + +%patch32 -p1 -b .moz-app-launcher +%patch33 -p1 -b .gnome3 +%patch34 -p1 -b .network-link-service +%patch35 -p1 -b .NetworkManager09 +%patch36 -p1 -b .omnijar + +%patch100 -p0 -b .build + +# Patch provided in bluegriffon sources +patch -p1 <bluegriffon/config/content.patch #See http://bluegriffon.org/pages/Build-BlueGriffon @@ -126,22 +214,9 @@ ac_add_options --enable-system-hunspell %if %{fedora} >= 15 ac_add_options --enable-system-cairo %endif -%if %{fedora} >= 10 ac_add_options --enable-libnotify -%else -ac_add_options --disable-libnotify -%endif -%if %{fedora} >= 9 ac_add_options --enable-system-lcms -%endif -%if %{fedora} >= 15 -# Official Fedora Xulrunner don't have it ac_add_options --disable-necko-wifi -%endif -%ifarch ppc ppc64 -ac_add_options --disable-necko-wifi -ac_add_options --disable-ipc -%endif ac_add_options --with-system-jpeg ac_add_options --with-system-zlib ac_add_options --with-system-bz2 @@ -158,7 +233,7 @@ ac_add_options --disable-static ac_add_options --disable-mochitest ac_add_options --disable-installer ac_add_options --disable-debug -ac_add_options --enable-optimize="\$MOZ_OPT_FLAGS" +ac_add_options --enable-optimize ac_add_options --enable-xinerama ac_add_options --enable-default-toolkit=cairo-gtk2 ac_add_options --disable-xprint @@ -172,16 +247,17 @@ ac_add_options --enable-safe-browsing ac_add_options --disable-updater ac_add_options --enable-gio ac_add_options --disable-gnomevfs -ac_add_options --enable-libxul EOF_MOZCONFIG echo "" >> .mozconfig +%if 0%{?gecko_version:1} echo "ac_add_options --with-libxul-sdk=\ $(pkg-config --variable=sdkdir libxul)" >> .mozconfig +%endif %build -MOZ_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | \ +MOZ_OPT_FLAGS=$(echo $RPM_OPT_FLAGS -fpermissive | \ %{__sed} -e 's/-Wall//' -e 's/-fexceptions/-fno-exceptions/g') export CFLAGS=$MOZ_OPT_FLAGS export CXXFLAGS=$MOZ_OPT_FLAGS @@ -209,6 +285,7 @@ tar --create --file - --dereference --directory=dist/bin --exclude xulrunner . \ | tar --extract --file - --directory $RPM_BUILD_ROOT/%{mozappdir} # Launcher +%if 0%{?gecko_version:1} install -d -m 755 $RPM_BUILD_ROOT%{_bindir} XULRUNNER_DIR=`pkg-config --variable=libdir libxul | %{__sed} -e "s,%{_libdir},,g"` %{__cat} %{SOURCE10} | %{__sed} -e "s,XULRUNNER_DIRECTORY,$XULRUNNER_DIR,g" \ @@ -216,6 +293,9 @@ XULRUNNER_DIR=`pkg-config --variable=libdir libxul | %{__sed} -e "s,%{_libdir},, | %{__sed} -e "s,GRE_CONFIG,%{grecnf},g" \ > $RPM_BUILD_ROOT%{_bindir}/%{name} %{__chmod} 755 $RPM_BUILD_ROOT%{_bindir}/%{name} +%else +install -D -m 755 %{SOURCE11} $RPM_BUILD_ROOT%{_bindir}/%{name} +%endif # Shortcut desktop-file-install \ @@ -264,6 +344,12 @@ update-desktop-database &> /dev/null || : %changelog +* Wed May 4 2011 Remi Collet <rpms@famillecollet.com> - 1.0-3 +- rebuild with bundled xulrunnner + +* Wed May 4 2011 Remi Collet <rpms@famillecollet.com> - 1.0-2 +- BlueGriffon 1.0 "Zephyr" (tags/1.0RC4 which is 1.0 finale) + * Sun May 1 2011 Remi Collet <rpms@famillecollet.com> - 1.0-1 - bluegriffon 1.0 (tags/1.0 + locales 58) diff --git a/crashreporter-remove-static.patch b/crashreporter-remove-static.patch new file mode 100644 index 0000000..b94d165 --- /dev/null +++ b/crashreporter-remove-static.patch @@ -0,0 +1,11 @@ +diff -up comm-1.9.2/mozilla/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/Makefile.in.static comm-1.9.2/mozilla/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/Makefile.in +--- mozilla/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/Makefile.in.static 2010-06-23 19:47:11.000000000 +0200 ++++ mozilla/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/Makefile.in 2010-07-12 15:51:41.000000000 +0200 +@@ -64,6 +64,6 @@ FORCE_USE_PIC = 1 + + #XXX: bug 554854 causes us to be unable to run binaries on the build slaves + # due to them having an older libstdc++ +-HOST_LDFLAGS += -static ++#HOST_LDFLAGS += -static + + include $(topsrcdir)/config/rules.mk diff --git a/mozilla-193-pkgconfig.patch b/mozilla-193-pkgconfig.patch new file mode 100644 index 0000000..c17c89b --- /dev/null +++ b/mozilla-193-pkgconfig.patch @@ -0,0 +1,73 @@ +diff -up xulrunner-1.9.3.0/mozilla-central/config/autoconf.mk.in.pk xulrunner-1.9.3.0/mozilla-central/config/autoconf.mk.in +--- xulrunner-1.9.3.0/mozilla-central/config/autoconf.mk.in.pk 2010-08-06 03:09:27.000000000 +0200 ++++ xulrunner-1.9.3.0/mozilla-central/config/autoconf.mk.in 2010-08-16 11:07:52.000000000 +0200 +@@ -58,14 +58,14 @@ MOZ_PKG_SPECIAL = @MOZ_PKG_SPECIAL@ + prefix = @prefix@ + exec_prefix = @exec_prefix@ + bindir = @bindir@ +-includedir = @includedir@/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION) ++includedir = @includedir@/$(MOZ_APP_NAME)-sdk-$(MOZ_APP_VERSION) + libdir = @libdir@ + datadir = @datadir@ + mandir = @mandir@ +-idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION) ++idldir = $(datadir)/idl/$(MOZ_APP_NAME)-sdk-$(MOZ_APP_VERSION) + + installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION) +-sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION) ++sdkdir = $(libdir)/$(MOZ_APP_NAME)-sdk-$(MOZ_APP_VERSION) + + DIST = $(DEPTH)/dist + LIBXUL_SDK = @LIBXUL_SDK@ +diff -up xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul-embedding.pc.in.pk xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul-embedding.pc.in +--- xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul-embedding.pc.in.pk 2010-08-06 03:09:24.000000000 +0200 ++++ xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul-embedding.pc.in 2010-08-16 11:12:32.000000000 +0200 +@@ -6,5 +6,6 @@ idldir=%idldir% + Name: libxul-embedding + Description: Static library for version-independent embedding of the Mozilla runtime + Version: %MOZILLA_VERSION% ++Requires: %NSPR_NAME% >= %NSPR_VERSION% + Libs: -L${sdkdir}/lib -lxpcomglue -ldl + Cflags: -DXPCOM_GLUE -I${includedir} %WCHAR_CFLAGS% +diff -up xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul.pc.in.pk xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul.pc.in +--- xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul.pc.in.pk 2010-08-06 03:09:24.000000000 +0200 ++++ xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/libxul.pc.in 2010-08-16 11:07:52.000000000 +0200 +@@ -2,6 +2,7 @@ prefix=%prefix% + sdkdir=%sdkdir% + includedir=%includedir% + idldir=%idldir% ++libdir=%libdir% + + Name: libxul + Description: The Mozilla Runtime and Embedding Engine +diff -up xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/Makefile.in.pk xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/Makefile.in +--- xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/Makefile.in.pk 2010-08-16 11:07:52.000000000 +0200 ++++ xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/Makefile.in 2010-08-16 11:07:52.000000000 +0200 +@@ -116,6 +116,7 @@ endif + -e "s|%includedir%|$(includedir)|" \ + -e "s|%idldir%|$(idldir)|" \ + -e "s|%sdkdir%|$(sdkdir)|" \ ++ -e "s|%libdir%|$(installdir)|" \ + -e "s|%MOZ_APP_NAME%|$(MOZ_APP_NAME)|" \ + -e "s|%MOZILLA_VERSION%|$(MOZ_APP_VERSION)|" \ + -e "s|%WCHAR_CFLAGS%|$(WCHAR_CFLAGS)|" \ +diff -up xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in.pk xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in +--- xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in.pk 2010-08-06 03:09:24.000000000 +0200 ++++ xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/mozilla-gtkmozembed-embedding.pc.in 2010-08-16 11:07:52.000000000 +0200 +@@ -1,5 +1,6 @@ + prefix=%prefix% + sdkdir=%sdkdir% ++libdir=%libdir% + includedir=%includedir% + + Name: mozilla-gtkembedmoz +diff -up xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/mozilla-gtkmozembed.pc.in.pk xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/mozilla-gtkmozembed.pc.in +--- xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/mozilla-gtkmozembed.pc.in.pk 2010-08-06 03:09:24.000000000 +0200 ++++ xulrunner-1.9.3.0/mozilla-central/xulrunner/installer/mozilla-gtkmozembed.pc.in 2010-08-16 11:07:52.000000000 +0200 +@@ -1,5 +1,6 @@ + prefix=%prefix% + sdkdir=%sdkdir% ++libdir=%libdir% + includedir=%includedir% + + Name: mozilla-gtkembedmoz diff --git a/firefox4-build-sbrk.patch b/mozilla-build-sbrk.patch index 7e8f8c9..7e8f8c9 100644 --- a/firefox4-build-sbrk.patch +++ b/mozilla-build-sbrk.patch diff --git a/firefox4-build.patch b/mozilla-build.patch index 065ca9f..065ca9f 100644 --- a/firefox4-build.patch +++ b/mozilla-build.patch diff --git a/firefox4-libjpeg-turbo.patch b/mozilla-libjpeg-turbo.patch index 54be1a1..54be1a1 100644 --- a/firefox4-libjpeg-turbo.patch +++ b/mozilla-libjpeg-turbo.patch diff --git a/mozilla-malloc.patch b/mozilla-malloc.patch deleted file mode 100644 index ffb4e53..0000000 --- a/mozilla-malloc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up xulrunner-1.9.3.0/mozilla-central/memory/mozalloc/mozalloc.h.old xulrunner-1.9.3.0/mozilla-central/memory/mozalloc/mozalloc.h ---- xulrunner-1.9.3.0/mozilla-central/memory/mozalloc/mozalloc.h.old 2010-08-06 03:09:14.000000000 +0200 -+++ xulrunner-1.9.3.0/mozilla-central/memory/mozalloc/mozalloc.h 2010-08-17 11:15:40.000000000 +0200 -@@ -214,7 +214,7 @@ MOZALLOC_EXPORT void* moz_valloc(size_t - #define MOZALLOC_THROW_IF_HAS_EXCEPTIONS throw() - #endif - --#ifdef MOZ_CPP_EXCEPTIONS -+#if 1 - #define MOZALLOC_THROW_BAD_ALLOC throw(std::bad_alloc) - #else - #define MOZALLOC_THROW_BAD_ALLOC MOZALLOC_THROW_IF_HAS_EXCEPTIONS diff --git a/mozilla-notify.patch b/mozilla-notify.patch deleted file mode 100644 index 7c865de..0000000 --- a/mozilla-notify.patch +++ /dev/null @@ -1,40 +0,0 @@ -https://bugzilla.mozilla.org/show_bug.cgi?id=628222 - -# HG changeset patch -# User Priit Laes <plaes@plaes.org> -# Date 1295907218 -7200 -# Node ID ebfe5822e8916cce3d1811e67f6cb95ba3caeb24 -# Parent e874889e43d1b40f16c8234d53f39126a04e6621 -Add support for libnotify-0.7+ - -diff -r e874889e43d1 -r ebfe5822e891 toolkit/system/gnome/nsAlertsIconListener.cpp ---- a/toolkit/system/gnome/nsAlertsIconListener.cpp Fri Jan 21 16:45:23 2011 -0500 -+++ b/toolkit/system/gnome/nsAlertsIconListener.cpp Tue Jan 25 00:13:38 2011 +0200 -@@ -46,6 +46,11 @@ - - #include <gdk/gdk.h> - -+// Compatibility macro for <libnotify-0.7 -+#ifndef NOTIFY_CHECK_VERSION -+#define NOTIFY_CHECK_VERSION(x,y,z) 0 -+#endif -+ - static PRBool gHasActions = PR_FALSE; - - static void notify_action_cb(NotifyNotification *notification, -@@ -218,7 +223,13 @@ - { - mNotification = notify_notification_new(mAlertTitle.get(), - mAlertText.get(), -- NULL, NULL); -+ NULL -+// >=libnotify-0.7.0 has no support for attaching to widgets -+#if !NOTIFY_CHECK_VERSION(0,7,0) -+ , NULL -+#endif -+ ); -+ - if (!mNotification) - return NS_ERROR_OUT_OF_MEMORY; - - diff --git a/wmclass.patch b/wmclass.patch new file mode 100644 index 0000000..5fe76ac --- /dev/null +++ b/wmclass.patch @@ -0,0 +1,29 @@ +# +# Online Desktop expects WMCLASS to match the .desktop file +# Since renaming the .desktop file is bad, work around this here +# + +diff -up ./widget/src/gtk2/nsWindow.cpp.wmclass ./widget/src/gtk2/nsWindow.cpp +--- ./widget/src/gtk2/nsWindow.cpp.wmclass 2010-10-25 11:33:21.649433261 -0700 ++++ ./widget/src/gtk2/nsWindow.cpp 2010-10-25 11:36:19.864431870 -0700 +@@ -3738,6 +3738,10 @@ nsWindow::Create(nsIWidget *aPare + GetBrandName(brandName); + NS_ConvertUTF16toUTF8 cBrand(brandName); + ++ if (brandName.EqualsLiteral("Minefield")) { ++ cBrand.Assign("Firefox"); ++ } ++ + if (mWindowType == eWindowType_dialog) { + mShell = gtk_window_new(GTK_WINDOW_TOPLEVEL); + SetDefaultIcon(); +@@ -4109,6 +4113,9 @@ nsWindow::SetWindowClass(const nsAString + #ifdef MOZ_X11 + nsXPIDLString brandName; + GetBrandName(brandName); ++ if (brandName.EqualsLiteral("Minefield")) { ++ brandName.AssignLiteral("Firefox"); ++ } + + XClassHint *class_hint = XAllocClassHint(); + if (!class_hint) diff --git a/xulrunner-2.0-NetworkManager09.patch b/xulrunner-2.0-NetworkManager09.patch new file mode 100644 index 0000000..317a1b4 --- /dev/null +++ b/xulrunner-2.0-NetworkManager09.patch @@ -0,0 +1,51 @@ +https://bugzilla.mozilla.org/show_bug.cgi?id=639959 + +--- source/toolkit/system/dbus/nsNetworkManagerListener.cpp.foo 2011-03-08 14:26:28.167074923 -0600 ++++ source/toolkit/system/dbus/nsNetworkManagerListener.cpp 2011-03-08 14:30:54.260748294 -0600 +@@ -51,15 +51,13 @@ + #define NM_DBUS_SERVICE "org.freedesktop.NetworkManager" + #define NM_DBUS_PATH "/org/freedesktop/NetworkManager" + #define NM_DBUS_INTERFACE "org.freedesktop.NetworkManager" +-#define NM_DBUS_SIGNAL_STATE_CHANGE "StateChange" +-typedef enum NMState +-{ +- NM_STATE_UNKNOWN = 0, +- NM_STATE_ASLEEP, +- NM_STATE_CONNECTING, +- NM_STATE_CONNECTED, +- NM_STATE_DISCONNECTED +-} NMState; ++#define NM_DBUS_SIGNAL_STATE_CHANGE "StateChange" /* Deprecated in 0.7.x */ ++#define NM_DBUS_SIGNAL_STATE_CHANGED "StateChanged" ++ ++#define NM_STATE_CONNECTED_OLD 3 ++#define NM_STATE_CONNECTED_LOCAL 50 ++#define NM_STATE_CONNECTED_SITE 60 ++#define NM_STATE_CONNECTED_GLOBAL 70 + + nsNetworkManagerListener::nsNetworkManagerListener() : + mLinkUp(PR_TRUE), mNetworkManagerActive(PR_FALSE), +@@ -174,7 +172,9 @@ + PRBool + nsNetworkManagerListener::HandleMessage(DBusMessage* message) { + if (dbus_message_is_signal(message, NM_DBUS_INTERFACE, +- NM_DBUS_SIGNAL_STATE_CHANGE)) { ++ NM_DBUS_SIGNAL_STATE_CHANGE) || ++ dbus_message_is_signal(message, NM_DBUS_INTERFACE, ++ NM_DBUS_SIGNAL_STATE_CHANGED)) { + UpdateNetworkStatus(message); + return PR_TRUE; + } +@@ -191,7 +191,10 @@ + mNetworkManagerActive = PR_TRUE; + + PRBool wasUp = mLinkUp; +- mLinkUp = result == NM_STATE_CONNECTED; ++ mLinkUp = (result == NM_STATE_CONNECTED_OLD) || ++ (result == NM_STATE_CONNECTED_LOCAL) || ++ (result == NM_STATE_CONNECTED_SITE) || ++ (result == NM_STATE_CONNECTED_GLOBAL); + if (wasUp == mLinkUp) + return; + + diff --git a/xulrunner-2.0-network-link-service.patch b/xulrunner-2.0-network-link-service.patch new file mode 100644 index 0000000..bdd1e2f --- /dev/null +++ b/xulrunner-2.0-network-link-service.patch @@ -0,0 +1,271 @@ +https://bugzilla.mozilla.org/show_bug.cgi?id=627672 + +diff -p -U8 mozilla-2.0/netwerk/base/src/nsIOService.cpp.network-link-service mozilla-2.0/netwerk/base/src/nsIOService.cpp +--- mozilla-2.0/netwerk/base/src/nsIOService.cpp.network-link-service 2011-03-18 16:34:03.000000000 -0700 ++++ mozilla-2.0/netwerk/base/src/nsIOService.cpp 2011-04-03 21:40:34.787142329 -0700 +@@ -160,31 +160,33 @@ PRInt16 gBadPortList[] = { + 2049, // nfs + 4045, // lockd + 6000, // x11 + 0, // This MUST be zero so that we can populating the array + }; + + static const char kProfileChangeNetTeardownTopic[] = "profile-change-net-teardown"; + static const char kProfileChangeNetRestoreTopic[] = "profile-change-net-restore"; ++static const char kStartupTopic[] = "profile-after-change"; + + // Necko buffer cache + nsIMemory* nsIOService::gBufferCache = nsnull; + PRUint32 nsIOService::gDefaultSegmentSize = 4096; + PRUint32 nsIOService::gDefaultSegmentCount = 24; + + //////////////////////////////////////////////////////////////////////////////// + + nsIOService::nsIOService() + : mOffline(PR_TRUE) + , mOfflineForProfileChange(PR_FALSE) + , mManageOfflineStatus(PR_TRUE) + , mSettingOffline(PR_FALSE) + , mSetOfflineValue(PR_FALSE) + , mShutdown(PR_FALSE) ++ , mNetworkLinkServiceInitialized(PR_FALSE) + , mChannelEventSinks(NS_CHANNEL_EVENT_SINK_CATEGORY) + , mContentSniffers(NS_CONTENT_SNIFFER_CATEGORY) + { + } + + nsresult + nsIOService::Init() + { +@@ -229,16 +231,17 @@ nsIOService::Init() + } + + // Register for profile change notifications + nsCOMPtr<nsIObserverService> observerService = + mozilla::services::GetObserverService(); + if (observerService) { + observerService->AddObserver(this, kProfileChangeNetTeardownTopic, PR_TRUE); + observerService->AddObserver(this, kProfileChangeNetRestoreTopic, PR_TRUE); ++ observerService->AddObserver(this, kStartupTopic, PR_TRUE); + observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE); + observerService->AddObserver(this, NS_NETWORK_LINK_TOPIC, PR_TRUE); + } + else + NS_WARNING("failed to get observer service"); + + NS_TIME_FUNCTION_MARK("Registered observers"); + +@@ -257,32 +260,20 @@ nsIOService::Init() + NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Was unable to allocate. No gBufferCache."); + CallQueryInterface(recyclingAllocator, &gBufferCache); + } + + NS_TIME_FUNCTION_MARK("Set up the recycling allocator"); + + gIOService = this; + +-#ifdef MOZ_IPC +- // go into managed mode if we can, and chrome process +- if (XRE_GetProcessType() == GeckoProcessType_Default) +-#endif +- mNetworkLinkService = do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID); ++ // We can't really determine if the machine has a usable network connection, ++ // (mNetworkLinkService will be initialized later) so let's cross our fingers! ++ SetOffline(PR_FALSE); + +- if (!mNetworkLinkService) +- // We can't really determine if the machine has a usable network connection, +- // so let's cross our fingers! +- mManageOfflineStatus = PR_FALSE; +- +- if (mManageOfflineStatus) +- TrackNetworkLinkStatusForOffline(); +- else +- SetOffline(PR_FALSE); +- + NS_TIME_FUNCTION_MARK("Set up network link service"); + + return NS_OK; + } + + + nsIOService::~nsIOService() + { +@@ -306,16 +293,54 @@ nsIOService::InitializeSocketTransportSe + if (mSocketTransportService) { + rv = mSocketTransportService->Init(); + NS_ASSERTION(NS_SUCCEEDED(rv), "socket transport service init failed"); + } + + return rv; + } + ++nsresult ++nsIOService::InitializeNetworkLinkService() ++{ ++ NS_TIME_FUNCTION; ++ ++ nsresult rv = NS_OK; ++ ++ if (mNetworkLinkServiceInitialized) ++ return rv; ++ ++#ifdef MOZ_IPC ++ // go into managed mode if we can, and chrome process ++ if (XRE_GetProcessType() == GeckoProcessType_Default) ++#endif ++ { ++ mNetworkLinkService = do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID, &rv); ++ if (NS_FAILED(rv)) { ++ NS_WARNING("failed to get network link service"); ++ return rv; ++ } ++ } ++ ++ mNetworkLinkServiceInitialized = PR_TRUE; ++ ++ if (!mNetworkLinkService) { ++ // We can't really determine if the machine has a usable network connection, ++ // so let's cross our fingers! ++ mManageOfflineStatus = PR_FALSE; ++ } ++ ++ if (mManageOfflineStatus) ++ TrackNetworkLinkStatusForOffline(); ++ else ++ SetOffline(PR_FALSE); ++ ++ return rv; ++} ++ + nsIOService* + nsIOService::GetInstance() { + if (!gIOService) { + gIOService = new nsIOService(); + if (!gIOService) + return nsnull; + NS_ADDREF(gIOService); + +@@ -658,16 +683,19 @@ nsIOService::NewChannel(const nsACString + if (NS_FAILED(rv)) return rv; + + return NewChannelFromURI(uri, result); + } + + PRBool + nsIOService::IsLinkUp() + { ++ NS_ASSERTION(mNetworkLinkServiceInitialized, ++ "network link service should be initialized"); ++ + if (!mNetworkLinkService) { + // We cannot decide, assume the link is up + return PR_TRUE; + } + + PRBool isLinkUp; + nsresult rv; + rv = mNetworkLinkService->GetIsLinkUp(&isLinkUp); +@@ -938,16 +966,20 @@ nsIOService::Observe(nsISupports *subjec + if (mOfflineForProfileChange) { + mOfflineForProfileChange = PR_FALSE; + if (!mManageOfflineStatus || + NS_FAILED(TrackNetworkLinkStatusForOffline())) { + SetOffline(PR_FALSE); + } + } + } ++ else if (!strcmp(topic, kStartupTopic)) { ++ // Lazy initialization of network link service (see bug 620472) ++ InitializeNetworkLinkService(); ++ } + else if (!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { + // Remember we passed XPCOM shutdown notification to prevent any + // changes of the offline status from now. We must not allow going + // online after this point. + mShutdown = PR_TRUE; + + SetOffline(PR_TRUE); + +@@ -1055,32 +1087,42 @@ nsIOService::NewSimpleNestedURI(nsIURI* + NS_IF_ADDREF(*aResult = new nsSimpleNestedURI(safeURI)); + return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY; + } + + NS_IMETHODIMP + nsIOService::SetManageOfflineStatus(PRBool aManage) { + PRBool wasManaged = mManageOfflineStatus; + mManageOfflineStatus = aManage; ++ ++ if (!mNetworkLinkServiceInitialized) { ++ nsresult rv = InitializeNetworkLinkService(); ++ if (NS_FAILED(rv)) ++ return rv; ++ } ++ + if (mManageOfflineStatus && !wasManaged) + return TrackNetworkLinkStatusForOffline(); + return NS_OK; + } + + NS_IMETHODIMP + nsIOService::GetManageOfflineStatus(PRBool* aManage) { + *aManage = mManageOfflineStatus; + return NS_OK; + } + + nsresult + nsIOService::TrackNetworkLinkStatusForOffline() + { + NS_ASSERTION(mManageOfflineStatus, + "Don't call this unless we're managing the offline status"); ++ NS_ASSERTION(mNetworkLinkServiceInitialized, ++ "network link service should be set up"); ++ + if (!mNetworkLinkService) + return NS_ERROR_FAILURE; + + if (mShutdown) + return NS_ERROR_NOT_AVAILABLE; + + // check to make sure this won't collide with Autodial + if (mSocketTransportService) { +diff -p -U8 mozilla-2.0/netwerk/base/src/nsIOService.h.network-link-service mozilla-2.0/netwerk/base/src/nsIOService.h +--- mozilla-2.0/netwerk/base/src/nsIOService.h.network-link-service 2011-03-18 16:34:03.000000000 -0700 ++++ mozilla-2.0/netwerk/base/src/nsIOService.h 2011-04-03 21:34:34.608645179 -0700 +@@ -129,16 +129,17 @@ private: + nsIProtocolHandler* hdlr); + + // Prefs wrangling + NS_HIDDEN_(void) PrefsChanged(nsIPrefBranch *prefs, const char *pref = nsnull); + NS_HIDDEN_(void) GetPrefBranch(nsIPrefBranch2 **); + NS_HIDDEN_(void) ParsePortList(nsIPrefBranch *prefBranch, const char *pref, PRBool remove); + + nsresult InitializeSocketTransportService(); ++ nsresult InitializeNetworkLinkService(); + + private: + PRPackedBool mOffline; + PRPackedBool mOfflineForProfileChange; + PRPackedBool mManageOfflineStatus; + + // Used to handle SetOffline() reentrancy. See the comment in + // SetOffline() for more details. +@@ -146,16 +147,17 @@ private: + PRPackedBool mSetOfflineValue; + + PRPackedBool mShutdown; + + nsCOMPtr<nsPISocketTransportService> mSocketTransportService; + nsCOMPtr<nsPIDNSService> mDNSService; + nsCOMPtr<nsIProtocolProxyService2> mProxyService; + nsCOMPtr<nsINetworkLinkService> mNetworkLinkService; ++ PRPackedBool mNetworkLinkServiceInitialized; + + // Cached protocol handlers + nsWeakPtr mWeakHandler[NS_N(gScheme)]; + + // cached categories + nsCategoryCache<nsIChannelEventSink> mChannelEventSinks; + nsCategoryCache<nsIContentSniffer> mContentSniffers; + diff --git a/xulrunner-2.0-system-cairo-tee.patch b/xulrunner-2.0-system-cairo-tee.patch deleted file mode 100644 index 85c8447..0000000 --- a/xulrunner-2.0-system-cairo-tee.patch +++ /dev/null @@ -1,29 +0,0 @@ -https://bugzilla.mozilla.org/show_bug.cgi?id=623797 - -# HG changeset patch -# User Jory A. Pratt (anarchy@gentoo.org) -# Parent b27366868c807e07a11741a7a2eb404ebc08e5e7 -Check to ensure system cairo has tee backend support, part 2 bug #623797 - -diff --git a/configure.in b/configure.in ---- a/configure.in -+++ b/configure.in -@@ -8714,16 +8714,17 @@ if test "$MOZ_TREE_CAIRO"; then - - CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h - mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null - - else - PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig) - MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS - MOZ_CAIRO_LIBS=$CAIRO_LIBS -+ PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION) - if test "$MOZ_X11"; then - PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION) - MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS" - MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS" - fi - fi - - AC_SUBST(MOZ_TREE_CAIRO) - diff --git a/xulrunner-2.0-system-cairo.patch b/xulrunner-2.0-system-cairo.patch deleted file mode 100644 index 5300f38..0000000 --- a/xulrunner-2.0-system-cairo.patch +++ /dev/null @@ -1,137 +0,0 @@ -https://bugzilla.mozilla.org/show_bug.cgi?id=623797 - -work around new features that are not avaliable in system-cairo on linux -(romaxa's original patch with modifications to use cairo-tee) - -diff --git a/config/system-headers b/config/system-headers ---- a/config/system-headers -+++ b/config/system-headers -@@ -81,16 +81,17 @@ pixman.h - cairo.h - cairo-atsui.h - cairo-beos.h - cairo-ft.h - cairo-glitz.h - cairo-os2.h - cairo-pdf.h - cairo-ps.h -+cairo-tee.h - cairo-quartz.h - cairo-win32.h - cairo-xlib.h - cairo-xlib-xrender.h - cairo-directfb.h - cairo-qpainter.h - #endif - dfiff.h -diff --git a/gfx/thebes/gfxASurface.cpp b/gfx/thebes/gfxASurface.cpp ---- a/gfx/thebes/gfxASurface.cpp -+++ b/gfx/thebes/gfxASurface.cpp -@@ -216,19 +216,21 @@ gfxASurface::Init(cairo_surface_t* surfa - - mSurface = surface; - mSurfaceValid = PR_TRUE; - - if (existingSurface) { - mFloatingRefs = 0; - } else { - mFloatingRefs = 1; -+#ifdef MOZ_TREE_CAIRO - if (cairo_surface_get_content(surface) != CAIRO_CONTENT_COLOR) { - cairo_surface_set_subpixel_antialiasing(surface, CAIRO_SUBPIXEL_ANTIALIASING_DISABLED); - } -+#endif - } - } - - gfxASurface::gfxSurfaceType - gfxASurface::GetType() const - { - if (!mSurfaceValid) - return (gfxSurfaceType)-1; -@@ -430,28 +432,34 @@ gfxASurface::FormatFromContent(gfxASurfa - default: - return ImageFormatRGB24; - } - } - - void - gfxASurface::SetSubpixelAntialiasingEnabled(PRBool aEnabled) - { -+#ifdef MOZ_TREE_CAIRO - if (!mSurfaceValid) - return; - cairo_surface_set_subpixel_antialiasing(mSurface, - aEnabled ? CAIRO_SUBPIXEL_ANTIALIASING_ENABLED : CAIRO_SUBPIXEL_ANTIALIASING_DISABLED); -+#endif - } - - PRBool - gfxASurface::GetSubpixelAntialiasingEnabled() - { - if (!mSurfaceValid) - return PR_FALSE; -+#ifdef MOZ_TREE_CAIRO - return cairo_surface_get_subpixel_antialiasing(mSurface) == CAIRO_SUBPIXEL_ANTIALIASING_ENABLED; -+#else -+ return PR_TRUE; -+#endif - } - - PRInt32 - gfxASurface::BytePerPixelFromFormat(gfxImageFormat format) - { - switch (format) { - case ImageFormatARGB32: - case ImageFormatRGB24: -diff --git a/gfx/thebes/gfxTeeSurface.cpp b/gfx/thebes/gfxTeeSurface.cpp ---- a/gfx/thebes/gfxTeeSurface.cpp -+++ b/gfx/thebes/gfxTeeSurface.cpp -@@ -32,17 +32,24 @@ - * 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 "gfxTeeSurface.h" - -+/* Once cairo in tree is update ensure we remove the ifdef -+ and just include cairo-tee.h -+*/ -+#ifdef MOZ_TREE_CAIRO - #include "cairo.h" -+#else -+#include "cairo-tee.h" -+#endif - - gfxTeeSurface::gfxTeeSurface(cairo_surface_t *csurf) - { - Init(csurf, PR_TRUE); - } - - gfxTeeSurface::gfxTeeSurface(gfxASurface **aSurfaces, PRInt32 aSurfaceCount) - { -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 -@@ -82,16 +82,17 @@ cairo.h - cairo-atsui.h - cairo-beos.h - cairo-ft.h - cairo-glitz.h - cairo-os2.h - cairo-pdf.h - cairo-ps.h - cairo-quartz.h -+cairo-tee.h - cairo-win32.h - cairo-xlib.h - cairo-xlib-xrender.h - cairo-directfb.h - cairo-qpainter.h - #endif - dfiff.h - exception - - diff --git a/xulrunner-omnijar.patch b/xulrunner-omnijar.patch new file mode 100644 index 0000000..66ec520 --- /dev/null +++ b/xulrunner-omnijar.patch @@ -0,0 +1,1737 @@ +# HG changeset patch +# Parent a7dea879b4b445a23186f438900562155bb39e99 +Bug 620931 part 1 - Use chrome manifest to register resource://gre-resources/ + +diff --git a/layout/style/jar.mn b/layout/style/jar.mn +--- a/layout/style/jar.mn ++++ b/layout/style/jar.mn +@@ -1,8 +1,10 @@ + toolkit.jar: + * res/ua.css (ua.css) + res/html.css (html.css) + res/quirk.css (quirk.css) + res/viewsource.css (viewsource.css) + * res/forms.css (forms.css) + res/arrow.gif (arrow.gif) + res/arrowd.gif (arrowd.gif) ++ ++% resource gre-resources %res/ +diff --git a/netwerk/protocol/res/nsResProtocolHandler.cpp b/netwerk/protocol/res/nsResProtocolHandler.cpp +--- a/netwerk/protocol/res/nsResProtocolHandler.cpp ++++ b/netwerk/protocol/res/nsResProtocolHandler.cpp +@@ -75,17 +75,16 @@ static nsResProtocolHandler *gResHandler + // + // this enables PR_LOG_ALWAYS level information and places all output in + // the file log.txt + // + static PRLogModuleInfo *gResLog; + #endif + + #define kGRE NS_LITERAL_CSTRING("gre") +-#define kGRE_RESOURCES NS_LITERAL_CSTRING("gre-resources") + + //---------------------------------------------------------------------------- + // nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution + //---------------------------------------------------------------------------- + + nsresult + nsResURL::EnsureFile() + { +@@ -197,28 +196,16 @@ nsResProtocolHandler::Init() + NS_ENSURE_SUCCESS(rv, rv); + + // + // make resource://gre/ point to the GRE directory + // + rv = AddSpecialDir(NS_GRE_DIR, kGRE); + NS_ENSURE_SUCCESS(rv, rv); + +- // make resource://gre-resources/ point to gre toolkit[.jar]/res +- nsCOMPtr<nsIURI> greURI; +- nsCOMPtr<nsIURI> greResURI; +- GetSubstitution(kGRE, getter_AddRefs(greURI)); +-#ifdef MOZ_CHROME_FILE_FORMAT_JAR +- NS_NAMED_LITERAL_CSTRING(strGRE_RES_URL, "jar:chrome/toolkit.jar!/res/"); +-#else +- NS_NAMED_LITERAL_CSTRING(strGRE_RES_URL, "chrome/toolkit/res/"); +-#endif +- rv = mIOService->NewURI(strGRE_RES_URL, nsnull, greURI, +- getter_AddRefs(greResURI)); +- SetSubstitution(kGRE_RESOURCES, greResURI); + //XXXbsmedberg Neil wants a resource://pchrome/ for the profile chrome dir... + // but once I finish multiple chrome registration I'm not sure that it is needed + + // XXX dveditz: resource://pchrome/ defeats profile directory salting + // if web content can load it. Tread carefully. + + return rv; + } +@@ -242,22 +229,16 @@ nsResProtocolHandler::Init(nsIFile *aOmn + // these entries should be kept in sync with the normal Init function + + // resource:/// points to jar:omni.jar!/ + SetSubstitution(EmptyCString(), uri); + + // resource://gre/ points to jar:omni.jar!/ + SetSubstitution(kGRE, uri); + +- urlStr += "chrome/toolkit/res/"; +- rv = mIOService->NewURI(urlStr, nsnull, nsnull, getter_AddRefs(uri)); +- NS_ENSURE_SUCCESS(rv, rv); +- +- // resource://gre-resources/ points to jar:omni.jar!/chrome/toolkit/res/ +- SetSubstitution(kGRE_RESOURCES, uri); + return NS_OK; + } + #endif + + #ifdef MOZ_IPC + static PLDHashOperator + EnumerateSubstitution(const nsACString& aKey, + nsIURI* aURI, +# HG changeset patch +# Parent 3038cccba1a071d6b418e15442d0f2d9f3dcb11d +Bug 620931 part 2 - When building --with-libxul-sdk, use the right preferences directory + +diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in +--- a/browser/locales/Makefile.in ++++ b/browser/locales/Makefile.in +@@ -183,17 +183,17 @@ install:: $(addsuffix .xml,$(SEARCH_PLUG + $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/searchplugins + + + libs-%: + $(NSINSTALL) -D $(DIST)/install + @$(MAKE) -C ../../toolkit/locales libs-$* BOTH_MANIFESTS=1 + @$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1 + @$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1 +- @$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref BOTH_MANIFESTS=1 ++ @$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR) BOTH_MANIFESTS=1 + @$(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) + @echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)." + $(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY) export + $(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx +diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk +--- a/toolkit/mozapps/installer/packager.mk ++++ b/toolkit/mozapps/installer/packager.mk +@@ -307,17 +307,17 @@ OMNIJAR_FILES = \ + res \ + defaults \ + greprefs.js \ + jsloader \ + $(NULL) + + NON_OMNIJAR_FILES += \ + chrome/icons/\* \ +- defaults/pref/channel-prefs.js \ ++ $(PREF_DIR)/channel-prefs.js \ + res/cursors/\* \ + res/MainMenu.nib/\* \ + $(NULL) + + PACK_OMNIJAR = \ + rm -f omni.jar components/binary.manifest && \ + grep -h '^binary-component' components/*.manifest > binary.manifest ; \ + sed -e 's/^binary-component/\#binary-component/' components/components.manifest > components.manifest && \ +# HG changeset patch +# Parent cd8df8030f7ad7530692bd7c4391a8009df56a02 +Bug 620931 part 3 - Allow GRE and XUL application to use omni.jar independently + +We now store two independent locations for an omni.jar, allowing GRE/XRE and +XUL application to each have their own omni.jar. And since xulrunner setups +are very independent from the XUL applications, we implement support for both +omni.jar and non omni.jar cases in the same runtime, with the side effect of +allowing to switch from one to the other manually without rebuilding the +binaries. + +We let the mozilla::Omnijar API handle both cases, so that callers don't need +too much work to support them. + +We also make the preferences service load the same set of preferences in all +the various cases (unified vs. separate, omni.jar vs. no omni.jar). + +The child process launcher for IPC is modified to pass the base directories +needed for the mozilla::Omnijar API initialization in the child process. + +Finally, the startupcache file name canonicalization is modified to separate +APP and GRE resources. + +diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp +--- a/ipc/glue/GeckoChildProcessHost.cpp ++++ b/ipc/glue/GeckoChildProcessHost.cpp +@@ -440,26 +440,29 @@ GeckoChildProcessHost::PerformAsyncLaunc + // other end of the socketpair() from us + + std::vector<std::string> childArgv; + + childArgv.push_back(exePath.value()); + + childArgv.insert(childArgv.end(), aExtraOpts.begin(), aExtraOpts.end()); + +-#ifdef MOZ_OMNIJAR + // Make sure the child process can find the omnijar + // See XRE_InitCommandLine in nsAppRunner.cpp +- nsCAutoString omnijarPath; +- if (mozilla::OmnijarPath()) { +- mozilla::OmnijarPath()->GetNativePath(omnijarPath); +- childArgv.push_back("-omnijar"); +- childArgv.push_back(omnijarPath.get()); ++ nsCAutoString path; ++ nsCOMPtr<nsIFile> file = mozilla::Omnijar::GetBase(mozilla::Omnijar::GRE); ++ if (file && NS_SUCCEEDED(file->GetNativePath(path))) { ++ childArgv.push_back("-grebase"); ++ childArgv.push_back(path.get()); + } +-#endif ++ file = mozilla::Omnijar::GetBase(mozilla::Omnijar::APP); ++ if (file && NS_SUCCEEDED(file->GetNativePath(path))) { ++ childArgv.push_back("-appbase"); ++ childArgv.push_back(path.get()); ++ } + + childArgv.push_back(pidstring); + + #if defined(MOZ_CRASHREPORTER) + # if defined(OS_LINUX) + int childCrashFd, childCrashRemapFd; + if (!CrashReporter::CreateNotificationPipeForChild( + &childCrashFd, &childCrashRemapFd)) +@@ -552,26 +555,29 @@ GeckoChildProcessHost::PerformAsyncLaunc + for (std::vector<std::string>::iterator it = aExtraOpts.begin(); + it != aExtraOpts.end(); + ++it) { + cmdLine.AppendLooseValue(UTF8ToWide(*it)); + } + + cmdLine.AppendLooseValue(std::wstring(mGroupId.get())); + +-#ifdef MOZ_OMNIJAR + // Make sure the child process can find the omnijar + // See XRE_InitCommandLine in nsAppRunner.cpp +- nsAutoString omnijarPath; +- if (mozilla::OmnijarPath()) { +- mozilla::OmnijarPath()->GetPath(omnijarPath); +- cmdLine.AppendLooseValue(UTF8ToWide("-omnijar")); +- cmdLine.AppendLooseValue(omnijarPath.get()); ++ nsAutoString path; ++ nsCOMPtr<nsIFile> file = mozilla::Omnijar::GetBase(mozilla::Omnijar::GRE); ++ if (file && NS_SUCCEEDED(file->GetPath(path))) { ++ cmdLine.AppendLooseValue(UTF8ToWide("-grebase")); ++ cmdLine.AppendLooseValue(path.get()); + } +-#endif ++ file = mozilla::Omnijar::GetBase(mozilla::Omnijar::APP); ++ if (file && NS_SUCCEEDED(file->GetPath(path))) { ++ cmdLine.AppendLooseValue(UTF8ToWide("-appbase")); ++ cmdLine.AppendLooseValue(path.get()); ++ } + + cmdLine.AppendLooseValue(UTF8ToWide(pidstring)); + + #if defined(MOZ_CRASHREPORTER) + cmdLine.AppendLooseValue( + UTF8ToWide(CrashReporter::GetChildNotificationPipe())); + #endif + +diff --git a/js/src/xpconnect/loader/mozJSComponentLoader.cpp b/js/src/xpconnect/loader/mozJSComponentLoader.cpp +--- a/js/src/xpconnect/loader/mozJSComponentLoader.cpp ++++ b/js/src/xpconnect/loader/mozJSComponentLoader.cpp +@@ -81,16 +81,17 @@ + #include "nsIConsoleService.h" + #include "nsIStorageStream.h" + #include "nsIStringStream.h" + #include "prmem.h" + #if defined(XP_WIN) + #include "nsILocalFileWin.h" + #endif + #include "xpcprivate.h" ++#include "nsIResProtocolHandler.h" + + #ifdef MOZ_ENABLE_LIBXUL + #include "mozilla/scache/StartupCache.h" + #include "mozilla/scache/StartupCacheUtils.h" + #endif + #include "mozilla/Omnijar.h" + + #include "jsdbgapi.h" +@@ -621,34 +622,21 @@ mozJSComponentLoader::LoadModule(nsILoca + + const mozilla::Module* + mozJSComponentLoader::LoadModuleFromJAR(nsILocalFile *aJarFile, + const nsACString &aComponentPath) + { + #if !defined(XPCONNECT_STANDALONE) + nsresult rv; + +- nsCAutoString fullSpec; +- +-#ifdef MOZ_OMNIJAR +- PRBool equal; +- rv = aJarFile->Equals(mozilla::OmnijarPath(), &equal); +- if (NS_SUCCEEDED(rv) && equal) { +- fullSpec = "resource://gre/"; +- } else { +-#endif +- nsCAutoString fileSpec; +- NS_GetURLSpecFromActualFile(aJarFile, fileSpec); +- fullSpec = "jar:"; +- fullSpec += fileSpec; +- fullSpec += "!/"; +-#ifdef MOZ_OMNIJAR +- } +-#endif +- ++ nsCAutoString fullSpec, fileSpec; ++ NS_GetURLSpecFromActualFile(aJarFile, fileSpec); ++ fullSpec = "jar:"; ++ fullSpec += fileSpec; ++ fullSpec += "!/"; + fullSpec += aComponentPath; + + nsCOMPtr<nsIURI> uri; + rv = NS_NewURI(getter_AddRefs(uri), fullSpec); + if (NS_FAILED(rv)) + return NULL; + + nsAutoString hashstring; +@@ -833,57 +821,138 @@ class JSScriptHolder + JSScriptHolder(JSContext *cx, JSScript *script) + : mCx(cx), mScript(script) {} + ~JSScriptHolder() { ::JS_DestroyScript(mCx, mScript); } + private: + JSContext *mCx; + JSScript *mScript; + }; + ++static const char baseName[2][5] = { "gre/", "app/" }; ++ ++static inline PRBool ++canonicalizeBase(nsCAutoString &spec, nsACString &out, mozilla::Omnijar::Type aType) ++{ ++ nsCAutoString base; ++ nsresult rv = mozilla::Omnijar::GetURIString(aType, base); ++ ++ if (NS_FAILED(rv) || !base.Length()) ++ return PR_FALSE; ++ ++ if (base.Compare(spec.get(), PR_FALSE, base.Length())) ++ return PR_FALSE; ++ ++ out.Append("/resource/"); ++ out.Append(baseName[aType]); ++ out.Append(Substring(spec, base.Length())); ++ return PR_TRUE; ++} + /** + * PathifyURI transforms mozilla .js uris into useful zip paths + * to make it makes it easier to manipulate startup cache entries + * using standard zip tools. + * Transformations applied: +- * * jsloader/<scheme> prefix is used to group mozJSComponentLoader cache entries in ++ * * jsloader/ prefix is used to group mozJSComponentLoader cache entries in + * a top-level zip directory. +- * * In MOZ_OMNIJAR case resource:/// and resource://gre/ URIs refer to the same path +- * so treat both of them as resource://gre/ ++ * * resource:// URIs are resolved to their corresponding file/jar URI to ++ * canonicalize resources URIs other than gre and app. ++ * * Paths under GRE or APP directory have their base path replaced with ++ * resource/gre or resource/app to avoid depending on install location. ++ * * jar:file:///path/to/file.jar!/sub/path urls are replaced with ++ * /path/to/file.jar/sub/path + * * .bin suffix is added to the end of the path to indicate that jsloader/ entries + * are binary representations of JS source. + * For example: +- * resource://gre/modules/XPCOMUtils.jsm becomes +- * jsloader/resource/gre/modules/XPCOMUtils.jsm.bin ++ * resource://gre/modules/XPCOMUtils.jsm or ++ * file://$GRE_DIR/modules/XPCOMUtils.jsm or ++ * jar:file://$GRE_DIR/omni.jar!/modules/XPCOMUtils.jsm become ++ * jsloader/resource/gre/modules/XPCOMUtils.jsm.bin ++ * file://$PROFILE_DIR/extensions/{uuid}/components/component.js becomes ++ * jsloader/$PROFILE_DIR/extensions/%7Buuid%7D/components/component.js.bin ++ * jar:file://$PROFILE_DIR/extensions/some.xpi!/components/component.js becomes ++ * jsloader/$PROFILE_DIR/extensions/some.xpi/components/component.js.bin + */ + static nsresult + PathifyURI(nsIURI *in, nsACString &out) + { +- out = "jsloader/"; +- nsCAutoString scheme; +- nsresult rv = in->GetScheme(scheme); +- NS_ENSURE_SUCCESS(rv, rv); +- out.Append(scheme); +- nsCAutoString host; +- // OK for GetHost to fail since it's not implemented sometimes +- in->GetHost(host); +-#ifdef MOZ_OMNIJAR +- if (scheme.Equals("resource") && host.Length() == 0){ +- host = "gre"; +- } +-#endif +- if (host.Length()) { +- out.Append("/"); +- out.Append(host); +- } +- nsCAutoString path; +- rv = in->GetPath(path); +- NS_ENSURE_SUCCESS(rv, rv); +- out.Append(path); +- out.Append(".bin"); +- return NS_OK; ++ PRBool equals; ++ nsresult rv; ++ nsCOMPtr<nsIURI> uri = in; ++ nsCAutoString spec; ++ ++ out = "jsloader"; ++ ++ // Resolve resource:// URIs. At the end of this if/else block, we ++ // have both spec and uri variables identifying the same URI. ++ if (NS_SUCCEEDED(in->SchemeIs("resource", &equals)) && equals) { ++ nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCOMPtr<nsIProtocolHandler> ph; ++ rv = ioService->GetProtocolHandler("resource", getter_AddRefs(ph)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCOMPtr<nsIResProtocolHandler> irph(do_QueryInterface(ph, &rv)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ rv = irph->ResolveURI(in, spec); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ rv = ioService->NewURI(spec, nsnull, nsnull, getter_AddRefs(uri)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ } else { ++ rv = in->GetSpec(spec); ++ NS_ENSURE_SUCCESS(rv, rv); ++ } ++ ++ if (!canonicalizeBase(spec, out, mozilla::Omnijar::GRE) && ++ !canonicalizeBase(spec, out, mozilla::Omnijar::APP)) { ++ if (NS_SUCCEEDED(uri->SchemeIs("file", &equals)) && equals) { ++ nsCOMPtr<nsIFileURL> baseFileURL; ++ baseFileURL = do_QueryInterface(uri, &rv); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCAutoString path; ++ rv = baseFileURL->GetPath(path); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ out.Append(path); ++ } else if (NS_SUCCEEDED(uri->SchemeIs("jar", &equals)) && equals) { ++ nsCOMPtr<nsIJARURI> jarURI = do_QueryInterface(uri, &rv); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCOMPtr<nsIURI> jarFileURI; ++ rv = jarURI->GetJARFile(getter_AddRefs(jarFileURI)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCOMPtr<nsIFileURL> jarFileURL; ++ jarFileURL = do_QueryInterface(jarFileURI, &rv); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ nsCAutoString path; ++ rv = jarFileURL->GetPath(path); ++ NS_ENSURE_SUCCESS(rv, rv); ++ out.Append(path); ++ ++ rv = jarURI->GetJAREntry(path); ++ NS_ENSURE_SUCCESS(rv, rv); ++ out.Append("/"); ++ out.Append(path); ++ } else { // Very unlikely ++ nsCAutoString spec; ++ rv = uri->GetSpec(spec); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ out.Append("/"); ++ out.Append(spec); ++ } ++ } ++ ++ out.Append(".bin"); ++ return NS_OK; + } + + /* static */ + #ifdef MOZ_ENABLE_LIBXUL + nsresult + mozJSComponentLoader::ReadScript(StartupCache* cache, nsIURI *uri, + JSContext *cx, JSScript **script) + { +diff --git a/modules/libjar/nsJAR.cpp b/modules/libjar/nsJAR.cpp +--- a/modules/libjar/nsJAR.cpp ++++ b/modules/libjar/nsJAR.cpp +@@ -171,26 +171,23 @@ nsJAR::Open(nsIFile* zipFile) + if (mLock) return NS_ERROR_FAILURE; // Already open! + + mZipFile = zipFile; + mOuterZipEntry.Truncate(); + + mLock = PR_NewLock(); + NS_ENSURE_TRUE(mLock, NS_ERROR_OUT_OF_MEMORY); + +-#ifdef MOZ_OMNIJAR + // The omnijar is special, it is opened early on and closed late + // this avoids reopening it +- PRBool equals; +- nsresult rv = zipFile->Equals(mozilla::OmnijarPath(), &equals); +- if (NS_SUCCEEDED(rv) && equals) { +- mZip = mozilla::OmnijarReader(); ++ nsZipArchive *zip = mozilla::Omnijar::GetReader(zipFile); ++ if (zip) { ++ mZip = zip; + return NS_OK; + } +-#endif + return mZip->OpenArchive(zipFile); + } + + NS_IMETHODIMP + nsJAR::OpenInner(nsIZipReader *aZipReader, const char *aZipEntry) + { + NS_ENSURE_ARG_POINTER(aZipReader); + NS_ENSURE_ARG_POINTER(aZipEntry); +@@ -234,23 +231,22 @@ nsJAR::Close() + mLock = nsnull; + } + + mParsedManifest = PR_FALSE; + mManifestData.Reset(); + mGlobalStatus = JAR_MANIFEST_NOT_PARSED; + mTotalItemsInManifest = 0; + +-#ifdef MOZ_OMNIJAR +- if (mZip == mozilla::OmnijarReader()) { ++ if ((mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE)) || ++ (mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::APP))) { + mZip.forget(); + mZip = new nsZipArchive(); + return NS_OK; + } +-#endif + return mZip->CloseArchive(); + } + + NS_IMETHODIMP + nsJAR::Test(const char *aEntryName) + { + return mZip->Test(aEntryName); + } +@@ -391,22 +387,21 @@ nsJAR::GetInputStreamWithSpec(const nsAC + NS_IMETHODIMP + nsJAR::GetCertificatePrincipal(const char* aFilename, nsIPrincipal** aPrincipal) + { + //-- Parameter check + if (!aPrincipal) + return NS_ERROR_NULL_POINTER; + *aPrincipal = nsnull; + +-#ifdef MOZ_OMNIJAR + // Don't check signatures in the omnijar - this is only + // interesting for extensions/XPIs. +- if (mZip == mozilla::OmnijarReader()) ++ if ((mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE)) || ++ (mZip == mozilla::Omnijar::GetReader(mozilla::Omnijar::APP))) + return NS_OK; +-#endif + + //-- Parse the manifest + nsresult rv = ParseManifest(); + if (NS_FAILED(rv)) return rv; + if (mGlobalStatus == JAR_NO_MANIFEST) + return NS_OK; + + PRInt16 requestedStatus; +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 +@@ -67,20 +67,18 @@ + + #include "prefapi.h" + #include "prefread.h" + #include "prefapi_private_data.h" + #include "PrefTuple.h" + + #include "nsITimelineService.h" + +-#ifdef MOZ_OMNIJAR + #include "mozilla/Omnijar.h" + #include "nsZipArchive.h" +-#endif + + // Definitions + #define INITIAL_PREF_FILES 10 + static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID); + + // Prototypes + static nsresult openPrefFile(nsIFile* aFile); + static nsresult pref_InitInitialObjects(void); +@@ -793,124 +791,144 @@ static nsresult pref_LoadPrefsInDirList( + pref_LoadPrefsInDir(dir, nsnull, 0); + } + } + } + } + return NS_OK; + } + +-//---------------------------------------------------------------------------------------- +-// Initialize default preference JavaScript buffers from +-// appropriate TEXT resources +-//---------------------------------------------------------------------------------------- +-static nsresult pref_InitDefaults() +-{ +- nsCOMPtr<nsIFile> greprefsFile; +- nsresult rv; +- +- rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(greprefsFile)); +- NS_ENSURE_SUCCESS(rv, rv); +- +- rv = greprefsFile->AppendNative(NS_LITERAL_CSTRING("greprefs.js")); +- NS_ENSURE_SUCCESS(rv, rv); +- +- rv = openPrefFile(greprefsFile); +- if (NS_FAILED(rv)) { +- NS_WARNING("Error parsing GRE default preferences. Is this an old-style embedding app?"); +- } +- +- return NS_OK; +-} +- +-#ifdef MOZ_OMNIJAR + static nsresult pref_ReadPrefFromJar(nsZipArchive* jarReader, const char *name) + { + nsZipItemPtr<char> manifest(jarReader, name, true); + NS_ENSURE_TRUE(manifest.Buffer(), NS_ERROR_NOT_AVAILABLE); + + PrefParseState ps; + PREF_InitParseState(&ps, PREF_ReaderCallback, NULL); + nsresult rv = PREF_ParseBuf(&ps, manifest, manifest.Length()); + PREF_FinalizeParseState(&ps); + + return rv; + } + +-static nsresult pref_InitAppDefaultsFromOmnijar() +-{ +- nsresult rv; +- +- nsZipArchive* jarReader = mozilla::OmnijarReader(); +- if (!jarReader) +- return pref_InitDefaults(); +- +- rv = pref_ReadPrefFromJar(jarReader, "greprefs.js"); +- NS_ENSURE_SUCCESS(rv, rv); +- +- nsZipFind *findPtr; +- rv = jarReader->FindInit("defaults/pref/*.js$", &findPtr); +- NS_ENSURE_SUCCESS(rv, rv); +- +- nsAutoPtr<nsZipFind> find(findPtr); +- +- nsTArray<nsCString> prefEntries; +- const char *entryName; +- PRUint16 entryNameLen; +- while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) { +- prefEntries.AppendElement(Substring(entryName, entryName + entryNameLen)); +- } +- +- prefEntries.Sort(); +- for (PRUint32 i = prefEntries.Length(); i--; ) { +- rv = pref_ReadPrefFromJar(jarReader, prefEntries[i].get()); +- if (NS_FAILED(rv)) +- NS_WARNING("Error parsing preferences."); +- } +- +- return NS_OK; +-} +-#endif +- ++//---------------------------------------------------------------------------------------- ++// Initialize default preference JavaScript buffers from ++// appropriate TEXT resources ++//---------------------------------------------------------------------------------------- + static nsresult pref_InitInitialObjects() + { + nsresult rv; + +- // first we parse the GRE default prefs. This also works if we're not using a GRE, +-#ifdef MOZ_OMNIJAR +- rv = pref_InitAppDefaultsFromOmnijar(); +-#else +- rv = pref_InitDefaults(); +-#endif +- NS_ENSURE_SUCCESS(rv, rv); ++ // In omni.jar case, we load the following prefs: ++ // - jar:$gre/omni.jar!/greprefs.js ++ // - jar:$gre/omni.jar!/defaults/pref/*.js ++ // In non omni.jar case, we load: ++ // - $gre/greprefs.js ++ // ++ // When $app == $gre, we additionally load, in all cases: ++ // - $gre/defaults/pref/*.js ++ // This is kept for bug 591866 (channel-prefs.js should not be in omni.jar). ++ // We load all files instead of channel-prefs.js only to have the same ++ // behaviour as $app != $gre. ++ // ++ // When $app != $gre, we additionally load, in omni.jar case: ++ // - jar:$app/omni.jar!/defaults/preferences/*.js ++ // - $app/defaults/preferences/*.js ++ // and in non omni.jar case: ++ // - $app/defaults/preferences/*.js + +- nsCOMPtr<nsIFile> defaultPrefDir; +- // now parse the "application" default preferences +- rv = NS_GetSpecialDirectory(NS_APP_PREF_DEFAULTS_50_DIR, getter_AddRefs(defaultPrefDir)); +- NS_ENSURE_SUCCESS(rv, rv); ++ nsZipFind *findPtr; ++ nsAutoPtr<nsZipFind> find; ++ nsTArray<nsCString> prefEntries; ++ const char *entryName; ++ PRUint16 entryNameLen; + +- /* these pref file names should not be used: we process them after all other application pref files for backwards compatibility */ +- static const char* specialFiles[] = { ++ nsZipArchive* jarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE); ++ if (jarReader) { ++ // Load jar:$gre/omni.jar!/greprefs.js ++ rv = pref_ReadPrefFromJar(jarReader, "greprefs.js"); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ // Load jar:$gre/omni.jar!/defaults/pref/*.js ++ rv = jarReader->FindInit("defaults/pref/*.js$", &findPtr); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ find = findPtr; ++ while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) { ++ prefEntries.AppendElement(Substring(entryName, entryName + entryNameLen)); ++ } ++ ++ prefEntries.Sort(); ++ for (PRUint32 i = prefEntries.Length(); i--; ) { ++ rv = pref_ReadPrefFromJar(jarReader, prefEntries[i].get()); ++ if (NS_FAILED(rv)) ++ NS_WARNING("Error parsing preferences."); ++ } ++ } else { ++ // Load $gre/greprefs.js ++ nsCOMPtr<nsIFile> greprefsFile; ++ rv = NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(greprefsFile)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ rv = greprefsFile->AppendNative(NS_LITERAL_CSTRING("greprefs.js")); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ rv = openPrefFile(greprefsFile); ++ if (NS_FAILED(rv)) ++ NS_WARNING("Error parsing GRE default preferences. Is this an old-style embedding app?"); ++ } ++ ++ if (!mozilla::Omnijar::HasOmnijar(mozilla::Omnijar::APP)) { ++ // Load $gre/defaults/pref/*.js ++ nsCOMPtr<nsIFile> defaultPrefDir; ++ ++ rv = NS_GetSpecialDirectory(NS_APP_PREF_DEFAULTS_50_DIR, getter_AddRefs(defaultPrefDir)); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ /* 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" +-#if defined(_AIX) ++#if defined(VMS) ++ , "openvms.js" ++#elif defined(_AIX) + , "aix.js" + #endif + #elif defined(XP_OS2) + "os2pref.js" ++#elif defined(XP_BEOS) ++ "beos.js" + #endif +- }; ++ }; + +- rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles)); +- if (NS_FAILED(rv)) { +- NS_WARNING("Error parsing application default preferences."); ++ rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, NS_ARRAY_LENGTH(specialFiles)); ++ if (NS_FAILED(rv)) ++ NS_WARNING("Error parsing application default preferences."); ++ } ++ ++ // Load jar:$app/omni.jar!/defaults/preferences/*.js ++ nsZipArchive *appJarReader = mozilla::Omnijar::GetReader(mozilla::Omnijar::APP); ++ if (appJarReader) { ++ rv = appJarReader->FindInit("defaults/preferences/*.js$", &findPtr); ++ NS_ENSURE_SUCCESS(rv, rv); ++ find = findPtr; ++ prefEntries.Clear(); ++ while (NS_SUCCEEDED(find->FindNext(&entryName, &entryNameLen))) { ++ prefEntries.AppendElement(Substring(entryName, entryName + entryNameLen)); ++ } ++ prefEntries.Sort(); ++ for (PRUint32 i = prefEntries.Length(); i--; ) { ++ rv = pref_ReadPrefFromJar(appJarReader, prefEntries[i].get()); ++ if (NS_FAILED(rv)) ++ NS_WARNING("Error parsing preferences."); ++ } + } + + rv = pref_LoadPrefsInDirList(NS_APP_PREFS_DEFAULTS_DIR_LIST); + NS_ENSURE_SUCCESS(rv, rv); + + NS_CreateServicesFromCategory(NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID, + nsnull, NS_PREFSERVICE_APPDEFAULTS_TOPIC_ID); + +diff --git a/netwerk/protocol/res/nsResProtocolHandler.cpp b/netwerk/protocol/res/nsResProtocolHandler.cpp +--- a/netwerk/protocol/res/nsResProtocolHandler.cpp ++++ b/netwerk/protocol/res/nsResProtocolHandler.cpp +@@ -152,97 +152,62 @@ nsResProtocolHandler::nsResProtocolHandl + } + + nsResProtocolHandler::~nsResProtocolHandler() + { + gResHandler = nsnull; + } + + nsresult +-nsResProtocolHandler::AddSpecialDir(const char* aSpecialDir, const nsACString& aSubstitution) +-{ +- nsCOMPtr<nsIFile> file; +- nsresult rv = NS_GetSpecialDirectory(aSpecialDir, getter_AddRefs(file)); +- NS_ENSURE_SUCCESS(rv, rv); +- +- nsCOMPtr<nsIURI> uri; +- rv = mIOService->NewFileURI(file, getter_AddRefs(uri)); +- NS_ENSURE_SUCCESS(rv, rv); +- +- return SetSubstitution(aSubstitution, uri); +-} +- +-nsresult + nsResProtocolHandler::Init() + { + if (!mSubstitutions.Init(32)) + return NS_ERROR_UNEXPECTED; + + nsresult rv; + + mIOService = do_GetIOService(&rv); + NS_ENSURE_SUCCESS(rv, rv); + +-#ifdef MOZ_OMNIJAR +- nsCOMPtr<nsIFile> omniJar(mozilla::OmnijarPath()); +- if (omniJar) +- return Init(omniJar); +-#endif +- +- // these entries should be kept in sync with the omnijar Init function ++ nsCAutoString appURI, greURI; ++ rv = mozilla::Omnijar::GetURIString(mozilla::Omnijar::APP, appURI); ++ NS_ENSURE_SUCCESS(rv, rv); ++ rv = mozilla::Omnijar::GetURIString(mozilla::Omnijar::GRE, greURI); ++ NS_ENSURE_SUCCESS(rv, rv); + + // +- // make resource:/// point to the application directory ++ // make resource:/// point to the application directory or omnijar + // +- rv = AddSpecialDir(NS_OS_CURRENT_PROCESS_DIR, EmptyCString()); ++ nsCOMPtr<nsIURI> uri; ++ rv = NS_NewURI(getter_AddRefs(uri), appURI.Length() ? appURI : greURI); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ rv = SetSubstitution(EmptyCString(), uri); + NS_ENSURE_SUCCESS(rv, rv); + + // + // make resource://gre/ point to the GRE directory + // +- rv = AddSpecialDir(NS_GRE_DIR, kGRE); ++ if (appURI.Length()) { // We already have greURI in uri if appURI.Length() is 0. ++ rv = NS_NewURI(getter_AddRefs(uri), greURI); ++ NS_ENSURE_SUCCESS(rv, rv); ++ } ++ ++ rv = SetSubstitution(kGRE, uri); + NS_ENSURE_SUCCESS(rv, rv); + + //XXXbsmedberg Neil wants a resource://pchrome/ for the profile chrome dir... + // but once I finish multiple chrome registration I'm not sure that it is needed + + // XXX dveditz: resource://pchrome/ defeats profile directory salting + // if web content can load it. Tread carefully. + + return rv; + } + +-#ifdef MOZ_OMNIJAR +-nsresult +-nsResProtocolHandler::Init(nsIFile *aOmniJar) +-{ +- nsresult rv; +- nsCOMPtr<nsIURI> uri; +- nsCAutoString omniJarSpec; +- NS_GetURLSpecFromActualFile(aOmniJar, omniJarSpec, mIOService); +- +- nsCAutoString urlStr("jar:"); +- urlStr += omniJarSpec; +- urlStr += "!/"; +- +- rv = mIOService->NewURI(urlStr, nsnull, nsnull, getter_AddRefs(uri)); +- NS_ENSURE_SUCCESS(rv, rv); +- +- // these entries should be kept in sync with the normal Init function +- +- // resource:/// points to jar:omni.jar!/ +- SetSubstitution(EmptyCString(), uri); +- +- // resource://gre/ points to jar:omni.jar!/ +- SetSubstitution(kGRE, uri); +- +- return NS_OK; +-} +-#endif +- + #ifdef MOZ_IPC + static PLDHashOperator + EnumerateSubstitution(const nsACString& aKey, + nsIURI* aURI, + void* aArg) + { + nsTArray<ResourceMapping>* resources = + static_cast<nsTArray<ResourceMapping>*>(aArg); +diff --git a/startupcache/StartupCache.cpp b/startupcache/StartupCache.cpp +--- a/startupcache/StartupCache.cpp ++++ b/startupcache/StartupCache.cpp +@@ -237,27 +237,36 @@ StartupCache::GetBuffer(const char* id, + nsZipItemPtr<char> zipItem(mArchive, id, true); + if (zipItem) { + *outbuf = zipItem.Forget(); + *length = zipItem.Length(); + return NS_OK; + } + } + +-#ifdef MOZ_OMNIJAR +- if (mozilla::OmnijarReader()) { ++ if (mozilla::Omnijar::GetReader(mozilla::Omnijar::APP)) { + // no need to checksum omnijarred entries +- nsZipItemPtr<char> zipItem(mozilla::OmnijarReader(), id); ++ nsZipItemPtr<char> zipItem(mozilla::Omnijar::GetReader(mozilla::Omnijar::APP), id); + if (zipItem) { + *outbuf = zipItem.Forget(); + *length = zipItem.Length(); + return NS_OK; + } + } +-#endif ++ ++ if (mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE)) { ++ // no need to checksum omnijarred entries ++ nsZipItemPtr<char> zipItem(mozilla::Omnijar::GetReader(mozilla::Omnijar::GRE), id); ++ if (zipItem) { ++ *outbuf = zipItem.Forget(); ++ *length = zipItem.Length(); ++ return NS_OK; ++ } ++ } ++ + return NS_ERROR_NOT_AVAILABLE; + } + + // Makes a copy of the buffer, client retains ownership of inbuf. + nsresult + StartupCache::PutBuffer(const char* id, const char* inbuf, PRUint32 len) + { + WaitOnWriteThread(); +diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp +--- a/toolkit/xre/nsAppRunner.cpp ++++ b/toolkit/xre/nsAppRunner.cpp +@@ -3897,35 +3897,45 @@ XRE_InitCommandLine(int aArgc, char* aAr + CommandLine::Init(aArgc, canonArgs); + + for (int i = 0; i < aArgc; ++i) + free(canonArgs[i]); + delete[] canonArgs; + #endif + #endif + +-#ifdef MOZ_OMNIJAR +- const char *omnijarPath = nsnull; +- ArgResult ar = CheckArg("omnijar", PR_FALSE, &omnijarPath); ++ const char *path = nsnull; ++ ArgResult ar = CheckArg("grebase", PR_FALSE, &path); + if (ar == ARG_BAD) { +- PR_fprintf(PR_STDERR, "Error: argument -omnijar requires an omnijar path\n"); ++ PR_fprintf(PR_STDERR, "Error: argument -grebase requires a path argument\n"); + return NS_ERROR_FAILURE; + } + +- if (!omnijarPath) ++ if (!path) + return rv; + +- nsCOMPtr<nsILocalFile> omnijar; +- rv = NS_NewNativeLocalFile(nsDependentCString(omnijarPath), PR_TRUE, +- getter_AddRefs(omnijar)); +- if (NS_SUCCEEDED(rv)) +- mozilla::SetOmnijar(omnijar); +-#endif +- +- return rv; ++ nsCOMPtr<nsILocalFile> greBase; ++ rv = XRE_GetFileFromPath(path, getter_AddRefs(greBase)); ++ if (NS_FAILED(rv)) ++ return rv; ++ ++ ar = CheckArg("appbase", PR_FALSE, &path); ++ if (ar == ARG_BAD) { ++ PR_fprintf(PR_STDERR, "Error: argument -appbase requires a path argument\n"); ++ return NS_ERROR_FAILURE; ++ } ++ ++ nsCOMPtr<nsILocalFile> appBase; ++ if (path) { ++ rv = XRE_GetFileFromPath(path, getter_AddRefs(appBase)); ++ if (NS_FAILED(rv)) ++ return rv; ++ } ++ ++ return mozilla::Omnijar::SetBase(greBase, appBase); + } + + nsresult + XRE_DeinitCommandLine() + { + nsresult rv = NS_OK; + + #if defined(MOZ_IPC) +diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp +--- a/toolkit/xre/nsEmbedFunctions.cpp ++++ b/toolkit/xre/nsEmbedFunctions.cpp +@@ -512,19 +512,17 @@ XRE_InitChildProcess(int aArgc, + } + + // Run the UI event loop on the main thread. + uiMessageLoop.MessageLoop::Run(); + + // Allow ProcessChild to clean up after itself before going out of + // scope and being deleted + process->CleanUp(); +-#ifdef MOZ_OMNIJAR +- mozilla::SetOmnijar(nsnull); +-#endif ++ mozilla::Omnijar::SetBase(nsnull, nsnull); + } + } + + NS_LogTerm(); + return XRE_DeinitCommandLine(); + } + + MessageLoop* +diff --git a/xpcom/build/Makefile.in b/xpcom/build/Makefile.in +--- a/xpcom/build/Makefile.in ++++ b/xpcom/build/Makefile.in +@@ -64,28 +64,25 @@ CSRCS = \ + $(NULL) + + CPPSRCS = \ + $(XPCOM_GLUE_SRC_LCPPSRCS) \ + $(XPCOM_GLUENS_SRC_LCPPSRCS) \ + nsXPComInit.cpp \ + nsXPCOMStrings.cpp \ + Services.cpp \ ++ Omnijar.cpp \ + $(NULL) + + ifndef MOZ_ENABLE_LIBXUL + ifeq (,$(filter-out WINNT WINCE OS2,$(OS_ARCH))) + CPPSRCS += dlldeps.cpp + endif + endif + +-ifdef MOZ_OMNIJAR +-CPPSRCS += Omnijar.cpp +-endif +- + SHARED_LIBRARY_LIBS = \ + $(DEPTH)/chrome/src/$(LIB_PREFIX)chrome_s.$(LIB_SUFFIX) \ + ../ds/$(LIB_PREFIX)xpcomds_s.$(LIB_SUFFIX) \ + ../io/$(LIB_PREFIX)xpcomio_s.$(LIB_SUFFIX) \ + ../components/$(LIB_PREFIX)xpcomcomponents_s.$(LIB_SUFFIX) \ + ../threads/$(LIB_PREFIX)xpcomthreads_s.$(LIB_SUFFIX) \ + ../proxy/src/$(LIB_PREFIX)xpcomproxy_s.$(LIB_SUFFIX) \ + ../base/$(LIB_PREFIX)xpcombase_s.$(LIB_SUFFIX) \ +diff --git a/xpcom/build/Omnijar.cpp b/xpcom/build/Omnijar.cpp +--- a/xpcom/build/Omnijar.cpp ++++ b/xpcom/build/Omnijar.cpp +@@ -16,16 +16,17 @@ + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Michael Wu <mwu@mozilla.com> ++ * Mike Hommey <mh@glandium.org> + * + * 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 +@@ -33,69 +34,175 @@ + * 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 "Omnijar.h" + +-#include "nsILocalFile.h" +-#include "nsXULAppAPI.h" ++#include "nsIFile.h" + #include "nsZipArchive.h" ++#include "nsNetUtil.h" + +-static nsILocalFile* sOmnijarPath = nsnull; +-static nsZipArchive* sOmnijarReader = nsnull; ++namespace mozilla { + +-static void +-SetupReader() ++nsIFile *Omnijar::sPath[2] = { nsnull, nsnull }; ++PRBool Omnijar::sIsOmnijar[2] = { PR_FALSE, PR_FALSE }; ++ ++#ifdef MOZ_ENABLE_LIBXUL ++nsZipArchive *Omnijar::sReader[2] = { nsnull, nsnull }; ++#endif ++ ++static already_AddRefed<nsIFile> ++ComputePath(nsIFile *aPath, PRBool &aIsOmnijar) + { +- if (!sOmnijarPath) { +- return; ++ PRBool isDir; ++ aIsOmnijar = PR_FALSE; ++ if (!aPath || NS_FAILED(aPath->IsDirectory(&isDir)) || !isDir) ++ return nsnull; ++ ++ nsCOMPtr<nsIFile> path; ++#ifdef MOZ_ENABLE_LIBXUL ++ // Search for omni.jar in the given directory ++ if (!isDir || NS_FAILED(aPath->Clone(getter_AddRefs(path)))) ++ return nsnull; ++ ++ if (NS_FAILED(path->AppendNative(NS_LITERAL_CSTRING("omni.jar")))) ++ return nsnull; ++ ++ if (NS_FAILED(path->Exists(&aIsOmnijar))) ++ return nsnull; ++#endif ++ ++ if (!aIsOmnijar && NS_FAILED(aPath->Clone(getter_AddRefs(path)))) ++ return nsnull; ++ ++ return path.forget(); ++} ++ ++nsresult ++Omnijar::SetBase(nsIFile *aGrePath, nsIFile *aAppPath) ++{ ++ NS_ABORT_IF_FALSE(aGrePath || !aAppPath, "Omnijar::SetBase(NULL, something) call forbidden"); ++ ++#ifdef MOZ_ENABLE_LIBXUL ++ if (sReader[GRE]) { ++ sReader[GRE]->CloseArchive(); ++ delete sReader[GRE]; ++ } ++ if (sReader[APP]) { ++ sReader[APP]->CloseArchive(); ++ delete sReader[APP]; ++ } ++ sReader[APP] = sReader[GRE] = nsnull; ++#endif ++ ++ nsresult rv; ++ PRBool equals; ++ if (aAppPath) { ++ rv = aAppPath->Equals(aGrePath, &equals); ++ NS_ENSURE_SUCCESS(rv, rv); ++ } else { ++ equals = PR_TRUE; + } + +- nsZipArchive* zipReader = new nsZipArchive(); +- if (!zipReader) { +- NS_IF_RELEASE(sOmnijarPath); +- return; ++ nsCOMPtr<nsIFile> grePath = ComputePath(aGrePath, sIsOmnijar[GRE]); ++ nsCOMPtr<nsIFile> appPath = ComputePath(equals ? nsnull : aAppPath, sIsOmnijar[APP]); ++ ++ NS_IF_RELEASE(sPath[GRE]); ++ sPath[GRE] = grePath; ++ NS_IF_ADDREF(sPath[GRE]); ++ ++ NS_IF_RELEASE(sPath[APP]); ++ sPath[APP] = appPath; ++ NS_IF_ADDREF(sPath[APP]); ++ ++ return NS_OK; ++} ++ ++already_AddRefed<nsIFile> ++Omnijar::GetBase(Type aType) ++{ ++ NS_ABORT_IF_FALSE(sPath[0], "Omnijar not initialized"); ++ ++ if (!sIsOmnijar[aType]) { ++ NS_IF_ADDREF(sPath[aType]); ++ return sPath[aType]; + } + +- if (NS_FAILED(zipReader->OpenArchive(sOmnijarPath))) { ++ nsCOMPtr<nsIFile> file, path; ++ if (NS_FAILED(sPath[aType]->Clone(getter_AddRefs(file)))) ++ return nsnull; ++ ++ if (NS_FAILED(file->GetParent(getter_AddRefs(path)))) ++ return nsnull; ++ return path.forget(); ++} ++ ++#ifdef MOZ_ENABLE_LIBXUL ++nsZipArchive * ++Omnijar::GetReader(Type aType) ++{ ++ if (!sIsOmnijar[aType]) ++ return nsnull; ++ ++ if (sReader[aType]) ++ return sReader[aType]; ++ ++ nsZipArchive* zipReader = new nsZipArchive(); ++ if (!zipReader) ++ return nsnull; ++ ++ if (NS_FAILED(zipReader->OpenArchive(sPath[aType]))) { + delete zipReader; +- NS_IF_RELEASE(sOmnijarPath); +- return; ++ return nsnull; + } + +- sOmnijarReader = zipReader; ++ return (sReader[aType] = zipReader); + } + +-nsILocalFile* +-mozilla::OmnijarPath() ++nsZipArchive * ++Omnijar::GetReader(nsIFile *aPath) + { +- if (!sOmnijarReader) +- SetupReader(); ++ PRBool equals; ++ nsresult rv; + +- return sOmnijarPath; ++ if (sIsOmnijar[GRE]) { ++ rv = sPath[GRE]->Equals(aPath, &equals); ++ if (NS_SUCCEEDED(rv) && equals) ++ return GetReader(GRE); ++ } ++ if (sIsOmnijar[APP]) { ++ rv = sPath[APP]->Equals(aPath, &equals); ++ if (NS_SUCCEEDED(rv) && equals) ++ return GetReader(APP); ++ } ++ return nsnull; ++} ++#endif ++ ++nsresult ++Omnijar::GetURIString(Type aType, nsCString &result) ++{ ++ NS_ABORT_IF_FALSE(sPath[0], "Omnijar not initialized"); ++ ++ result = ""; ++ ++ if ((aType == APP) && (!sPath[APP])) ++ return NS_OK; ++ ++ nsCAutoString omniJarSpec; ++ nsresult rv = NS_GetURLSpecFromActualFile(sPath[aType], omniJarSpec); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ if (sIsOmnijar[aType]) { ++ result = "jar:"; ++ result += omniJarSpec; ++ result += "!"; ++ } else { ++ result = omniJarSpec; ++ } ++ result += "/"; ++ return NS_OK; + } + +-nsZipArchive* +-mozilla::OmnijarReader() +-{ +- if (!sOmnijarReader) +- SetupReader(); +- +- return sOmnijarReader; +-} +- +-void +-mozilla::SetOmnijar(nsILocalFile* aPath) +-{ +- NS_IF_RELEASE(sOmnijarPath); +- if (sOmnijarReader) { +- sOmnijarReader->CloseArchive(); +- delete sOmnijarReader; +- sOmnijarReader = nsnull; +- } +- +- sOmnijarPath = aPath; +- NS_IF_ADDREF(sOmnijarPath); +-} +- ++} /* namespace mozilla */ +diff --git a/xpcom/build/Omnijar.h b/xpcom/build/Omnijar.h +--- a/xpcom/build/Omnijar.h ++++ b/xpcom/build/Omnijar.h +@@ -16,16 +16,17 @@ + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Michael Wu <mwu@mozilla.com> ++ * Mike Hommey <mh@glandium.org> + * + * 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 +@@ -34,29 +35,137 @@ + * 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 mozilla_Omnijar_h + #define mozilla_Omnijar_h + +-class nsILocalFile; ++#include "nscore.h" ++#include "nsTArray.h" ++#include "nsCOMPtr.h" ++#include "nsString.h" ++ ++class nsIFile; + class nsZipArchive; +- +-#ifdef MOZ_OMNIJAR ++class nsIURI; + + namespace mozilla { + ++#ifdef MOZ_ENABLE_LIBXUL ++#define OMNIJAR_EXPORT ++#else ++#define OMNIJAR_EXPORT NS_EXPORT ++#endif ++ ++class OMNIJAR_EXPORT Omnijar { ++private: + /** +- * This returns the path to the omnijar. +- * If the omnijar isn't available, this function will return null. +- * Callers should fallback to flat packaging if null. ++ * Store an nsIFile for either a base directory when there is no omni.jar, ++ * or omni.jar itself. We can store two paths here, one for GRE ++ * (corresponding to resource://gre/) and one for APP ++ * (corresponding to resource:/// and resource://app/), but only ++ * store one when both point to the same location (unified). + */ +-nsILocalFile *OmnijarPath(); +-nsZipArchive *OmnijarReader(); +-void SetOmnijar(nsILocalFile* aPath); ++static nsIFile *sPath[2]; ++/** ++ * Store whether the corresponding sPath is an omni.jar or a directory ++ */ ++static PRBool sIsOmnijar[2]; ++ ++#ifdef MOZ_ENABLE_LIBXUL ++/** ++ * Cached nsZipArchives for the corresponding sPath ++ */ ++static nsZipArchive *sReader[2]; ++#endif ++ ++public: ++enum Type { ++ GRE = 0, ++ APP = 1 ++}; ++ ++/** ++ * Returns whether SetBase has been called at least once with ++ * a valid nsIFile ++ */ ++static PRBool ++IsInitialized() ++{ ++ // GRE path is always set after initialization. ++ return sPath[0] != nsnull; ++} ++ ++/** ++ * Sets the base directories for GRE and APP. APP base directory ++ * may be nsnull, in case the APP and GRE directories are the same. ++ */ ++static nsresult SetBase(nsIFile *aGrePath, nsIFile *aAppPath); ++ ++/** ++ * Returns an nsIFile pointing to the omni.jar file for GRE or APP. ++ * Returns nsnull when there is no corresponding omni.jar. ++ * Also returns nsnull for APP in the unified case. ++ */ ++static already_AddRefed<nsIFile> ++GetPath(Type aType) ++{ ++ NS_ABORT_IF_FALSE(sPath[0], "Omnijar not initialized"); ++ ++ if (sIsOmnijar[aType]) { ++ NS_IF_ADDREF(sPath[aType]); ++ return sPath[aType]; ++ } ++ return nsnull; ++} ++ ++/** ++ * Returns whether GRE or APP use an omni.jar. Returns PR_False when ++ * using an omni.jar in the unified case. ++ */ ++static PRBool ++HasOmnijar(Type aType) ++{ ++ return sIsOmnijar[aType]; ++} ++ ++/** ++ * Returns the base directory for GRE or APP. In the unified case, ++ * returns nsnull for APP. ++ */ ++static already_AddRefed<nsIFile> GetBase(Type aType); ++ ++/** ++ * Returns a nsZipArchive pointer for the omni.jar file for GRE or ++ * APP. Returns nsnull in the same cases GetPath() would. ++ */ ++#ifdef MOZ_ENABLE_LIBXUL ++static nsZipArchive *GetReader(Type aType); ++#else ++static nsZipArchive *GetReader(Type aType) { return nsnull; } ++#endif ++ ++/** ++ * Returns a nsZipArchive pointer for the given path IAOI the given ++ * path is the omni.jar for either GRE or APP. ++ */ ++#ifdef MOZ_ENABLE_LIBXUL ++static nsZipArchive *GetReader(nsIFile *aPath); ++#else ++static nsZipArchive *GetReader(nsIFile *aPath) { return nsnull; } ++#endif ++ ++/** ++ * Returns the URI string corresponding to the omni.jar or directory ++ * for GRE or APP. i.e. jar:/path/to/omni.jar!/ for omni.jar and ++ * /path/to/base/dir/ otherwise. Returns an empty string for APP in ++ * the unified case. ++ * The returned URI is guaranteed to end with a slash. ++ */ ++static nsresult GetURIString(Type aType, nsCString &result); ++ ++}; /* class Omnijar */ + + } /* namespace mozilla */ + +-#endif /* MOZ_OMNIJAR */ +- + #endif /* mozilla_Omnijar_h */ +diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp +--- a/xpcom/build/nsXPComInit.cpp ++++ b/xpcom/build/nsXPComInit.cpp +@@ -462,35 +462,35 @@ NS_InitXPCOM2(nsIServiceManager* *result + nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib); + } + + if (appFileLocationProvider) { + rv = nsDirectoryService::gService->RegisterProvider(appFileLocationProvider); + if (NS_FAILED(rv)) return rv; + } + +-#ifdef MOZ_OMNIJAR + NS_TIME_FUNCTION_MARK("Next: Omnijar init"); + +- if (!mozilla::OmnijarPath()) { +- nsCOMPtr<nsILocalFile> omnijar; ++ if (!mozilla::Omnijar::IsInitialized()) { ++ nsCOMPtr<nsILocalFile> greDir, appDir; + nsCOMPtr<nsIFile> file; + +- rv = NS_ERROR_FAILURE; + nsDirectoryService::gService->Get(NS_GRE_DIR, + NS_GET_IID(nsIFile), + getter_AddRefs(file)); +- if (file) +- rv = file->Append(NS_LITERAL_STRING("omni.jar")); +- if (NS_SUCCEEDED(rv)) +- omnijar = do_QueryInterface(file); +- if (NS_SUCCEEDED(rv)) +- mozilla::SetOmnijar(omnijar); ++ greDir = do_QueryInterface(file); ++ ++ nsDirectoryService::gService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, ++ NS_GET_IID(nsIFile), ++ getter_AddRefs(file)); ++ appDir = do_QueryInterface(file); ++ ++ rv = mozilla::Omnijar::SetBase(greDir, appDir); ++ NS_ENSURE_SUCCESS(rv, rv); + } +-#endif + + #ifdef MOZ_IPC + if ((sCommandLineWasInitialized = !CommandLine::IsInitialized())) { + NS_TIME_FUNCTION_MARK("Next: IPC command line init"); + + #ifdef OS_WIN + CommandLine::Init(0, nsnull); + #else +@@ -769,18 +769,16 @@ ShutdownXPCOM(nsIServiceManager* servMgr + sCommandLineWasInitialized = false; + } + if (sExitManager) { + delete sExitManager; + sExitManager = nsnull; + } + #endif + +-#ifdef MOZ_OMNIJAR +- mozilla::SetOmnijar(nsnull); +-#endif ++ mozilla::Omnijar::SetBase(nsnull, nsnull); + + NS_LogTerm(); + + return NS_OK; + } + + } // namespace mozilla +diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp +--- a/xpcom/components/nsComponentManager.cpp ++++ b/xpcom/components/nsComponentManager.cpp +@@ -175,18 +175,16 @@ NS_DEFINE_CID(kCategoryManagerCID, NS_CA + #define COMPMGR_TIME_FUNCTION_CONTRACTID(cid) \ + NS_TIME_FUNCTION_MIN_FMT(5, "%s (line %d) (contractid: %s)", MOZ_FUNCTION_NAME, \ + __LINE__, (cid)) + #else + #define COMPMGR_TIME_FUNCTION_CID(cid) do {} while (0) + #define COMPMGR_TIME_FUNCTION_CONTRACTID(cid) do {} while (0) + #endif + +-#define kOMNIJAR_PREFIX NS_LITERAL_CSTRING("resource:///") +- + nsresult + nsGetServiceFromCategory::operator()(const nsIID& aIID, void** aInstancePtr) const + { + nsresult rv; + nsXPIDLCString value; + nsCOMPtr<nsICategoryManager> catman; + nsComponentManagerImpl *compMgr = nsComponentManagerImpl::gComponentManager; + if (!compMgr) { +@@ -390,47 +388,44 @@ nsresult nsComponentManagerImpl::Init() + + nsCategoryManager::GetSingleton()->SuppressNotifications(true); + + RegisterModule(&kXPCOMModule, NULL); + + for (PRUint32 i = 0; i < sStaticModules->Length(); ++i) + RegisterModule((*sStaticModules)[i], NULL); + +-#ifdef MOZ_OMNIJAR +- if (mozilla::OmnijarPath()) { +- nsCOMPtr<nsIZipReader> omnijarReader = new nsJAR(); +- rv = omnijarReader->Open(mozilla::OmnijarPath()); +- if (NS_SUCCEEDED(rv)) +- RegisterJarManifest(omnijarReader, "chrome.manifest", false); ++ nsCOMPtr<nsIFile> appOmnijar = mozilla::Omnijar::GetPath(mozilla::Omnijar::APP); ++ if (appOmnijar) { ++ cl = sModuleLocations->InsertElementAt(1); // Insert after greDir ++ cl->type = NS_COMPONENT_LOCATION; ++ cl->location = do_QueryInterface(appOmnijar); ++ cl->jar = true; + } +-#endif ++ nsCOMPtr<nsIFile> greOmnijar = mozilla::Omnijar::GetPath(mozilla::Omnijar::GRE); ++ if (greOmnijar) { ++ cl = sModuleLocations->InsertElementAt(0); ++ cl->type = NS_COMPONENT_LOCATION; ++ cl->location = do_QueryInterface(greOmnijar); ++ cl->jar = true; ++ } + + for (PRUint32 i = 0; i < sModuleLocations->Length(); ++i) { + ComponentLocation& l = sModuleLocations->ElementAt(i); + if (!l.jar) { + RegisterManifestFile(l.type, l.location, false); + continue; + } + + nsCOMPtr<nsIZipReader> reader = do_CreateInstance(kZipReaderCID, &rv); + rv = reader->Open(l.location); + if (NS_SUCCEEDED(rv)) + RegisterJarManifest(reader, "chrome.manifest", false); + } + +-#ifdef MOZ_OMNIJAR +- if (mozilla::OmnijarPath()) { +- cl = sModuleLocations->InsertElementAt(0); +- cl->type = NS_COMPONENT_LOCATION; +- cl->location = mozilla::OmnijarPath(); +- cl->jar = true; +- } +-#endif +- + nsCategoryManager::GetSingleton()->SuppressNotifications(false); + + mStatus = NORMAL; + + return NS_OK; + } + + void +# HG changeset patch +# Parent ff1b810f78226d7f4010909d3cde05a57fdcf20c +Bug 620931 part 4 - Fix resource://app/ to always point to the same as resource:/// + +diff --git a/netwerk/protocol/res/nsResProtocolHandler.cpp b/netwerk/protocol/res/nsResProtocolHandler.cpp +--- a/netwerk/protocol/res/nsResProtocolHandler.cpp ++++ b/netwerk/protocol/res/nsResProtocolHandler.cpp +@@ -74,16 +74,17 @@ static nsResProtocolHandler *gResHandler + // set NSPR_LOG_FILE=log.txt + // + // this enables PR_LOG_ALWAYS level information and places all output in + // the file log.txt + // + static PRLogModuleInfo *gResLog; + #endif + ++#define kAPP NS_LITERAL_CSTRING("app") + #define kGRE NS_LITERAL_CSTRING("gre") + + //---------------------------------------------------------------------------- + // nsResURL : overrides nsStandardURL::GetFile to provide nsIFile resolution + //---------------------------------------------------------------------------- + + nsresult + nsResURL::EnsureFile() +@@ -179,16 +180,22 @@ nsResProtocolHandler::Init() + nsCOMPtr<nsIURI> uri; + rv = NS_NewURI(getter_AddRefs(uri), appURI.Length() ? appURI : greURI); + NS_ENSURE_SUCCESS(rv, rv); + + rv = SetSubstitution(EmptyCString(), uri); + NS_ENSURE_SUCCESS(rv, rv); + + // ++ // make resource://app/ point to the application directory or omnijar ++ // ++ rv = SetSubstitution(kAPP, uri); ++ NS_ENSURE_SUCCESS(rv, rv); ++ ++ // + // make resource://gre/ point to the GRE directory + // + if (appURI.Length()) { // We already have greURI in uri if appURI.Length() is 0. + rv = NS_NewURI(getter_AddRefs(uri), greURI); + NS_ENSURE_SUCCESS(rv, rv); + } + + rv = SetSubstitution(kGRE, uri); +diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp +--- a/toolkit/xre/nsXREDirProvider.cpp ++++ b/toolkit/xre/nsXREDirProvider.cpp +@@ -300,19 +300,16 @@ nsXREDirProvider::GetFile(const char* aP + } + } + else if (!strcmp(aProperty, XRE_EXECUTABLE_FILE) && gArgv[0]) { + nsCOMPtr<nsILocalFile> lf; + rv = XRE_GetBinaryPath(gArgv[0], getter_AddRefs(lf)); + if (NS_SUCCEEDED(rv)) + file = lf; + } +- else if (!strcmp(aProperty, "resource:app")) { +- rv = GetAppDir()->Clone(getter_AddRefs(file)); +- } + + else if (!strcmp(aProperty, NS_APP_PROFILE_DIR_STARTUP) && mProfileDir) { + return mProfileDir->Clone(aFile); + } + else if (!strcmp(aProperty, NS_APP_PROFILE_LOCAL_DIR_STARTUP)) { + if (mProfileLocalDir) + return mProfileLocalDir->Clone(aFile); + +# HG changeset patch +# Parent 7d2228db71a299afca60babff632a967d2d6c456 +Bug 620931 part 5 - Enable omni.jar by default on xulrunner + +diff --git a/xulrunner/confvars.sh b/xulrunner/confvars.sh +--- a/xulrunner/confvars.sh ++++ b/xulrunner/confvars.sh +@@ -36,15 +36,16 @@ + # + # ***** END LICENSE BLOCK ***** + + MOZ_APP_NAME=xulrunner + MOZ_APP_DISPLAYNAME=XULRunner + MOZ_UPDATER=1 + MOZ_XULRUNNER=1 + MOZ_ENABLE_LIBXUL=1 ++MOZ_CHROME_FILE_FORMAT=omni + MOZ_STATIC_BUILD_UNSUPPORTED=1 + MOZ_APP_VERSION=$MOZILLA_VERSION + if test "$MOZ_STORAGE"; then + MOZ_PLACES=1 + fi + MOZ_EXTENSIONS_DEFAULT=" gnomevfs" + MOZ_URL_CLASSIFIER=1 diff --git a/xulrunner-version.patch b/xulrunner-version.patch new file mode 100644 index 0000000..d08bde9 --- /dev/null +++ b/xulrunner-version.patch @@ -0,0 +1,13 @@ +diff -up mozilla/toolkit/mozapps/update/src/updater/module.ver mozilla/toolkit/mozapps/update/src/updater/module +diff -up mozilla/xulrunner/installer/Makefile.in.ver mozilla/xulrunner/installer/Makefile.in +--- mozilla/xulrunner/installer/Makefile.in.ver 2007-12-14 09:51:34.000000000 +0100 ++++ mozilla/xulrunner/installer/Makefile.in 2007-12-14 09:52:03.000000000 +0100 +@@ -44,6 +44,8 @@ VPATH = @srcdir@ + + include $(DEPTH)/config/autoconf.mk + ++MOZ_APP_VERSION="__RPM_VERSION_INTERNAL__" ++ + NO_PKG_FILES = \ + xulrunner-config \ + regchrome* \ |