aboutsummaryrefslogtreecommitdiffstats
path: root/www
diff options
context:
space:
mode:
authorflo <flo@FreeBSD.org>2013-01-11 06:29:23 +0800
committerflo <flo@FreeBSD.org>2013-01-11 06:29:23 +0800
commitb147be0d11dbfcd15be435b9e0d3dfc630c216e9 (patch)
treedd14b47bf2d53036668a1976cb68d74952705242 /www
parentabaa47ae639fd233614733df20c4cfe5a393ef19 (diff)
downloadfreebsd-ports-gnome-b147be0d11dbfcd15be435b9e0d3dfc630c216e9.tar.gz
freebsd-ports-gnome-b147be0d11dbfcd15be435b9e0d3dfc630c216e9.tar.zst
freebsd-ports-gnome-b147be0d11dbfcd15be435b9e0d3dfc630c216e9.zip
- update www/firefox to 18.0
- update www/firefox-esr to 17.0.2 - update www/seamonkey to 2.15 (enigmail to 1.5.0) - remove QT4 option to avoid confusion (it turned out to be too experimental) In collaboration with: Jan Beich <jbeich@tormail.org> Security: http://www.vuxml.org/freebsd/a4ed6632-5aa9-11e2-8fcb-c8600054b392.html
Diffstat (limited to 'www')
-rw-r--r--www/firefox-esr-i18n/Makefile6
-rw-r--r--www/firefox-esr-i18n/distinfo328
-rw-r--r--www/firefox-esr/Makefile22
-rw-r--r--www/firefox-esr/distinfo4
-rw-r--r--www/firefox-esr/files/extra-bug78053113
-rw-r--r--www/firefox-esr/files/patch-alsapulse117
-rw-r--r--www/firefox-esr/files/patch-bug65355129
-rw-r--r--www/firefox-esr/files/patch-bug691898285
-rw-r--r--www/firefox-esr/files/patch-bug69603034
-rw-r--r--www/firefox-esr/files/patch-bug71431273
-rw-r--r--www/firefox-esr/files/patch-bug72297561
-rw-r--r--www/firefox-esr/files/patch-bug72565553
-rw-r--r--www/firefox-esr/files/patch-bug72896850
-rw-r--r--www/firefox-esr/files/patch-bug72915518
-rw-r--r--www/firefox-esr/files/patch-bug73234013
-rw-r--r--www/firefox-esr/files/patch-bug74173790
-rw-r--r--www/firefox-esr/files/patch-bug753046187
-rw-r--r--www/firefox-esr/files/patch-bug76107788
-rw-r--r--www/firefox-esr/files/patch-bug77805621
-rw-r--r--www/firefox-esr/files/patch-bug77807814
-rw-r--r--www/firefox-esr/files/patch-bug77984728
-rw-r--r--www/firefox-esr/files/patch-bug7814574
-rw-r--r--www/firefox-esr/files/patch-bug78346334
-rw-r--r--www/firefox-esr/files/patch-bug784631 (renamed from www/firefox/files/patch-bug784631)0
-rw-r--r--www/firefox-esr/files/patch-bug78477622
-rw-r--r--www/firefox-esr/files/patch-bug786995 (renamed from www/firefox/files/patch-bug786995)0
-rw-r--r--www/firefox-esr/files/patch-bug787904 (renamed from www/firefox/files/patch-bug787904)0
-rw-r--r--www/firefox-esr/files/patch-bug78803911
-rw-r--r--www/firefox-esr/files/patch-bug7881082
-rw-r--r--www/firefox-esr/files/patch-bug788955299
-rw-r--r--www/firefox-esr/files/patch-bug789656 (renamed from www/firefox/files/patch-bug789656)0
-rw-r--r--www/firefox-esr/files/patch-bug7896935
-rw-r--r--www/firefox-esr/files/patch-bug79136665
-rw-r--r--www/firefox-esr/files/patch-bug7994414
-rw-r--r--www/firefox-esr/files/patch-bug80613929
-rw-r--r--www/firefox-esr/files/patch-bug82800336
-rw-r--r--www/firefox-esr/files/patch-clang32-libc++-visibility-hack38
-rw-r--r--www/firefox-esr/files/patch-clang32-visibility-hack20
-rw-r--r--www/firefox-esr/files/patch-config-baseconfig.mk16
-rw-r--r--www/firefox-esr/files/patch-config_autoconf.mk.in21
-rw-r--r--www/firefox-esr/files/patch-content-media-nsAudioStream.cpp14
-rw-r--r--www/firefox-esr/files/patch-dom-ipc-ContentChild.cpp10
-rw-r--r--www/firefox-esr/files/patch-extensions-spellcheck-hunspell-src-mozHunspell.cpp2
-rw-r--r--www/firefox-esr/files/patch-gfx-qcms-qcmstypes.h11
-rw-r--r--www/firefox-esr/files/patch-js-src-js-confdefs.h.in (renamed from www/firefox-esr/files/patch-js-src-configure.in)6
-rw-r--r--www/firefox-esr/files/patch-toolkit-xre-nsEmbedFunctions.cpp10
-rw-r--r--www/firefox-esr/files/patch-z-bug76244570
-rw-r--r--www/firefox-esr/pkg-descr2
-rw-r--r--www/firefox-i18n/Makefile4
-rw-r--r--www/firefox-i18n/distinfo328
-rw-r--r--www/firefox/Makefile23
-rw-r--r--www/firefox/Makefile.options6
-rw-r--r--www/firefox/Makefile.webplugins10
-rw-r--r--www/firefox/distinfo4
-rw-r--r--www/firefox/files/extra-bug7805316
-rw-r--r--www/firefox/files/patch-alsapulse28
-rw-r--r--www/firefox/files/patch-bug713802163
-rw-r--r--www/firefox/files/patch-bug72297520
-rw-r--r--www/firefox/files/patch-bug7530461213
-rw-r--r--www/firefox/files/patch-bug78350552
-rw-r--r--www/firefox/files/patch-bug7878043557
-rw-r--r--www/firefox/files/patch-bug78803948
-rw-r--r--www/firefox/files/patch-bug78810820
-rw-r--r--www/firefox/files/patch-bug78943627
-rw-r--r--www/firefox/files/patch-bug789693109
-rw-r--r--www/firefox/files/patch-bug791305384
-rw-r--r--www/firefox/files/patch-bug79136695
-rw-r--r--www/firefox/files/patch-bug79835415
-rw-r--r--www/firefox/files/patch-bug799441116
-rw-r--r--www/firefox/files/patch-bug80040191
-rw-r--r--www/firefox/files/patch-bug8061396
-rw-r--r--www/firefox/files/patch-bug8074922188
-rw-r--r--www/firefox/files/patch-bug81502527
-rw-r--r--www/firefox/files/patch-bug81748126
-rw-r--r--www/firefox/files/patch-bug826985370
-rw-r--r--www/firefox/files/patch-bug82800336
-rw-r--r--www/firefox/files/patch-content-base-src-nsTextFragmentImpl.h14
-rw-r--r--www/firefox/files/patch-content-media-nsAudioStream.cpp15
-rw-r--r--www/firefox/files/patch-gfx-qcms-qcmstypes.h11
-rw-r--r--www/firefox/files/patch-ipc-chromium-src-base-platform_thread_posix.cc16
-rw-r--r--www/firefox/files/patch-media-webrtc-trunk-src-modules-audio_device-main-source-linux-latebindingsymboltable_linux.cc37
-rw-r--r--www/firefox/files/patch-media-webrtc-trunk-src-system_wrappers-source-spreadsortlib-spreadsort.hpp16
-rw-r--r--www/firefox/files/patch-media-webrtc-trunk-src-system_wrappers-source-thread_posix.cc16
-rw-r--r--www/firefox/files/patch-media-webrtc-trunk-testing-gtest-include-gtest-internal-gtest-port.h17
-rw-r--r--www/firefox/files/patch-python-psutil-psutil-_psutil_bsd.c13
-rw-r--r--www/firefox/files/patch-xpcom-base-AvailableMemoryTracker.cpp10
-rw-r--r--www/firefox/files/patch-z-bug81591627
-rw-r--r--www/seamonkey-i18n/Makefile4
-rw-r--r--www/seamonkey-i18n/distinfo92
-rw-r--r--www/seamonkey/Makefile17
-rw-r--r--www/seamonkey/distinfo8
-rw-r--r--www/seamonkey/files/extra-bug7805316
-rw-r--r--www/seamonkey/files/patch-alsapulse28
-rw-r--r--www/seamonkey/files/patch-bug713802176
-rw-r--r--www/seamonkey/files/patch-bug72297520
-rw-r--r--www/seamonkey/files/patch-bug7530461213
-rw-r--r--www/seamonkey/files/patch-bug78350552
-rw-r--r--www/seamonkey/files/patch-bug78463152
-rw-r--r--www/seamonkey/files/patch-bug78699536
-rw-r--r--www/seamonkey/files/patch-bug7878043557
-rw-r--r--www/seamonkey/files/patch-bug78790412
-rw-r--r--www/seamonkey/files/patch-bug78803948
-rw-r--r--www/seamonkey/files/patch-bug78810820
-rw-r--r--www/seamonkey/files/patch-bug78943627
-rw-r--r--www/seamonkey/files/patch-bug78965611
-rw-r--r--www/seamonkey/files/patch-bug789693109
-rw-r--r--www/seamonkey/files/patch-bug791305384
-rw-r--r--www/seamonkey/files/patch-bug79136695
-rw-r--r--www/seamonkey/files/patch-bug79835415
-rw-r--r--www/seamonkey/files/patch-bug799441116
-rw-r--r--www/seamonkey/files/patch-bug80040191
-rw-r--r--www/seamonkey/files/patch-bug8061396
-rw-r--r--www/seamonkey/files/patch-bug8074922188
-rw-r--r--www/seamonkey/files/patch-bug81502527
-rw-r--r--www/seamonkey/files/patch-bug81748126
-rw-r--r--www/seamonkey/files/patch-bug826985370
-rw-r--r--www/seamonkey/files/patch-bug82800336
-rw-r--r--www/seamonkey/files/patch-enigmail-ipc-src-Makefile90
-rw-r--r--www/seamonkey/files/patch-mozilla-content-base-src-nsTextFragmentImpl.h14
-rw-r--r--www/seamonkey/files/patch-mozilla-content-media-nsAudioStream.cpp15
-rw-r--r--www/seamonkey/files/patch-mozilla-gfx-qcms-qcmstypes.h11
-rw-r--r--www/seamonkey/files/patch-mozilla-ipc-chromium-src-base-platform_thread_posix.cc16
-rw-r--r--www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-modules-audio_device-main-source-linux-latebindingsymboltable_linux.cc37
-rw-r--r--www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-system_wrappers-source-spreadsortlib-spreadsort.hpp16
-rw-r--r--www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-system_wrappers-source-thread_posix.cc16
-rw-r--r--www/seamonkey/files/patch-mozilla-media-webrtc-trunk-testing-gtest-include-gtest-internal-gtest-port.h17
-rw-r--r--www/seamonkey/files/patch-mozilla-python-psutil-psutil-_psutil_bsd.c13
-rw-r--r--www/seamonkey/files/patch-mozilla-xpcom-base-AvailableMemoryTracker.cpp10
-rw-r--r--www/seamonkey/files/patch-z-bug81591627
129 files changed, 15121 insertions, 5432 deletions
diff --git a/www/firefox-esr-i18n/Makefile b/www/firefox-esr-i18n/Makefile
index 5128aa9a9947..9b11e1862aa7 100644
--- a/www/firefox-esr-i18n/Makefile
+++ b/www/firefox-esr-i18n/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= firefox-i18n
-PORTVERSION= 10.0.11
+PORTVERSION= 17.0.2
CATEGORIES= www
MASTER_SITE_SUBDIR= firefox/releases/${PORTVERSION}esr/linux-i686/xpi
PKGNAMEPREFIX=
@@ -14,7 +14,7 @@ COMMENT= Localized interface for Firefox
EXTRACT_DEPENDS= zip:${PORTSDIR}/archivers/zip
-USE_FIREFOX= 10
+USE_FIREFOX= 17
USE_XPI= firefox linux-firefox
LATEST_LINK= firefox-esr-i18n
@@ -86,7 +86,7 @@ post-patch:
${XARGS} -0L1 ${REINPLACE_CMD} -i '' -e '/<?xml/,$$!d'
List-Langs:
- @fetch -o- "http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${PORTVERSION}esr/linux-i686/xpi"|\
+ @fetch -o- "http://releases.mozilla.org/pub/mozilla.org/${MASTER_SITE_SUBDIR}"|\
${PERL} -ne 'if(/.*href="([a-zA-Z-]+).xpi.*/){print "$$1\n"}' |\
${AWK} 'BEGIN{ORS=" "}{print $1}END{printf "\nNumber of languages: %d\n",NR}'
diff --git a/www/firefox-esr-i18n/distinfo b/www/firefox-esr-i18n/distinfo
index a78baba4606d..61e6e0b0fb42 100644
--- a/www/firefox-esr-i18n/distinfo
+++ b/www/firefox-esr-i18n/distinfo
@@ -1,164 +1,164 @@
-SHA256 (xpi/firefox-i18n-10.0.11/af.xpi) = 90ece8bfb785765f665cd15683009b1e35426b68e94205bd0b706902697fbd59
-SIZE (xpi/firefox-i18n-10.0.11/af.xpi) = 238745
-SHA256 (xpi/firefox-i18n-10.0.11/ak.xpi) = 9aea100e427b299226ea334c47d668200bd58bf630657776440c2ff32509f4a2
-SIZE (xpi/firefox-i18n-10.0.11/ak.xpi) = 240573
-SHA256 (xpi/firefox-i18n-10.0.11/ar.xpi) = 1bf9bcf59939bb4a24ab1c36d1a8edecbf7c383484d3dbd56d5418a25dc95e96
-SIZE (xpi/firefox-i18n-10.0.11/ar.xpi) = 263704
-SHA256 (xpi/firefox-i18n-10.0.11/ast.xpi) = e4ee31393e42505360a466e870abc28890c648a23f7fce8041dbf8b464628de5
-SIZE (xpi/firefox-i18n-10.0.11/ast.xpi) = 237976
-SHA256 (xpi/firefox-i18n-10.0.11/be.xpi) = 3b5a43bb9175bcd12d81f67d3699b7851dc44ef79b25f53aea87c292ee670982
-SIZE (xpi/firefox-i18n-10.0.11/be.xpi) = 245758
-SHA256 (xpi/firefox-i18n-10.0.11/bg.xpi) = cfe29da7a6308836ca25531c44ab458e3e1bb484d2f743655d2157a31ef5d98e
-SIZE (xpi/firefox-i18n-10.0.11/bg.xpi) = 276757
-SHA256 (xpi/firefox-i18n-10.0.11/bn-BD.xpi) = 8697b84e257a88664ec88e074fb39913289e15f3fe89370fdb7e53c09071ab5c
-SIZE (xpi/firefox-i18n-10.0.11/bn-BD.xpi) = 288294
-SHA256 (xpi/firefox-i18n-10.0.11/bn-IN.xpi) = f96afb1587eebb95577f1f55d42396a76ed660cd3c91edcf62d765906c6975f2
-SIZE (xpi/firefox-i18n-10.0.11/bn-IN.xpi) = 319305
-SHA256 (xpi/firefox-i18n-10.0.11/br.xpi) = 2ca127fc72121b42cfa879bc83614041388da802518668c16511b9d252c9f8a9
-SIZE (xpi/firefox-i18n-10.0.11/br.xpi) = 247652
-SHA256 (xpi/firefox-i18n-10.0.11/bs.xpi) = 43ec26eec3280d79f8ffd18b42b0d4d1f8e290f64a4d7d2b3241c6f428c20a26
-SIZE (xpi/firefox-i18n-10.0.11/bs.xpi) = 245309
-SHA256 (xpi/firefox-i18n-10.0.11/ca.xpi) = 9784161ef50ecf8a0037901fc867938575c2fc8691f1726bba303efd6b9be776
-SIZE (xpi/firefox-i18n-10.0.11/ca.xpi) = 248222
-SHA256 (xpi/firefox-i18n-10.0.11/cs.xpi) = 96b782caf8d73fe848cdc1c851f6b325a140cf84c7d40a0cb1d13602bc2dbcf9
-SIZE (xpi/firefox-i18n-10.0.11/cs.xpi) = 248770
-SHA256 (xpi/firefox-i18n-10.0.11/cy.xpi) = 059d36645fa9099b35f100cc2fd75dce78be7c40eb8c969668b7105e383309a3
-SIZE (xpi/firefox-i18n-10.0.11/cy.xpi) = 244198
-SHA256 (xpi/firefox-i18n-10.0.11/da.xpi) = 30c0d33590c2ba72ae9a1e22ecf5214ca3f44e24db871f337f8a169409b75f74
-SIZE (xpi/firefox-i18n-10.0.11/da.xpi) = 240329
-SHA256 (xpi/firefox-i18n-10.0.11/de.xpi) = 6e2488e7136dc5d67548d806175feecd0d94b75f48901e023305c7befda9268f
-SIZE (xpi/firefox-i18n-10.0.11/de.xpi) = 249299
-SHA256 (xpi/firefox-i18n-10.0.11/el.xpi) = 18a012130ca0501a6ce700639d4223837738886a1cbd70b5573011c3769a9c54
-SIZE (xpi/firefox-i18n-10.0.11/el.xpi) = 264381
-SHA256 (xpi/firefox-i18n-10.0.11/en-GB.xpi) = b392ec30ce941d4761f2c53ccca02edf7be1b8f06390642b584bdfb2f8705e6c
-SIZE (xpi/firefox-i18n-10.0.11/en-GB.xpi) = 231195
-SHA256 (xpi/firefox-i18n-10.0.11/en-US.xpi) = 6b9df8158e63b30bad7f112852408cda926f89677a44cf4d9a37a2bcec635eff
-SIZE (xpi/firefox-i18n-10.0.11/en-US.xpi) = 230682
-SHA256 (xpi/firefox-i18n-10.0.11/en-ZA.xpi) = e481c04f33ba14f4760258ada9ba5727ec501a3399a4ab1bde5a5446184f6146
-SIZE (xpi/firefox-i18n-10.0.11/en-ZA.xpi) = 233921
-SHA256 (xpi/firefox-i18n-10.0.11/eo.xpi) = 4b11045857c9d215826bf13ae3a8dac8b8e87e3441593d49b263aea83a48ea26
-SIZE (xpi/firefox-i18n-10.0.11/eo.xpi) = 240904
-SHA256 (xpi/firefox-i18n-10.0.11/es-AR.xpi) = d3fb903212edc4a40c5004fee75b0f9f1c0e04583c8b289192f22076e0c98cd4
-SIZE (xpi/firefox-i18n-10.0.11/es-AR.xpi) = 245347
-SHA256 (xpi/firefox-i18n-10.0.11/es-CL.xpi) = 0630d0535e6930818ad685567b8d83a860ea3a3f5791bd5d1f0ae20a8ec95dda
-SIZE (xpi/firefox-i18n-10.0.11/es-CL.xpi) = 250206
-SHA256 (xpi/firefox-i18n-10.0.11/es-ES.xpi) = fb3617624d8606a3155a224078a26a48a01cc7537f3dfa63acbc0b17c21253fd
-SIZE (xpi/firefox-i18n-10.0.11/es-ES.xpi) = 215379
-SHA256 (xpi/firefox-i18n-10.0.11/es-MX.xpi) = 86bd2bb3d9b5480906f8c060432bdb824d616dc1376536cbd3d7169a65afdc64
-SIZE (xpi/firefox-i18n-10.0.11/es-MX.xpi) = 224153
-SHA256 (xpi/firefox-i18n-10.0.11/et.xpi) = a507c129c1cffc8f3cf1d824f3684ef91d3abdb12d3cad9e9665e6824289495f
-SIZE (xpi/firefox-i18n-10.0.11/et.xpi) = 242632
-SHA256 (xpi/firefox-i18n-10.0.11/eu.xpi) = a2dc136240db5c0ff1215674c415624e8f21dd8623dbe87725ef6c9d2226fb1d
-SIZE (xpi/firefox-i18n-10.0.11/eu.xpi) = 240253
-SHA256 (xpi/firefox-i18n-10.0.11/fa.xpi) = 4d740a9f10d053c58358b2a98557954ca718aa8484786c8259752b2c395b0dd2
-SIZE (xpi/firefox-i18n-10.0.11/fa.xpi) = 272854
-SHA256 (xpi/firefox-i18n-10.0.11/fi.xpi) = 72e96b22cec634a5a05524c17aeaa2480374d60cd6862e5a4aa9bda0c6f29a37
-SIZE (xpi/firefox-i18n-10.0.11/fi.xpi) = 243631
-SHA256 (xpi/firefox-i18n-10.0.11/fr.xpi) = 31811aee809cb8896470d5f9e279e44e2ffbaa99b7265a9e21a52c2c35324c68
-SIZE (xpi/firefox-i18n-10.0.11/fr.xpi) = 249570
-SHA256 (xpi/firefox-i18n-10.0.11/fy-NL.xpi) = b4282711697e6dd54b31765355e3cc488c00f375022ce81dad0a8d73bad07d2a
-SIZE (xpi/firefox-i18n-10.0.11/fy-NL.xpi) = 249344
-SHA256 (xpi/firefox-i18n-10.0.11/ga-IE.xpi) = 33cc30bf1b2a4bc028db85eb83387a393c8e306f703b1b6e2b282e661d71f584
-SIZE (xpi/firefox-i18n-10.0.11/ga-IE.xpi) = 252024
-SHA256 (xpi/firefox-i18n-10.0.11/gl.xpi) = 96a188af032c3dc13976475d97b936ac7f3e6eb6ee8d4a6cf54494d122fd9f69
-SIZE (xpi/firefox-i18n-10.0.11/gl.xpi) = 243250
-SHA256 (xpi/firefox-i18n-10.0.11/gu-IN.xpi) = facd8483801bc169a9d5ee4674e5a9ba343b0348ee4957158141f73bf291e8db
-SIZE (xpi/firefox-i18n-10.0.11/gu-IN.xpi) = 275223
-SHA256 (xpi/firefox-i18n-10.0.11/he.xpi) = bf586d97424d0b07e7bd08ccb7dfd65eb66a9f00d8bec0a9be79f8cea10a85a0
-SIZE (xpi/firefox-i18n-10.0.11/he.xpi) = 264936
-SHA256 (xpi/firefox-i18n-10.0.11/hi-IN.xpi) = 2a7f647f27b118ecb238ea39739afcb285347fdd581d2aef6ee31921d5f88187
-SIZE (xpi/firefox-i18n-10.0.11/hi-IN.xpi) = 280002
-SHA256 (xpi/firefox-i18n-10.0.11/hr.xpi) = aa4a53ecd79c026bd28d7be2a8bc62f6a97b129e3f9c6b4b7d9cf64e9c5797a3
-SIZE (xpi/firefox-i18n-10.0.11/hr.xpi) = 249334
-SHA256 (xpi/firefox-i18n-10.0.11/hu.xpi) = dcccb43804ff627cb2bf6404e961b0cc7beab8d8c1318471ad7117fc1154a2ba
-SIZE (xpi/firefox-i18n-10.0.11/hu.xpi) = 253775
-SHA256 (xpi/firefox-i18n-10.0.11/hy-AM.xpi) = 483dd0db1b5ef9a22f6069e372467a9e683863dfd20c5e2aa74c7d8d3b9fb842
-SIZE (xpi/firefox-i18n-10.0.11/hy-AM.xpi) = 445453
-SHA256 (xpi/firefox-i18n-10.0.11/id.xpi) = e527a326a558be79a787fc53cb1e1333cbc99d555f256c4570ecbd7f79ab927b
-SIZE (xpi/firefox-i18n-10.0.11/id.xpi) = 236825
-SHA256 (xpi/firefox-i18n-10.0.11/is.xpi) = 5fe7ae96611fad428064aedffd35078df7ad59eacaea80c74b84deb2d0affaa6
-SIZE (xpi/firefox-i18n-10.0.11/is.xpi) = 243069
-SHA256 (xpi/firefox-i18n-10.0.11/it.xpi) = 3090a4c7144c2dc3da2e48e12d6de8948af810230b9ed148213af304f0652fa1
-SIZE (xpi/firefox-i18n-10.0.11/it.xpi) = 212718
-SHA256 (xpi/firefox-i18n-10.0.11/ja.xpi) = 0f8b69eb5ddc9b2dd3980f643a0961721efec591c88810fb089e894b8a22ddc3
-SIZE (xpi/firefox-i18n-10.0.11/ja.xpi) = 273117
-SHA256 (xpi/firefox-i18n-10.0.11/kk.xpi) = 35a71e82a33ebef14cbbc86bf58a0223356aecf1a5607e81c75c2f2b206f2c1c
-SIZE (xpi/firefox-i18n-10.0.11/kk.xpi) = 279779
-SHA256 (xpi/firefox-i18n-10.0.11/kn.xpi) = 4c3ceac9bec6807115249f2a6eb8481dd06b1f88e85e8bd7047fa94187b146ee
-SIZE (xpi/firefox-i18n-10.0.11/kn.xpi) = 299832
-SHA256 (xpi/firefox-i18n-10.0.11/ko.xpi) = c789168594f6575a1127f9e6e9fc7b01516410a9af8dc6c54b3e33539893320f
-SIZE (xpi/firefox-i18n-10.0.11/ko.xpi) = 227948
-SHA256 (xpi/firefox-i18n-10.0.11/ku.xpi) = 5dc01d26576ea193ebb0ae6191da70be1b0ea4fefab3f83933ae7df6d599408d
-SIZE (xpi/firefox-i18n-10.0.11/ku.xpi) = 254711
-SHA256 (xpi/firefox-i18n-10.0.11/lg.xpi) = e7a64db780496953dfb9d623307ef087f09009daa4c0e1161e99100e5c971339
-SIZE (xpi/firefox-i18n-10.0.11/lg.xpi) = 247675
-SHA256 (xpi/firefox-i18n-10.0.11/lt.xpi) = 13fac6431709afd0741a94f4f3ecd365926b43c4a01f0eb1f4e592e32f62113c
-SIZE (xpi/firefox-i18n-10.0.11/lt.xpi) = 330633
-SHA256 (xpi/firefox-i18n-10.0.11/lv.xpi) = 6190c2da9b08c0d75f430a7d30a06e7b3991cc888cfe491e512b3ceb49b9a6ea
-SIZE (xpi/firefox-i18n-10.0.11/lv.xpi) = 244354
-SHA256 (xpi/firefox-i18n-10.0.11/mai.xpi) = 4fbe32f1dcf63e78950a95fa77caf78e93e54a7a0c88be5bb73ac07d89cccf6f
-SIZE (xpi/firefox-i18n-10.0.11/mai.xpi) = 279254
-SHA256 (xpi/firefox-i18n-10.0.11/mk.xpi) = 71ef2339a6a8b4bb6e6f8a755c8250aba8e4d214fbb36ca2bdfcb219cbfc1e9a
-SIZE (xpi/firefox-i18n-10.0.11/mk.xpi) = 272941
-SHA256 (xpi/firefox-i18n-10.0.11/ml.xpi) = 0931b0d3302867d43724e61a7912988f44de9d72d671a7c70675cb641efa72cd
-SIZE (xpi/firefox-i18n-10.0.11/ml.xpi) = 306677
-SHA256 (xpi/firefox-i18n-10.0.11/mr.xpi) = f10a7722375b3ec12065beb08ddd0c1da87e6d6bce92463a7ca15765d54d52ea
-SIZE (xpi/firefox-i18n-10.0.11/mr.xpi) = 281459
-SHA256 (xpi/firefox-i18n-10.0.11/nb-NO.xpi) = c5b49962a4f5cb7c81fb72428478ccbb9cfba4508e6916b4ce0968caa5b95ab9
-SIZE (xpi/firefox-i18n-10.0.11/nb-NO.xpi) = 241212
-SHA256 (xpi/firefox-i18n-10.0.11/nl.xpi) = b05fc760572c72dafbaa53c2b249e19b5fe119568cff724ee1a7410bcb8eaaa8
-SIZE (xpi/firefox-i18n-10.0.11/nl.xpi) = 242402
-SHA256 (xpi/firefox-i18n-10.0.11/nn-NO.xpi) = b25c05f8f767ec38c5a40c10330a7ca93509dfef5769997170b9aa7caab367e8
-SIZE (xpi/firefox-i18n-10.0.11/nn-NO.xpi) = 242455
-SHA256 (xpi/firefox-i18n-10.0.11/nso.xpi) = 166d3c6f4b30cfa51bdddd04834ff95461650c41bb83c02482f12f119f0630a9
-SIZE (xpi/firefox-i18n-10.0.11/nso.xpi) = 245697
-SHA256 (xpi/firefox-i18n-10.0.11/or.xpi) = 3353de0d6b62d5b604bce992504354d3da22c61aa591392833058020b00bb182
-SIZE (xpi/firefox-i18n-10.0.11/or.xpi) = 281687
-SHA256 (xpi/firefox-i18n-10.0.11/pa-IN.xpi) = 4b0bbbd5bb310711abea9a347747cea6778dd3e5c01a325023e86a5cc710bb3b
-SIZE (xpi/firefox-i18n-10.0.11/pa-IN.xpi) = 282146
-SHA256 (xpi/firefox-i18n-10.0.11/pl.xpi) = b3c34eb9c030976f6acd45247c70725c22ce0dd1262376ab155e73670b627cca
-SIZE (xpi/firefox-i18n-10.0.11/pl.xpi) = 252049
-SHA256 (xpi/firefox-i18n-10.0.11/pt-BR.xpi) = 2a87614897d01560f6eca36c94bc988805b7a6b2b896e11668da87174c36fbb4
-SIZE (xpi/firefox-i18n-10.0.11/pt-BR.xpi) = 246850
-SHA256 (xpi/firefox-i18n-10.0.11/pt-PT.xpi) = 7bee6a6533029db35546bd401ef2b6cd60edf5c8ec334181ab3e4a915ae24c35
-SIZE (xpi/firefox-i18n-10.0.11/pt-PT.xpi) = 246478
-SHA256 (xpi/firefox-i18n-10.0.11/rm.xpi) = 31190db630ee3dbb8f1fc8f097dea93eac380ee99e87b581b919d3a47af02f98
-SIZE (xpi/firefox-i18n-10.0.11/rm.xpi) = 245773
-SHA256 (xpi/firefox-i18n-10.0.11/ro.xpi) = 45d422e0719308cd2540bd331b7439579b265e9679de1051e7f8e006ecbf0899
-SIZE (xpi/firefox-i18n-10.0.11/ro.xpi) = 263253
-SHA256 (xpi/firefox-i18n-10.0.11/ru.xpi) = b856c77141af93ccf0268278e7325e6367da86c53d3644089ea22b1e8daec828
-SIZE (xpi/firefox-i18n-10.0.11/ru.xpi) = 254986
-SHA256 (xpi/firefox-i18n-10.0.11/si.xpi) = 16791cce9532b68b946e90015235e24f7b9b3b7f3931c222449f0da9342624e7
-SIZE (xpi/firefox-i18n-10.0.11/si.xpi) = 271991
-SHA256 (xpi/firefox-i18n-10.0.11/sk.xpi) = a4585d5dc8052f53c8951892fd72a2c853d92174e94ecd1a002451983e461d6d
-SIZE (xpi/firefox-i18n-10.0.11/sk.xpi) = 254290
-SHA256 (xpi/firefox-i18n-10.0.11/sl.xpi) = fd2747d6f0e5949fcd39d4e7a6cc568a417fce034b1cc94615c5216070f3dcec
-SIZE (xpi/firefox-i18n-10.0.11/sl.xpi) = 241036
-SHA256 (xpi/firefox-i18n-10.0.11/son.xpi) = 01fe863e1bd6a0d75d7d64663f8550e70501f63454eb3d919e5c7d3ccb806610
-SIZE (xpi/firefox-i18n-10.0.11/son.xpi) = 239061
-SHA256 (xpi/firefox-i18n-10.0.11/sq.xpi) = bbc5088737f3c3fdf4c1f0e099bfd21ab20afaeff544095a0fc0e9b39c45771a
-SIZE (xpi/firefox-i18n-10.0.11/sq.xpi) = 227698
-SHA256 (xpi/firefox-i18n-10.0.11/sr.xpi) = 635a327b322995d2bbe0967bc7bead3c19105dc27476e6a657981fe1d095693b
-SIZE (xpi/firefox-i18n-10.0.11/sr.xpi) = 277746
-SHA256 (xpi/firefox-i18n-10.0.11/sv-SE.xpi) = 0e35b899fdcd77a00a76833911862079ea2777f705da904d0b7693d4a1e7958b
-SIZE (xpi/firefox-i18n-10.0.11/sv-SE.xpi) = 278882
-SHA256 (xpi/firefox-i18n-10.0.11/ta-LK.xpi) = d5e1f81c716bb307a73c1d25ec22e72666b4f9e27ab2921859cb96082bbc05d5
-SIZE (xpi/firefox-i18n-10.0.11/ta-LK.xpi) = 290620
-SHA256 (xpi/firefox-i18n-10.0.11/ta.xpi) = 5ba580f167a9bf1fd28d7a1d82b33f5d0727693b926ece0e28813250542d0345
-SIZE (xpi/firefox-i18n-10.0.11/ta.xpi) = 274057
-SHA256 (xpi/firefox-i18n-10.0.11/te.xpi) = 49f3f8ac436c99cfaba4d5870a8b7e52a36534ff6eb1dd96b9204858da93534f
-SIZE (xpi/firefox-i18n-10.0.11/te.xpi) = 289047
-SHA256 (xpi/firefox-i18n-10.0.11/th.xpi) = b37d9376d43608d0a96a7d52ec7548822936bb853dd08a0b62aac16102f5c0ea
-SIZE (xpi/firefox-i18n-10.0.11/th.xpi) = 272424
-SHA256 (xpi/firefox-i18n-10.0.11/tr.xpi) = bc690ed31ab5e890682ba08ffdd28210047394e3581ec960043028dc5bad911a
-SIZE (xpi/firefox-i18n-10.0.11/tr.xpi) = 249918
-SHA256 (xpi/firefox-i18n-10.0.11/uk.xpi) = ef7bd32e6dc545f4bbac5951446bb24cfdf092d60edc0383f20ce6ec9fbe9cb8
-SIZE (xpi/firefox-i18n-10.0.11/uk.xpi) = 279134
-SHA256 (xpi/firefox-i18n-10.0.11/vi.xpi) = 54e2954f1d24ee9935a5c4532575adc6ff133297de0b79ffb226031eaa863935
-SIZE (xpi/firefox-i18n-10.0.11/vi.xpi) = 262787
-SHA256 (xpi/firefox-i18n-10.0.11/zh-CN.xpi) = 7f948e543242bdbdd14de4d63cdbf81999b83709f1d9f964565f525b3e9de8ac
-SIZE (xpi/firefox-i18n-10.0.11/zh-CN.xpi) = 256548
-SHA256 (xpi/firefox-i18n-10.0.11/zh-TW.xpi) = 0d719d4d9635df855bde99c8bf654c5172672eacfd6d9d068706683464ddad2b
-SIZE (xpi/firefox-i18n-10.0.11/zh-TW.xpi) = 257494
-SHA256 (xpi/firefox-i18n-10.0.11/zu.xpi) = 26ac7353f3a526559330e800899790698a3b92d61289e3dd19a84623b43bf264
-SIZE (xpi/firefox-i18n-10.0.11/zu.xpi) = 246397
+SHA256 (xpi/firefox-i18n-17.0.2/af.xpi) = 6d5b8d789da804fb261093e5ad6026273497b8ba2eb505dab2d8637195cb6ebd
+SIZE (xpi/firefox-i18n-17.0.2/af.xpi) = 285646
+SHA256 (xpi/firefox-i18n-17.0.2/ak.xpi) = d25e30e73ea0c9ad96cd5f58344d624cbabaa5dcd355c8760ef43013f1e0a04d
+SIZE (xpi/firefox-i18n-17.0.2/ak.xpi) = 287476
+SHA256 (xpi/firefox-i18n-17.0.2/ar.xpi) = 528f44b1054fe2f426d942fa69011666c2e3c245aaeaccdf652d9d9cab9004ea
+SIZE (xpi/firefox-i18n-17.0.2/ar.xpi) = 316007
+SHA256 (xpi/firefox-i18n-17.0.2/ast.xpi) = 918812abf88a6ab942e551fecd8f25f72a3f91218d4dd19c1d7cc991de38c63a
+SIZE (xpi/firefox-i18n-17.0.2/ast.xpi) = 268623
+SHA256 (xpi/firefox-i18n-17.0.2/be.xpi) = 6eb8091585624dcc4781dfd876b1952ce1bdc6004bb7d2885c1e405ae2a01c7c
+SIZE (xpi/firefox-i18n-17.0.2/be.xpi) = 277911
+SHA256 (xpi/firefox-i18n-17.0.2/bg.xpi) = 979d1fb47d0d4c76269ad271e032212f7eb6f35dab0b4393d695e32073857765
+SIZE (xpi/firefox-i18n-17.0.2/bg.xpi) = 331761
+SHA256 (xpi/firefox-i18n-17.0.2/bn-BD.xpi) = 27bfe4fde40586a18897701f4fd786b78b6237c56c22a7dd64ffacb6007f38a6
+SIZE (xpi/firefox-i18n-17.0.2/bn-BD.xpi) = 343803
+SHA256 (xpi/firefox-i18n-17.0.2/bn-IN.xpi) = 47399b587379b5eed87a7648d5c9783d3996bd550e31b0fd031b59719d0e8897
+SIZE (xpi/firefox-i18n-17.0.2/bn-IN.xpi) = 377521
+SHA256 (xpi/firefox-i18n-17.0.2/br.xpi) = 17230b71212b70583828ac84abf197a607336c72b39039add18c2931b00bbef3
+SIZE (xpi/firefox-i18n-17.0.2/br.xpi) = 296083
+SHA256 (xpi/firefox-i18n-17.0.2/bs.xpi) = 398cc929a711e785f6058b40838943227dd8e90f35d67dd903f25a6aba9931ca
+SIZE (xpi/firefox-i18n-17.0.2/bs.xpi) = 296723
+SHA256 (xpi/firefox-i18n-17.0.2/ca.xpi) = 07dcf710f1b5b3a80aadd1ae680a8b65d802740ded815bbc6aa06464b2f0c17d
+SIZE (xpi/firefox-i18n-17.0.2/ca.xpi) = 298032
+SHA256 (xpi/firefox-i18n-17.0.2/cs.xpi) = 6e235250929d1a9b273ed49b58d03f14a29ffafde4f35d1fbde733cf42961a35
+SIZE (xpi/firefox-i18n-17.0.2/cs.xpi) = 298633
+SHA256 (xpi/firefox-i18n-17.0.2/cy.xpi) = 734201eb4ba589380559af9875a1161d5684a5a08393c5f886ea1c2962852b62
+SIZE (xpi/firefox-i18n-17.0.2/cy.xpi) = 289368
+SHA256 (xpi/firefox-i18n-17.0.2/da.xpi) = b986646e296e3addc098893213e090632dcb69235b313eeff39bad58e47c948d
+SIZE (xpi/firefox-i18n-17.0.2/da.xpi) = 287168
+SHA256 (xpi/firefox-i18n-17.0.2/de.xpi) = 9caf742303a72dd0183b7a9685f4c902ea5ba8bb808cb2571fd7f3eb2bbbdea5
+SIZE (xpi/firefox-i18n-17.0.2/de.xpi) = 274884
+SHA256 (xpi/firefox-i18n-17.0.2/el.xpi) = 77f3022fd8cc99094163ff731631957cf504992222f02d448e69aaa6df4b1d7f
+SIZE (xpi/firefox-i18n-17.0.2/el.xpi) = 316152
+SHA256 (xpi/firefox-i18n-17.0.2/en-GB.xpi) = abfe856366428908f4a8392667968dd65cb894dd2af4d8a6e82b343d497b7d92
+SIZE (xpi/firefox-i18n-17.0.2/en-GB.xpi) = 276604
+SHA256 (xpi/firefox-i18n-17.0.2/en-US.xpi) = fca93c146b34b808546dbf88d2c17d26bd68ed26a4ce4dcf4e9f31d103764ffe
+SIZE (xpi/firefox-i18n-17.0.2/en-US.xpi) = 276655
+SHA256 (xpi/firefox-i18n-17.0.2/en-ZA.xpi) = 21465bfe612c8656fa676ab545e096ed96f65cbdf7aeadbdbb712f8375b508b6
+SIZE (xpi/firefox-i18n-17.0.2/en-ZA.xpi) = 277435
+SHA256 (xpi/firefox-i18n-17.0.2/eo.xpi) = 81fd6274cd248840a02879341025a1399bb1f16863d8352255064de12bfd8784
+SIZE (xpi/firefox-i18n-17.0.2/eo.xpi) = 289300
+SHA256 (xpi/firefox-i18n-17.0.2/es-AR.xpi) = c0efd7922fcffea22b86bbb78f3e67d6e3641523e4806d2dd21bca104c2f9485
+SIZE (xpi/firefox-i18n-17.0.2/es-AR.xpi) = 293739
+SHA256 (xpi/firefox-i18n-17.0.2/es-CL.xpi) = 1f94635df9d969aa3e02486bd0a89490d02d71e61961d0fa6162537d110f14ac
+SIZE (xpi/firefox-i18n-17.0.2/es-CL.xpi) = 301378
+SHA256 (xpi/firefox-i18n-17.0.2/es-ES.xpi) = ecf0f9a4279cab133779eca077b93a5336dfb37c78a088863de0ee60ac7c1426
+SIZE (xpi/firefox-i18n-17.0.2/es-ES.xpi) = 246685
+SHA256 (xpi/firefox-i18n-17.0.2/es-MX.xpi) = 336c3262f8b8ab9822de6e574714c47dfc5edc960b622ddc6838a775d57b1cf4
+SIZE (xpi/firefox-i18n-17.0.2/es-MX.xpi) = 252471
+SHA256 (xpi/firefox-i18n-17.0.2/et.xpi) = 0756ac731e0cd6571f7c6f826c67ffce040dcaf9db233c71f83c9fcb2703e3af
+SIZE (xpi/firefox-i18n-17.0.2/et.xpi) = 289194
+SHA256 (xpi/firefox-i18n-17.0.2/eu.xpi) = 47ea6e37cf4e83443abc33e297a7c7b059627a73477c96d4fe71c8319f79abd5
+SIZE (xpi/firefox-i18n-17.0.2/eu.xpi) = 288727
+SHA256 (xpi/firefox-i18n-17.0.2/fa.xpi) = e4406bde464693adb956f882310ac7c2d1231343ff2087ff40257581980c1cfd
+SIZE (xpi/firefox-i18n-17.0.2/fa.xpi) = 328497
+SHA256 (xpi/firefox-i18n-17.0.2/fi.xpi) = 5192fbc5cd6401df1dd429647d18917c5fb760e384909fb8b151abeddcf11219
+SIZE (xpi/firefox-i18n-17.0.2/fi.xpi) = 293155
+SHA256 (xpi/firefox-i18n-17.0.2/fr.xpi) = 3917245c0c2b7a6b5eefc84733aed1a8cf9af7c749845825d3db2459075d62db
+SIZE (xpi/firefox-i18n-17.0.2/fr.xpi) = 297862
+SHA256 (xpi/firefox-i18n-17.0.2/fy-NL.xpi) = bf6798af96f37c5d7e205586adb00d5a603f6cda6f68931a37026a9a21fd7943
+SIZE (xpi/firefox-i18n-17.0.2/fy-NL.xpi) = 294190
+SHA256 (xpi/firefox-i18n-17.0.2/ga-IE.xpi) = 84583f93270ac4fec14522bac7567f21ea34f4fbe2ac21c7059b0aeaa9deef81
+SIZE (xpi/firefox-i18n-17.0.2/ga-IE.xpi) = 301476
+SHA256 (xpi/firefox-i18n-17.0.2/gl.xpi) = 68df133bf048268db0f026e34952303e518a03db34fb8da3cf6864ffd44d52ba
+SIZE (xpi/firefox-i18n-17.0.2/gl.xpi) = 291497
+SHA256 (xpi/firefox-i18n-17.0.2/gu-IN.xpi) = 7663fb8fc33167fe69bc144d952d6f7468ba1dc7c4e577c8e4d5bfae822f8a45
+SIZE (xpi/firefox-i18n-17.0.2/gu-IN.xpi) = 323980
+SHA256 (xpi/firefox-i18n-17.0.2/he.xpi) = a63942d94f82e7d82488af6481d66bc7ebc252ff22bc83465ff92d85260a0665
+SIZE (xpi/firefox-i18n-17.0.2/he.xpi) = 305982
+SHA256 (xpi/firefox-i18n-17.0.2/hi-IN.xpi) = 0d3ca8f2d75b94826625e9058465e51897d517ae1a5304f6976a775b7df4e980
+SIZE (xpi/firefox-i18n-17.0.2/hi-IN.xpi) = 335364
+SHA256 (xpi/firefox-i18n-17.0.2/hr.xpi) = 10c19f435aab461c68c373b3a641fc58b2a6ee6e652fda2a86180a9ee092eeda
+SIZE (xpi/firefox-i18n-17.0.2/hr.xpi) = 292440
+SHA256 (xpi/firefox-i18n-17.0.2/hu.xpi) = 579fed50c2d95b34e252b2b201e46b059a57779add5eb715ea60511212c60ee5
+SIZE (xpi/firefox-i18n-17.0.2/hu.xpi) = 307544
+SHA256 (xpi/firefox-i18n-17.0.2/hy-AM.xpi) = c491aed01542cb4fe7ece9b9f6381d5719d02ae588fb4765fa8b122a357e3d69
+SIZE (xpi/firefox-i18n-17.0.2/hy-AM.xpi) = 332703
+SHA256 (xpi/firefox-i18n-17.0.2/id.xpi) = 28383d70e236213d8f9691e41f36f2d97f90d41eff5e4cbc12788d89dd0baa41
+SIZE (xpi/firefox-i18n-17.0.2/id.xpi) = 288225
+SHA256 (xpi/firefox-i18n-17.0.2/is.xpi) = 6d44bad43c84d53ab443fc7175390e142688307682015ceb4564cb981893c4be
+SIZE (xpi/firefox-i18n-17.0.2/is.xpi) = 289408
+SHA256 (xpi/firefox-i18n-17.0.2/it.xpi) = 55d0b58610a6237a821d6a1e2ad3f3982d03c0fb6cdacc7c01185a089e7e72e4
+SIZE (xpi/firefox-i18n-17.0.2/it.xpi) = 243145
+SHA256 (xpi/firefox-i18n-17.0.2/ja.xpi) = 22723d0f2d958d1ed991157efdebea1358a5de10e855c206a349d3f349cfb27a
+SIZE (xpi/firefox-i18n-17.0.2/ja.xpi) = 326990
+SHA256 (xpi/firefox-i18n-17.0.2/kk.xpi) = 208ad4848ed9cf22413912ea60234f697e12967e75527542a0e56bb7b662bf8e
+SIZE (xpi/firefox-i18n-17.0.2/kk.xpi) = 334852
+SHA256 (xpi/firefox-i18n-17.0.2/kn.xpi) = 97e8be41f22e0d188190d3b093d6b6ddf6e9ae08c3af8ebb0f4ae7dfc811322a
+SIZE (xpi/firefox-i18n-17.0.2/kn.xpi) = 359400
+SHA256 (xpi/firefox-i18n-17.0.2/ko.xpi) = ad09b95fb698bbb977e03d06f45a4cdc98f33cdaa726d53902b1ae6a2879d659
+SIZE (xpi/firefox-i18n-17.0.2/ko.xpi) = 301229
+SHA256 (xpi/firefox-i18n-17.0.2/ku.xpi) = 591ad0aec47eeb41719747ab8890e4985c3fead338c5dcb47196c08a7bbca2e1
+SIZE (xpi/firefox-i18n-17.0.2/ku.xpi) = 309398
+SHA256 (xpi/firefox-i18n-17.0.2/lg.xpi) = 52037aff0b854432bcadb125e81124eaf3bc53e4a3c066a61cfc5135ab9a2750
+SIZE (xpi/firefox-i18n-17.0.2/lg.xpi) = 295127
+SHA256 (xpi/firefox-i18n-17.0.2/lt.xpi) = eca9fcabfc1e486ad59ee841460c0379b0bd2e54f1487c63bd61e89d94cabeb7
+SIZE (xpi/firefox-i18n-17.0.2/lt.xpi) = 353962
+SHA256 (xpi/firefox-i18n-17.0.2/lv.xpi) = 11e2eb38248f7e4e39cca3550c3e2953c5541bdc8e78a4aa34f0d578a69c161c
+SIZE (xpi/firefox-i18n-17.0.2/lv.xpi) = 295904
+SHA256 (xpi/firefox-i18n-17.0.2/mai.xpi) = 7d93d89c7875fa0a46994b1fecbf1355629b5438e33d4837faefd9242120661f
+SIZE (xpi/firefox-i18n-17.0.2/mai.xpi) = 332767
+SHA256 (xpi/firefox-i18n-17.0.2/mk.xpi) = 96bbbb901703e6943e0071f42149b3f79b4689ae52fc1736d1e769f54b830cd3
+SIZE (xpi/firefox-i18n-17.0.2/mk.xpi) = 320078
+SHA256 (xpi/firefox-i18n-17.0.2/ml.xpi) = 185fea73d12ddd3f37b28b6c6235caca5bd468bb601cbcf6cce9ff148931b7f3
+SIZE (xpi/firefox-i18n-17.0.2/ml.xpi) = 366041
+SHA256 (xpi/firefox-i18n-17.0.2/mr.xpi) = 7c36acce4865ff26e5eb0dd60085f703ac6f004f4b6a0ca7aa1ce7c904be718c
+SIZE (xpi/firefox-i18n-17.0.2/mr.xpi) = 332360
+SHA256 (xpi/firefox-i18n-17.0.2/nb-NO.xpi) = f5a27194dc2ca6a6a7e2cb7c70784fb3798b49a1f008ff90d98e68997f44ced9
+SIZE (xpi/firefox-i18n-17.0.2/nb-NO.xpi) = 289388
+SHA256 (xpi/firefox-i18n-17.0.2/nl.xpi) = 26c6860c0eead97210586fef461cfc4fb85d726ee8b3941a371686233db60bdc
+SIZE (xpi/firefox-i18n-17.0.2/nl.xpi) = 290612
+SHA256 (xpi/firefox-i18n-17.0.2/nn-NO.xpi) = 543971f7f6b15d8ae63120e9fc3f0f7cb1f0a897ca95face942d581e5791186c
+SIZE (xpi/firefox-i18n-17.0.2/nn-NO.xpi) = 292344
+SHA256 (xpi/firefox-i18n-17.0.2/nso.xpi) = 1c1baebb622c2826b4e1eb763468bbe0bf56f7fdd2e6431abd7f32004dd55f11
+SIZE (xpi/firefox-i18n-17.0.2/nso.xpi) = 292650
+SHA256 (xpi/firefox-i18n-17.0.2/or.xpi) = c2f1ca7cca066f39ac6883d1067b3c79016a381d46447eb7e4a5293280328d15
+SIZE (xpi/firefox-i18n-17.0.2/or.xpi) = 334183
+SHA256 (xpi/firefox-i18n-17.0.2/pa-IN.xpi) = ff49e418d4e325e4c9fa84781742374b3c27aefbf6b8bbe09887775caaa91ebf
+SIZE (xpi/firefox-i18n-17.0.2/pa-IN.xpi) = 323004
+SHA256 (xpi/firefox-i18n-17.0.2/pl.xpi) = 7f721e9882045105313429509ab226e41095b5770884344641de151cb9263388
+SIZE (xpi/firefox-i18n-17.0.2/pl.xpi) = 305535
+SHA256 (xpi/firefox-i18n-17.0.2/pt-BR.xpi) = 15ca70dd7ab5347f1cba36694c3b95186ec51116ce025e5c37af3fbe89e71c61
+SIZE (xpi/firefox-i18n-17.0.2/pt-BR.xpi) = 293744
+SHA256 (xpi/firefox-i18n-17.0.2/pt-PT.xpi) = 0e8a3ca7f66147f0ae6c31d6a852d3b1ccc0ce7ba6172ba3c508e00fbd02fdd7
+SIZE (xpi/firefox-i18n-17.0.2/pt-PT.xpi) = 295958
+SHA256 (xpi/firefox-i18n-17.0.2/rm.xpi) = 3e679cb3e971c789355f49c14e23224182443a2288c77c951cabd7a2c4114213
+SIZE (xpi/firefox-i18n-17.0.2/rm.xpi) = 292966
+SHA256 (xpi/firefox-i18n-17.0.2/ro.xpi) = 09609f849f05a04682ef546680b4f759314ba06019b7dd934790a92e17a366c3
+SIZE (xpi/firefox-i18n-17.0.2/ro.xpi) = 314752
+SHA256 (xpi/firefox-i18n-17.0.2/ru.xpi) = 6527cac471d9871acb1a6da80de4d9710b81ebd49fe43129d2786c3d96e90436
+SIZE (xpi/firefox-i18n-17.0.2/ru.xpi) = 289415
+SHA256 (xpi/firefox-i18n-17.0.2/si.xpi) = 0fb93b12d416021158623f7d7b5b63dda7502a9f20702e30d7744e94ebdf77aa
+SIZE (xpi/firefox-i18n-17.0.2/si.xpi) = 321864
+SHA256 (xpi/firefox-i18n-17.0.2/sk.xpi) = ccce11f3a9d13609053a1a3ff147d34c5bade81f7453b3da0ee487df1f5376a6
+SIZE (xpi/firefox-i18n-17.0.2/sk.xpi) = 305978
+SHA256 (xpi/firefox-i18n-17.0.2/sl.xpi) = c90f58f2eb25729d2427e19013ff2d0101c2e99bc4234835fed68c6959287781
+SIZE (xpi/firefox-i18n-17.0.2/sl.xpi) = 291138
+SHA256 (xpi/firefox-i18n-17.0.2/son.xpi) = f88c4f4dbc5b7ade0de1346e35bbc2bacb642eb1d1659d32d7893fcce5737377
+SIZE (xpi/firefox-i18n-17.0.2/son.xpi) = 288184
+SHA256 (xpi/firefox-i18n-17.0.2/sq.xpi) = e3e8314dfbf0d0f864a76916ef3f19ac57256db64f42c4f1ac05cdb0eab9a845
+SIZE (xpi/firefox-i18n-17.0.2/sq.xpi) = 295666
+SHA256 (xpi/firefox-i18n-17.0.2/sr.xpi) = 189f7b005034028a09e10a45f6809c0606dceee1345e986003702ef571a57f31
+SIZE (xpi/firefox-i18n-17.0.2/sr.xpi) = 338515
+SHA256 (xpi/firefox-i18n-17.0.2/sv-SE.xpi) = 0c9892582a3f219fc07e6ba4e588984c008feca940faab729882a50c5e3ac4f2
+SIZE (xpi/firefox-i18n-17.0.2/sv-SE.xpi) = 292584
+SHA256 (xpi/firefox-i18n-17.0.2/ta-LK.xpi) = 91ace66d948897af1e4ab2b519dd6f4572bf13915c9d21a6a7f07cff9dab86f2
+SIZE (xpi/firefox-i18n-17.0.2/ta-LK.xpi) = 344432
+SHA256 (xpi/firefox-i18n-17.0.2/ta.xpi) = 315956e7fccce6adf7f784800a03a7f7e5a24601eb575bd76c6734fec2f1b398
+SIZE (xpi/firefox-i18n-17.0.2/ta.xpi) = 329867
+SHA256 (xpi/firefox-i18n-17.0.2/te.xpi) = 33c6a4a17e92ab3268758ece255271888658cbd9061aee0aea2d50956b85a525
+SIZE (xpi/firefox-i18n-17.0.2/te.xpi) = 346458
+SHA256 (xpi/firefox-i18n-17.0.2/th.xpi) = a13de019b2814a5bb31648dcaff04ba66c128e5e809541899c729bb87171a501
+SIZE (xpi/firefox-i18n-17.0.2/th.xpi) = 328177
+SHA256 (xpi/firefox-i18n-17.0.2/tr.xpi) = b684db78c4f01e13ebdc779f8802b2883f5f8ff8015c38458634a10fb99871b5
+SIZE (xpi/firefox-i18n-17.0.2/tr.xpi) = 300342
+SHA256 (xpi/firefox-i18n-17.0.2/uk.xpi) = e5474caf32058dece593b881802bffd23a9c1548d44a51227dc83d3c8c6b4e01
+SIZE (xpi/firefox-i18n-17.0.2/uk.xpi) = 328751
+SHA256 (xpi/firefox-i18n-17.0.2/vi.xpi) = 8d305abdae1b2dd69fcd73ca56c9ae664208a7cdcfeb3e0e58103dd606256412
+SIZE (xpi/firefox-i18n-17.0.2/vi.xpi) = 318048
+SHA256 (xpi/firefox-i18n-17.0.2/zh-CN.xpi) = 7746f105a0bc76603b07d51e0b01aa88f53edc6dbc4e98e864f7e4c607a5c526
+SIZE (xpi/firefox-i18n-17.0.2/zh-CN.xpi) = 308750
+SHA256 (xpi/firefox-i18n-17.0.2/zh-TW.xpi) = 7724971a455a04f7f8709720fa734ad407a73d09584f7fc16cdf8d7ece31b2e5
+SIZE (xpi/firefox-i18n-17.0.2/zh-TW.xpi) = 309938
+SHA256 (xpi/firefox-i18n-17.0.2/zu.xpi) = 81a2bf30599c6805b47d8af2708c9b2c8bd3d2611f1f0596259ba9ac854e4a98
+SIZE (xpi/firefox-i18n-17.0.2/zu.xpi) = 301094
diff --git a/www/firefox-esr/Makefile b/www/firefox-esr/Makefile
index 45dd4ce4fc96..915e34b15434 100644
--- a/www/firefox-esr/Makefile
+++ b/www/firefox-esr/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= firefox
-DISTVERSION= 10.0.11
+DISTVERSION= 17.0.2
PORTEPOCH= 1
CATEGORIES= www ipv6
MASTER_SITES= ${MASTER_SITE_MOZILLA}
@@ -12,16 +12,18 @@ DISTNAME= ${PORTNAME}-${DISTVERSION}esr.source
MAINTAINER= gecko@FreeBSD.org
COMMENT= Web browser based on the browser portion of Mozilla
-BUILD_DEPENDS= nspr>=4.8.8:${PORTSDIR}/devel/nspr \
+BUILD_DEPENDS= nspr>=4.9.2:${PORTSDIR}/devel/nspr \
nss>=3.13.6_1:${PORTSDIR}/security/nss \
- sqlite3>=3.7.7.1:${PORTSDIR}/databases/sqlite3 \
+ sqlite3>=3.7.13:${PORTSDIR}/databases/sqlite3 \
+ ${PYTHON_SITELIBDIR}/_sqlite3.so:${PORTSDIR}/databases/py-sqlite3 \
cairo>=1.10.2_1,1:${PORTSDIR}/graphics/cairo \
unzip:${PORTSDIR}/archivers/unzip
USE_AUTOTOOLS= autoconf213:env
+USE_PYTHON_BUILD=-2.7
LATEST_LINK= firefox-esr
USE_GECKO= gecko
-CONFLICTS= firefox-1[1-9].*
+CONFLICTS= firefox-2[0-9].* firefox-1[1-689].* firefox-10.*
MOZ_PKGCONFIG_FILES= # empty
USE_MOZILLA= # empty
MOZILLA_NAME= Firefox
@@ -43,13 +45,16 @@ MOZ_OPTIONS= --program-transform-name='s/firefox/${MOZILLA}/' \
--enable-application=browser \
--enable-official-branding
-OPTIONS_DEFINE= PGO
+OPTIONS_DEFINE= GSTREAMER PGO
OPTIONS_DEFAULT=GIO
.include "${.CURDIR}/../../www/firefox/Makefile.options"
+
+OPTIONS_DEFAULT:=${OPTIONS_DEFAULT:S/OSS/ALSA/}
+
.include <bsd.port.pre.mk>
-WRKSRC:= ${WRKDIR}/mozilla-esr10
+WRKSRC:= ${WRKDIR}/mozilla-esr17
.if ${ARCH} == amd64
CONFIGURE_TARGET=x86_64-portbld-freebsd${OSREL}
@@ -64,7 +69,6 @@ CFLAGS+= -mminimal-toc
.if ${PORT_OPTIONS:MPGO}
BUILD_DEPENDS+= ${PYTHON_SITELIBDIR}/_sqlite3.so:${PORTSDIR}/databases/py-sqlite3
-USE_PYTHON_BUILD= -2.7
USE_DISPLAY= yes
.include "${PORTSDIR}/Mk/bsd.python.mk"
@@ -76,10 +80,6 @@ MOZ_MK_OPTIONS+=PROFILE_GEN_SCRIPT="${PYTHON_CMD} \
@MOZ_OBJDIR@/_profile/pgo/profileserver.py"
.endif
-.if !empty(CXX:M*clang++*) || (${CXX:Mc++} && ${OSVERSION} > 1000023)
-CXXFLAGS+= -Wno-return-type-c-linkage
-.endif
-
pre-extract:
.if ${PORT_OPTIONS:MPGO}
@${ECHO} "*****************************************************************"
diff --git a/www/firefox-esr/distinfo b/www/firefox-esr/distinfo
index 1d6b420050c4..a7e07589b3a6 100644
--- a/www/firefox-esr/distinfo
+++ b/www/firefox-esr/distinfo
@@ -1,2 +1,2 @@
-SHA256 (firefox-10.0.11esr.source.tar.bz2) = 94b4d5a339d97dc56fd349f93407c3af4f408a4a8409a64e3680d564d37594f8
-SIZE (firefox-10.0.11esr.source.tar.bz2) = 75444542
+SHA256 (firefox-17.0.2esr.source.tar.bz2) = 92bf717b3e3933b84fd37b0e5c5026868e139be828637cfcf4acdc83f7ccd886
+SIZE (firefox-17.0.2esr.source.tar.bz2) = 90828234
diff --git a/www/firefox-esr/files/extra-bug780531 b/www/firefox-esr/files/extra-bug780531
new file mode 100644
index 000000000000..aa3547c397a4
--- /dev/null
+++ b/www/firefox-esr/files/extra-bug780531
@@ -0,0 +1,13 @@
+--- configure.in~
++++ configure.in
+@@ -5151,8 +5148,8 @@ fi
+
+ AC_SUBST(MOZ_WEBRTC)
+
+-case "$target_cpu" in
+-arm*)
++case "$target" in
++arm-*-linux*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
+ MOZ_SAMPLE_TYPE_S16LE=1
+ AC_DEFINE(MOZ_SAMPLE_TYPE_S16LE)
+ AC_SUBST(MOZ_SAMPLE_TYPE_S16LE)
diff --git a/www/firefox-esr/files/patch-alsapulse b/www/firefox-esr/files/patch-alsapulse
index 175b41680977..f0c38d347bea 100644
--- a/www/firefox-esr/files/patch-alsapulse
+++ b/www/firefox-esr/files/patch-alsapulse
@@ -1,74 +1,65 @@
---- config/autoconf.mk.in~
-+++ config/autoconf.mk.in
-@@ -568,7 +568,13 @@ MOZ_LIBNOTIFY_CFLAGS = @MOZ_LIBNOTIFY_CF
- MOZ_LIBNOTIFY_LIBS = @MOZ_LIBNOTIFY_LIBS@
- MOZ_ENABLE_LIBNOTIFY = @MOZ_ENABLE_LIBNOTIFY@
-
-+MOZ_ALSA = @MOZ_ALSA@
- MOZ_ALSA_LIBS = @MOZ_ALSA_LIBS@
-+MOZ_ALSA_CFLAGS = @MOZ_ALSA_CFLAGS@
-+
-+MOZ_PULSEAUDIO = @MOZ_PULSEAUDIO@
-+MOZ_PULSEAUDIO_LIBS = @MOZ_PULSEAUDIO_LIBS@
-+MOZ_PULSEAUDIO_CFLAGS = @MOZ_PULSEAUDIO_CFLAGS@
-
- GLIB_CFLAGS = @GLIB_CFLAGS@
- GLIB_LIBS = @GLIB_LIBS@
---- configure.in~
+diff --git configure.in configure.in
+index 5980b76..11f5f77 100644
+--- configure.in
+++ configure.in
-@@ -5758,17 +5775,48 @@ dnl ====================================
+@@ -5600,13 +5600,25 @@ dnl ========================================================
dnl = Check alsa availability on Linux if using sydneyaudio
dnl ========================================================
+MOZ_ARG_ENABLE_BOOL(alsa,
-+[ --enable-alsa Enable Alsa support],
++[ --enable-alsa Enable Alsa support (default on Linux)],
+MOZ_ALSA=1,
+MOZ_ALSA= MOZ_ALSA_FORCE=$enableval)
+
dnl If using sydneyaudio with Linux, ensure that the alsa library is available
--if test -n "$MOZ_SYDNEYAUDIO"; then
-+if test -n "$MOZ_SYDNEYAUDIO" -a "$MOZ_ALSA_FORCE" != "no"; then
- case "$target_os" in
- linux*)
-+ MOZ_ALSA=1
-+ ;;
-+ esac
+-if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
++if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux" -a "$MOZ_ALSA_FORCE" != "no"; then
++ MOZ_ALSA=1
+fi
+
+if test -n "$MOZ_ALSA"; then
- PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
++ AC_DEFINE(MOZ_CUBEB)
+ PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
[echo "$MOZ_ALSA_PKG_ERRORS"
AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux. Disable with --disable-ogg --disable-wave --disable-webm. (On Ubuntu, you might try installing the package libasound2-dev.)])])
-- ;;
-- esac
fi
-+AC_SUBST(MOZ_ALSA_CFLAGS)
+AC_SUBST(MOZ_ALSA)
+
-+dnl ========================================================
-+dnl = Enable PulseAudio
-+dnl ========================================================
-+
-+MOZ_ARG_ENABLE_BOOL(pulseaudio,
-+[ --enable-pulseaudio Enable PulseAudio support],
-+MOZ_PULSEAUDIO=1,
-+MOZ_PULSEAUDIO=)
-+
-+if test -n "$MOZ_PULSEAUDIO"; then
-+ PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
-+ [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
-+ AC_MSG_ERROR([pulseaudio audio backend requires libpulse package])])
-+fi
-+
-+AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
-+AC_SUBST(MOZ_PULSEAUDIO_LIBS)
-+AC_SUBST(MOZ_PULSEAUDIO)
-+
dnl ========================================================
- dnl Permissions System
+ dnl = Enable PulseAudio
dnl ========================================================
---- media/libsydneyaudio/src/Makefile.in~
+diff --git media/libcubeb/src/Makefile.in media/libcubeb/src/Makefile.in
+index 5ab4dd8..c8df26f 100644
+--- media/libcubeb/src/Makefile.in
++++ media/libcubeb/src/Makefile.in
+@@ -24,10 +24,6 @@ endif
+
+ ifeq ($(OS_TARGET),Android)
+ # No Android implementation of libcubeb yet.
+-else ifeq ($(OS_TARGET),Linux)
+-CSRCS = \
+- cubeb_alsa.c \
+- $(NULL)
+ endif
+
+ ifeq ($(OS_TARGET),Darwin)
+@@ -42,6 +38,12 @@ CSRCS = \
+ $(NULL)
+ endif
+
++ifdef MOZ_ALSA
++CSRCS = \
++ cubeb_alsa.c \
++ $(NULL)
++endif
++
+ ifdef MOZ_PULSEAUDIO
+ CSRCS = \
+ cubeb_pulse.c \
+diff --git media/libsydneyaudio/src/Makefile.in media/libsydneyaudio/src/Makefile.in
+index 8dda8ce..b19641d 100644
+--- media/libsydneyaudio/src/Makefile.in
+++ media/libsydneyaudio/src/Makefile.in
@@ -30,10 +30,6 @@ else ifeq ($(MOZ_WIDGET_TOOLKIT),android)
CSRCS = \
@@ -100,20 +91,24 @@
ifeq ($(OS_ARCH),WINNT)
OS_LIBS += winmm.lib
endif
---- toolkit/library/libxul-config.mk~
-+++ toolkit/library/libxul-config.mk
-@@ -348,10 +348,12 @@ ifdef MOZ_NATIVE_LIBVPX
- EXTRA_DSO_LDOPTS += $(MOZ_LIBVPX_LIBS)
- endif
+diff --git toolkit/library/Makefile.in toolkit/library/Makefile.in
+index 43384e9..e46a6e3 100644
+--- toolkit/library/Makefile.in
++++ toolkit/library/Makefile.in
+@@ -370,14 +370,11 @@ endif
+
+ EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib)
-ifdef MOZ_SYDNEYAUDIO
-ifeq ($(OS_ARCH),Linux)
++ifneq (,$(MOZ_CUBEB)$(MOZ_SYDNEYAUDIO))
+ifdef MOZ_ALSA
EXTRA_DSO_LDOPTS += $(MOZ_ALSA_LIBS)
endif
-+
-+ifdef MOZ_PULSEAUDIO
-+EXTRA_DSO_LDOPTS += $(MOZ_PULSEAUDIO_LIBS)
+-endif
+-
+ ifdef MOZ_PULSEAUDIO
+-ifdef MOZ_CUBEB
+ EXTRA_DSO_LDOPTS += $(MOZ_PULSEAUDIO_LIBS)
+ endif
endif
-
- ifdef HAVE_CLOCK_MONOTONIC
diff --git a/www/firefox-esr/files/patch-bug653551 b/www/firefox-esr/files/patch-bug653551
deleted file mode 100644
index f9316f0f725b..000000000000
--- a/www/firefox-esr/files/patch-bug653551
+++ /dev/null
@@ -1,29 +0,0 @@
-commit 47ea30f
-Author: Landry Breuil <landry@openbsd.org>
-Date: Thu Feb 2 15:31:56 2012 +0900
-
- Bug 653551 - Jaegermonkey Sparc back-end broken on sparc64. r=leon.sha
----
- js/src/configure.in | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git js/src/configure.in js/src/configure.in
-index 84390cf..d663c46 100644
---- js/src/configure.in
-+++ js/src/configure.in
-@@ -2806,13 +2806,15 @@ arm*-*)
- AC_DEFINE(JS_NUNBOX32)
- ;;
- sparc*-*)
-+ if test ! "$HAVE_64BIT_OS" ; then
- NANOJIT_ARCH=Sparc
- ENABLE_METHODJIT=1
- ENABLE_MONOIC=1
- ENABLE_POLYIC=1
- ENABLE_METHODJIT_TYPED_ARRAY=1
- AC_DEFINE(JS_CPU_SPARC)
- AC_DEFINE(JS_NUNBOX32)
-+ fi
- ;;
- mips*-*)
- ENABLE_METHODJIT=1
diff --git a/www/firefox-esr/files/patch-bug691898 b/www/firefox-esr/files/patch-bug691898
deleted file mode 100644
index 977cae2b5bff..000000000000
--- a/www/firefox-esr/files/patch-bug691898
+++ /dev/null
@@ -1,285 +0,0 @@
-From: Mike Hommey <mh@glandium.org>
-Date: Sat, 24 Dec 2011 09:56:58 +0100
-Subject: Bug 691898 - Use YARR interpreter instead of PCRE on platforms where
- YARR JIT is not supported
-
----
- js/src/Makefile.in | 21 +++++++++++++--------
- js/src/vm/RegExpObject-inl.h | 28 ++++++----------------------
- js/src/vm/RegExpObject.cpp | 36 ------------------------------------
- js/src/vm/RegExpObject.h | 27 ++++++---------------------
- js/src/yarr/wtfbridge.h | 2 --
- 5 files changed, 25 insertions(+), 89 deletions(-)
-
-diff --git a/js/src/Makefile.in b/js/src/Makefile.in
-index fc48cbd..49f0bdc 100644
---- js/src/Makefile.in
-+++ js/src/Makefile.in
-@@ -416,15 +416,20 @@ CPPSRCS += checks.cc \
-
- ifeq (,$(filter arm% sparc %86 x86_64,$(TARGET_CPU)))
-
--VPATH += $(srcdir)/yarr/pcre \
-+VPATH += $(srcdir)/assembler \
-+ $(srcdir)/assembler/wtf \
-+ $(srcdir)/yarr \
- $(NULL)
-
- CPPSRCS += \
-- pcre_compile.cpp \
-- pcre_exec.cpp \
-- pcre_tables.cpp \
-- pcre_xclass.cpp \
-- pcre_ucp_searchfuncs.cpp \
-+ Assertions.cpp \
-+ OSAllocatorOS2.cpp \
-+ OSAllocatorPosix.cpp \
-+ OSAllocatorWin.cpp \
-+ PageBlock.cpp \
-+ YarrInterpreter.cpp \
-+ YarrPattern.cpp \
-+ YarrSyntaxChecker.cpp \
- $(NULL)
- else
-
-@@ -1015,10 +1020,10 @@ endif
- # Needed to "configure" it correctly. Unfortunately these
- # flags wind up being applied to all code in js/src, not just
- # the code in js/src/assembler.
--CXXFLAGS += -DUSE_SYSTEM_MALLOC=1 -DENABLE_ASSEMBLER=1
-+CXXFLAGS += -DUSE_SYSTEM_MALLOC=1
-
- ifneq (,$(ENABLE_YARR_JIT)$(ENABLE_TRACEJIT)$(ENABLE_METHODJIT))
--CXXFLAGS += -DENABLE_JIT=1
-+CXXFLAGS += -DENABLE_JIT=1 -DENABLE_ASSEMBLER=1
- endif
-
- INCLUDES += -I$(srcdir)/assembler -I$(srcdir)/yarr
-diff --git a/js/src/vm/RegExpObject-inl.h b/js/src/vm/RegExpObject-inl.h
-index 5f7817d..91108a7 100644
---- js/src/vm/RegExpObject-inl.h
-+++ js/src/vm/RegExpObject-inl.h
-@@ -327,6 +327,7 @@ RegExpPrivate::create(JSContext *cx, JSString *source, RegExpFlag flags, TokenSt
- return RetType(self);
- }
-
-+#if ENABLE_YARR_JIT
- /* This function should be deleted once bad Android platforms phase out. See bug 604774. */
- inline bool
- RegExpPrivateCode::isJITRuntimeEnabled(JSContext *cx)
-@@ -337,12 +338,12 @@ RegExpPrivateCode::isJITRuntimeEnabled(JSContext *cx)
- return true;
- #endif
- }
-+#endif
-
- inline bool
- RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream *ts,
- uintN *parenCount, RegExpFlag flags)
- {
--#if ENABLE_YARR_JIT
- /* Parse the pattern. */
- ErrorCode yarrError;
- YarrPattern yarrPattern(pattern, bool(flags & IgnoreCaseFlag), bool(flags & MultilineFlag),
-@@ -359,7 +360,7 @@ RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream *
- * case we have to bytecode compile it.
- */
-
--#ifdef JS_METHODJIT
-+#if ENABLE_YARR_JIT && defined(JS_METHODJIT)
- if (isJITRuntimeEnabled(cx) && !yarrPattern.m_containsBackreferences) {
- if (!cx->compartment->ensureJaegerCompartmentExists(cx))
- return false;
-@@ -371,21 +372,11 @@ RegExpPrivateCode::compile(JSContext *cx, JSLinearString &pattern, TokenStream *
- }
- #endif
-
-+#if ENABLE_YARR_JIT
- codeBlock.setFallBack(true);
-+#endif
- byteCode = byteCompile(yarrPattern, cx->compartment->regExpAllocator).get();
- return true;
--#else /* !defined(ENABLE_YARR_JIT) */
-- int error = 0;
-- compiled = jsRegExpCompile(pattern.chars(), pattern.length(),
-- ignoreCase() ? JSRegExpIgnoreCase : JSRegExpDoNotIgnoreCase,
-- multiline() ? JSRegExpMultiline : JSRegExpSingleLine,
-- parenCount, &error);
-- if (error) {
-- reportPCREError(cx, error);
-- return false;
-- }
-- return true;
--#endif
- }
-
- inline bool
-@@ -431,19 +422,12 @@ RegExpPrivateCode::execute(JSContext *cx, const jschar *chars, size_t start, siz
- else
- result = JSC::Yarr::execute(codeBlock, chars, start, length, output);
- #else
-- result = jsRegExpExecute(cx, compiled, chars, length, start, output, outputCount);
-+ result = JSC::Yarr::interpret(byteCode, chars, start, length, output);
- #endif
-
- if (result == -1)
- return Success_NotFound;
-
--#if !ENABLE_YARR_JIT
-- if (result < 0) {
-- reportPCREError(cx, result);
-- return Error;
-- }
--#endif
--
- JS_ASSERT(result >= 0);
- return Success;
- }
-diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp
-index f75c6a5..7631dd5 100644
---- js/src/vm/RegExpObject.cpp
-+++ js/src/vm/RegExpObject.cpp
-@@ -251,7 +251,6 @@ Class js::RegExpClass = {
- NULL /* trace */
- };
-
--#if ENABLE_YARR_JIT
- void
- RegExpPrivateCode::reportYarrError(JSContext *cx, TokenStream *ts, ErrorCode error)
- {
-@@ -283,41 +282,6 @@ RegExpPrivateCode::reportYarrError(JSContext *cx, TokenStream *ts, ErrorCode err
- }
- }
-
--#else /* !ENABLE_YARR_JIT */
--
--void
--RegExpPrivateCode::reportPCREError(JSContext *cx, int error)
--{
--#define REPORT(msg_) \
-- JS_ReportErrorFlagsAndNumberUC(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL, msg_); \
-- return
-- switch (error) {
-- case -2: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-- case 0: JS_NOT_REACHED("Precondition violation: an error must have occurred.");
-- case 1: REPORT(JSMSG_TRAILING_SLASH);
-- case 2: REPORT(JSMSG_TRAILING_SLASH);
-- case 3: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-- case 4: REPORT(JSMSG_BAD_QUANTIFIER);
-- case 5: REPORT(JSMSG_BAD_QUANTIFIER);
-- case 6: REPORT(JSMSG_BAD_CLASS_RANGE);
-- case 7: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-- case 8: REPORT(JSMSG_BAD_CLASS_RANGE);
-- case 9: REPORT(JSMSG_BAD_QUANTIFIER);
-- case 10: REPORT(JSMSG_UNMATCHED_RIGHT_PAREN);
-- case 11: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-- case 12: REPORT(JSMSG_UNMATCHED_RIGHT_PAREN);
-- case 13: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-- case 14: REPORT(JSMSG_MISSING_PAREN);
-- case 15: REPORT(JSMSG_BAD_BACKREF);
-- case 16: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-- case 17: REPORT(JSMSG_REGEXP_TOO_COMPLEX);
-- default:
-- JS_NOT_REACHED("Precondition violation: unknown PCRE error code.");
-- }
--#undef REPORT
--}
--#endif /* ENABLE_YARR_JIT */
--
- bool
- js::ParseRegExpFlags(JSContext *cx, JSString *flagStr, RegExpFlag *flagsOut)
- {
-diff --git a/js/src/vm/RegExpObject.h b/js/src/vm/RegExpObject.h
-index 1449d56..279f3c0 100644
---- js/src/vm/RegExpObject.h
-+++ js/src/vm/RegExpObject.h
-@@ -49,8 +49,6 @@
- #include "yarr/Yarr.h"
- #if ENABLE_YARR_JIT
- #include "yarr/YarrJIT.h"
--#else
--#include "yarr/pcre/pcre.h"
- #endif
-
- namespace js {
-@@ -153,48 +151,39 @@ ResetRegExpObject(JSContext *cx, AlreadyIncRefed<RegExpPrivate> rep);
- /* Abstracts away the gross |RegExpPrivate| backend details. */
- class RegExpPrivateCode
- {
--#if ENABLE_YARR_JIT
- typedef JSC::Yarr::BytecodePattern BytecodePattern;
- typedef JSC::Yarr::ErrorCode ErrorCode;
-+ typedef JSC::Yarr::YarrPattern YarrPattern;
-+#if ENABLE_YARR_JIT
- typedef JSC::Yarr::JSGlobalData JSGlobalData;
- typedef JSC::Yarr::YarrCodeBlock YarrCodeBlock;
-- typedef JSC::Yarr::YarrPattern YarrPattern;
-
- /* Note: Native code is valid only if |codeBlock.isFallBack() == false|. */
- YarrCodeBlock codeBlock;
-- BytecodePattern *byteCode;
--#else
-- JSRegExp *compiled;
- #endif
-+ BytecodePattern *byteCode;
-
- public:
- RegExpPrivateCode()
- :
- #if ENABLE_YARR_JIT
- codeBlock(),
-- byteCode(NULL)
--#else
-- compiled(NULL)
- #endif
-+ byteCode(NULL)
- { }
-
- ~RegExpPrivateCode() {
- #if ENABLE_YARR_JIT
- codeBlock.release();
-+#endif
- if (byteCode)
- Foreground::delete_<BytecodePattern>(byteCode);
--#else
-- if (compiled)
-- jsRegExpFree(compiled);
--#endif
- }
-
- #if ENABLE_YARR_JIT
- static inline bool isJITRuntimeEnabled(JSContext *cx);
-- void reportYarrError(JSContext *cx, TokenStream *ts, JSC::Yarr::ErrorCode error);
--#else
-- void reportPCREError(JSContext *cx, int error);
- #endif
-+ void reportYarrError(JSContext *cx, TokenStream *ts, JSC::Yarr::ErrorCode error);
-
- inline bool compile(JSContext *cx, JSLinearString &pattern, TokenStream *ts, uintN *parenCount,
- RegExpFlag flags);
-@@ -205,11 +194,7 @@ class RegExpPrivateCode
- int *output, size_t outputCount);
-
- static size_t getOutputSize(size_t pairCount) {
--#if ENABLE_YARR_JIT
- return pairCount * 2;
--#else
-- return pairCount * 3; /* Should be x2, but PCRE has... needs. */
--#endif
- }
- };
-
-diff --git a/js/src/yarr/wtfbridge.h b/js/src/yarr/wtfbridge.h
-index ac41d08..fb8eb86 100644
---- js/src/yarr/wtfbridge.h
-+++ js/src/yarr/wtfbridge.h
-@@ -49,9 +49,7 @@
- #include "jsprvtd.h"
- #include "vm/String.h"
- #include "assembler/wtf/Platform.h"
--#if ENABLE_YARR_JIT
- #include "assembler/jit/ExecutableAllocator.h"
--#endif
-
- namespace JSC { namespace Yarr {
-
diff --git a/www/firefox-esr/files/patch-bug696030 b/www/firefox-esr/files/patch-bug696030
deleted file mode 100644
index 6845651544d7..000000000000
--- a/www/firefox-esr/files/patch-bug696030
+++ /dev/null
@@ -1,34 +0,0 @@
-commit 5e354b9
-Author: Chris Coulson <chris.coulson@canonical.com>
-Date: Thu Jan 5 11:19:50 2012 +1300
-
- Bug 696030 - Use MonitorAutoLock rather than MonitorAutoEnter in nsGIOProtocolHandler r=karlt
-
- --HG--
- extra : rebase_source : 6f3d1a49a07affab679e41cd8cf968d62c072299
----
- extensions/gio/nsGIOProtocolHandler.cpp | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git extensions/gio/nsGIOProtocolHandler.cpp extensions/gio/nsGIOProtocolHandler.cpp
-index 9347b6e..e8f153d 100644
---- extensions/gio/nsGIOProtocolHandler.cpp
-+++ extensions/gio/nsGIOProtocolHandler.cpp
-@@ -238,7 +238,7 @@ class nsGIOInputStream : public nsIInputStream
- void
- nsGIOInputStream::SetMountResult(MountOperationResult result, gint error_code)
- {
-- mozilla::MonitorAutoEnter mon(mMonitorMountInProgress);
-+ mozilla::MonitorAutoLock mon(mMonitorMountInProgress);
- mMountRes = result;
- mMountErrorCode = error_code;
- mon.Notify();
-@@ -263,7 +263,7 @@ nsGIOInputStream::MountVolume() {
- NULL,
- mount_enclosing_volume_finished,
- this);
-- mozilla::MonitorAutoEnter mon(mMonitorMountInProgress);
-+ mozilla::MonitorAutoLock mon(mMonitorMountInProgress);
- /* Waiting for finish of mount operation thread */
- while (mMountRes == MOUNT_OPERATION_IN_PROGRESS)
- mon.Wait();
diff --git a/www/firefox-esr/files/patch-bug714312 b/www/firefox-esr/files/patch-bug714312
deleted file mode 100644
index 114144d18388..000000000000
--- a/www/firefox-esr/files/patch-bug714312
+++ /dev/null
@@ -1,73 +0,0 @@
-commit c104d9b
-Author: Landry Breuil <landry@openbsd.org>
-Date: Mon Jan 9 17:32:00 2012 -0600
-
- Bug 714312 - Use <machine/endian.h> to get endianess on BSD systems, fixing the BSD build. r=ted
-
- --HG--
- extra : rebase_source : 8b418bdb2d713093d138ffed20bf1630c05f396b
----
- js/src/configure.in | 5 +++++
- js/src/js-config.h.in | 4 ++++
- js/src/jscpucfg.h | 17 +++++++++++++++++
- 3 files changed, 26 insertions(+)
-
-diff --git js/src/configure.in js/src/configure.in
-index 164c896..361b29e 100644
---- js/src/configure.in
-+++ js/src/configure.in
-@@ -2934,6 +2934,11 @@ if test "$ac_cv_header_endian_h" = yes;
- AC_DEFINE(JS_HAVE_ENDIAN_H)
- fi
-
-+AC_CHECK_HEADERS(machine/endian.h)
-+if test "$ac_cv_header_machine_endian_h" = yes; then
-+ AC_DEFINE(JS_HAVE_MACHINE_ENDIAN_H)
-+fi
-+
- AC_CHECK_HEADERS(sys/isa_defs.h)
- if test "$ac_cv_header_sys_isa_defs_h" = yes; then
- AC_DEFINE(JS_HAVE_SYS_ISA_DEFS_H)
-diff --git js/src/js-config.h.in js/src/js-config.h.in
-index fb009fa..402262e 100644
---- js/src/js-config.h.in
-+++ js/src/js-config.h.in
-@@ -59,6 +59,10 @@
- useable. See jscpucfg.h. */
- #undef JS_HAVE_ENDIAN_H
-
-+/* Define to 1 if the <machine/endian.h> header is present and
-+ useable. See jscpucfg.h. */
-+#undef JS_HAVE_MACHINE_ENDIAN_H
-+
- /* Define to 1 if the <sys/isa_defs.h> header is present and
- useable. See jscpucfg.h. */
- #undef JS_HAVE_SYS_ISA_DEFS_H
-diff --git js/src/jscpucfg.h js/src/jscpucfg.h
-index dd32bce..5fd8415 100644
---- js/src/jscpucfg.h
-+++ js/src/jscpucfg.h
-@@ -92,6 +92,23 @@
- # error "endian.h does not define __BYTE_ORDER. Cannot determine endianness."
- # endif
-
-+/* BSDs */
-+#elif defined(JS_HAVE_MACHINE_ENDIAN_H)
-+# include <sys/types.h>
-+# include <machine/endian.h>
-+
-+# if defined(_BYTE_ORDER)
-+# if _BYTE_ORDER == _LITTLE_ENDIAN
-+# define IS_LITTLE_ENDIAN 1
-+# undef IS_BIG_ENDIAN
-+# elif _BYTE_ORDER == _BIG_ENDIAN
-+# undef IS_LITTLE_ENDIAN
-+# define IS_BIG_ENDIAN 1
-+# endif
-+# else /* !defined(_BYTE_ORDER) */
-+# error "machine/endian.h does not define _BYTE_ORDER. Cannot determine endianness."
-+# endif
-+
- #elif defined(JS_HAVE_SYS_ISA_DEFS_H)
- # include <sys/isa_defs.h>
-
diff --git a/www/firefox-esr/files/patch-bug722975 b/www/firefox-esr/files/patch-bug722975
new file mode 100644
index 000000000000..46a3381b9375
--- /dev/null
+++ b/www/firefox-esr/files/patch-bug722975
@@ -0,0 +1,61 @@
+# HG changeset patch
+# Parent 9d3c9b863c697634e434b687d456bb82fa794ecf
+# User Uli Schlachter <psychon@znc.in>
+Bug 722975 - --enable-system-cairo build is broken after Bug 715658 fixed
+
+
+diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp
+--- gfx/thebes/gfxPlatform.cpp
++++ gfx/thebes/gfxPlatform.cpp
+@@ -484,21 +484,19 @@ gfxPlatform::CreateDrawTargetForSurface(
+
+ cairo_user_data_key_t kSourceSurface;
+
+ void SourceBufferDestroy(void *srcBuffer)
+ {
+ static_cast<SourceSurface*>(srcBuffer)->Release();
+ }
+
+-void SourceSnapshotDetached(cairo_surface_t *nullSurf)
++void SourceSnapshotDetached(void *nullSurf)
+ {
+- gfxImageSurface* origSurf =
+- static_cast<gfxImageSurface*>(cairo_surface_get_user_data(nullSurf, &kSourceSurface));
+-
++ gfxImageSurface *origSurf = static_cast<gfxImageSurface*>(nullSurf);
+ origSurf->SetData(&kSourceSurface, NULL, NULL);
+ }
+
+ RefPtr<SourceSurface>
+ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurface)
+ {
+ void *userData = aSurface->GetData(&kSourceSurface);
+
+@@ -588,24 +586,19 @@ gfxPlatform::GetSourceSurfaceForSurface(
+ }
+
+ srcBuffer = Factory::CreateWrappingDataSourceSurface(imgSurface->Data(),
+ imgSurface->Stride(),
+ size, format);
+
+ }
+
+- cairo_surface_t *nullSurf =
+- cairo_null_surface_create(CAIRO_CONTENT_COLOR_ALPHA);
+- cairo_surface_set_user_data(nullSurf,
+- &kSourceSurface,
+- imgSurface,
+- NULL);
+- cairo_surface_attach_snapshot(imgSurface->CairoSurface(), nullSurf, SourceSnapshotDetached);
+- cairo_surface_destroy(nullSurf);
++ cairo_surface_set_mime_data(imgSurface->CairoSurface(), "mozilla/magic",
++ (const unsigned char *) "data", 4,
++ SourceSnapshotDetached, imgSurface.get());
+ }
+
+ srcBuffer->AddRef();
+ aSurface->SetData(&kSourceSurface, srcBuffer, SourceBufferDestroy);
+
+ return srcBuffer;
+ }
+
diff --git a/www/firefox-esr/files/patch-bug725655 b/www/firefox-esr/files/patch-bug725655
deleted file mode 100644
index ec331a5ccb73..000000000000
--- a/www/firefox-esr/files/patch-bug725655
+++ /dev/null
@@ -1,53 +0,0 @@
-commit 18b9c9d
-Author: Martin Stránský <stransky@redhat.com>
-Date: Fri Feb 10 16:07:41 2012 +0100
-
- Bug 725655 - gcc 4.7 build failures (missing headers). r=benjamin
----
- ipc/chromium/src/base/file_util_linux.cc | 3 +++
- ipc/chromium/src/base/message_pump_libevent.cc | 3 +++
- ipc/chromium/src/base/time_posix.cc | 3 +++
- 3 files changed, 9 insertions(+)
-
-diff --git ipc/chromium/src/base/file_util_linux.cc ipc/chromium/src/base/file_util_linux.cc
-index cca706f..171e44f 100644
---- ipc/chromium/src/base/file_util_linux.cc
-+++ ipc/chromium/src/base/file_util_linux.cc
-@@ -5,6 +5,9 @@
- #include "base/file_util.h"
-
- #include <fcntl.h>
-+#if defined(ANDROID) || defined(OS_POSIX)
-+#include <unistd.h>
-+#endif
-
- #include <string>
- #include <vector>
-diff --git ipc/chromium/src/base/message_pump_libevent.cc ipc/chromium/src/base/message_pump_libevent.cc
-index 6194f79..9f31dbb 100644
---- ipc/chromium/src/base/message_pump_libevent.cc
-+++ ipc/chromium/src/base/message_pump_libevent.cc
-@@ -6,6 +6,9 @@
-
- #include <errno.h>
- #include <fcntl.h>
-+#if defined(ANDROID) || defined(OS_POSIX)
-+#include <unistd.h>
-+#endif
-
- #include "eintr_wrapper.h"
- #include "base/logging.h"
-diff --git ipc/chromium/src/base/time_posix.cc ipc/chromium/src/base/time_posix.cc
-index 8d1a1d5..abf2a56 100644
---- ipc/chromium/src/base/time_posix.cc
-+++ ipc/chromium/src/base/time_posix.cc
-@@ -13,6 +13,9 @@
- #else
- #include <time.h>
- #endif
-+#if defined(ANDROID) || defined(OS_POSIX)
-+#include <unistd.h>
-+#endif
-
- #include <limits>
-
diff --git a/www/firefox-esr/files/patch-bug728968 b/www/firefox-esr/files/patch-bug728968
deleted file mode 100644
index 01638e8fd119..000000000000
--- a/www/firefox-esr/files/patch-bug728968
+++ /dev/null
@@ -1,50 +0,0 @@
-commit 4075972
-Author: Mike Hommey <mh+mozilla@glandium.org>
-Date: Thu Feb 23 11:00:46 2012 +0100
-
- Bug 728968 - Detect clock_gettime when it's not in -lrt. r=khuey
----
- configure.in | 29 ++++++++++++++++-------------
- 1 file changed, 16 insertions(+), 13 deletions(-)
-
-diff --git configure.in configure.in
-index 3ba7e2f..3d0614c 100644
---- configure.in
-+++ configure.in
-@@ -3728,20 +3728,23 @@ AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat6
- AC_CHECK_FUNCS(flockfile getpagesize)
- AC_CHECK_FUNCS(localtime_r strtok_r)
-
--dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
--_SAVE_LDFLAGS=$LDFLAGS
--LDFLAGS="$LDFLAGS -lrt"
--AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
-- ac_cv_have_clock_monotonic,
-- [AC_TRY_LINK([#include <time.h>],
-- [ struct timespec ts;
-- clock_gettime(CLOCK_MONOTONIC, &ts); ],
-- ac_cv_have_clock_monotonic=yes,
-- ac_cv_have_clock_monotonic=no)])
--LDFLAGS=$_SAVE_LDFLAGS
--if test "$ac_cv_have_clock_monotonic" = "yes"; then
-+dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
-+AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
-+ ac_cv_clock_monotonic,
-+ [for libs in "" -lrt; do
-+ _SAVE_LDFLAGS="$LDFLAGS"
-+ LDFLAGS="$LDFLAGS $libs"
-+ AC_TRY_LINK([#include <time.h>],
-+ [ struct timespec ts;
-+ clock_gettime(CLOCK_MONOTONIC, &ts); ],
-+ ac_cv_clock_monotonic=$libs
-+ break,
-+ ac_cv_clock_monotonic=no)
-+ LDFLAGS="$_SAVE_LDFLAGS"
-+ done])
-+if test "$ac_cv_clock_monotonic" != "no"; then
- HAVE_CLOCK_MONOTONIC=1
-- REALTIME_LIBS=-lrt
-+ REALTIME_LIBS=$ac_cv_clock_monotonic
- AC_DEFINE(HAVE_CLOCK_MONOTONIC)
- AC_SUBST(HAVE_CLOCK_MONOTONIC)
- AC_SUBST(REALTIME_LIBS)
diff --git a/www/firefox-esr/files/patch-bug729155 b/www/firefox-esr/files/patch-bug729155
deleted file mode 100644
index a8f2a6623493..000000000000
--- a/www/firefox-esr/files/patch-bug729155
+++ /dev/null
@@ -1,18 +0,0 @@
---- dom/plugins/ipc/PluginMessageUtils.cpp
-+++ dom/plugins/ipc/PluginMessageUtils.cpp
-@@ -114,6 +114,7 @@ MediateRace(const RPCChannel::Message& parent,
- }
- }
-
-+#if defined(OS_LINUX)
- static string
- ReplaceAll(const string& haystack, const string& needle, const string& with)
- {
-@@ -127,6 +128,7 @@ ReplaceAll(const string& haystack, const string& needle, const string& with)
-
- return munged;
- }
-+#endif
-
- string
- MungePluginDsoPath(const string& path)
diff --git a/www/firefox-esr/files/patch-bug732340 b/www/firefox-esr/files/patch-bug732340
new file mode 100644
index 000000000000..95756678bd0f
--- /dev/null
+++ b/www/firefox-esr/files/patch-bug732340
@@ -0,0 +1,13 @@
+--- gfx/harfbuzz/src/hb-ot-layout.cc.orig 2012-06-24 22:14:46.463741874 -0400
++++ gfx/harfbuzz/src/hb-ot-layout.cc 2012-06-24 22:15:06.784770042 -0400
+@@ -537,4 +537,10 @@ hb_ot_layout_position_finish (hb_face_t
+ GPOS::position_finish (buffer);
+ }
+
++#if !defined(__clang__) && defined(__GNUC__) && __GNUC_MINOR__ <= 3
++template int SortedArrayOf<Record<LangSys> >::search<unsigned int>(unsigned int const &) const;
++template int SortedArrayOf<Record<Script> >::search<unsigned int>(unsigned int const &) const;
++template int SortedArrayOf<IntType<unsigned short> >::search<unsigned int>(unsigned int const &) const;
++template int SortedArrayOf<RangeRecord>::search<unsigned int>(unsigned int const &) const;
++#endif
+
diff --git a/www/firefox-esr/files/patch-bug741737 b/www/firefox-esr/files/patch-bug741737
deleted file mode 100644
index b00aef3d1382..000000000000
--- a/www/firefox-esr/files/patch-bug741737
+++ /dev/null
@@ -1,90 +0,0 @@
-changeset: 91900:eee73897136b
-user: Martin Stransky <stransky@redhat.com>
-date: Tue Apr 17 19:57:40 2012 -0400
-summary: Bug 741737 - Configure libvpx with pkgconfig. r=khuey, a=npotb
-
-diff --git a/configure.in b/configure.in
---- configure.in
-+++ configure.in
-@@ -5588,12 +5588,10 @@ MOZ_ARG_DISABLE_BOOL(webm,
-
- dnl system libvpx Support
- dnl ========================================================
--MOZ_ARG_WITH_STRING(system-libvpx,
--[ --with-system-libvpx=[PFX]
-- Use system libvpx [installed at prefix PFX]],
-- LIBVPX_DIR=$withval)
-+MOZ_ARG_WITH_BOOL(system-libvpx,
-+[ --with-system-libvpx Use system libvpx (located with pkgconfig)],
-+ MOZ_NATIVE_LIBVPX=1)
-
--MOZ_NATIVE_LIBVPX=
- MOZ_LIBVPX_INCLUDES=
- MOZ_LIBVPX_LIBS=
-
-@@ -5606,53 +5604,18 @@ if test -n "$MOZ_WEBM"; then
- AC_DEFINE(MOZ_VP8_ENCODER)
- fi
-
-- if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
-- _SAVE_CFLAGS=$CFLAGS
-- _SAVE_LDFLAGS=$LDFLAGS
-- _SAVE_LIBS=$LIBS
-- if test "${LIBVPX_DIR}" = "yes"; then
-- LIBVPX_DIR=/usr
-- fi
-- CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
-- LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
-- MOZ_NATIVE_LIBVPX_DEC_TEST=
-- MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
-- [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
-- AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
-- fi],
-- AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
-- AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
-- [MOZ_NATIVE_LIBVPX_DEC_TEST=1],
-- ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
-- if test -n "$MOZ_NATIVE_LIBVPX_DEC_TEST" ; then
-- AC_MSG_CHECKING([for libvpx version >= v0.9.7])
-- dnl We need at least v0.9.7 to fix several crash bugs (for which we
-- dnl had local patches prior to v0.9.7).
-- dnl
-- dnl This is a terrible test for the library version, but we don't
-- dnl have a good one. There is no version number in a public header,
-- dnl and testing the headers still doesn't guarantee we link against
-- dnl the right version. While we could call vpx_codec_version() at
-- dnl run-time, that would break cross-compiling. There are no
-- dnl additional exported symbols between the v0.9.7 release and the
-- dnl v0.9.6 one to check for.
-- AC_TRY_COMPILE([
-- #include <vpx/vpx_decoder.h>
-- #if !defined(VPX_CODEC_USE_INPUT_PARTITION)
-- #error "test failed."
-- #endif
-- ],
-- [return 0;],
-- [AC_MSG_RESULT([yes])
-- MOZ_NATIVE_LIBVPX=1
-- MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
-- MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
-- [AC_MSG_RESULT([no])
-- AC_MSG_ERROR([--with-system-libvpx requested but it is not v0.9.7 or later])])
-- fi
-- CFLAGS=$_SAVE_CFLAGS
-- LDFLAGS=$_SAVE_LDFLAGS
-- LIBS=$_SAVE_LIBS
-+ if test -n "$MOZ_NATIVE_LIBVPX"; then
-+ dnl ============================
-+ dnl === libvpx Version check ===
-+ dnl ============================
-+ dnl Check to see if we have a system libvpx package.
-+ PKG_CHECK_MODULES(LIBVPX, vpx >= 0.9.7)
-+
-+ MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
-+ [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])])
-+
-+ AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
-+ [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
- fi
- fi
-
diff --git a/www/firefox-esr/files/patch-bug753046 b/www/firefox-esr/files/patch-bug753046
index c606ab1f58bc..c5ecdbd8af1b 100644
--- a/www/firefox-esr/files/patch-bug753046
+++ b/www/firefox-esr/files/patch-bug753046
@@ -56,7 +56,7 @@ $NetBSD: patch-ipc_chromium_Makefile.in,v 1.1 2012/03/06 12:34:09 ryoon Exp $
--- ipc/chromium/Makefile.in.orig 2012-02-16 06:40:33.000000000 +0000
+++ ipc/chromium/Makefile.in
-@@ -278,6 +278,34 @@ endif
+@@ -278,6 +278,33 @@ endif
endif # } OS_LINUX
@@ -64,7 +64,6 @@ $NetBSD: patch-ipc_chromium_Makefile.in,v 1.1 2012/03/06 12:34:09 ryoon Exp $
+
+CPPSRCS += \
+ atomicops_internals_x86_gcc.cc \
-+ file_util_linux.cc \
+ process_util_bsd.cc \
+ time_posix.cc \
+ $(NULL)
@@ -381,37 +380,29 @@ diff --git ipc/chromium/src/base/dir_reader_posix.h ipc/chromium/src/base/dir_re
index 9a34492..62b280c 100644
--- ipc/chromium/src/base/dir_reader_posix.h
+++ ipc/chromium/src/base/dir_reader_posix.h
-@@ -18,6 +18,8 @@
+@@ -18,16 +18,20 @@
+ // seems worse than falling back to enumerating all file descriptors so we will
+ // probably never implement this on the Mac.
- #if defined(OS_LINUX)
+-#if defined(OS_LINUX) && !defined(OS_OPENBSD)
++#if defined(OS_LINUX)
#include "base/dir_reader_linux.h"
+#elif defined(OS_BSD)
+#include "base/dir_reader_bsd.h"
#else
#include "base/dir_reader_fallback.h"
#endif
-@@ -26,6 +28,8 @@
- #if defined(OS_LINUX)
+ namespace base {
+
+-#if defined(OS_LINUX) && !defined(OS_OPENBSD)
++#if defined(OS_LINUX)
typedef DirReaderLinux DirReaderPosix;
+#elif defined(OS_BSD)
+typedef DirReaderBSD DirReaderPosix;
#else
typedef DirReaderFallback DirReaderPosix;
#endif
-diff --git ipc/chromium/src/base/file_util_linux.cc ipc/chromium/src/base/file_util_linux.cc
-index 171e44f..0c6dfcc 100644
---- ipc/chromium/src/base/file_util_linux.cc
-+++ ipc/chromium/src/base/file_util_linux.cc
-@@ -28,7 +28,7 @@ bool GetTempDir(FilePath* path) {
- }
-
- bool GetShmemTempDir(FilePath* path) {
--#ifdef ANDROID
-+#if defined(ANDROID) || defined(OS_BSD)
- return GetTempDir(path);
- #else
- *path = FilePath("/dev/shm");
$NetBSD: patch-ipc_chromium_src_base_file__util__posix.cc,v 1.2 2012/03/06 12:34:09 ryoon Exp $
--- ipc/chromium/src/base/file_util_posix.cc.orig 2011-12-20 23:28:19.000000000 +0000
@@ -469,7 +460,7 @@ $NetBSD: patch-ipc_chromium_src_base_platform__thread__posix.cc,v 1.4 2012/04/01
--- ipc/chromium/src/base/platform_thread_posix.cc.orig 2012-03-13 01:36:53.000000000 +0000
+++ ipc/chromium/src/base/platform_thread_posix.cc
-@@ -9,9 +9,23 @@
+@@ -9,16 +9,30 @@
#if defined(OS_MACOSX)
#include <mach/mach.h>
@@ -477,9 +468,10 @@ $NetBSD: patch-ipc_chromium_src_base_platform__thread__posix.cc,v 1.4 2012/04/01
+#include <lwp.h>
#elif defined(OS_LINUX)
#include <sys/syscall.h>
- #include <unistd.h>
-+#elif defined(OS_DRAGONFLY)
-+#include <unistd.h>
+-#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
+ #include <sys/prctl.h>
+-#elif !defined(__NetBSD__)
+-#include <pthread_np.h>
+#elif defined(OS_FREEBSD)
+#include <sys/param.h>
+#if __FreeBSD_version > 802500
@@ -489,15 +481,24 @@ $NetBSD: patch-ipc_chromium_src_base_platform__thread__posix.cc,v 1.4 2012/04/01
+extern "C" int thr_self(long *);
+_Pragma("GCC visibility pop")
+#endif
-+#include <pthread_np.h>
+ #endif
++
++#if !defined(OS_MACOSX)
+ #include <unistd.h>
#endif
++#if defined(OS_BSD) && !defined(OS_NETBSD)
++#include <pthread_np.h>
++#endif
++
#if defined(OS_MACOSX)
-@@ -38,9 +45,20 @@
+ namespace base {
+ void InitThreading();
+@@ -38,9 +45,20 @@ PlatformThreadId PlatformThread::CurrentId() {
// into the kernel.
#if defined(OS_MACOSX)
return mach_thread_self();
--#elif defined (__OpenBSD__)
+-#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#elif defined(OS_NETBSD)
+ return _lwp_self();
+#elif defined(OS_DRAGONFLY)
@@ -517,6 +518,18 @@ $NetBSD: patch-ipc_chromium_src_base_platform__thread__posix.cc,v 1.4 2012/04/01
#elif defined(OS_LINUX)
return syscall(__NR_gettid);
#endif
+@@ -102,9 +102,9 @@ void PlatformThread::SetName(const char* name) {
+ // Note that glibc also has a 'pthread_setname_np' api, but it may not be
+ // available everywhere and it's only benefit over using prctl directly is
+ // that it can set the name of threads other than the current thread.
+-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
++#if defined(OS_BSD) && !defined(OS_NETBSD)
+ pthread_set_name_np(pthread_self(), name);
+-#elif defined(__NetBSD__)
++#elif defined(OS_NETBSD)
+ pthread_setname_np(pthread_self(), "%s", (void *)name);
+ #else
+ prctl(PR_SET_NAME, reinterpret_cast<uintptr_t>(name), 0, 0, 0);
$NetBSD: patch-ipc_chromium_src_base_process__util.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
--- ipc/chromium/src/base/process_util.h.orig 2011-12-21 00:28:19.000000000 +0100
@@ -558,7 +571,7 @@ $NetBSD: patch-ipc_chromium_src_base_process__util__bsd.cc,v 1.4 2012/04/01 15:1
--- ipc/chromium/src/base/process_util_bsd.cc.orig 2012-04-01 00:04:28.000000000 +0000
+++ ipc/chromium/src/base/process_util_bsd.cc
-@@ -0,0 +1,318 @@
+@@ -0,0 +1,367 @@
+// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
@@ -593,6 +606,20 @@ $NetBSD: patch-ipc_chromium_src_base_process__util__bsd.cc,v 1.4 2012/04/01 15:1
+#define HAVE_POSIX_SPAWN 1
+#endif
+
++/*
++ * On platforms that are not gonk based, we fall back to an arbitrary
++ * UID. This is generally the UID for user `nobody', albeit it is not
++ * always the case.
++ */
++
++#if defined(OS_NETBSD) || defined(OS_OPENBSD)
++# define CHILD_UNPRIVILEGED_UID 32767
++# define CHILD_UNPRIVILEGED_GID 32767
++#else
++# define CHILD_UNPRIVILEGED_UID 65534
++# define CHILD_UNPRIVILEGED_GID 65534
++#endif
++
+#ifndef __dso_public
+# ifdef __exported
+# define __dso_public __exported
@@ -641,6 +668,17 @@ $NetBSD: patch-ipc_chromium_src_base_process__util__bsd.cc,v 1.4 2012/04/01 15:1
+ const environment_map& env_vars_to_set,
+ bool wait, ProcessHandle* process_handle,
+ ProcessArchitecture arch) {
++ return LaunchApp(argv, fds_to_remap, env_vars_to_set,
++ SAME_PRIVILEGES_AS_PARENT,
++ wait, process_handle);
++}
++
++bool LaunchApp(const std::vector<std::string>& argv,
++ const file_handle_mapping_vector& fds_to_remap,
++ const environment_map& env_vars_to_set,
++ ChildPrivileges privs,
++ bool wait, ProcessHandle* process_handle,
++ ProcessArchitecture arch) {
+ bool retval = true;
+
+ char* argv_copy[argv.size() + 1];
@@ -755,6 +793,17 @@ $NetBSD: patch-ipc_chromium_src_base_process__util__bsd.cc,v 1.4 2012/04/01 15:1
+ const environment_map& env_vars_to_set,
+ bool wait, ProcessHandle* process_handle,
+ ProcessArchitecture arch) {
++ return LaunchApp(argv, fds_to_remap, env_vars_to_set,
++ SAME_PRIVILEGES_AS_PARENT,
++ wait, process_handle);
++}
++
++bool LaunchApp(const std::vector<std::string>& argv,
++ const file_handle_mapping_vector& fds_to_remap,
++ const environment_map& env_vars_to_set,
++ ChildPrivileges privs,
++ bool wait, ProcessHandle* process_handle,
++ ProcessArchitecture arch) {
+ scoped_array<char*> argv_cstr(new char*[argv.size() + 1]);
+ // Illegal to allocate memory after fork and before execvp
+ InjectiveMultimap fd_shuffle1, fd_shuffle2;
@@ -777,19 +826,32 @@ $NetBSD: patch-ipc_chromium_src_base_process__util__bsd.cc,v 1.4 2012/04/01 15:1
+
+ CloseSuperfluousFds(fd_shuffle2);
+
++ for (size_t i = 0; i < argv.size(); i++)
++ argv_cstr[i] = const_cast<char*>(argv[i].c_str());
++ argv_cstr[argv.size()] = NULL;
++
++ if (privs == UNPRIVILEGED) {
++ if (setgid(CHILD_UNPRIVILEGED_GID) != 0) {
++ DLOG(ERROR) << "FAILED TO setgid() CHILD PROCESS, path: " << argv_cstr[0];
++ _exit(127);
++ }
++ if (setuid(CHILD_UNPRIVILEGED_UID) != 0) {
++ DLOG(ERROR) << "FAILED TO setuid() CHILD PROCESS, path: " << argv_cstr[0];
++ _exit(127);
++ }
++ if (chdir("/") != 0)
++ gProcessLog.print("==> could not chdir()\n");
++ }
++
+ for (environment_map::const_iterator it = env_vars_to_set.begin();
+ it != env_vars_to_set.end(); ++it) {
+ if (setenv(it->first.c_str(), it->second.c_str(), 1/*overwrite*/))
+ _exit(127);
+ }
-+
-+ for (size_t i = 0; i < argv.size(); i++)
-+ argv_cstr[i] = const_cast<char*>(argv[i].c_str());
-+ argv_cstr[argv.size()] = NULL;
-+ execvp(argv_cstr[0], argv_cstr.get());
++ execv(argv_cstr[0], argv_cstr.get());
+ // if we get here, we're in serious trouble and should complain loudly
+ DLOG(ERROR) << "FAILED TO exec() CHILD PROCESS, path: " << argv_cstr[0];
-+ exit(127);
++ _exit(127);
+ } else {
+ gProcessLog.print("==> process %d launched child process %d\n",
+ GetCurrentProcId(), pid);
@@ -951,57 +1013,6 @@ $NetBSD: patch-ipc_chromium_src_base_sys__info__posix.cc,v 1.2 2011/11/27 13:09:
#else
long pages = sysconf(_SC_PHYS_PAGES);
long page_size = sysconf(_SC_PAGE_SIZE);
-$NetBSD: patch-ipc_chromium_src_base_third__party_nspr_prcpucfg.h,v 1.2 2012/03/06 12:34:09 ryoon Exp $
-
---- ipc/chromium/src/base/third_party/nspr/prcpucfg.h.orig 2011-12-20 23:28:19.000000000 +0000
-+++ ipc/chromium/src/base/third_party/nspr/prcpucfg.h
-@@ -34,7 +34,7 @@
- #include "base/third_party/nspr/prcpucfg_win.h"
- #elif defined(__APPLE__)
- #include "base/third_party/nspr/prcpucfg_mac.h"
--#elif defined(__linux__) || defined(ANDROID)
-+#elif defined(__linux__) || defined(ANDROID) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
- #include "base/third_party/nspr/prcpucfg_linux.h"
- #elif defined(__OpenBSD__)
- #include "base/third_party/nspr/prcpucfg_openbsd.h"
-$NetBSD: patch-ipc_chromium_src_base_third__party_nspr_prtime.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- ipc/chromium/src/base/third_party/nspr/prtime.cc.orig 2011-12-20 23:28:19.000000000 +0000
-+++ ipc/chromium/src/base/third_party/nspr/prtime.cc
-@@ -212,7 +212,7 @@ PR_ImplodeTime(const PRExplodedTime *exp
- LL_ADD(retVal, retVal, temp);
-
- return retVal;
--#elif defined(OS_LINUX)
-+#elif defined(OS_LINUX) || defined(OS_DRAGONFLY)
- struct tm exp_tm = {0};
- exp_tm.tm_sec = exploded->tm_sec;
- exp_tm.tm_min = exploded->tm_min;
-@@ -245,6 +245,24 @@ PR_ImplodeTime(const PRExplodedTime *exp
- result *= kSecondsToMicroseconds;
- result += exploded->tm_usec;
- return result;
-+#elif defined(OS_FREEBSD) || defined(OS_NETBSD)
-+ struct tm exp_tm = {0};
-+ exp_tm.tm_sec = exploded->tm_sec;
-+ exp_tm.tm_min = exploded->tm_min;
-+ exp_tm.tm_hour = exploded->tm_hour;
-+ exp_tm.tm_mday = exploded->tm_mday;
-+ exp_tm.tm_mon = exploded->tm_month;
-+ exp_tm.tm_year = exploded->tm_year - 1900;
-+
-+ // time_t is 64bit
-+ time_t absolute_time = timegm(&exp_tm);
-+
-+ PRTime result = static_cast<PRTime>(absolute_time);
-+ result -= exploded->tm_params.tp_gmt_offset +
-+ exploded->tm_params.tp_dst_offset;
-+ result *= kSecondsToMicroseconds;
-+ result += exploded->tm_usec;
-+ return result;
- #else
- #error No PR_ImplodeTime implemented on your platform.
- #endif
diff --git ipc/chromium/src/base/time_posix.cc ipc/chromium/src/base/time_posix.cc
index abf2a56..48791f6 100644
--- ipc/chromium/src/base/time_posix.cc
@@ -1146,11 +1157,11 @@ $NetBSD: patch-ipc_glue_GeckoChildProcessHost.cpp,v 1.2 2012/03/15 08:30:06 ryoo
nsCString path;
greDir->GetNativePath(path);
-# ifdef OS_LINUX
--# ifdef ANDROID
+-# ifdef MOZ_WIDGET_ANDROID
+# if defined(OS_LINUX) || defined(OS_BSD)
-+# if defined(ANDROID) || defined(OS_BSD)
++# if defined(MOZ_WIDGET_ANDROID) || defined(OS_BSD)
path += "/lib";
- # endif // ANDROID
+ # endif // MOZ_WIDGET_ANDROID
const char *ld_library_path = PR_GetEnv("LD_LIBRARY_PATH");
@@ -557,7 +557,7 @@
childArgv.push_back(pidstring);
@@ -1167,7 +1178,7 @@ $NetBSD: patch-ipc_glue_GeckoChildProcessHost.cpp,v 1.2 2012/03/15 08:30:06 ryoo
base::LaunchApp(childArgv, mFileMap,
-#if defined(OS_LINUX) || defined(OS_MACOSX)
+#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD)
- newEnvVars,
+ newEnvVars, privs,
#endif
false, &process, arch);
diff --git ipc/glue/SharedMemorySysV.h ipc/glue/SharedMemorySysV.h
diff --git a/www/firefox-esr/files/patch-bug761077 b/www/firefox-esr/files/patch-bug761077
deleted file mode 100644
index 922fa55131e8..000000000000
--- a/www/firefox-esr/files/patch-bug761077
+++ /dev/null
@@ -1,88 +0,0 @@
-diff --git xpcom/reflect/xptcall/public/genstubs.pl xpcom/reflect/xptcall/public/genstubs.pl
-index b8a87a5..918c4cf 100644
---- xpcom/reflect/xptcall/public/genstubs.pl
-+++ xpcom/reflect/xptcall/public/genstubs.pl
-@@ -44,7 +44,7 @@ print OUTFILE "* 0 is QueryInterface\n";
- print OUTFILE "* 1 is AddRef\n";
- print OUTFILE "* 2 is Release\n";
- print OUTFILE "*/\n";
--print OUTFILE "#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__))\n";
-+print OUTFILE "#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__) && !defined(__FreeBSD__))\n";
- for($i = 0; $i < $entry_count; $i++) {
- print OUTFILE "NS_IMETHOD Stub",$i+3,"();\n";
- }
-diff --git xpcom/reflect/xptcall/public/xptcstubsdecl.inc xpcom/reflect/xptcall/public/xptcstubsdecl.inc
-index eb66761..807db26 100644
---- xpcom/reflect/xptcall/public/xptcstubsdecl.inc
-+++ xpcom/reflect/xptcall/public/xptcstubsdecl.inc
-@@ -8,7 +8,7 @@
- * 1 is AddRef
- * 2 is Release
- */
--#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__))
-+#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__) && !defined(__FreeBSD__))
- NS_IMETHOD Stub3();
- NS_IMETHOD Stub4();
- NS_IMETHOD Stub5();
-diff --git xpcom/reflect/xptcall/src/md/unix/Makefile.in xpcom/reflect/xptcall/src/md/unix/Makefile.in
-index ae6ed66..2783957 100644
---- xpcom/reflect/xptcall/src/md/unix/Makefile.in
-+++ xpcom/reflect/xptcall/src/md/unix/Makefile.in
-@@ -70,7 +70,7 @@ endif
- endif
- endif
- # IA64 Linux
--ifneq (,$(filter Linux,$(OS_ARCH)))
-+ifneq (,$(filter Linux FreeBSD,$(OS_ARCH)))
- ifneq (,$(findstring ia64,$(OS_TEST)))
- CPPSRCS := xptcinvoke_ipf64.cpp xptcstubs_ipf64.cpp
- ASFILES := xptcstubs_asm_ipf64.s xptcinvoke_asm_ipf64.s
-@@ -269,7 +269,7 @@ endif
- #
- # Linux/PPC
- #
--ifeq ($(OS_ARCH)$(OS_TEST),Linuxpowerpc)
-+ifneq (,$(filter Linuxpowerpc FreeBSDpowerpc,$(OS_ARCH)$(OS_TEST)))
- CPPSRCS := xptcinvoke_ppc_linux.cpp xptcstubs_ppc_linux.cpp
- ASFILES := xptcinvoke_asm_ppc_linux.s xptcstubs_asm_ppc_linux.s
- AS := $(CC) -c -x assembler-with-cpp
-@@ -278,7 +278,7 @@ endif
- #
- # Linux/PPC64
- #
--ifeq ($(OS_ARCH)$(OS_TEST),Linuxpowerpc64)
-+ifneq (,$(filter Linuxpowerpc64 FreeBSDpowerpc64,$(OS_ARCH)$(OS_TEST)))
- CPPSRCS := xptcinvoke_ppc64_linux.cpp xptcstubs_ppc64_linux.cpp
- ASFILES := xptcinvoke_asm_ppc64_linux.s xptcstubs_asm_ppc64_linux.s
- AS := $(CC) -c -x assembler-with-cpp
-@@ -350,7 +350,7 @@ endif
- #
- # OpenBSD/SPARC64
- #
--ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDsparc64)
-+ifneq (,$(filter OpenBSDsparc64 FreeBSDsparc64,$(OS_ARCH)$(OS_TEST)))
- CPPSRCS := xptcinvoke_sparc64_openbsd.cpp xptcstubs_sparc64_openbsd.cpp
- ASFILES := xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_openbsd.s
- endif
-diff --git xpcom/reflect/xptcall/src/xptcprivate.h xpcom/reflect/xptcall/src/xptcprivate.h
-index d903ced..e4ec832 100644
---- xpcom/reflect/xptcall/src/xptcprivate.h
-+++ xpcom/reflect/xptcall/src/xptcprivate.h
-@@ -14,7 +14,7 @@
-
- class xptiInterfaceEntry;
-
--#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__))
-+#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__) && !defined(__FreeBSD__))
- #define STUB_ENTRY(n) NS_IMETHOD Stub##n() = 0;
- #else
- #define STUB_ENTRY(n) NS_IMETHOD Stub##n(PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64) = 0;
-@@ -31,7 +31,7 @@ public:
- #undef STUB_ENTRY
- #undef SENTINEL_ENTRY
-
--#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__))
-+#if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__) && !defined(__FreeBSD__))
- #define STUB_ENTRY(n) NS_IMETHOD Stub##n();
- #else
- #define STUB_ENTRY(n) NS_IMETHOD Stub##n(PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
diff --git a/www/firefox-esr/files/patch-bug778056 b/www/firefox-esr/files/patch-bug778056
deleted file mode 100644
index 2730ffbfc594..000000000000
--- a/www/firefox-esr/files/patch-bug778056
+++ /dev/null
@@ -1,21 +0,0 @@
---- memory/mozalloc/mozalloc.cpp~
-+++ memory/mozalloc/mozalloc.cpp
-@@ -52,6 +52,9 @@
- #if defined(XP_UNIX)
- # include <unistd.h> // for valloc on *BSD
- #endif //if defined(XP_UNIX)
-+#ifdef __FreeBSD__
-+# include <malloc_np.h> // for malloc_usable_size
-+#endif
-
- #if defined(MOZ_MEMORY)
- // jemalloc.h doesn't redeclare symbols if they're provided by the OS
-@@ -259,7 +262,7 @@ moz_malloc_usable_size(void *ptr)
-
- #if defined(XP_MACOSX)
- return malloc_size(ptr);
--#elif defined(MOZ_MEMORY)
-+#elif defined(MOZ_MEMORY) || defined(__FreeBSD__)
- return malloc_usable_size(ptr);
- #elif defined(XP_WIN)
- return _msize(ptr);
diff --git a/www/firefox-esr/files/patch-bug778078 b/www/firefox-esr/files/patch-bug778078
index a68f07ab34ed..f7bedeb8053c 100644
--- a/www/firefox-esr/files/patch-bug778078
+++ b/www/firefox-esr/files/patch-bug778078
@@ -1,11 +1,11 @@
--- toolkit/xre/nsAppRunner.cpp~
+++ toolkit/xre/nsAppRunner.cpp
-@@ -3133,7 +3133,7 @@ XRE_main(int argc, char* argv[], const n
- gQtOnlyArgv[gQtOnlyArgc] = nsnull;
- #endif
- #if defined(MOZ_WIDGET_GTK2)
+@@ -3833,7 +3833,7 @@ XREMain::XRE_main(int argc, char* argv[]
+ ScopedLogging log;
+
+ #if defined(MOZ_WIDGET_GTK)
-#ifdef MOZ_MEMORY
+#if defined(MOZ_MEMORY) || defined(__FreeBSD__) || defined(__NetBSD__)
- // Disable the slice allocator, since jemalloc already uses similar layout
- // algorithms, and using a sub-allocator tends to increase fragmentation.
- // This must be done before g_thread_init() is called.
+ // Disable the slice allocator, since jemalloc already uses similar layout
+ // algorithms, and using a sub-allocator tends to increase fragmentation.
+ // This must be done before g_thread_init() is called.
diff --git a/www/firefox-esr/files/patch-bug779847 b/www/firefox-esr/files/patch-bug779847
deleted file mode 100644
index f431c4a8d3c5..000000000000
--- a/www/firefox-esr/files/patch-bug779847
+++ /dev/null
@@ -1,28 +0,0 @@
---- gfx/ycbcr/Makefile.in
-+++ gfx/ycbcr/Makefile.in
-@@ -54,23 +54,13 @@ CPPSRCS += yuv_row_win.cpp \
- $(NULL)
- endif
- else
--ifeq ($(OS_ARCH),Linux)
--CPPSRCS += yuv_row_posix.cpp \
-- $(NULL)
--else
--ifeq ($(OS_ARCH),SunOS)
--CPPSRCS += yuv_row_posix.cpp \
-- $(NULL)
--else
--ifeq ($(OS_ARCH),Darwin)
-+ifneq (,$(filter Linux SunOS Darwin DragonFly FreeBSD NetBSD OpenBSD, $(OS_ARCH)))
- CPPSRCS += yuv_row_posix.cpp \
- $(NULL)
- else
- CPPSRCS += yuv_row_other.cpp \
- $(NULL)
--endif # Darwin
--endif # SunOS
--endif # linux
-+endif # posix
- endif # windows
-
- ifeq (arm,$(findstring arm,$(OS_TEST)))
diff --git a/www/firefox-esr/files/patch-bug781457 b/www/firefox-esr/files/patch-bug781457
index 8cf3cfb70c14..8a790ccf84a9 100644
--- a/www/firefox-esr/files/patch-bug781457
+++ b/www/firefox-esr/files/patch-bug781457
@@ -1,5 +1,5 @@
---- xpcom/base/nsStackWalk.cpp.orig 2010-12-15 02:03:41.000000000 +0100
-+++ xpcom/base/nsStackWalk.cpp 2010-12-15 11:28:20.000000000 +0100
+--- xpcom/base/nsStackWalk.cpp.orig 2012-05-29 00:57:31.000000000 +0200
++++ xpcom/base/nsStackWalk.cpp 2012-06-03 12:33:40.000000000 +0200
@@ -1123,6 +1123,7 @@ NS_StackWalk(NS_WalkStackCallback aCallb
#elif defined(HAVE__UNWIND_BACKTRACE)
diff --git a/www/firefox-esr/files/patch-bug783463 b/www/firefox-esr/files/patch-bug783463
index 56ec54b3fcc3..b27a1997c534 100644
--- a/www/firefox-esr/files/patch-bug783463
+++ b/www/firefox-esr/files/patch-bug783463
@@ -1,20 +1,14 @@
---- widget/src/qt/nsNativeThemeQt.cpp~
-+++ widget/src/qt/nsNativeThemeQt.cpp
-@@ -25,7 +25,6 @@
- #include "nsThemeConstants.h"
- #include "nsIServiceManager.h"
- #include "nsIDOMHTMLInputElement.h"
--#include <malloc.h>
-
-
- #include "gfxASurface.h"
---- widget/src/qt/nsSound.cpp~
-+++ widget/src/qt/nsSound.cpp
-@@ -40,6 +40,7 @@
- #include <QSound>
-
- #include <string.h>
-+#include <unistd.h>
-
- #include "nscore.h"
- #include "plstr.h"
+--- gfx/skia/Makefile.in~
++++ gfx/skia/Makefile.in
+@@ -339,10 +339,9 @@ CPPSRCS += \
+ SkMMapStream.cpp \
+ SkOSFile.cpp \
+ $(NULL)
+-ifeq (Linux,$(OS_TARGET))
++ifneq (,$(or $(MOZ_X11),$(filter Linux,$(OS_TARGET))))
+ CPPSRCS += \
+ SkFontHost_linux.cpp \
+- SkFontHost_tables.cpp \
+ SkTime_Unix.cpp \
+ $(NULL)
+ endif
diff --git a/www/firefox/files/patch-bug784631 b/www/firefox-esr/files/patch-bug784631
index 2c8a1560b877..2c8a1560b877 100644
--- a/www/firefox/files/patch-bug784631
+++ b/www/firefox-esr/files/patch-bug784631
diff --git a/www/firefox-esr/files/patch-bug784776 b/www/firefox-esr/files/patch-bug784776
deleted file mode 100644
index 2036b3d441e3..000000000000
--- a/www/firefox-esr/files/patch-bug784776
+++ /dev/null
@@ -1,22 +0,0 @@
---- intl/locale/src/unix/nsDateTimeFormatUnix.cpp~
-+++ intl/locale/src/unix/nsDateTimeFormatUnix.cpp
-@@ -100,7 +100,7 @@ void nsDateTimeFormatUnix::LocalePreferr
- struct tm *tmc;
- int i;
-
-- tt = time((time_t)NULL);
-+ tt = time(NULL);
- tmc = localtime(&tt);
-
- tmc->tm_hour=22; // put the test sample hour to 22:00 which is 10PM
---- xpcom/glue/nsBaseHashtable.h~
-+++ xpcom/glue/nsBaseHashtable.h
-@@ -147,7 +147,7 @@ public:
- {
- EntryType* ent = this->GetEntry(aKey);
- if (!ent)
-- return NULL;
-+ return 0;
-
- return ent->mData;
- }
diff --git a/www/firefox/files/patch-bug786995 b/www/firefox-esr/files/patch-bug786995
index 85b3abcc3d13..85b3abcc3d13 100644
--- a/www/firefox/files/patch-bug786995
+++ b/www/firefox-esr/files/patch-bug786995
diff --git a/www/firefox/files/patch-bug787904 b/www/firefox-esr/files/patch-bug787904
index 55f7a6046813..55f7a6046813 100644
--- a/www/firefox/files/patch-bug787904
+++ b/www/firefox-esr/files/patch-bug787904
diff --git a/www/firefox-esr/files/patch-bug788039 b/www/firefox-esr/files/patch-bug788039
index 678f0d493eae..a678de2eab4f 100644
--- a/www/firefox-esr/files/patch-bug788039
+++ b/www/firefox-esr/files/patch-bug788039
@@ -1,16 +1,5 @@
# Bug 788039 - With no prefix search libevent via pkg-config.
---- config/autoconf.mk.in~
-+++ config/autoconf.mk.in
-@@ -227,7 +227,7 @@ MOZ_HUNSPELL_CFLAGS = @MOZ_HUNSPELL_CFLA
-
- MOZ_NATIVE_LIBEVENT = @MOZ_NATIVE_LIBEVENT@
- MOZ_LIBEVENT_LIBS = @MOZ_LIBEVENT_LIBS@
--MOZ_LIBEVENT_INCLUDES = @MOZ_LIBEVENT_INCLUDES@
-+MOZ_LIBEVENT_CFLAGS = @MOZ_LIBEVENT_CFLAGS@
-
- MOZ_NATIVE_LIBVPX = @MOZ_NATIVE_LIBVPX@
- MOZ_LIBVPX_LIBS = @MOZ_LIBVPX_LIBS@
--- configure.in~
+++ configure.in
@@ -3854,7 +3854,7 @@ fi
diff --git a/www/firefox-esr/files/patch-bug788108 b/www/firefox-esr/files/patch-bug788108
index 746146760c62..80ff18649882 100644
--- a/www/firefox-esr/files/patch-bug788108
+++ b/www/firefox-esr/files/patch-bug788108
@@ -7,7 +7,7 @@
-//A trick to handle IEEE floating point exceptions on FreeBSD - E.D.
-#ifdef __FreeBSD__
-#include <ieeefp.h>
--#ifdef __alpha__
+-#if !defined(__i386__) && !defined(__x86_64__)
-static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP;
-#else
-static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP|FP_X_DNML;
diff --git a/www/firefox-esr/files/patch-bug788955 b/www/firefox-esr/files/patch-bug788955
new file mode 100644
index 000000000000..57c5f12d7ed4
--- /dev/null
+++ b/www/firefox-esr/files/patch-bug788955
@@ -0,0 +1,299 @@
+diff --git Makefile.in Makefile.in
+index e341462..f75bd55 100644
+--- Makefile.in
++++ Makefile.in
+@@ -48,8 +48,10 @@ endif
+ ifdef MOZ_MEMORY
+ tier_base_dirs += memory/mozjemalloc
+ ifdef MOZ_JEMALLOC
++ifndef MOZ_NATIVE_JEMALLOC
+ tier_base_dirs += memory/jemalloc
+ endif
++endif
+ tier_base_dirs += memory/build
+ endif
+ ifndef MOZ_NATIVE_ZLIB
+diff --git allmakefiles.sh allmakefiles.sh
+index 6a9be4b..d2e49e3 100755
+--- allmakefiles.sh
++++ allmakefiles.sh
+@@ -59,7 +59,7 @@ if [ ! "$LIBXUL_SDK" ]; then
+ mozglue/Makefile
+ mozglue/build/Makefile
+ "
+- if [ "$MOZ_JEMALLOC" ]; then
++ if [ "$MOZ_JEMALLOC" -a -z "$MOZ_NATIVE_JEMALLOC" ]; then
+ add_makefiles "
+ memory/jemalloc/Makefile
+ "
+diff --git configure.in configure.in
+index bb05782..2f32516 100644
+--- configure.in
++++ configure.in
+@@ -3711,21 +3711,22 @@ fi
+
+ dnl Check for the existence of various allocation headers/functions
+
++MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
+ MALLOC_H=
+-MOZ_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
+-if test "$MALLOC_H" = ""; then
+- MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
+- if test "$MALLOC_H" = ""; then
+- MOZ_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
++
++for file in $MALLOC_HEADERS; do
++ MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
++ if test "$MALLOC_H" != ""; then
++ AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
++ break
+ fi
+-fi
+-if test "$MALLOC_H" != ""; then
+- AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
+-fi
++done
+
+ MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
+ AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
+
++AC_CHECK_FUNCS(malloc_usable_size)
++
+ dnl See if compiler supports some gcc-style attributes
+
+ AC_CACHE_CHECK(for __attribute__((always_inline)),
+@@ -6939,6 +6940,18 @@ else
+ fi
+
+ if test -z "$MOZ_MEMORY"; then
++ if test -n "$MOZ_JEMALLOC"; then
++ MOZ_NATIVE_JEMALLOC=1
++ AC_CHECK_FUNCS(mallctl nallocm,,
++ [MOZ_NATIVE_JEMALLOC=
++ break])
++ if test -n "$MOZ_NATIVE_JEMALLOC"; then
++ MOZ_MEMORY=1
++ AC_DEFINE(MOZ_MEMORY)
++ AC_DEFINE(MOZ_JEMALLOC)
++ AC_DEFINE(MOZ_NATIVE_JEMALLOC)
++ fi
++ fi
+ case "${target}" in
+ *-mingw*)
+ if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
+@@ -7033,6 +7046,7 @@ else
+ fi # MOZ_MEMORY
+ AC_SUBST(MOZ_MEMORY)
+ AC_SUBST(MOZ_JEMALLOC)
++AC_SUBST(MOZ_NATIVE_JEMALLOC)
+ AC_SUBST(MOZ_GLUE_LDFLAGS)
+ AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
+ AC_SUBST(WIN32_CRT_LIBS)
+@@ -8820,10 +8834,22 @@ fi
+
+ # Run jemalloc configure script
+
+-if test "$MOZ_JEMALLOC" -a "$MOZ_MEMORY"; then
++if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_JEMALLOC" -a "$MOZ_MEMORY" ; then
+ ac_configure_args="$_SUBDIR_CONFIG_ARGS --build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
+- if test "$OS_ARCH" = "Linux"; then
+- MANGLE="malloc calloc valloc free realloc memalign posix_memalign malloc_usable_size"
++ case "$OS_ARCH" in
++ Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
++ MANGLE="malloc calloc valloc free realloc posix_memalign"
++ case "$OS_ARCH" in
++ Linux)
++ MANGLE="$MANGLE memalign malloc_usable_size"
++ ;;
++ FreeBSD)
++ MANGLE="$MANGLE malloc_usable_size"
++ ;;
++ esac
++ ;;
++ esac
++ if test -n "$MANGLE"; then
+ MANGLED=
+ JEMALLOC_WRAPPER=
+ if test -n "$_WRAP_MALLOC"; then
+diff --git memory/build/Makefile.in memory/build/Makefile.in
+index dca0f48..af93ee0 100644
+--- memory/build/Makefile.in
++++ memory/build/Makefile.in
+@@ -22,7 +22,9 @@ CSRCS = extraMallocFuncs.c
+
+ ifdef MOZ_JEMALLOC
+ CSRCS += mozjemalloc_compat.c
++ifndef MOZ_NATIVE_JEMALLOC
+ SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/jemalloc)
++endif
+ else
+ SHARED_LIBRARY_LIBS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DEPTH)/memory/mozjemalloc)
+ endif
+diff --git memory/build/extraMallocFuncs.c memory/build/extraMallocFuncs.c
+index 9d87629..03c8320 100644
+--- memory/build/extraMallocFuncs.c
++++ memory/build/extraMallocFuncs.c
+@@ -94,8 +94,16 @@ wrap(wcsdup)(const wchar_t *src)
+ #endif
+
+ #ifdef MOZ_JEMALLOC
++
++#undef wrap
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
++#endif
++
+ /* Override some jemalloc defaults */
+-const char *je_malloc_conf = "narenas:1,lg_chunk:20";
++MOZ_EXPORT_DATA(const char *) wrap(malloc_conf) = "narenas:1,lg_chunk:20";
+
+ #ifdef ANDROID
+ #include <android/log.h>
+diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c
+index 10a845a..94ad96e 100644
+--- memory/build/mozjemalloc_compat.c
++++ memory/build/mozjemalloc_compat.c
+@@ -5,14 +5,21 @@
+ #include "mozilla/Types.h"
+ #include "jemalloc_types.h"
+
+-extern int je_mallctl(const char*, void*, size_t*, void*, size_t);
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
++#endif
+
+-MOZ_EXPORT_API (void)
++extern MOZ_IMPORT_API(int)
++wrap(mallctl)(const char*, void*, size_t*, void*, size_t);
++
++MOZ_EXPORT_API(void)
+ jemalloc_stats(jemalloc_stats_t *stats)
+ {
+ size_t size = sizeof(stats->mapped);
+- je_mallctl("stats.mapped", &stats->mapped, &size, NULL, 0);
+- je_mallctl("stats.allocated", &stats->allocated, &size, NULL, 0);
++ wrap(mallctl)("stats.mapped", &stats->mapped, &size, NULL, 0);
++ wrap(mallctl)("stats.allocated", &stats->allocated, &size, NULL, 0);
+ stats->committed = -1;
+ stats->dirty = -1;
+ }
+diff --git memory/jemalloc/src/src/mutex.c memory/jemalloc/src/src/mutex.c
+index 37a843e..55e18c2 100644
+--- memory/jemalloc/src/src/mutex.c
++++ memory/jemalloc/src/src/mutex.c
+@@ -64,7 +64,7 @@ pthread_create(pthread_t *__restrict thread,
+ /******************************************************************************/
+
+ #ifdef JEMALLOC_MUTEX_INIT_CB
+-int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex,
++JEMALLOC_EXPORT int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex,
+ void *(calloc_cb)(size_t, size_t));
+ #endif
+
+diff --git memory/mozalloc/mozalloc.cpp memory/mozalloc/mozalloc.cpp
+index 5b61050b..5b3399a 100644
+--- memory/mozalloc/mozalloc.cpp
++++ memory/mozalloc/mozalloc.cpp
+@@ -12,16 +12,13 @@
+ #include <sys/types.h>
+
+ #if defined(MALLOC_H)
+-# include MALLOC_H // for memalign, valloc where available
++# include MALLOC_H // for memalign, valloc, malloc_size, malloc_usable_size
+ #endif // if defined(MALLOC_H)
+ #include <stddef.h> // for size_t
+ #include <stdlib.h> // for malloc, free
+ #if defined(XP_UNIX)
+ # include <unistd.h> // for valloc on *BSD
+ #endif //if defined(XP_UNIX)
+-#if defined(__FreeBSD__)
+-# include <malloc_np.h> // for malloc_usable_size
+-#endif // if defined(__FreeBSD__)
+
+ #if defined(XP_WIN) || (defined(XP_OS2) && defined(__declspec))
+ # define MOZALLOC_EXPORT __declspec(dllexport)
+@@ -213,8 +210,7 @@ moz_malloc_usable_size(void *ptr)
+
+ #if defined(XP_MACOSX)
+ return malloc_size(ptr);
+-#elif defined(MOZ_MEMORY) || (defined(XP_LINUX) && !defined(ANDROID)) || defined(__FreeBSD__)
+- // Android bionic libc doesn't have malloc_usable_size.
++#elif defined(HAVE_MALLOC_USABLE_SIZE) || defined(MOZ_MEMORY)
+ return malloc_usable_size(ptr);
+ #elif defined(XP_WIN)
+ return _msize(ptr);
+diff --git memory/mozjemalloc/jemalloc.h memory/mozjemalloc/jemalloc.h
+index f0e0878..2486e83 100644
+--- memory/mozjemalloc/jemalloc.h
++++ memory/mozjemalloc/jemalloc.h
+@@ -37,22 +37,29 @@
+ #endif
+ #include "jemalloc_types.h"
+
++#if defined(MOZ_NATIVE_JEMALLOC)
++#define wrap(a) a
++#else
++#define wrap(a) je_ ## a
++#endif
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+
+-#if defined(MOZ_MEMORY_LINUX)
++#if defined(MOZ_NATIVE_JEMALLOC) \
++ || defined(MOZ_MEMORY_LINUX) || defined(MOZ_MEMORY_BSD)
+ __attribute__((weak))
+ #endif
+ void jemalloc_stats(jemalloc_stats_t *stats);
+
+ /* Computes the usable size in advance. */
+ #if !defined(MOZ_MEMORY_DARWIN)
+-#if defined(MOZ_MEMORY_LINUX)
++#if defined(MOZ_MEMORY_LINUX) || defined(MOZ_MEMORY_BSD)
+ __attribute__((weak))
+ #endif
+ #if defined(MOZ_JEMALLOC)
+-int je_nallocm(size_t *rsize, size_t size, int flags);
++MOZ_IMPORT_API(int) wrap(nallocm)(size_t *rsize, size_t size, int flags);
+ #else
+ size_t je_malloc_good_size(size_t size);
+ #endif
+@@ -62,11 +69,11 @@ static inline size_t je_malloc_usable_size_in_advance(size_t size) {
+ #if defined(MOZ_MEMORY_DARWIN)
+ return malloc_good_size(size);
+ #elif defined(MOZ_JEMALLOC)
+- if (je_nallocm) {
++ if (wrap(nallocm)) {
+ size_t ret;
+ if (size == 0)
+ size = 1;
+- if (!je_nallocm(&ret, size, 0))
++ if (!wrap(nallocm)(&ret, size, 0))
+ return ret;
+ }
+ return size;
+@@ -113,4 +120,6 @@ void jemalloc_purge_freed_pages();
+ } /* extern "C" */
+ #endif
+
++#undef wrap
++
+ #endif /* _JEMALLOC_H_ */
+diff --git mozglue/build/Makefile.in mozglue/build/Makefile.in
+index c333647..15ba505 100644
+--- mozglue/build/Makefile.in
++++ mozglue/build/Makefile.in
+@@ -23,7 +23,7 @@ FORCE_STATIC_LIB = 1
+ endif
+
+ # Keep jemalloc separated when mozglue is statically linked
+-ifeq (1_1,$(MOZ_MEMORY)_$(FORCE_SHARED_LIB))
++ifeq (1_1,$(MOZ_MEMORY)_$(or $(MOZ_NATIVE_JEMALLOC),$(FORCE_SHARED_LIB)))
+ SHARED_LIBRARY_LIBS = $(call EXPAND_LIBNAME_PATH,memory,$(DEPTH)/memory/build)
+ else
+ # Temporary, until bug 662814 lands
diff --git a/www/firefox/files/patch-bug789656 b/www/firefox-esr/files/patch-bug789656
index ebc567ef27ac..ebc567ef27ac 100644
--- a/www/firefox/files/patch-bug789656
+++ b/www/firefox-esr/files/patch-bug789656
diff --git a/www/firefox-esr/files/patch-bug789693 b/www/firefox-esr/files/patch-bug789693
index dee137ab64fe..1d2b790a35d5 100644
--- a/www/firefox-esr/files/patch-bug789693
+++ b/www/firefox-esr/files/patch-bug789693
@@ -1,6 +1,6 @@
--- toolkit/components/startup/nsAppStartup.cpp
+++ toolkit/components/startup/nsAppStartup.cpp
-@@ -50,17 +50,40 @@
+@@ -50,18 +50,41 @@
#include <sys/syscall.h>
#endif
@@ -19,6 +19,7 @@
#endif
#include "mozilla/Telemetry.h"
+ #include "mozilla/StartupTimeline.h"
+#if defined(__NetBSD__)
+#undef KERN_PROC
@@ -44,7 +45,7 @@
+
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
- using namespace mozilla;
+ #define kPrefLastSuccess "toolkit.startup.last_success"
@@ -836,42 +859,30 @@ CalculateProcessCreationTimestamp()
#endif
return timestamp;
diff --git a/www/firefox-esr/files/patch-bug791366 b/www/firefox-esr/files/patch-bug791366
index 08a9181a33a7..2be866d928cd 100644
--- a/www/firefox-esr/files/patch-bug791366
+++ b/www/firefox-esr/files/patch-bug791366
@@ -2,17 +2,17 @@ diff --git xpcom/base/nsMemoryReporterManager.cpp xpcom/base/nsMemoryReporterMan
index a9aff58..674e757 100644
--- xpcom/base/nsMemoryReporterManager.cpp
+++ xpcom/base/nsMemoryReporterManager.cpp
-@@ -64,7 +64,7 @@ extern void jemalloc_stats(jemalloc_stat
- # endif // XP_LINUX
+@@ -32,7 +32,7 @@ using namespace mozilla;
+ # include "jemalloc.h"
#endif // MOZ_MEMORY
--#if defined(XP_LINUX) || defined(XP_MACOSX)
+-#if defined(XP_LINUX) || defined(XP_MACOSX) || defined(SOLARIS)
+#ifdef XP_UNIX
#include <sys/time.h>
#include <sys/resource.h>
-@@ -122,6 +122,78 @@ static PRInt64 GetResident()
- return GetProcSelfStatmField(1);
+@@ -95,6 +95,81 @@ static nsresult GetResident(PRInt64 *n)
+ return GetProcSelfStatmField(1, n);
}
+#elif defined(__DragonFly__) || defined(__FreeBSD__) \
@@ -69,56 +69,27 @@ index a9aff58..674e757 100644
+ return NS_OK;
+}
+
-+static PRInt64 GetVsize()
++#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
++static nsresult GetVsize(PRInt64 *n)
+{
+ KINFO_PROC proc;
-+ if (NS_SUCCEEDED(GetKinfoProcSelf(&proc)))
-+ return KP_SIZE(proc);
++ nsresult rv = GetKinfoProcSelf(&proc);
++ if (NS_SUCCEEDED(rv))
++ *n = KP_SIZE(proc);
+
-+ return -1;
++ return rv;
+}
+
-+static PRInt64 GetResident()
++static nsresult GetResident(PRInt64 *n)
+{
+ KINFO_PROC proc;
-+ if (NS_SUCCEEDED(GetKinfoProcSelf(&proc)))
-+ return KP_RSS(proc);
++ nsresult rv = GetKinfoProcSelf(&proc);
++ if (NS_SUCCEEDED(rv))
++ *n = KP_RSS(proc);
+
-+ return -1;
++ return rv;
+}
+
- #elif defined(XP_MACOSX)
+ #elif defined(SOLARIS)
- #include <mach/mach_init.h>
-@@ -224,7 +297,7 @@ static PRInt64 GetResident()
-
- #endif
-
--#if defined(XP_LINUX) || defined(XP_MACOSX) || defined(XP_WIN)
-+#if defined(XP_UNIX) || defined(XP_WIN)
- NS_MEMORY_REPORTER_IMPLEMENT(Vsize,
- "vsize",
- KIND_OTHER,
-@@ -239,7 +312,7 @@ NS_MEMORY_REPORTER_IMPLEMENT(Vsize,
- "measure of the memory resources used by the process.")
- #endif
-
--#if defined(XP_LINUX) || defined(XP_MACOSX)
-+#if defined(XP_UNIX)
- NS_MEMORY_REPORTER_IMPLEMENT(PageFaultsSoft,
- "page-faults-soft",
- KIND_OTHER,
-@@ -457,11 +530,11 @@ nsMemoryReporterManager::Init()
- REGISTER(HeapUnallocated);
- REGISTER(Resident);
-
--#if defined(XP_LINUX) || defined(XP_MACOSX) || defined(XP_WIN)
-+#if defined(XP_UNIX) || defined(XP_WIN)
- REGISTER(Vsize);
- #endif
-
--#if defined(XP_LINUX) || defined(XP_MACOSX)
-+#if defined(XP_UNIX)
- REGISTER(PageFaultsSoft);
- REGISTER(PageFaultsHard);
- #endif
+ #include <procfs.h>
diff --git a/www/firefox-esr/files/patch-bug799441 b/www/firefox-esr/files/patch-bug799441
index 3f9f1b45db2f..98bc613ba60d 100644
--- a/www/firefox-esr/files/patch-bug799441
+++ b/www/firefox-esr/files/patch-bug799441
@@ -60,8 +60,8 @@ index ccf2846..79112a8 100644
include $(topsrcdir)/config/rules.mk
diff --git toolkit/library/Makefile.in toolkit/library/Makefile.in
index 7f9046e..6499758 100644
---- toolkit/library/libxul-config.mk
-+++ toolkit/library/libxul-config.mk
+--- toolkit/library/Makefile.in
++++ toolkit/library/Makefile.in
@@ -333,6 +333,11 @@ COMPONENT_LIBS += gkdebug
endif
endif
diff --git a/www/firefox-esr/files/patch-bug806139 b/www/firefox-esr/files/patch-bug806139
new file mode 100644
index 000000000000..56791e71fb61
--- /dev/null
+++ b/www/firefox-esr/files/patch-bug806139
@@ -0,0 +1,29 @@
+--- content/html/content/public/nsHTMLMediaElement.h~
++++ content/html/content/public/nsHTMLMediaElement.h
+@@ -311,7 +311,7 @@ public:
+ static bool IsH264Enabled();
+ static bool IsH264Type(const nsACString& aType);
+ static const char gH264Types[3][16];
+- static char const *const gH264Codecs[7];
++ static char const *const gH264Codecs[9];
+ #endif
+
+ #ifdef MOZ_MEDIA_PLUGINS
+--- content/html/content/src/nsHTMLMediaElement.cpp~
++++ content/html/content/src/nsHTMLMediaElement.cpp
+@@ -2114,12 +2114,14 @@ const char nsHTMLMediaElement::gH264Type
+ "video/quicktime",
+ };
+
+-char const *const nsHTMLMediaElement::gH264Codecs[7] = {
++char const *const nsHTMLMediaElement::gH264Codecs[9] = {
+ "avc1.42E01E",
+ "avc1.42001E",
+ "avc1.58A01E",
+ "avc1.4D401E",
+ "avc1.64001E",
++ "avc1.64001F",
++ "mp4v.20.3",
+ "mp4a.40.2",
+ nullptr
+ };
diff --git a/www/firefox-esr/files/patch-bug828003 b/www/firefox-esr/files/patch-bug828003
new file mode 100644
index 000000000000..0a5463bd69b8
--- /dev/null
+++ b/www/firefox-esr/files/patch-bug828003
@@ -0,0 +1,36 @@
+--- gfx/qcms/qcmstypes.h
++++ gfx/qcms/qcmstypes.h
+@@ -7,30 +7,12 @@
+ #include "mozilla/StandardInteger.h"
+
+ /* prtypes.h defines IS_LITTLE_ENDIAN and IS_BIG ENDIAN */
++/* stdint.h defines int*_t and uintptr_t */
+
+-#if defined (__SVR4) && defined (__sun)
+-/* int_types.h gets included somehow, so avoid redefining the types differently */
+-#include <sys/int_types.h>
+-#elif defined (_AIX)
++#if defined (_AIX)
+ #include <sys/types.h>
+-#elif defined(__OpenBSD__)
+-#include <inttypes.h>
+-#elif !defined(ANDROID)
+-typedef int8_t int8_t;
+-typedef uint8_t uint8_t;
+-typedef int16_t int16_t;
+-typedef uint16_t uint16_t;
+-typedef int32_t int32_t;
+-typedef uint32_t uint32_t;
+-typedef int64_t int64_t;
+-typedef uint64_t uint64_t;
+-
+-#ifdef __OS2__
+-/* OS/2's stdlib typdefs uintptr_t. So we'll just include that so we don't collide */
++#elif __OS2__
+ #include <stdlib.h>
+-#elif !defined(__intptr_t_defined) && !defined(_UINTPTR_T_DEFINED)
+-typedef PRUptrdiff uintptr_t;
+-#endif
+ #endif
+
+ #else // MOZ_QCMS
diff --git a/www/firefox-esr/files/patch-clang32-libc++-visibility-hack b/www/firefox-esr/files/patch-clang32-libc++-visibility-hack
new file mode 100644
index 000000000000..ccada32cbee3
--- /dev/null
+++ b/www/firefox-esr/files/patch-clang32-libc++-visibility-hack
@@ -0,0 +1,38 @@
+--- configure.in~
++++ configure.in
+@@ -2855,6 +2855,7 @@ EOF
+ #pragma GCC visibility push(hidden)
+ #pragma GCC visibility push(default)
+ #include <string.h>
++#include <iterator>
+ #pragma GCC visibility pop
+
+ __attribute__ ((visibility ("default"))) void Func() {
+@@ -2863,7 +2864,7 @@ __attribute__ ((visibility ("default"))) void Func() {
+ }
+ EOF
+ ac_cv_have_visibility_builtin_bug=no
+- if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
++ if ! ${CXX-c++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
+ ac_cv_have_visibility_builtin_bug=yes
+ else
+ if test `grep -c "@PLT" conftest.S` = 0; then
+--- js/src/configure.in~
++++ js/src/configure.in
+@@ -2855,6 +2855,7 @@ EOF
+ #pragma GCC visibility push(hidden)
+ #pragma GCC visibility push(default)
+ #include <string.h>
++#include <iterator>
+ #pragma GCC visibility pop
+
+ __attribute__ ((visibility ("default"))) void Func() {
+@@ -2863,7 +2864,7 @@ __attribute__ ((visibility ("default"))) void Func() {
+ }
+ EOF
+ ac_cv_have_visibility_builtin_bug=no
+- if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
++ if ! ${CXX-c++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
+ ac_cv_have_visibility_builtin_bug=yes
+ else
+ if test `grep -c "@PLT" conftest.S` = 0; then
diff --git a/www/firefox-esr/files/patch-clang32-visibility-hack b/www/firefox-esr/files/patch-clang32-visibility-hack
deleted file mode 100644
index 7744fed5e17e..000000000000
--- a/www/firefox-esr/files/patch-clang32-visibility-hack
+++ /dev/null
@@ -1,20 +0,0 @@
---- configure.in~
-+++ configure.in
-@@ -3230,6 +3230,7 @@ EOF
- ac_cv_have_visibility_class_bug,
- [cat > conftest.c <<EOF
- #pragma GCC visibility push(hidden)
-+struct TestStruct;
- struct __attribute__ ((visibility ("default"))) TestStruct {
- static void Init();
- };
---- js/src/configure.in~
-+++ js/src/configure.in
-@@ -3230,6 +3230,7 @@ EOF
- ac_cv_have_visibility_class_bug,
- [cat > conftest.c <<EOF
- #pragma GCC visibility push(hidden)
-+struct TestStruct;
- struct __attribute__ ((visibility ("default"))) TestStruct {
- static void Init();
- };
diff --git a/www/firefox-esr/files/patch-config-baseconfig.mk b/www/firefox-esr/files/patch-config-baseconfig.mk
new file mode 100644
index 000000000000..e6fd78f35e7b
--- /dev/null
+++ b/www/firefox-esr/files/patch-config-baseconfig.mk
@@ -0,0 +1,16 @@
+--- config/baseconfig.mk~
++++ config/baseconfig.mk
+@@ -1,9 +1,9 @@
+ INCLUDED_AUTOCONF_MK = 1
+
+-includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+-idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+-installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
+-sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
++includedir := $(includedir)/%%MOZILLA%%
++idldir = $(datadir)/idl/%%MOZILLA%%
++installdir = $(libdir)/%%MOZILLA%%
++sdkdir = $(libdir)/%%MOZILLA%%
+ DIST = $(DEPTH)/dist
+
+ # We do magic with OBJ_SUFFIX in config.mk, the following ensures we don't
diff --git a/www/firefox-esr/files/patch-config_autoconf.mk.in b/www/firefox-esr/files/patch-config_autoconf.mk.in
deleted file mode 100644
index 877c48294fc6..000000000000
--- a/www/firefox-esr/files/patch-config_autoconf.mk.in
+++ /dev/null
@@ -1,21 +0,0 @@
---- config/autoconf.mk.in.orig 2009-04-24 03:46:37.000000000 +0200
-+++ config/autoconf.mk.in 2009-05-11 15:03:26.000000000 +0200
-@@ -57,14 +57,14 @@
- prefix = @prefix@
- exec_prefix = @exec_prefix@
- bindir = @bindir@
--includedir = @includedir@/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-+includedir = @includedir@/%%MOZILLA%%
- libdir = @libdir@
- datadir = @datadir@
- mandir = @mandir@
--idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-+idldir = $(datadir)/idl/%%MOZILLA%%
-
--installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
--sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION)
-+installdir = $(libdir)/%%MOZILLA%%
-+sdkdir = $(libdir)/%%MOZILLA%%
-
- DIST = $(DEPTH)/dist
- LIBXUL_SDK = @LIBXUL_SDK@
diff --git a/www/firefox-esr/files/patch-content-media-nsAudioStream.cpp b/www/firefox-esr/files/patch-content-media-nsAudioStream.cpp
new file mode 100644
index 000000000000..bd0f0d4963db
--- /dev/null
+++ b/www/firefox-esr/files/patch-content-media-nsAudioStream.cpp
@@ -0,0 +1,14 @@
+--- content/media/nsAudioStream.cpp~
++++ content/media/nsAudioStream.cpp
+@@ -298,7 +298,11 @@ static int PrefChanged(const char* aPref
+ gVolumeScale = NS_MAX<double>(0, PR_strtod(utf8.get(), nsnull));
+ }
+ } else if (strcmp(aPref, PREF_USE_CUBEB) == 0) {
++#if defined(__FreeBSD__) && __FreeBSD_version < 800097
++ bool value = Preferences::GetBool(aPref, false);
++#else
+ bool value = Preferences::GetBool(aPref, true);
++#endif
+ mozilla::MutexAutoLock lock(*gAudioPrefsLock);
+ gUseCubeb = value;
+ } else if (strcmp(aPref, PREF_CUBEB_LATENCY) == 0) {
diff --git a/www/firefox-esr/files/patch-dom-ipc-ContentChild.cpp b/www/firefox-esr/files/patch-dom-ipc-ContentChild.cpp
deleted file mode 100644
index 5a2826f3a41d..000000000000
--- a/www/firefox-esr/files/patch-dom-ipc-ContentChild.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
---- dom/ipc/ContentChild.cpp~
-+++ dom/ipc/ContentChild.cpp
-@@ -42,6 +42,7 @@
- #endif
-
- #ifdef MOZ_WIDGET_QT
-+#include <unistd.h>
- #include "nsQAppInstance.h"
- #endif
-
diff --git a/www/firefox-esr/files/patch-extensions-spellcheck-hunspell-src-mozHunspell.cpp b/www/firefox-esr/files/patch-extensions-spellcheck-hunspell-src-mozHunspell.cpp
index 419955d77ff1..161feb2ca7b5 100644
--- a/www/firefox-esr/files/patch-extensions-spellcheck-hunspell-src-mozHunspell.cpp
+++ b/www/firefox-esr/files/patch-extensions-spellcheck-hunspell-src-mozHunspell.cpp
@@ -7,7 +7,7 @@
+ // load system hunspell dictionaries
+ nsIFile* hunDir;
+ NS_NewNativeLocalFile(NS_LITERAL_CSTRING("%%LOCALBASE%%/share/hunspell"),
-+ true, (nsILocalFile**)&hunDir);
++ true, &hunDir);
+ LoadDictionariesFromDir(hunDir);
+
// find dictionaries from extensions requiring restart
diff --git a/www/firefox-esr/files/patch-gfx-qcms-qcmstypes.h b/www/firefox-esr/files/patch-gfx-qcms-qcmstypes.h
deleted file mode 100644
index 33d9e3356b77..000000000000
--- a/www/firefox-esr/files/patch-gfx-qcms-qcmstypes.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- gfx/qcms/qcmstypes.h.orig 2010-11-22 12:01:36.000000000 +0100
-+++ gfx/qcms/qcmstypes.h 2010-11-22 12:02:42.000000000 +0100
-@@ -25,7 +25,7 @@
- #ifdef __OS2__
- /* OS/2's stdlib typdefs uintptr_t. So we'll just include that so we don't collide */
- #include <stdlib.h>
--#elif !defined(__intptr_t_defined) && !defined(_UINTPTR_T_DEFINED)
-+#elif !defined(__intptr_t_defined) && !defined(_INTPTR_T_DECLARED)
- typedef PRUptrdiff uintptr_t;
- #endif
- #endif
diff --git a/www/firefox-esr/files/patch-js-src-configure.in b/www/firefox-esr/files/patch-js-src-js-confdefs.h.in
index fc8e66185a87..cb032237b2cc 100644
--- a/www/firefox-esr/files/patch-js-src-configure.in
+++ b/www/firefox-esr/files/patch-js-src-js-confdefs.h.in
@@ -1,6 +1,6 @@
---- js/src/configure.in.orig 2012-01-29 11:24:33.000000000 +0100
-+++ js/src/configure.in 2012-01-30 23:30:02.051087215 +0100
-@@ -5946,6 +5946,7 @@ _EGREP_PATTERN="${_EGREP_PATTERN}dummy_n
+--- js/src/js-confdefs.h.in~
++++ js/src/js-confdefs.h.in
+@@ -12,6 +12,7 @@
* C++ implementations should define these macros only when __STDC_LIMIT_MACROS
* is defined before <stdint.h> is included. */
#define __STDC_LIMIT_MACROS
diff --git a/www/firefox-esr/files/patch-toolkit-xre-nsEmbedFunctions.cpp b/www/firefox-esr/files/patch-toolkit-xre-nsEmbedFunctions.cpp
deleted file mode 100644
index 6c493d940fe7..000000000000
--- a/www/firefox-esr/files/patch-toolkit-xre-nsEmbedFunctions.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
---- toolkit/xre/nsEmbedFunctions.cpp~
-+++ toolkit/xre/nsEmbedFunctions.cpp
-@@ -36,6 +36,7 @@
- * ***** END LICENSE BLOCK ***** */
-
- #if defined(MOZ_WIDGET_QT)
-+#include <unistd.h>
- #include "nsQAppInstance.h"
- #endif
-
diff --git a/www/firefox-esr/files/patch-z-bug762445 b/www/firefox-esr/files/patch-z-bug762445
new file mode 100644
index 000000000000..fd42fea9cab2
--- /dev/null
+++ b/www/firefox-esr/files/patch-z-bug762445
@@ -0,0 +1,70 @@
+commit b44dc8e
+Author: Jan Beich <jbeich@tormail.org>
+Date: Fri Oct 12 18:49:59 2012 +0000
+
+ Bug 762445 - Add jemalloc3 glue for heap-committed, heap-dirty in about:memory.
+---
+ memory/build/mozjemalloc_compat.c | 34 ++++++++++++++++++++++++++++------
+ 1 file changed, 28 insertions(+), 6 deletions(-)
+
+diff --git memory/build/mozjemalloc_compat.c memory/build/mozjemalloc_compat.c
+index 94ad96e..7adfef5 100644
+--- memory/build/mozjemalloc_compat.c
++++ memory/build/mozjemalloc_compat.c
+@@ -11,15 +11,50 @@
+ #define wrap(a) je_ ## a
+ #endif
+
+-extern MOZ_IMPORT_API(int)
++/*
++ * CTL_* macros are from memory/jemalloc/src/src/stats.c with changes:
++ * - drop `t' argument to avoid redundancy in calculating type size
++ * - require `i' argument for arena number explicitly
++ */
++
++#define CTL_GET(n, v) do { \
++ size_t sz = sizeof(v); \
++ wrap(mallctl)(n, &v, &sz, NULL, 0); \
++} while (0)
++
++#define CTL_I_GET(n, v, i) do { \
++ size_t mib[6]; \
++ size_t miblen = sizeof(mib) / sizeof(mib[0]); \
++ size_t sz = sizeof(v); \
++ wrap(mallctlnametomib)(n, mib, &miblen); \
++ mib[2] = i; \
++ wrap(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \
++} while (0)
++
++MOZ_IMPORT_API(int)
+ wrap(mallctl)(const char*, void*, size_t*, void*, size_t);
++MOZ_IMPORT_API(int)
++wrap(mallctlnametomib)(const char *name, size_t *mibp, size_t *miblenp);
++MOZ_IMPORT_API(int)
++wrap(mallctlbymib)(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
+
+ MOZ_EXPORT_API(void)
+ jemalloc_stats(jemalloc_stats_t *stats)
+ {
+- size_t size = sizeof(stats->mapped);
+- wrap(mallctl)("stats.mapped", &stats->mapped, &size, NULL, 0);
+- wrap(mallctl)("stats.allocated", &stats->allocated, &size, NULL, 0);
+- stats->committed = -1;
+- stats->dirty = -1;
++ unsigned narenas;
++ size_t active, allocated, mapped, page, pdirty;
++
++ CTL_GET("arenas.narenas", narenas);
++ CTL_GET("arenas.page", page);
++ CTL_GET("stats.active", active);
++ CTL_GET("stats.allocated", allocated);
++ CTL_GET("stats.mapped", mapped);
++
++ /* get the summation for all arenas, i == narenas */
++ CTL_I_GET("stats.arenas.0.pdirty", pdirty, narenas);
++
++ stats->allocated = allocated;
++ stats->mapped = mapped;
++ stats->dirty = pdirty * page;
++ stats->committed = active + stats->dirty;
+ }
diff --git a/www/firefox-esr/pkg-descr b/www/firefox-esr/pkg-descr
index c9f27891b898..faddf782e71f 100644
--- a/www/firefox-esr/pkg-descr
+++ b/www/firefox-esr/pkg-descr
@@ -1,5 +1,5 @@
Mozilla Firefox is a free and open source web browser descended from the
-Mozilla Application Suite. It is small, fast and easy to use, and offers
+Mozilla Application Suite. It is small, fast and easy to use, and offers
many advanced features:
o Popup Blocking
diff --git a/www/firefox-i18n/Makefile b/www/firefox-i18n/Makefile
index 21f8859b1b4b..0fe4e8c0e90e 100644
--- a/www/firefox-i18n/Makefile
+++ b/www/firefox-i18n/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= firefox-i18n
-PORTVERSION= 17.0.1
+PORTVERSION= 18.0
CATEGORIES= www
MASTER_SITE_SUBDIR= firefox/releases/${PORTVERSION}/linux-i686/xpi
PKGNAMEPREFIX=
@@ -14,7 +14,7 @@ COMMENT= Localized interface for Firefox
EXTRACT_DEPENDS= zip:${PORTSDIR}/archivers/zip
-USE_FIREFOX= 17
+USE_FIREFOX= 18
USE_XPI= firefox linux-firefox
USE_SUBMAKE= yes
diff --git a/www/firefox-i18n/distinfo b/www/firefox-i18n/distinfo
index fa7471806504..6f5942e3c0fa 100644
--- a/www/firefox-i18n/distinfo
+++ b/www/firefox-i18n/distinfo
@@ -1,164 +1,164 @@
-SHA256 (xpi/firefox-i18n-17.0.1/af.xpi) = 79946751171224948166a1452b0a3b6173e12743febaf7d62df82532e629c942
-SIZE (xpi/firefox-i18n-17.0.1/af.xpi) = 281146
-SHA256 (xpi/firefox-i18n-17.0.1/ak.xpi) = d16f38bf48d36415c845d9eba5a551c05750c08ccf8859dcd571b6c380c4513f
-SIZE (xpi/firefox-i18n-17.0.1/ak.xpi) = 282977
-SHA256 (xpi/firefox-i18n-17.0.1/ar.xpi) = e4f8a029f846dcc65ffb7857b1f961cca151fa26e0d7a68f0a479867e3c8e1df
-SIZE (xpi/firefox-i18n-17.0.1/ar.xpi) = 311507
-SHA256 (xpi/firefox-i18n-17.0.1/ast.xpi) = 5f27101e8a120ab7af30b5077089c7b4dc531de4efa0553f3d2194fd36b9ebd4
-SIZE (xpi/firefox-i18n-17.0.1/ast.xpi) = 264124
-SHA256 (xpi/firefox-i18n-17.0.1/be.xpi) = 43c8657472340252e4dbf47acec30c33c48ee925382c60484f89feb3b7d46bb5
-SIZE (xpi/firefox-i18n-17.0.1/be.xpi) = 273412
-SHA256 (xpi/firefox-i18n-17.0.1/bg.xpi) = a9e0ce0381dee06c192657c94e9b3f4b69d28284d08eab467b8a400a561df7b6
-SIZE (xpi/firefox-i18n-17.0.1/bg.xpi) = 327261
-SHA256 (xpi/firefox-i18n-17.0.1/bn-BD.xpi) = 116c07018be7de3b4dfc463b1da1f3962dff092a1a28165b3431086d44598357
-SIZE (xpi/firefox-i18n-17.0.1/bn-BD.xpi) = 339303
-SHA256 (xpi/firefox-i18n-17.0.1/bn-IN.xpi) = d3f5932231e942be726403d08d633850745499e428f94708456eb3e9ff8230a7
-SIZE (xpi/firefox-i18n-17.0.1/bn-IN.xpi) = 373021
-SHA256 (xpi/firefox-i18n-17.0.1/br.xpi) = dbe0fe456828f375fb55cd46410d5368c0d0a84173c5a0ec1aa02c18e7022f82
-SIZE (xpi/firefox-i18n-17.0.1/br.xpi) = 291583
-SHA256 (xpi/firefox-i18n-17.0.1/bs.xpi) = 7a4400dd0b05c5c35b576ed9881f34e175c0cd8dba359a8995d3220d3bbfc773
-SIZE (xpi/firefox-i18n-17.0.1/bs.xpi) = 292223
-SHA256 (xpi/firefox-i18n-17.0.1/ca.xpi) = 2993abcbd5b4d75d21f1413d8f90f804b214008b047383870ac7e810383dfe5e
-SIZE (xpi/firefox-i18n-17.0.1/ca.xpi) = 293532
-SHA256 (xpi/firefox-i18n-17.0.1/cs.xpi) = e05eaf795400ca227cc9305fb0719dc950c9f83c36045d1c82b54ec1f172e2d0
-SIZE (xpi/firefox-i18n-17.0.1/cs.xpi) = 294133
-SHA256 (xpi/firefox-i18n-17.0.1/cy.xpi) = 5e3d83605e003cea83700df461ce2d9021657d90c8eed1c04b28ca4e1227790a
-SIZE (xpi/firefox-i18n-17.0.1/cy.xpi) = 284868
-SHA256 (xpi/firefox-i18n-17.0.1/da.xpi) = d683462657cad304c67a3b31e51afabbc8cd5ea200b5437118655d2228003f4d
-SIZE (xpi/firefox-i18n-17.0.1/da.xpi) = 282668
-SHA256 (xpi/firefox-i18n-17.0.1/de.xpi) = ce5e154648c9ca8e90460914ebb1a7883f234df52c507f9b34952b36d2278bc2
-SIZE (xpi/firefox-i18n-17.0.1/de.xpi) = 270384
-SHA256 (xpi/firefox-i18n-17.0.1/el.xpi) = 89cdd8ca1a5f99436fe9d37925a7907e5a57a9c113762d4d901493ef31f5e7c5
-SIZE (xpi/firefox-i18n-17.0.1/el.xpi) = 311653
-SHA256 (xpi/firefox-i18n-17.0.1/en-GB.xpi) = b73bd071eff3830685521486da2a3c9ff48e18bf398a7860e47ccdee2117c95f
-SIZE (xpi/firefox-i18n-17.0.1/en-GB.xpi) = 272104
-SHA256 (xpi/firefox-i18n-17.0.1/en-US.xpi) = 5e45250dbde96c6d922a192b0b4fb0591d8d0dac802b5859013907d1a522b5d4
-SIZE (xpi/firefox-i18n-17.0.1/en-US.xpi) = 272156
-SHA256 (xpi/firefox-i18n-17.0.1/en-ZA.xpi) = 5e8004313ad1153bb43eaff17ea0d78c5112b631d393c58685d4899b1a7203e7
-SIZE (xpi/firefox-i18n-17.0.1/en-ZA.xpi) = 272935
-SHA256 (xpi/firefox-i18n-17.0.1/eo.xpi) = 58ec9689784450209d9b5ca63a02c58ecb665930365b419ec4f91c6497ee9316
-SIZE (xpi/firefox-i18n-17.0.1/eo.xpi) = 284801
-SHA256 (xpi/firefox-i18n-17.0.1/es-AR.xpi) = 378c22b0dc9e7ee455f5c1f2cd4853a7f9f4b0872032adc1e530e35ef6de3080
-SIZE (xpi/firefox-i18n-17.0.1/es-AR.xpi) = 289239
-SHA256 (xpi/firefox-i18n-17.0.1/es-CL.xpi) = fb639b16b8087983315251f97119a3694bddf03f0ccb0d138c12ed12654e6ca2
-SIZE (xpi/firefox-i18n-17.0.1/es-CL.xpi) = 296878
-SHA256 (xpi/firefox-i18n-17.0.1/es-ES.xpi) = 21c86166ea229c1db574cec3fb66f684e70efae5a13d28f0fdc73d42d9865b20
-SIZE (xpi/firefox-i18n-17.0.1/es-ES.xpi) = 242185
-SHA256 (xpi/firefox-i18n-17.0.1/es-MX.xpi) = 46bfa95ccc11c12f43a53eb35e3535e03ebb89ad35e3e18b1349943919dbc9a9
-SIZE (xpi/firefox-i18n-17.0.1/es-MX.xpi) = 247972
-SHA256 (xpi/firefox-i18n-17.0.1/et.xpi) = 1c2be6ddd962b84c50db991fe7346d2673d16e63a44f50745e4d5520ceb0f502
-SIZE (xpi/firefox-i18n-17.0.1/et.xpi) = 284694
-SHA256 (xpi/firefox-i18n-17.0.1/eu.xpi) = bd9e661baf655be491e666592b0797163e94e9f13cf16b3b8bb2de25b183e65b
-SIZE (xpi/firefox-i18n-17.0.1/eu.xpi) = 284227
-SHA256 (xpi/firefox-i18n-17.0.1/fa.xpi) = c604ffeb77c5856a438c3645c017fd60830cd196c80f697be6a7dac4af4492b2
-SIZE (xpi/firefox-i18n-17.0.1/fa.xpi) = 323997
-SHA256 (xpi/firefox-i18n-17.0.1/fi.xpi) = 4cbe8988e070c50d2fa35f91fe094f6b9fe0eb1a38f7a02bfa2a14c2d12befb8
-SIZE (xpi/firefox-i18n-17.0.1/fi.xpi) = 288656
-SHA256 (xpi/firefox-i18n-17.0.1/fr.xpi) = e237590c1424f7b0d88f20f5435df110be1719f0745a0681d4691f09efdcc287
-SIZE (xpi/firefox-i18n-17.0.1/fr.xpi) = 293362
-SHA256 (xpi/firefox-i18n-17.0.1/fy-NL.xpi) = a9e1bb63c215ae63fa3aa6466208697054874ebd05c04594918a06a929fdec30
-SIZE (xpi/firefox-i18n-17.0.1/fy-NL.xpi) = 289690
-SHA256 (xpi/firefox-i18n-17.0.1/ga-IE.xpi) = 8ebc6fa56b13b6b6cb8b9192b3ca286aaada9116d57ae2180aa66c3cc63b36da
-SIZE (xpi/firefox-i18n-17.0.1/ga-IE.xpi) = 296976
-SHA256 (xpi/firefox-i18n-17.0.1/gl.xpi) = c585ce4065f0d77b3b9fc858e22767052dcd39ec221d5f965360ea5f46a85711
-SIZE (xpi/firefox-i18n-17.0.1/gl.xpi) = 286997
-SHA256 (xpi/firefox-i18n-17.0.1/gu-IN.xpi) = 515fa47b36eaa48209a35ac58fc8f72869daf8d502a67f11360c3095280489d3
-SIZE (xpi/firefox-i18n-17.0.1/gu-IN.xpi) = 319480
-SHA256 (xpi/firefox-i18n-17.0.1/he.xpi) = 10d9f2e8adc6a6154ef54355a6841761a9493a69e4436fb9fe262ed25c91b40c
-SIZE (xpi/firefox-i18n-17.0.1/he.xpi) = 301482
-SHA256 (xpi/firefox-i18n-17.0.1/hi-IN.xpi) = 522dd4b1b6f6395694279d1cc49c761e2746c2e3f50e6078cd42bc834c4eca20
-SIZE (xpi/firefox-i18n-17.0.1/hi-IN.xpi) = 330864
-SHA256 (xpi/firefox-i18n-17.0.1/hr.xpi) = 78e235e7339f36bbdc548a317376e3f197d50ff5b3ed9d80531f19e88fdc4ae7
-SIZE (xpi/firefox-i18n-17.0.1/hr.xpi) = 287940
-SHA256 (xpi/firefox-i18n-17.0.1/hu.xpi) = 6c3d0491980971ef33939f07a2b2954411f0a6faeda7350ebc5dac03b9aea340
-SIZE (xpi/firefox-i18n-17.0.1/hu.xpi) = 303044
-SHA256 (xpi/firefox-i18n-17.0.1/hy-AM.xpi) = dbe5c9d5bc97938c8053907a9adca2e7fa5d1ef8002c620f59fb2b3972096505
-SIZE (xpi/firefox-i18n-17.0.1/hy-AM.xpi) = 328203
-SHA256 (xpi/firefox-i18n-17.0.1/id.xpi) = 71042659017a0d768b921211433c72721b3d6623164ad67a7dc6142dc53d798e
-SIZE (xpi/firefox-i18n-17.0.1/id.xpi) = 283726
-SHA256 (xpi/firefox-i18n-17.0.1/is.xpi) = 23214de85cb2427f86aea7bc40fe71a6f66936c23ce6f874618f17efa03b1b6f
-SIZE (xpi/firefox-i18n-17.0.1/is.xpi) = 284908
-SHA256 (xpi/firefox-i18n-17.0.1/it.xpi) = c62fad53c04467fd7b75ab9523683172cfc368bb3a8502143039880cfcd61998
-SIZE (xpi/firefox-i18n-17.0.1/it.xpi) = 238645
-SHA256 (xpi/firefox-i18n-17.0.1/ja.xpi) = b58f4feaf7c891cae544673c81a34c1e0b9fbe612849ca4c439dc5118a199ff2
-SIZE (xpi/firefox-i18n-17.0.1/ja.xpi) = 322490
-SHA256 (xpi/firefox-i18n-17.0.1/kk.xpi) = 1864d4881cbe8bdaa4bcf08d4a370b44c0822591a206a5e74912780d13d26fd3
-SIZE (xpi/firefox-i18n-17.0.1/kk.xpi) = 330352
-SHA256 (xpi/firefox-i18n-17.0.1/kn.xpi) = c11d44b77e0319299475fef88b5c01ac8ccbe746df479c6b7d2a583fee338ced
-SIZE (xpi/firefox-i18n-17.0.1/kn.xpi) = 354900
-SHA256 (xpi/firefox-i18n-17.0.1/ko.xpi) = 453acea9fc1ad1b2a8fc93dc71f2298a2be9f7a8938f0c41f27c0d0503671a44
-SIZE (xpi/firefox-i18n-17.0.1/ko.xpi) = 296729
-SHA256 (xpi/firefox-i18n-17.0.1/ku.xpi) = a43f9b89761f38359e59be7840e51658003b354c4420762afcb430cdab198828
-SIZE (xpi/firefox-i18n-17.0.1/ku.xpi) = 304898
-SHA256 (xpi/firefox-i18n-17.0.1/lg.xpi) = 18cf04654e253242380117c03215723fb2f7ea5e4b54b9ee3434bbba99338f7a
-SIZE (xpi/firefox-i18n-17.0.1/lg.xpi) = 290627
-SHA256 (xpi/firefox-i18n-17.0.1/lt.xpi) = d68145f604e6eb6ef2d0d84ec9791077242ad3c2c3ea20571852b0d64a65854b
-SIZE (xpi/firefox-i18n-17.0.1/lt.xpi) = 349462
-SHA256 (xpi/firefox-i18n-17.0.1/lv.xpi) = b6e23532352d2714d8fffac469da1c93717243cb2625229a4284e56ca70e49a8
-SIZE (xpi/firefox-i18n-17.0.1/lv.xpi) = 291404
-SHA256 (xpi/firefox-i18n-17.0.1/mai.xpi) = 6292c85c1a924037ffc41e301b8482a54980b1917ae26eb3e9d29adf6f1276e4
-SIZE (xpi/firefox-i18n-17.0.1/mai.xpi) = 328267
-SHA256 (xpi/firefox-i18n-17.0.1/mk.xpi) = 018910e2c6a739007aeb3b568e30b16454a642b3ad8f7a32555892abd86096e4
-SIZE (xpi/firefox-i18n-17.0.1/mk.xpi) = 315578
-SHA256 (xpi/firefox-i18n-17.0.1/ml.xpi) = f91bebb5d7175e99e23206ff51be04427b28f28c0c203be7dd54463e51d5a010
-SIZE (xpi/firefox-i18n-17.0.1/ml.xpi) = 361541
-SHA256 (xpi/firefox-i18n-17.0.1/mr.xpi) = cc9b7ac996488943f7a7d2ca5474e20c25b461da61b67def9359faebd0284adf
-SIZE (xpi/firefox-i18n-17.0.1/mr.xpi) = 327860
-SHA256 (xpi/firefox-i18n-17.0.1/nb-NO.xpi) = a8aec8c2df851b1d0d2b40ad9b8ebca1cbd41e869a7ff4196c4815dfbf71cf76
-SIZE (xpi/firefox-i18n-17.0.1/nb-NO.xpi) = 284889
-SHA256 (xpi/firefox-i18n-17.0.1/nl.xpi) = f6870752dbd491f0106c4c91c7416c4e0c244bb7b368230fd83c3824c5ce0eac
-SIZE (xpi/firefox-i18n-17.0.1/nl.xpi) = 286112
-SHA256 (xpi/firefox-i18n-17.0.1/nn-NO.xpi) = 977e05f7727869bf971e591c8d60271fc2fc259312285f6f24994211bc5e192b
-SIZE (xpi/firefox-i18n-17.0.1/nn-NO.xpi) = 287844
-SHA256 (xpi/firefox-i18n-17.0.1/nso.xpi) = 62a2bccdf08d28b9794f1bf0ad1dc4a1d37dfee3c6c58bf830e47134d6104561
-SIZE (xpi/firefox-i18n-17.0.1/nso.xpi) = 288150
-SHA256 (xpi/firefox-i18n-17.0.1/or.xpi) = 76599f08b7520c09444d46cf6c0cf33d4591965d9a60b0d304a1487d6a9b564d
-SIZE (xpi/firefox-i18n-17.0.1/or.xpi) = 329684
-SHA256 (xpi/firefox-i18n-17.0.1/pa-IN.xpi) = 8b5101a373fbc4d686bc1d497047152680da5cfab27cd9f05aa30f82a0759603
-SIZE (xpi/firefox-i18n-17.0.1/pa-IN.xpi) = 318504
-SHA256 (xpi/firefox-i18n-17.0.1/pl.xpi) = a9cb97edc06701a262fef5652eb90a95a24c4f9a7573fd6b07292a0147b0d24c
-SIZE (xpi/firefox-i18n-17.0.1/pl.xpi) = 301035
-SHA256 (xpi/firefox-i18n-17.0.1/pt-BR.xpi) = ca60b72278dee550066f929072d48f57a614d76922d62ec44112acd399b0e6eb
-SIZE (xpi/firefox-i18n-17.0.1/pt-BR.xpi) = 289244
-SHA256 (xpi/firefox-i18n-17.0.1/pt-PT.xpi) = 467cb8660625c4583eea1de0e0a1ec457a17da9b448d783b4eea043560f4411f
-SIZE (xpi/firefox-i18n-17.0.1/pt-PT.xpi) = 291458
-SHA256 (xpi/firefox-i18n-17.0.1/rm.xpi) = 2a48c8bc8814f8a8b8967405c7850c81c3260d9d8183cdeca7a1c88cfda60878
-SIZE (xpi/firefox-i18n-17.0.1/rm.xpi) = 288466
-SHA256 (xpi/firefox-i18n-17.0.1/ro.xpi) = 8f17b399e7635f0b651ccbe0703c68e7dc5c1de68eb263e0ebabc986b7a6a075
-SIZE (xpi/firefox-i18n-17.0.1/ro.xpi) = 310252
-SHA256 (xpi/firefox-i18n-17.0.1/ru.xpi) = fe56cf2a9525f7770ea933829ea19a24c14ab22ca7ba22b0589832511a04bbc4
-SIZE (xpi/firefox-i18n-17.0.1/ru.xpi) = 284915
-SHA256 (xpi/firefox-i18n-17.0.1/si.xpi) = 9f625c26a8812baa21a39f0abbd9f6f44872a0313138f377c24c96f94dec483f
-SIZE (xpi/firefox-i18n-17.0.1/si.xpi) = 317364
-SHA256 (xpi/firefox-i18n-17.0.1/sk.xpi) = 4f53b79c3a27bec6fb26e797da338a884b01a883f57482d5ff3ab8bc2edb6708
-SIZE (xpi/firefox-i18n-17.0.1/sk.xpi) = 301478
-SHA256 (xpi/firefox-i18n-17.0.1/sl.xpi) = c81aed04e9b0cc2aaf31d683bbb335a03b55d749f02ec5f2c32d82715900ba66
-SIZE (xpi/firefox-i18n-17.0.1/sl.xpi) = 286638
-SHA256 (xpi/firefox-i18n-17.0.1/son.xpi) = eeb0193e01b11be3308afadf418111c4d352335d58dae6a99d6070ebf8b501a3
-SIZE (xpi/firefox-i18n-17.0.1/son.xpi) = 283684
-SHA256 (xpi/firefox-i18n-17.0.1/sq.xpi) = 93ee14c4cb5f09f536fca30cf480ff4c8541c6f095be7a49485590979e594e0b
-SIZE (xpi/firefox-i18n-17.0.1/sq.xpi) = 291166
-SHA256 (xpi/firefox-i18n-17.0.1/sr.xpi) = 4710068e07eb4055be6da7ce55a683fdf4737e2a9692723eeb847037d6b46d40
-SIZE (xpi/firefox-i18n-17.0.1/sr.xpi) = 334015
-SHA256 (xpi/firefox-i18n-17.0.1/sv-SE.xpi) = ca4499381e1003bcbe34e361d94bfbc5f42f015389bc0aac0aa238dd992757ee
-SIZE (xpi/firefox-i18n-17.0.1/sv-SE.xpi) = 288084
-SHA256 (xpi/firefox-i18n-17.0.1/ta-LK.xpi) = 51e5cf61504d44dd782ddf6bc459ae2e733c470ac7cddede9055ba952f271284
-SIZE (xpi/firefox-i18n-17.0.1/ta-LK.xpi) = 339932
-SHA256 (xpi/firefox-i18n-17.0.1/ta.xpi) = 939484b400ff3928bb07c29d978b029a68216c0b7c6d8b0f9e560b28ef5bfe28
-SIZE (xpi/firefox-i18n-17.0.1/ta.xpi) = 325367
-SHA256 (xpi/firefox-i18n-17.0.1/te.xpi) = 47648dc9de2992de9bae61a926214df34d24873992b25c9e1fb9333994714854
-SIZE (xpi/firefox-i18n-17.0.1/te.xpi) = 341958
-SHA256 (xpi/firefox-i18n-17.0.1/th.xpi) = 52f5fd75d9d93de9e08d790af28f92b4df1c150f4758552f9c2ac44951e601dd
-SIZE (xpi/firefox-i18n-17.0.1/th.xpi) = 323676
-SHA256 (xpi/firefox-i18n-17.0.1/tr.xpi) = f2df762fa8ad03e32efcb12b6f8734fb3010f2eb19eee97b4821231c1f50e6fc
-SIZE (xpi/firefox-i18n-17.0.1/tr.xpi) = 295842
-SHA256 (xpi/firefox-i18n-17.0.1/uk.xpi) = 307cd2fbe5a838045513053ee18b208495e25c0b23b43ea77178e0eacf53ebab
-SIZE (xpi/firefox-i18n-17.0.1/uk.xpi) = 324251
-SHA256 (xpi/firefox-i18n-17.0.1/vi.xpi) = 8a15d3dfe5fa360e4b1eacdda2160ef1cbaf2681f537ab430d7133d2462e9e03
-SIZE (xpi/firefox-i18n-17.0.1/vi.xpi) = 313549
-SHA256 (xpi/firefox-i18n-17.0.1/zh-CN.xpi) = 7ffc7afd6aeb4b954f9aafa94ac5a764e8fa44a13c4aba87a87773955be0050d
-SIZE (xpi/firefox-i18n-17.0.1/zh-CN.xpi) = 304251
-SHA256 (xpi/firefox-i18n-17.0.1/zh-TW.xpi) = cefcd27a01a573885d4fc9c85f13f9fc2ef17f35ec238a38eb32db0d79a0e3e1
-SIZE (xpi/firefox-i18n-17.0.1/zh-TW.xpi) = 305438
-SHA256 (xpi/firefox-i18n-17.0.1/zu.xpi) = 6f1bd98029668b48424147f112404ac70f69abecd3888a7d010ff425943c2855
-SIZE (xpi/firefox-i18n-17.0.1/zu.xpi) = 296594
+SHA256 (xpi/firefox-i18n-18.0/af.xpi) = ec615f98f61239de0fef37a13ae4d9dc86176c7293b00abba276ff47a2213a10
+SIZE (xpi/firefox-i18n-18.0/af.xpi) = 290197
+SHA256 (xpi/firefox-i18n-18.0/ak.xpi) = c419c301af9f98e9789797a9f3c4ff4641754f72f35d10adc1fed36a2f00237e
+SIZE (xpi/firefox-i18n-18.0/ak.xpi) = 292032
+SHA256 (xpi/firefox-i18n-18.0/ar.xpi) = 6eaedfe083a03737cb70cb4a95a997817e7ebf4e97b4da7c94e49c732d0df0cb
+SIZE (xpi/firefox-i18n-18.0/ar.xpi) = 320810
+SHA256 (xpi/firefox-i18n-18.0/ast.xpi) = ffd0c2726fa3ebacdff7557b59e5d93af1d79f0f93921a2aa05b68a244116589
+SIZE (xpi/firefox-i18n-18.0/ast.xpi) = 274123
+SHA256 (xpi/firefox-i18n-18.0/be.xpi) = d248a4be34e4be30c8c5e5f1f73f036854088010113ab252cc9202aae2d340ca
+SIZE (xpi/firefox-i18n-18.0/be.xpi) = 283984
+SHA256 (xpi/firefox-i18n-18.0/bg.xpi) = 113d52823f8946d9ed7f342054efc6095f4f65b59174528f39847103f0d36a8b
+SIZE (xpi/firefox-i18n-18.0/bg.xpi) = 336593
+SHA256 (xpi/firefox-i18n-18.0/bn-BD.xpi) = df70c518378890f7445c3f7779e4d366834bf52d319135def75ce957d6e479c3
+SIZE (xpi/firefox-i18n-18.0/bn-BD.xpi) = 349685
+SHA256 (xpi/firefox-i18n-18.0/bn-IN.xpi) = c22d62a41af648e3e73ad3364c25b80889dacc602be7ce6c302eb84ca62df451
+SIZE (xpi/firefox-i18n-18.0/bn-IN.xpi) = 382202
+SHA256 (xpi/firefox-i18n-18.0/br.xpi) = dee9c3d21d515b067b75f3b1bbccd9a43fac8853dc7e68315871f04c494162b0
+SIZE (xpi/firefox-i18n-18.0/br.xpi) = 299178
+SHA256 (xpi/firefox-i18n-18.0/bs.xpi) = d65ddcc4b537049ab2120a66825081cdc5c386b65dc6125f9702a7059eab4101
+SIZE (xpi/firefox-i18n-18.0/bs.xpi) = 301364
+SHA256 (xpi/firefox-i18n-18.0/ca.xpi) = 07fe39e491e7db5d353e6b802fa0ef8118c88ec6c436fdec61b8af41a13cae57
+SIZE (xpi/firefox-i18n-18.0/ca.xpi) = 301729
+SHA256 (xpi/firefox-i18n-18.0/cs.xpi) = 5fbc3d6e30bb3da7924c2e4b94325bfa74376369f134f52804febeb0a3f69bfa
+SIZE (xpi/firefox-i18n-18.0/cs.xpi) = 303376
+SHA256 (xpi/firefox-i18n-18.0/cy.xpi) = 45057fe7aa10c0bba63833075fa9a174585a60c20c723f354a6a15f735d9ac69
+SIZE (xpi/firefox-i18n-18.0/cy.xpi) = 294047
+SHA256 (xpi/firefox-i18n-18.0/da.xpi) = 9700f5a3e3af5a11e3815217d4eb33041c05e4a36a7a8967dda1f99fc5a45373
+SIZE (xpi/firefox-i18n-18.0/da.xpi) = 290720
+SHA256 (xpi/firefox-i18n-18.0/de.xpi) = 0313e4b1f39f64c6cf1790aacec4ac2460fb030cf299b721d84bf93628816d0c
+SIZE (xpi/firefox-i18n-18.0/de.xpi) = 278521
+SHA256 (xpi/firefox-i18n-18.0/el.xpi) = bf98480d33aa29d10f2f6a6e1a3c3d701e0a7ca7545baadfef4764fa3f9c2d23
+SIZE (xpi/firefox-i18n-18.0/el.xpi) = 328483
+SHA256 (xpi/firefox-i18n-18.0/en-GB.xpi) = 8bb7df4df90ba3e76e41cd268fbfda0836c11e6bbd29608b88b42deaea602e8f
+SIZE (xpi/firefox-i18n-18.0/en-GB.xpi) = 279671
+SHA256 (xpi/firefox-i18n-18.0/en-US.xpi) = 440405f3a5f721d9e9488cb0f59bbc98da2f94992b72647c465ea7432e3fa533
+SIZE (xpi/firefox-i18n-18.0/en-US.xpi) = 281027
+SHA256 (xpi/firefox-i18n-18.0/en-ZA.xpi) = 9d1257ecde3ac065add91f0a886a36b8e49eeaf0a16104189ec854d0f8939f95
+SIZE (xpi/firefox-i18n-18.0/en-ZA.xpi) = 281568
+SHA256 (xpi/firefox-i18n-18.0/eo.xpi) = abf3a015163f65ee5a2d3ea46a2fd46428f4e9339122a5f8a769bfd1bcfe256a
+SIZE (xpi/firefox-i18n-18.0/eo.xpi) = 294113
+SHA256 (xpi/firefox-i18n-18.0/es-AR.xpi) = 24e14f386f4e0cc7d57676fe14e6f907881dac8cb16c096c30993800c815ea6f
+SIZE (xpi/firefox-i18n-18.0/es-AR.xpi) = 296926
+SHA256 (xpi/firefox-i18n-18.0/es-CL.xpi) = 1544c0d2162bcc345a65fb0cd5897f6cde268eea6ec579b56c14a96e776635de
+SIZE (xpi/firefox-i18n-18.0/es-CL.xpi) = 305621
+SHA256 (xpi/firefox-i18n-18.0/es-ES.xpi) = 97650503d3364f5b108e0e4a685aa0e260b480c75a8cd7ffe5285f7f4db0c487
+SIZE (xpi/firefox-i18n-18.0/es-ES.xpi) = 249721
+SHA256 (xpi/firefox-i18n-18.0/es-MX.xpi) = 70e093b910b54a77006202a98306cd66824553df15ae9e61aec61b7ddcecec6f
+SIZE (xpi/firefox-i18n-18.0/es-MX.xpi) = 257693
+SHA256 (xpi/firefox-i18n-18.0/et.xpi) = cef0e3ef852574d3fdb8147b07940cbf96694241948859eb2f93fc58f6c4623f
+SIZE (xpi/firefox-i18n-18.0/et.xpi) = 292421
+SHA256 (xpi/firefox-i18n-18.0/eu.xpi) = 8a60e9402cd0bdeb8dae1490a1ff2b990f91a7196fafba1c2cc29a595cbe41d4
+SIZE (xpi/firefox-i18n-18.0/eu.xpi) = 292628
+SHA256 (xpi/firefox-i18n-18.0/fa.xpi) = 80dfeed5a601678efa5373172b1593a7c0a5d7427f88e09b36e4eab29aee03eb
+SIZE (xpi/firefox-i18n-18.0/fa.xpi) = 328164
+SHA256 (xpi/firefox-i18n-18.0/fi.xpi) = 8edfceb32534a6065942acde7a60e4faea37bee602d96ca8e6fcf3ee6546d463
+SIZE (xpi/firefox-i18n-18.0/fi.xpi) = 296405
+SHA256 (xpi/firefox-i18n-18.0/fr.xpi) = da8ee38aeac38a048b046082c1095a26d527da8f32a70a2f6be6fe644cfbe34a
+SIZE (xpi/firefox-i18n-18.0/fr.xpi) = 301055
+SHA256 (xpi/firefox-i18n-18.0/fy-NL.xpi) = 3565d2b8aecb35c977573776a40cf9125825c560614cab54717dc0513951343d
+SIZE (xpi/firefox-i18n-18.0/fy-NL.xpi) = 297842
+SHA256 (xpi/firefox-i18n-18.0/ga-IE.xpi) = e710115da28cc6875987c8e89d5b02cce65cc4f5e5bd259e9d00ee84182afd31
+SIZE (xpi/firefox-i18n-18.0/ga-IE.xpi) = 306165
+SHA256 (xpi/firefox-i18n-18.0/gl.xpi) = fdb3ead49de542f9a4fefb550a8937fde2a01bbf2f5c714adb4ff8a3413a2ead
+SIZE (xpi/firefox-i18n-18.0/gl.xpi) = 296117
+SHA256 (xpi/firefox-i18n-18.0/gu-IN.xpi) = 337ad24946899d504958dae8d96a6e9819cee433e718038a2ca3712da36ca04b
+SIZE (xpi/firefox-i18n-18.0/gu-IN.xpi) = 329139
+SHA256 (xpi/firefox-i18n-18.0/he.xpi) = 00bec56fcebd5542a1500c31681acce7af4e31ad083549559a2d5f0ceed7c6df
+SIZE (xpi/firefox-i18n-18.0/he.xpi) = 310625
+SHA256 (xpi/firefox-i18n-18.0/hi-IN.xpi) = 0c8ff57d18dc1202157269c393e936d3587c2dda9551558db0d346f55fe36a03
+SIZE (xpi/firefox-i18n-18.0/hi-IN.xpi) = 340355
+SHA256 (xpi/firefox-i18n-18.0/hr.xpi) = 2b0055ab81ccd10f94ae0612a777f4ba2a63638b0f06c17b66702e756ac9b6ca
+SIZE (xpi/firefox-i18n-18.0/hr.xpi) = 295802
+SHA256 (xpi/firefox-i18n-18.0/hu.xpi) = cb502aa109d76d8bf781954b0694b772906bc9f7ce3c8d32728fd1753a0d9d1d
+SIZE (xpi/firefox-i18n-18.0/hu.xpi) = 311629
+SHA256 (xpi/firefox-i18n-18.0/hy-AM.xpi) = 4ce31c92ec6e8e8bcd0ca29916dea53d83292af9211c36ccd47a418762070e0e
+SIZE (xpi/firefox-i18n-18.0/hy-AM.xpi) = 337288
+SHA256 (xpi/firefox-i18n-18.0/id.xpi) = cc855a5abc73239d03879765ca5167ed22cbd11a6264f3086e9c37e2fe05df42
+SIZE (xpi/firefox-i18n-18.0/id.xpi) = 292685
+SHA256 (xpi/firefox-i18n-18.0/is.xpi) = ca884bb02d6b710003b764cb86aa6f519f96b572c1c3c5331031d4bab90e0cc8
+SIZE (xpi/firefox-i18n-18.0/is.xpi) = 293896
+SHA256 (xpi/firefox-i18n-18.0/it.xpi) = fa81e9536555aeca783e2176c9814061f5bdcfe4666db859e86cf5cbf2d9a0ea
+SIZE (xpi/firefox-i18n-18.0/it.xpi) = 245757
+SHA256 (xpi/firefox-i18n-18.0/ja.xpi) = b86cbd21a6cb19e3e48a27664eccb8fbae8a8358f70b89ffadbc0710c21d1f65
+SIZE (xpi/firefox-i18n-18.0/ja.xpi) = 332142
+SHA256 (xpi/firefox-i18n-18.0/kk.xpi) = caf8a17e0ce3c6a7bddfaac114b97507a8142165101581c17e3be399aba7d610
+SIZE (xpi/firefox-i18n-18.0/kk.xpi) = 338262
+SHA256 (xpi/firefox-i18n-18.0/kn.xpi) = 10afd530fcc2f0e503ef36a62157e89be485233f5b18e6ab144e9ee004a1a955
+SIZE (xpi/firefox-i18n-18.0/kn.xpi) = 364066
+SHA256 (xpi/firefox-i18n-18.0/ko.xpi) = 91ece69cf30b96207c18b6038d246e4ae56b0cbe0c6b0bf8ae9601a31894e72e
+SIZE (xpi/firefox-i18n-18.0/ko.xpi) = 304674
+SHA256 (xpi/firefox-i18n-18.0/ku.xpi) = 8d359e1a60208d72f85da04f4ec35fd5b560667a8909f2bbd5687396fb8639b1
+SIZE (xpi/firefox-i18n-18.0/ku.xpi) = 313503
+SHA256 (xpi/firefox-i18n-18.0/lg.xpi) = 2fb581047bfd9455a9dcb38a815a22856edab63dd67610080777576a4f90735e
+SIZE (xpi/firefox-i18n-18.0/lg.xpi) = 299711
+SHA256 (xpi/firefox-i18n-18.0/lt.xpi) = a1df9b7576835c5d286cbb94c90380c83e1af62a338f97821580274057b4244d
+SIZE (xpi/firefox-i18n-18.0/lt.xpi) = 312535
+SHA256 (xpi/firefox-i18n-18.0/lv.xpi) = 20b29f6aef2262d5c8cbb1325d73fe033be946bb3174183726103831cdf6eecf
+SIZE (xpi/firefox-i18n-18.0/lv.xpi) = 293706
+SHA256 (xpi/firefox-i18n-18.0/mai.xpi) = 43954afb184f86b77e8f8c8cc912fe2cf046b0c66425ed2442a5a342986a57b5
+SIZE (xpi/firefox-i18n-18.0/mai.xpi) = 337574
+SHA256 (xpi/firefox-i18n-18.0/mk.xpi) = bd102720786b7ce2bd5914eac87aedad1ca77d0e0d6f7af66c9a68e58cb03480
+SIZE (xpi/firefox-i18n-18.0/mk.xpi) = 324802
+SHA256 (xpi/firefox-i18n-18.0/ml.xpi) = 1dd385805f170d361aed64cd2c8b0e178a63e463aa1f52e1d203aedbb9f8be0f
+SIZE (xpi/firefox-i18n-18.0/ml.xpi) = 371094
+SHA256 (xpi/firefox-i18n-18.0/mr.xpi) = 017d48da78ec0417dd374fb75773ee79a426fb7eb734c61c6c76e804b56f55b1
+SIZE (xpi/firefox-i18n-18.0/mr.xpi) = 337701
+SHA256 (xpi/firefox-i18n-18.0/nb-NO.xpi) = a3493d5882ef1d0c7d5b04b019cc910e9af59eb213ee0250017a8560228f2b23
+SIZE (xpi/firefox-i18n-18.0/nb-NO.xpi) = 292590
+SHA256 (xpi/firefox-i18n-18.0/nl.xpi) = 314c2abc7fc62d230fd113ccb70dafedcf76782b8ebf0421a47d909c6be71789
+SIZE (xpi/firefox-i18n-18.0/nl.xpi) = 293813
+SHA256 (xpi/firefox-i18n-18.0/nn-NO.xpi) = f48a90ace289cccf3b0a8edf4e558d36e1b0127f314e7afe39f10ba5fecbe4f8
+SIZE (xpi/firefox-i18n-18.0/nn-NO.xpi) = 296936
+SHA256 (xpi/firefox-i18n-18.0/nso.xpi) = 83d70f8222e3489c64aa574734b6093f363c7e87fa8509a4f354929613277c4a
+SIZE (xpi/firefox-i18n-18.0/nso.xpi) = 297261
+SHA256 (xpi/firefox-i18n-18.0/or.xpi) = ababf628d316fa9928c9c593d3468b84db06751eb05efd2a22fdc4e7c867ce86
+SIZE (xpi/firefox-i18n-18.0/or.xpi) = 339402
+SHA256 (xpi/firefox-i18n-18.0/pa-IN.xpi) = 09691aab9de0f7cc497933485b8d25c2865826018f299cc72749c4dc2149f01b
+SIZE (xpi/firefox-i18n-18.0/pa-IN.xpi) = 327711
+SHA256 (xpi/firefox-i18n-18.0/pl.xpi) = b1db3cd45b2b27749d43413cf68508c9e4b92f10d253cea870d2393b8bfc5ffb
+SIZE (xpi/firefox-i18n-18.0/pl.xpi) = 310234
+SHA256 (xpi/firefox-i18n-18.0/pt-BR.xpi) = 7f835180c342665f7d575d04c5164440cdfce9396c9e15d05c22129927fcecae
+SIZE (xpi/firefox-i18n-18.0/pt-BR.xpi) = 298674
+SHA256 (xpi/firefox-i18n-18.0/pt-PT.xpi) = 44b36f7dd48626908dd091c00afd2a081620859135fd734bcc7f37d80226b01f
+SIZE (xpi/firefox-i18n-18.0/pt-PT.xpi) = 298405
+SHA256 (xpi/firefox-i18n-18.0/rm.xpi) = 5fadabd7559ec85405d599e8c15fd153e8f0341e9410ce96aa2f9e016a795cf3
+SIZE (xpi/firefox-i18n-18.0/rm.xpi) = 296158
+SHA256 (xpi/firefox-i18n-18.0/ro.xpi) = 23e18fdd2805398e18f81e755e42bfa41e3d7e8c68bb990295ceaf47b256b833
+SIZE (xpi/firefox-i18n-18.0/ro.xpi) = 319296
+SHA256 (xpi/firefox-i18n-18.0/ru.xpi) = 7a9916f8cc2e743e3a3a10b03a3575fb0d9a7807aeddfe3a51147fb1e3f2e795
+SIZE (xpi/firefox-i18n-18.0/ru.xpi) = 292427
+SHA256 (xpi/firefox-i18n-18.0/si.xpi) = 972449afca04b1470156edf6278cacef2a8ea95eeb0ef3cb1d43e660ba0d389f
+SIZE (xpi/firefox-i18n-18.0/si.xpi) = 326714
+SHA256 (xpi/firefox-i18n-18.0/sk.xpi) = 6d95a4bb54f6f004df610af33229830ba4e4ee040af1fe7452738361207994f8
+SIZE (xpi/firefox-i18n-18.0/sk.xpi) = 309261
+SHA256 (xpi/firefox-i18n-18.0/sl.xpi) = b42f103b75d1475509e5fa99cd100e25c0dc8919d3f9eb6f273633ba87582d75
+SIZE (xpi/firefox-i18n-18.0/sl.xpi) = 292333
+SHA256 (xpi/firefox-i18n-18.0/son.xpi) = d82ff652148a24587a5ca41ab42373e8aad3692ac77203ddd881ed02a0bd57df
+SIZE (xpi/firefox-i18n-18.0/son.xpi) = 292736
+SHA256 (xpi/firefox-i18n-18.0/sq.xpi) = 609ac57fe54034f649e564edf69ba1b278a9f1aab06f4a311092cb9c1b667874
+SIZE (xpi/firefox-i18n-18.0/sq.xpi) = 299091
+SHA256 (xpi/firefox-i18n-18.0/sr.xpi) = 59eca44e8bc84a1fcbb5d705f30a27fa9703dccadc350371a5f351f84f5e3e5c
+SIZE (xpi/firefox-i18n-18.0/sr.xpi) = 342986
+SHA256 (xpi/firefox-i18n-18.0/sv-SE.xpi) = ba6296e0d25e7d33ac048863d10f4f504cbba6c21559f8970f99e639dd3228e2
+SIZE (xpi/firefox-i18n-18.0/sv-SE.xpi) = 296299
+SHA256 (xpi/firefox-i18n-18.0/ta-LK.xpi) = 846f09087d642091542b3c2938b31ea6191dbdb448f5da6252a327d4e8d64907
+SIZE (xpi/firefox-i18n-18.0/ta-LK.xpi) = 348880
+SHA256 (xpi/firefox-i18n-18.0/ta.xpi) = db4183c24131d95f26f3c06c20959ea41891525550c2ed6a5c697db83e10397f
+SIZE (xpi/firefox-i18n-18.0/ta.xpi) = 333867
+SHA256 (xpi/firefox-i18n-18.0/te.xpi) = f81fa1ec7bea4f8f0f249fb96410ee991915e190074db940d489a3b2a4130e40
+SIZE (xpi/firefox-i18n-18.0/te.xpi) = 348022
+SHA256 (xpi/firefox-i18n-18.0/th.xpi) = 083921dd603a4c86da42e27150eba77ef422279d7cca6a06c6121aec44fed302
+SIZE (xpi/firefox-i18n-18.0/th.xpi) = 332567
+SHA256 (xpi/firefox-i18n-18.0/tr.xpi) = 940a948eaf1ee4805399aa1fedabdb6fdf108ec5b8b56210f8157c6010e68cad
+SIZE (xpi/firefox-i18n-18.0/tr.xpi) = 303776
+SHA256 (xpi/firefox-i18n-18.0/uk.xpi) = 91be4d10068ea3032d049664eee8ffb1790b12a7951e453dd4c4bef566ddc8af
+SIZE (xpi/firefox-i18n-18.0/uk.xpi) = 333533
+SHA256 (xpi/firefox-i18n-18.0/vi.xpi) = 42c1361211a0692e6475c30fe464735eab7fd03d2dd9e0168a669684c0fc0a48
+SIZE (xpi/firefox-i18n-18.0/vi.xpi) = 322148
+SHA256 (xpi/firefox-i18n-18.0/zh-CN.xpi) = fa5816d39c1752d987c3772414526ced9e92f63c6c9f22805ca5b2da4f6d03c7
+SIZE (xpi/firefox-i18n-18.0/zh-CN.xpi) = 313764
+SHA256 (xpi/firefox-i18n-18.0/zh-TW.xpi) = 9fe7a039ddaf7c0666c3e25cc87c6a342a5ac09b0316c60f7723c927167c2095
+SIZE (xpi/firefox-i18n-18.0/zh-TW.xpi) = 315081
+SHA256 (xpi/firefox-i18n-18.0/zu.xpi) = 442ea76cdfc9f94eb66c4479b9647466d1f06d5c2bad993dee45542937bdfbcd
+SIZE (xpi/firefox-i18n-18.0/zu.xpi) = 305238
diff --git a/www/firefox/Makefile b/www/firefox/Makefile
index 0eae44c8b1f5..763518bed1a1 100644
--- a/www/firefox/Makefile
+++ b/www/firefox/Makefile
@@ -2,27 +2,28 @@
# $FreeBSD$
PORTNAME= firefox
-DISTVERSION= 17.0.2
+DISTVERSION= 18.0
PORTEPOCH= 1
CATEGORIES= www ipv6
MASTER_SITES= ${MASTER_SITE_MOZILLA}
-MASTER_SITE_SUBDIR= ${PORTNAME}/releases/${DISTVERSION}esr/source
-DISTNAME= ${PORTNAME}-${DISTVERSION}esr.source
+MASTER_SITE_SUBDIR= ${PORTNAME}/releases/${DISTVERSION}/source
+DISTNAME= ${PORTNAME}-${DISTVERSION}.source
MAINTAINER= gecko@FreeBSD.org
COMMENT= Web browser based on the browser portion of Mozilla
-BUILD_DEPENDS= nspr>=4.9:${PORTSDIR}/devel/nspr \
- nss>=3.13.6_1:${PORTSDIR}/security/nss \
- sqlite3>=3.7.12.1:${PORTSDIR}/databases/sqlite3 \
+BUILD_DEPENDS= nspr>=4.9.3:${PORTSDIR}/devel/nspr \
+ nss>=3.14.1:${PORTSDIR}/security/nss \
+ sqlite3>=3.7.14.1:${PORTSDIR}/databases/sqlite3 \
${PYTHON_SITELIBDIR}/_sqlite3.so:${PORTSDIR}/databases/py-sqlite3 \
cairo>=1.10.2_1,1:${PORTSDIR}/graphics/cairo \
unzip:${PORTSDIR}/archivers/unzip
USE_AUTOTOOLS= autoconf213:env
USE_PYTHON_BUILD=-2.7
+OBJDIR_BUILD= # in-tree build broken after bug 789837
USE_GECKO= gecko
-CONFLICTS= firefox-10.*
+CONFLICTS= firefox-1[07].*
MOZ_PKGCONFIG_FILES= # empty
USE_MOZILLA= # empty
MOZILLA_NAME= Firefox
@@ -44,8 +45,8 @@ MOZ_OPTIONS= --program-transform-name='s/firefox/${MOZILLA}/' \
--enable-application=browser \
--enable-official-branding
-OPTIONS_DEFINE= GSTREAMER PGO
-OPTIONS_DEFAULT=GIO
+OPTIONS_DEFINE= GSTREAMER PGO WEBRTC
+OPTIONS_DEFAULT=GIO WEBRTC
.include "${.CURDIR}/../../www/firefox/Makefile.options"
@@ -53,7 +54,7 @@ OPTIONS_DEFAULT:=${OPTIONS_DEFAULT:S/OSS/ALSA/}
.include <bsd.port.pre.mk>
-WRKSRC:= ${WRKDIR}/mozilla-esr17
+WRKSRC:= ${WRKDIR}/mozilla-release
.if ${ARCH} == amd64
CONFIGURE_TARGET=x86_64-portbld-freebsd${OSREL}
@@ -99,6 +100,8 @@ post-extract:
<${FILESDIR}/firefox.desktop.in >${WRKDIR}/${MOZILLA}.desktop
post-patch:
+ @${REINPLACE_CMD} -e '/MOZPNG/s/=[0-9]*/=10511/' \
+ ${WRKSRC}/configure.in
@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
${WRKSRC}/browser/app/nsBrowserApp.cpp
diff --git a/www/firefox/Makefile.options b/www/firefox/Makefile.options
index 1170b6ce6919..61f1dde43ffb 100644
--- a/www/firefox/Makefile.options
+++ b/www/firefox/Makefile.options
@@ -2,19 +2,15 @@
OPTIONS_DEFINE+= DBUS DEBUG GCONF GIO GNOMEUI GNOMEVFS2 LIBPROXY \
LOGGING OPTIMIZED_CFLAGS
-OPTIONS_DEFAULT+= DBUS GTK2 LOGGING OSS
+OPTIONS_DEFAULT+= DBUS LOGGING OSS
OPTIONS_SINGLE+= AUDIO
OPTIONS_SINGLE_AUDIO= ALSA OSS PULSEAUDIO
-OPTIONS_SINGLE+= TOOLKIT
-OPTIONS_SINGLE_TOOLKIT= GTK2 QT4
-
ENIGMAIL_DESC?= Enigmail extension
GIO_DESC?= GIO for file I/O # move to bsd.options.desc.mk
GNOMEUI_DESC?= libgnomeui support module
LIBPROXY_DESC?= Proxy support via libproxy
LIGHTNING_DESC?= Calendar extension
LOGGING_DESC?= Additional log messages
-QT4_DESC?= Qt GUI (EXPERIMENTAL, bug 521582)
WEBRTC_DESC?= Web Real-Time Communication
diff --git a/www/firefox/Makefile.webplugins b/www/firefox/Makefile.webplugins
index 6d6142b83225..9cd5effdee01 100644
--- a/www/firefox/Makefile.webplugins
+++ b/www/firefox/Makefile.webplugins
@@ -1,13 +1,5 @@
-# -*- mode: makefile-bsdmake; tab-width: 4; -*-
-# ex:ts=4
-#
-# New ports collection makefile for: npapi infrastructure
-# Date created: 27 June 2006
-# Whom: Andrew Pantyukhin <infofarmer@FreeBSD.org>
-#
+# Created by: Andrew Pantyukhin <infofarmer@FreeBSD.org>
# $FreeBSD$
-# $MCom: ports-stable/www/firefox/Makefile.webplugins,v 1.14 2008/11/12 17:55:09 mezz Exp $
-#
# MAINTAINER= gecko@FreeBSD.org
#
diff --git a/www/firefox/distinfo b/www/firefox/distinfo
index a7e07589b3a6..2bb094386db5 100644
--- a/www/firefox/distinfo
+++ b/www/firefox/distinfo
@@ -1,2 +1,2 @@
-SHA256 (firefox-17.0.2esr.source.tar.bz2) = 92bf717b3e3933b84fd37b0e5c5026868e139be828637cfcf4acdc83f7ccd886
-SIZE (firefox-17.0.2esr.source.tar.bz2) = 90828234
+SHA256 (firefox-18.0.source.tar.bz2) = 53f06ff49882060e811b06ceb5d59e5a8851bda23e4cc82426010de967565014
+SIZE (firefox-18.0.source.tar.bz2) = 96948716
diff --git a/www/firefox/files/extra-bug780531 b/www/firefox/files/extra-bug780531
index aa3547c397a4..f8ca253d7c9d 100644
--- a/www/firefox/files/extra-bug780531
+++ b/www/firefox/files/extra-bug780531
@@ -8,6 +8,6 @@
-arm*)
+case "$target" in
+arm-*-linux*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
- MOZ_SAMPLE_TYPE_S16LE=1
- AC_DEFINE(MOZ_SAMPLE_TYPE_S16LE)
- AC_SUBST(MOZ_SAMPLE_TYPE_S16LE)
+ MOZ_SAMPLE_TYPE_S16=1
+ AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
+ AC_SUBST(MOZ_SAMPLE_TYPE_S16)
diff --git a/www/firefox/files/patch-alsapulse b/www/firefox/files/patch-alsapulse
index f0c38d347bea..6a8bad77fc17 100644
--- a/www/firefox/files/patch-alsapulse
+++ b/www/firefox/files/patch-alsapulse
@@ -2,21 +2,18 @@ diff --git configure.in configure.in
index 5980b76..11f5f77 100644
--- configure.in
+++ configure.in
-@@ -5600,13 +5600,25 @@ dnl ========================================================
- dnl = Check alsa availability on Linux if using sydneyaudio
- dnl ========================================================
+@@ -5618,11 +5618,25 @@ dnl ========================================================
-+MOZ_ARG_ENABLE_BOOL(alsa,
-+[ --enable-alsa Enable Alsa support (default on Linux)],
-+MOZ_ALSA=1,
-+MOZ_ALSA= MOZ_ALSA_FORCE=$enableval)
-+
dnl If using sydneyaudio with Linux, ensure that the alsa library is available
--if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
-+if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux" -a "$MOZ_ALSA_FORCE" != "no"; then
+ if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
+ MOZ_ALSA=1
+fi
+
++MOZ_ARG_ENABLE_BOOL(alsa,
++[ --enable-alsa Enable Alsa support (default on Linux)],
++MOZ_ALSA=1,
++MOZ_ALSA=)
++
+if test -n "$MOZ_ALSA"; then
+ AC_DEFINE(MOZ_CUBEB)
PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
@@ -25,10 +22,21 @@ index 5980b76..11f5f77 100644
fi
+AC_SUBST(MOZ_ALSA)
++AC_SUBST(MOZ_ALSA_CFLAGS)
++AC_SUBST(MOZ_ALSA_LIBS)
+
dnl ========================================================
dnl = Enable PulseAudio
dnl ========================================================
+@@ -8633,8 +8647,6 @@ AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
+ AC_SUBST(MOZ_VP8_ENCODER)
+ AC_SUBST(MOZ_VP8)
+ AC_SUBST(MOZ_OGG)
+-AC_SUBST(MOZ_ALSA_LIBS)
+-AC_SUBST(MOZ_ALSA_CFLAGS)
+ AC_SUBST(VPX_AS)
+ AC_SUBST(VPX_ASFLAGS)
+ AC_SUBST(VPX_DASH_C_FLAG)
diff --git media/libcubeb/src/Makefile.in media/libcubeb/src/Makefile.in
index 5ab4dd8..c8df26f 100644
--- media/libcubeb/src/Makefile.in
diff --git a/www/firefox/files/patch-bug713802 b/www/firefox/files/patch-bug713802
deleted file mode 100644
index 7d3cc4dad110..000000000000
--- a/www/firefox/files/patch-bug713802
+++ /dev/null
@@ -1,163 +0,0 @@
-commit 20586fa
-Author: Karl Tomlinson <karlt+@karlt.net>
-Date: Thu Sep 27 18:35:06 2012 +1200
-
- b=713802 default enable GIO support and disable GnomeVFS r=glandium
-
- --HG--
- extra : transplant_source : wk%ADr%CA%8EN%AE%C93p/p%0A%26%0E%1D0%F20
----
- browser/confvars.sh | 2 +-
- configure.in | 20 ++++++++++----------
- xulrunner/confvars.sh | 2 +-
- 3 files changed, 12 insertions(+), 12 deletions(-)
-
-diff --git browser/confvars.sh browser/confvars.sh
-index 40ab494..eae5645 100755
---- browser/confvars.sh
-+++ browser/confvars.sh
-@@ -21,7 +21,7 @@ MOZ_SERVICES_AITC=1
- MOZ_SERVICES_NOTIFICATIONS=1
- MOZ_SERVICES_SYNC=1
- MOZ_APP_VERSION=$FIREFOX_VERSION
--MOZ_EXTENSIONS_DEFAULT=" gnomevfs"
-+MOZ_EXTENSIONS_DEFAULT=" gio"
- # MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
- # Changing MOZ_*BRANDING_DIRECTORY requires a clobber to ensure correct results,
- # because branding dependencies are broken.
-diff --git configure.in configure.in
-index 87a9391..2118651 100644
---- configure.in
-+++ configure.in
-@@ -4846,21 +4846,21 @@ dnl ========================================================
-
- if test "$MOZ_X11"
- then
-- dnl build the gnomevfs extension by default only when the
-+ dnl build the GIO extension by default only when the
- dnl GTK2 toolkit is in use.
- if test "$MOZ_ENABLE_GTK2"
- then
-- MOZ_ENABLE_GNOMEVFS=1
-+ MOZ_ENABLE_GIO=1
- MOZ_ENABLE_GCONF=1
- fi
-
- dnl ========================================================
- dnl = GnomeVFS support module
- dnl ========================================================
-- MOZ_ARG_DISABLE_BOOL(gnomevfs,
-- [ --disable-gnomevfs Disable GnomeVFS support ],
-- MOZ_ENABLE_GNOMEVFS=,
-- MOZ_ENABLE_GNOMEVFS=force)
-+ MOZ_ARG_ENABLE_BOOL(gnomevfs,
-+ [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
-+ MOZ_ENABLE_GNOMEVFS=force,
-+ MOZ_ENABLE_GNOMEVFS=)
-
- if test "$MOZ_ENABLE_GNOMEVFS"
- then
-@@ -4884,10 +4884,10 @@ then
- dnl ========================================================
- dnl = GIO support module
- dnl ========================================================
-- MOZ_ARG_ENABLE_BOOL(gio,
-- [ --enable-gio Enable GIO support (default: disabled)],
-- MOZ_ENABLE_GIO=force,
-- MOZ_ENABLE_GIO=)
-+ MOZ_ARG_DISABLE_BOOL(gio,
-+ [ --disable-gio Disable GIO support],
-+ MOZ_ENABLE_GIO=,
-+ MOZ_ENABLE_GIO=force)
-
- if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
- then
-diff --git xulrunner/confvars.sh xulrunner/confvars.sh
-index 2fa6ead..5fe2c3d 100755
---- xulrunner/confvars.sh
-+++ xulrunner/confvars.sh
-@@ -10,5 +10,5 @@ MOZ_XULRUNNER=1
- MOZ_CHROME_FILE_FORMAT=omni
- MOZ_APP_VERSION=$MOZILLA_VERSION
- MOZ_PLACES=1
--MOZ_EXTENSIONS_DEFAULT=" gnomevfs"
-+MOZ_EXTENSIONS_DEFAULT=" gio"
- MOZ_URL_CLASSIFIER=1
-
-commit d884d75
-Author: Karl Tomlinson <karlt+@karlt.net>
-Date: Thu Sep 27 18:34:44 2012 +1200
-
- b=713802 disable gnomevfs extension without --enable-gnomevfs r=glandium
-
- --HG--
- extra : transplant_source : i%07%81%E9%90_%C1%05b%194%9B%1E%93%FC%03%279%F9%8A
----
- configure.in | 12 +++---------
- 1 file changed, 3 insertions(+), 9 deletions(-)
-
-diff --git configure.in configure.in
-index f2b4041..87a9391 100644
---- configure.in
-+++ configure.in
-@@ -4875,12 +4875,6 @@ then
- fi
- MOZ_ENABLE_GNOMEVFS=
- ])
-- else
-- if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
-- PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
-- MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
-- ])
-- fi
- fi
-
- AC_SUBST(MOZ_ENABLE_GNOMEVFS)
-@@ -5967,10 +5961,10 @@ MOZ_ARG_ENABLE_STRING(extensions,
- done],
- MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
-
--if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
-+if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
- # Suppress warning on non-X11 platforms
- if test -n "$MOZ_X11"; then
-- AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
-+ AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
- fi
- MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
- fi
-@@ -5983,7 +5977,7 @@ fi
- if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
- # Suppress warning on non-X11 platforms
- if test -n "$MOZ_X11"; then
-- AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
-+ AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
- fi
- MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
- fi
-
-commit ddedeea
-Author: Karl Tomlinson <karlt+@karlt.net>
-Date: Thu Sep 27 13:47:19 2012 +1200
-
- b=713802 link gio extension against libxul for tracemalloc stack functions r=bsmedberg
-
- --HG--
- extra : transplant_source : %C8%A3o%BE%A0z%F7%C8%8A%E6%0E%D4s%7D%90%9C%D9%0F%06%7E
----
- extensions/gio/Makefile.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git extensions/gio/Makefile.in extensions/gio/Makefile.in
-index 46412c4..ccf2846 100644
---- extensions/gio/Makefile.in
-+++ extensions/gio/Makefile.in
-@@ -23,7 +23,7 @@ LOCAL_INCLUDES = $(MOZ_GIO_CFLAGS)
-
- EXTRA_DSO_LDOPTS = \
- $(XPCOM_GLUE_LDOPTS) \
-- $(NSPR_LIBS) \
-+ $(MOZ_COMPONENT_LIBS) \
- $(MOZ_GIO_LIBS) \
- $(NULL)
-
diff --git a/www/firefox/files/patch-bug722975 b/www/firefox/files/patch-bug722975
index 46a3381b9375..21c28b19540b 100644
--- a/www/firefox/files/patch-bug722975
+++ b/www/firefox/files/patch-bug722975
@@ -7,13 +7,13 @@ Bug 722975 - --enable-system-cairo build is broken after Bug 715658 fixed
diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp
--- gfx/thebes/gfxPlatform.cpp
+++ gfx/thebes/gfxPlatform.cpp
-@@ -484,21 +484,19 @@ gfxPlatform::CreateDrawTargetForSurface(
+@@ -502,21 +502,19 @@ struct SourceSurfaceUserData
+ BackendType mBackendType;
+ };
- cairo_user_data_key_t kSourceSurface;
-
- void SourceBufferDestroy(void *srcBuffer)
+ void SourceBufferDestroy(void *srcSurfUD)
{
- static_cast<SourceSurface*>(srcBuffer)->Release();
+ delete static_cast<SourceSurfaceUserData*>(srcSurfUD);
}
-void SourceSnapshotDetached(cairo_surface_t *nullSurf)
@@ -31,7 +31,7 @@ diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp
{
void *userData = aSurface->GetData(&kSourceSurface);
-@@ -588,24 +586,19 @@ gfxPlatform::GetSourceSurfaceForSurface(
+@@ -621,24 +619,19 @@ gfxPlatform::GetSourceSurfaceForSurface(
}
srcBuffer = Factory::CreateWrappingDataSourceSurface(imgSurface->Data(),
@@ -53,9 +53,9 @@ diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp
+ SourceSnapshotDetached, imgSurface.get());
}
- srcBuffer->AddRef();
- aSurface->SetData(&kSourceSurface, srcBuffer, SourceBufferDestroy);
+ SourceSurfaceUserData *srcSurfUD = new SourceSurfaceUserData;
+ srcSurfUD->mBackendType = aTarget->GetType();
+ srcSurfUD->mSrcSurface = srcBuffer;
+ aSurface->SetData(&kSourceSurface, srcSurfUD, SourceBufferDestroy);
return srcBuffer;
- }
-
diff --git a/www/firefox/files/patch-bug753046 b/www/firefox/files/patch-bug753046
deleted file mode 100644
index c5ecdbd8af1b..000000000000
--- a/www/firefox/files/patch-bug753046
+++ /dev/null
@@ -1,1213 +0,0 @@
-# Bug 753046 - Add support for DragonFly/NetBSD
-
-$NetBSD: patch-dom_plugins_ipc_PluginModuleChild.cpp,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- dom/plugins/ipc/PluginModuleChild.cpp.orig 2011-12-20 23:28:14.000000000 +0000
-+++ dom/plugins/ipc/PluginModuleChild.cpp
-@@ -5,6 +5,7 @@
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- #ifdef MOZ_WIDGET_QT
-+#include <unistd.h> // for _exit()
- #include <QtCore/QTimer>
- #include "nsQAppInstance.h"
- #include "NestedLoopTimer.h"
-@@ -228,7 +228,7 @@ PluginModuleChild::Init(const std::strin
-
- // TODO: use PluginPRLibrary here
-
--#if defined(OS_LINUX)
-+#if defined(OS_LINUX) || defined(OS_BSD)
- mShutdownFunc =
- (NP_PLUGINSHUTDOWN) PR_FindFunctionSymbol(mLibrary, "NP_Shutdown");
-
-@@ -1790,7 +1790,7 @@ PluginModuleChild::AnswerNP_GetEntryPoin
- PLUGIN_LOG_DEBUG_METHOD;
- AssertPluginThread();
-
--#if defined(OS_LINUX)
-+#if defined(OS_LINUX) || defined(OS_BSD)
- return true;
- #elif defined(OS_WIN) || defined(OS_MACOSX)
- *_retval = mGetEntryPointsFunc(&mFunctions);
-@@ -1823,7 +1823,7 @@ PluginModuleChild::AnswerNP_Initialize(N
- SendBackUpXResources(FileDescriptor(xSocketFd, false/*don't close*/));
- #endif
-
--#if defined(OS_LINUX)
-+#if defined(OS_LINUX) || defined(OS_BSD)
- *_retval = mInitializeFunc(&sBrowserFuncs, &mFunctions);
- return true;
- #elif defined(OS_WIN) || defined(OS_MACOSX)
-$NetBSD: patch-dom_plugins_ipc_PluginModuleChild.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- dom/plugins/ipc/PluginModuleChild.h.orig 2011-12-20 23:28:14.000000000 +0000
-+++ dom/plugins/ipc/PluginModuleChild.h
-@@ -340,7 +340,7 @@ private:
-
- // we get this from the plugin
- NP_PLUGINSHUTDOWN mShutdownFunc;
--#ifdef OS_LINUX
-+#if defined(OS_LINUX) || defined(OS_BSD)
- NP_PLUGINUNIXINIT mInitializeFunc;
- #elif defined(OS_WIN) || defined(OS_MACOSX)
- NP_PLUGININIT mInitializeFunc;
-$NetBSD: patch-ipc_chromium_Makefile.in,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- ipc/chromium/Makefile.in.orig 2012-02-16 06:40:33.000000000 +0000
-+++ ipc/chromium/Makefile.in
-@@ -278,6 +278,33 @@ endif
-
- endif # } OS_LINUX
-
-+ifdef OS_BSD # {
-+
-+CPPSRCS += \
-+ atomicops_internals_x86_gcc.cc \
-+ process_util_bsd.cc \
-+ time_posix.cc \
-+ $(NULL)
-+
-+ifdef MOZ_ENABLE_GTK2
-+CPPSRCS += \
-+ message_pump_glib.cc \
-+ $(NULL)
-+endif
-+
-+ifdef MOZ_ENABLE_QT
-+MOCSRCS = \
-+ moc_message_pump_qt.cc \
-+ $(NULL)
-+
-+CPPSRCS += \
-+ $(MOCSRCS) \
-+ message_pump_qt.cc \
-+ $(NULL)
-+endif
-+
-+endif # } OS_BSD
-+
- # libevent
-
- ifndef MOZ_NATIVE_LIBEVENT # {
-$NetBSD: patch-ipc_chromium_chromium-config.mk,v 1.2 2012/03/15 08:30:06 ryoon Exp $
-
---- ipc/chromium/chromium-config.mk.orig 2012-02-16 07:40:33.000000000 +0100
-+++ ipc/chromium/chromium-config.mk 2012-03-11 11:05:40.397182000 +0100
-@@ -56,17 +56,6 @@
- -I$(DEPTH)/ipc/ipdl/_ipdlheaders \
- $(NULL)
-
--ifeq ($(OS_ARCH),Darwin) # {
--
--OS_MACOSX = 1
--OS_POSIX = 1
--
--DEFINES += \
-- -DOS_MACOSX=1 \
-- -DOS_POSIX=1 \
-- $(NULL)
--
--else # } {
- ifeq ($(OS_ARCH),WINNT) # {
- OS_LIBS += $(call EXPAND_LIBNAME,psapi shell32 dbghelp)
-
-@@ -93,13 +82,65 @@
- endif
-
- else # } {
--
--OS_LINUX = 1
- OS_POSIX = 1
-+DEFINES += -DOS_POSIX=1
-+
-+ifeq ($(OS_ARCH),Darwin) # {
-+
-+OS_MACOSX = 1
-+DEFINES += \
-+ -DOS_MACOSX=1 \
-+ $(NULL)
-+
-+else # } {
-+ifeq ($(OS_ARCH),DragonFly) # {
-+
-+OS_DRAGONFLY = 1
-+OS_BSD = 1
-+OS_LIBS += $(call EXPAND_LIBNAME,kvm)
-+DEFINES += \
-+ -DOS_DRAGONFLY=1 \
-+ -DOS_BSD=1 \
-+ $(NULL)
-+
-+else # } {
-+ifeq ($(OS_ARCH),FreeBSD) # {
-+
-+OS_FREEBSD = 1
-+OS_BSD = 1
-+OS_LIBS += $(call EXPAND_LIBNAME,kvm)
-+DEFINES += \
-+ -DOS_FREEBSD=1 \
-+ -DOS_BSD=1 \
-+ $(NULL)
-
-+else # } {
-+ifeq ($(OS_ARCH),NetBSD) # {
-+
-+OS_NETBSD = 1
-+OS_BSD = 1
-+OS_LIBS += $(call EXPAND_LIBNAME,kvm)
-+DEFINES += \
-+ -DOS_NETBSD=1 \
-+ -DOS_BSD=1 \
-+ $(NULL)
-+
-+else # } {
-+ifeq ($(OS_ARCH),OpenBSD) # {
-+
-+OS_OPENBSD = 1
-+OS_BSD = 1
-+OS_LIBS += $(call EXPAND_LIBNAME,kvm)
-+DEFINES += \
-+ -DOS_OPENBSD=1 \
-+ -DOS_BSD=1 \
-+ $(NULL)
-+
-+else # } {
-+
-+OS_LINUX = 1
- DEFINES += \
- -DOS_LINUX=1 \
-- -DOS_POSIX=1 \
- $(NULL)
-
- # NB: to stop gcc warnings about exporting template instantiation
-@@ -107,4 +147,8 @@
-
- endif # }
- endif # }
-+endif # }
-+endif # }
-+endif # }
-+endif # }
-
-$NetBSD: patch-ipc_chromium_src_base_base__paths.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- ipc/chromium/src/base/base_paths.h.orig 2011-12-20 23:28:19.000000000 +0000
-+++ ipc/chromium/src/base/base_paths.h
-@@ -13,7 +13,7 @@
- #include "base/base_paths_win.h"
- #elif defined(OS_MACOSX)
- #include "base/base_paths_mac.h"
--#elif defined(OS_LINUX)
-+#elif defined(OS_LINUX) || defined(OS_BSD)
- #include "base/base_paths_linux.h"
- #endif
- #include "base/path_service.h"
-$NetBSD: patch-ipc_chromium_src_base_debug__util__posic.cc,v 1.3 2012/04/01 15:18:45 ryoon Exp $
-
---- ipc/chromium/src/base/debug_util_posix.cc.orig 2012-03-13 01:36:53.000000000 +0000
-+++ ipc/chromium/src/base/debug_util_posix.cc
-@@ -5,7 +5,7 @@
- #include "build/build_config.h"
- #include "base/debug_util.h"
-
--#define MOZ_HAVE_EXECINFO_H (!defined(ANDROID) && !defined(__OpenBSD__))
-+#define MOZ_HAVE_EXECINFO_H (defined(OS_LINUX) && !defined(ANDROID))
-
- #include <errno.h>
- #include <fcntl.h>
-@@ -17,9 +17,16 @@
- #include <unistd.h>
- #if MOZ_HAVE_EXECINFO_H
- #include <execinfo.h>
-+#endif
-+
-+#if defined(OS_MACOSX) || defined(OS_BSD)
- #include <sys/sysctl.h>
- #endif
-
-+#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD)
-+#include <sys/user.h>
-+#endif
-+
- #include "base/basictypes.h"
- #include "base/eintr_wrapper.h"
- #include "base/logging.h"
-@@ -32,7 +37,7 @@ bool DebugUtil::SpawnDebuggerOnProcess(u
- return false;
- }
-
--#if defined(OS_MACOSX)
-+#if defined(OS_MACOSX) || defined(OS_BSD)
-
- // Based on Apple's recommended method as described in
- // http://developer.apple.com/qa/qa2004/qa1361.html
-@@ -71,7 +76,15 @@ bool DebugUtil::BeingDebugged() {
-
- // This process is being debugged if the P_TRACED flag is set.
- is_set = true;
-+#if defined(OS_DRAGONFLY)
-+ being_debugged = (info.kp_flags & P_TRACED) != 0;
-+#elif defined(OS_FREEBSD)
-+ being_debugged = (info.ki_flag & P_TRACED) != 0;
-+#elif defined(OS_OPENBSD)
-+ being_debugged = (info.p_flag & P_TRACED) != 0;
-+#else
- being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0;
-+#endif
- return being_debugged;
- }
-
-diff --git ipc/chromium/src/base/dir_reader_bsd.h ipc/chromium/src/base/dir_reader_bsd.h
-new file mode 100644
-index 0000000..3fc1a87
---- /dev/null
-+++ ipc/chromium/src/base/dir_reader_bsd.h
-@@ -0,0 +1,112 @@
-+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+// derived from dir_reader_linux.h
-+
-+#ifndef BASE_DIR_READER_BSD_H_
-+#define BASE_DIR_READER_BSD_H_
-+#pragma once
-+
-+#include <dirent.h>
-+#include <errno.h>
-+#include <fcntl.h>
-+#include <stdint.h>
-+#include <unistd.h>
-+
-+#include "base/logging.h"
-+#include "base/eintr_wrapper.h"
-+
-+// See the comments in dir_reader_posix.h about this.
-+
-+namespace base {
-+
-+class DirReaderBSD {
-+ public:
-+ explicit DirReaderBSD(const char* directory_path)
-+#ifdef O_DIRECTORY
-+ : fd_(open(directory_path, O_RDONLY | O_DIRECTORY)),
-+#else
-+ : fd_(open(directory_path, O_RDONLY)),
-+#endif
-+ offset_(0),
-+ size_(0) {
-+ memset(buf_, 0, sizeof(buf_));
-+ }
-+
-+ ~DirReaderBSD() {
-+ if (fd_ >= 0) {
-+ if (HANDLE_EINTR(close(fd_)))
-+ DLOG(ERROR) << "Failed to close directory handle";
-+ }
-+ }
-+
-+ bool IsValid() const {
-+ return fd_ >= 0;
-+ }
-+
-+ // Move to the next entry returning false if the iteration is complete.
-+ bool Next() {
-+ if (size_) {
-+ struct dirent* dirent = reinterpret_cast<struct dirent*>(&buf_[offset_]);
-+#ifdef OS_DRAGONFLY
-+ offset_ += _DIRENT_DIRSIZ(dirent);
-+#else
-+ offset_ += dirent->d_reclen;
-+#endif
-+ }
-+
-+ if (offset_ != size_)
-+ return true;
-+
-+#ifdef OS_OPENBSD
-+ const int r = getdirentries(fd_, buf_, sizeof(buf_), basep_);
-+#else
-+ const int r = getdents(fd_, buf_, sizeof(buf_));
-+#endif
-+ if (r == 0)
-+ return false;
-+ if (r == -1) {
-+#ifdef OS_OPENBSD
-+ DLOG(ERROR) << "getdirentries returned an error: " << errno;
-+#else
-+ DLOG(ERROR) << "getdents returned an error: " << errno;
-+#endif
-+ return false;
-+ }
-+ size_ = r;
-+ offset_ = 0;
-+ return true;
-+ }
-+
-+ const char* name() const {
-+ if (!size_)
-+ return NULL;
-+
-+ const struct dirent* dirent =
-+ reinterpret_cast<const struct dirent*>(&buf_[offset_]);
-+ return dirent->d_name;
-+ }
-+
-+ int fd() const {
-+ return fd_;
-+ }
-+
-+ static bool IsFallback() {
-+ return false;
-+ }
-+
-+ private:
-+ const int fd_;
-+ char buf_[512];
-+#ifdef OS_OPENBSD
-+ off_t *basep_;
-+#endif
-+ size_t offset_, size_;
-+
-+ DISALLOW_COPY_AND_ASSIGN(DirReaderBSD);
-+};
-+
-+} // namespace base
-+
-+#endif // BASE_DIR_READER_BSD_H_
-diff --git ipc/chromium/src/base/dir_reader_posix.h ipc/chromium/src/base/dir_reader_posix.h
-index 9a34492..62b280c 100644
---- ipc/chromium/src/base/dir_reader_posix.h
-+++ ipc/chromium/src/base/dir_reader_posix.h
-@@ -18,16 +18,20 @@
- // seems worse than falling back to enumerating all file descriptors so we will
- // probably never implement this on the Mac.
-
--#if defined(OS_LINUX) && !defined(OS_OPENBSD)
-+#if defined(OS_LINUX)
- #include "base/dir_reader_linux.h"
-+#elif defined(OS_BSD)
-+#include "base/dir_reader_bsd.h"
- #else
- #include "base/dir_reader_fallback.h"
- #endif
-
- namespace base {
-
--#if defined(OS_LINUX) && !defined(OS_OPENBSD)
-+#if defined(OS_LINUX)
- typedef DirReaderLinux DirReaderPosix;
-+#elif defined(OS_BSD)
-+typedef DirReaderBSD DirReaderPosix;
- #else
- typedef DirReaderFallback DirReaderPosix;
- #endif
-$NetBSD: patch-ipc_chromium_src_base_file__util__posix.cc,v 1.2 2012/03/06 12:34:09 ryoon Exp $
-
---- ipc/chromium/src/base/file_util_posix.cc.orig 2011-12-20 23:28:19.000000000 +0000
-+++ ipc/chromium/src/base/file_util_posix.cc
-@@ -31,7 +31,7 @@
- #include "base/time.h"
-
- // FreeBSD/OpenBSD lacks stat64, but its stat handles files >2GB just fine
--#if defined(OS_FREEBSD) || defined(OS_OPENBSD)
-+#ifndef HAVE_STAT64
- #define stat64 stat
- #endif
-
-$NetBSD: patch-ipc_chromium_src_base_message__loop.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- ipc/chromium/src/base/message_loop.cc.orig 2012-02-16 07:40:33.000000000 +0100
-+++ ipc/chromium/src/base/message_loop.cc 2012-02-21 21:24:41.000000000 +0100
-@@ -19,7 +19,7 @@
- #if defined(OS_POSIX)
- #include "base/message_pump_libevent.h"
- #endif
--#if defined(OS_LINUX)
-+#if defined(OS_LINUX) || defined(OS_BSD)
- #ifdef MOZ_WIDGET_GTK2
- #include "base/message_pump_glib.h"
- #endif
-@@ -119,7 +119,7 @@
- if (type_ == TYPE_UI) {
- #if defined(OS_MACOSX)
- pump_ = base::MessagePumpMac::Create();
--#elif defined(OS_LINUX)
-+#elif defined(OS_LINUX) || defined(OS_BSD)
- pump_ = new base::MessagePumpForUI();
- #endif // OS_LINUX
- } else if (type_ == TYPE_IO) {
-$NetBSD: patch-ipc_chromium_src_base_platform__thread.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- ipc/chromium/src/base/platform_thread.h.orig 2011-12-20 23:28:19.000000000 +0000
-+++ ipc/chromium/src/base/platform_thread.h
-@@ -22,9 +22,12 @@ typedef void* PlatformThreadHandle; // HANDLE
- #elif defined(OS_POSIX)
- #include <pthread.h>
- typedef pthread_t PlatformThreadHandle;
--#if defined(OS_LINUX)
-+#if defined(OS_LINUX) || defined(OS_OPENBSD)
- #include <unistd.h>
- typedef pid_t PlatformThreadId;
-+#elif defined(OS_BSD)
-+#include <sys/types.h>
-+typedef lwpid_t PlatformThreadId;
- #elif defined(OS_MACOSX)
- #include <mach/mach.h>
- typedef mach_port_t PlatformThreadId;
-$NetBSD: patch-ipc_chromium_src_base_platform__thread__posix.cc,v 1.4 2012/04/01 15:18:45 ryoon Exp $
-
---- ipc/chromium/src/base/platform_thread_posix.cc.orig 2012-03-13 01:36:53.000000000 +0000
-+++ ipc/chromium/src/base/platform_thread_posix.cc
-@@ -9,16 +9,30 @@
-
- #if defined(OS_MACOSX)
- #include <mach/mach.h>
-+#elif defined(OS_NETBSD)
-+#include <lwp.h>
- #elif defined(OS_LINUX)
- #include <sys/syscall.h>
--#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
- #include <sys/prctl.h>
--#elif !defined(__NetBSD__)
--#include <pthread_np.h>
-+#elif defined(OS_FREEBSD)
-+#include <sys/param.h>
-+#if __FreeBSD_version > 802500
-+#include <sys/thr.h>
-+#else
-+_Pragma("GCC visibility push(default)")
-+extern "C" int thr_self(long *);
-+_Pragma("GCC visibility pop")
-+#endif
- #endif
-+
-+#if !defined(OS_MACOSX)
- #include <unistd.h>
- #endif
-
-+#if defined(OS_BSD) && !defined(OS_NETBSD)
-+#include <pthread_np.h>
-+#endif
-+
- #if defined(OS_MACOSX)
- namespace base {
- void InitThreading();
-@@ -38,9 +45,20 @@ PlatformThreadId PlatformThread::CurrentId() {
- // into the kernel.
- #if defined(OS_MACOSX)
- return mach_thread_self();
--#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
-+#elif defined(OS_NETBSD)
-+ return _lwp_self();
-+#elif defined(OS_DRAGONFLY)
-+ return lwp_gettid();
-+#elif defined(OS_FREEBSD)
-+# if __FreeBSD_version > 900030
-+ return pthread_getthreadid_np();
-+# else
-+ long lwpid;
-+ thr_self(&lwpid);
-+ return lwpid;
-+# endif
-+#elif defined(OS_OPENBSD)
-- // TODO(BSD): find a better thread ID
-- return (intptr_t)(pthread_self());
-+ return (intptr_t) (pthread_self());
- #elif defined(OS_LINUX)
- return syscall(__NR_gettid);
- #endif
-@@ -102,9 +102,9 @@ void PlatformThread::SetName(const char* name) {
- // Note that glibc also has a 'pthread_setname_np' api, but it may not be
- // available everywhere and it's only benefit over using prctl directly is
- // that it can set the name of threads other than the current thread.
--#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
-+#if defined(OS_BSD) && !defined(OS_NETBSD)
- pthread_set_name_np(pthread_self(), name);
--#elif defined(__NetBSD__)
-+#elif defined(OS_NETBSD)
- pthread_setname_np(pthread_self(), "%s", (void *)name);
- #else
- prctl(PR_SET_NAME, reinterpret_cast<uintptr_t>(name), 0, 0, 0);
-$NetBSD: patch-ipc_chromium_src_base_process__util.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- ipc/chromium/src/base/process_util.h.orig 2011-12-21 00:28:19.000000000 +0100
-+++ ipc/chromium/src/base/process_util.h 2012-01-31 13:14:54.000000000 +0100
-@@ -280,6 +280,7 @@ class NamedProcessIterator {
- const ProcessEntry* NextProcessEntry();
-
- private:
-+#if !defined(OS_BSD)
- // Determines whether there's another process (regardless of executable)
- // left in the list of all processes. Returns true and sets entry_ to
- // that process's info if there is one, false otherwise.
-@@ -292,18 +292,24 @@
- void InitProcessEntry(ProcessEntry* entry);
-
- std::wstring executable_name_;
-+#endif
-
- #if defined(OS_WIN)
- HANDLE snapshot_;
- bool started_iteration_;
- #elif defined(OS_LINUX)
- DIR *procfs_dir_;
-+#elif defined(OS_BSD)
-+ std::vector<ProcessEntry> content;
-+ size_t nextEntry;
- #elif defined(OS_MACOSX)
- std::vector<kinfo_proc> kinfo_procs_;
- size_t index_of_kinfo_proc_;
- #endif
-+#if !defined(OS_BSD)
- ProcessEntry entry_;
- const ProcessFilter* filter_;
-+#endif
-
- DISALLOW_EVIL_CONSTRUCTORS(NamedProcessIterator);
- };
-$NetBSD: patch-ipc_chromium_src_base_process__util__bsd.cc,v 1.4 2012/04/01 15:18:45 ryoon Exp $
-
---- ipc/chromium/src/base/process_util_bsd.cc.orig 2012-04-01 00:04:28.000000000 +0000
-+++ ipc/chromium/src/base/process_util_bsd.cc
-@@ -0,0 +1,367 @@
-+// Copyright (c) 2008 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+// derived from process_util_linux.cc and process_util_mac.cc
-+
-+#include "base/process_util.h"
-+
-+#include <sys/param.h>
-+#include <sys/sysctl.h>
-+#include <sys/wait.h>
-+#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD)
-+#include <sys/user.h>
-+#endif
-+
-+#include <ctype.h>
-+#include <fcntl.h>
-+#include <kvm.h>
-+#include <unistd.h>
-+
-+#include <string>
-+
-+#include "base/debug_util.h"
-+#include "base/eintr_wrapper.h"
-+#include "base/file_util.h"
-+#include "base/logging.h"
-+#include "base/string_tokenizer.h"
-+#include "base/string_util.h"
-+
-+#if (defined(_POSIX_SPAWN) && _POSIX_SPAWN > 0) \
-+ || (defined(OS_NETBSD) && __NetBSD_Version__ >= 599006500)
-+#define HAVE_POSIX_SPAWN 1
-+#endif
-+
-+/*
-+ * On platforms that are not gonk based, we fall back to an arbitrary
-+ * UID. This is generally the UID for user `nobody', albeit it is not
-+ * always the case.
-+ */
-+
-+#if defined(OS_NETBSD) || defined(OS_OPENBSD)
-+# define CHILD_UNPRIVILEGED_UID 32767
-+# define CHILD_UNPRIVILEGED_GID 32767
-+#else
-+# define CHILD_UNPRIVILEGED_UID 65534
-+# define CHILD_UNPRIVILEGED_GID 65534
-+#endif
-+
-+#ifndef __dso_public
-+# ifdef __exported
-+# define __dso_public __exported
-+# else
-+# define __dso_public __attribute__((__visibility__("default")))
-+# endif
-+#endif
-+
-+#ifdef HAVE_POSIX_SPAWN
-+#include <spawn.h>
-+extern "C" char **environ __dso_public;
-+#endif
-+
-+namespace {
-+
-+enum ParsingState {
-+ KEY_NAME,
-+ KEY_VALUE
-+};
-+
-+static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG");
-+
-+} // namespace
-+
-+namespace base {
-+
-+#ifdef HAVE_POSIX_SPAWN
-+
-+void FreeEnvVarsArray(char* array[], int length)
-+{
-+ for (int i = 0; i < length; i++) {
-+ free(array[i]);
-+ }
-+ delete[] array;
-+}
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ bool wait, ProcessHandle* process_handle) {
-+ return LaunchApp(argv, fds_to_remap, environment_map(),
-+ wait, process_handle);
-+}
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ const environment_map& env_vars_to_set,
-+ bool wait, ProcessHandle* process_handle,
-+ ProcessArchitecture arch) {
-+ return LaunchApp(argv, fds_to_remap, env_vars_to_set,
-+ SAME_PRIVILEGES_AS_PARENT,
-+ wait, process_handle);
-+}
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ const environment_map& env_vars_to_set,
-+ ChildPrivileges privs,
-+ bool wait, ProcessHandle* process_handle,
-+ ProcessArchitecture arch) {
-+ bool retval = true;
-+
-+ char* argv_copy[argv.size() + 1];
-+ for (size_t i = 0; i < argv.size(); i++) {
-+ argv_copy[i] = const_cast<char*>(argv[i].c_str());
-+ }
-+ argv_copy[argv.size()] = NULL;
-+
-+ // Make sure we don't leak any FDs to the child process by marking all FDs
-+ // as close-on-exec.
-+ SetAllFDsToCloseOnExec();
-+
-+ // Copy environment to a new char array and add the variables
-+ // in env_vars_to_set.
-+ // Existing variables are overwritten by env_vars_to_set.
-+ int pos = 0;
-+ environment_map combined_env_vars = env_vars_to_set;
-+ while(environ[pos] != NULL) {
-+ std::string varString = environ[pos];
-+ std::string varName = varString.substr(0, varString.find_first_of('='));
-+ std::string varValue = varString.substr(varString.find_first_of('=') + 1);
-+ if (combined_env_vars.find(varName) == combined_env_vars.end()) {
-+ combined_env_vars[varName] = varValue;
-+ }
-+ pos++;
-+ }
-+ int varsLen = combined_env_vars.size() + 1;
-+
-+ char** vars = new char*[varsLen];
-+ int i = 0;
-+ for (environment_map::const_iterator it = combined_env_vars.begin();
-+ it != combined_env_vars.end(); ++it) {
-+ std::string entry(it->first);
-+ entry += "=";
-+ entry += it->second;
-+ vars[i] = strdup(entry.c_str());
-+ i++;
-+ }
-+ vars[i] = NULL;
-+
-+ posix_spawn_file_actions_t file_actions;
-+ if (posix_spawn_file_actions_init(&file_actions) != 0) {
-+ FreeEnvVarsArray(vars, varsLen);
-+ return false;
-+ }
-+
-+ // Turn fds_to_remap array into a set of dup2 calls.
-+ for (file_handle_mapping_vector::const_iterator it = fds_to_remap.begin();
-+ it != fds_to_remap.end();
-+ ++it) {
-+ int src_fd = it->first;
-+ int dest_fd = it->second;
-+
-+ if (src_fd == dest_fd) {
-+ int flags = fcntl(src_fd, F_GETFD);
-+ if (flags != -1) {
-+ fcntl(src_fd, F_SETFD, flags & ~FD_CLOEXEC);
-+ }
-+ } else {
-+ if (posix_spawn_file_actions_adddup2(&file_actions, src_fd, dest_fd) != 0) {
-+ posix_spawn_file_actions_destroy(&file_actions);
-+ FreeEnvVarsArray(vars, varsLen);
-+ return false;
-+ }
-+ }
-+ }
-+
-+ pid_t pid = 0;
-+ int spawn_succeeded = (posix_spawnp(&pid,
-+ argv_copy[0],
-+ &file_actions,
-+ NULL,
-+ argv_copy,
-+ vars) == 0);
-+
-+ FreeEnvVarsArray(vars, varsLen);
-+
-+ posix_spawn_file_actions_destroy(&file_actions);
-+
-+ bool process_handle_valid = pid > 0;
-+ if (!spawn_succeeded || !process_handle_valid) {
-+ retval = false;
-+ } else {
-+ if (wait)
-+ HANDLE_EINTR(waitpid(pid, 0, 0));
-+
-+ if (process_handle)
-+ *process_handle = pid;
-+ }
-+
-+ return retval;
-+}
-+
-+bool LaunchApp(const CommandLine& cl,
-+ bool wait, bool start_hidden, ProcessHandle* process_handle) {
-+ // TODO(playmobil): Do we need to respect the start_hidden flag?
-+ file_handle_mapping_vector no_files;
-+ return LaunchApp(cl.argv(), no_files, wait, process_handle);
-+}
-+
-+#else // no posix_spawn, use fork/exec
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ bool wait, ProcessHandle* process_handle) {
-+ return LaunchApp(argv, fds_to_remap, environment_map(),
-+ wait, process_handle);
-+}
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ const environment_map& env_vars_to_set,
-+ bool wait, ProcessHandle* process_handle,
-+ ProcessArchitecture arch) {
-+ return LaunchApp(argv, fds_to_remap, env_vars_to_set,
-+ SAME_PRIVILEGES_AS_PARENT,
-+ wait, process_handle);
-+}
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ const environment_map& env_vars_to_set,
-+ ChildPrivileges privs,
-+ bool wait, ProcessHandle* process_handle,
-+ ProcessArchitecture arch) {
-+ scoped_array<char*> argv_cstr(new char*[argv.size() + 1]);
-+ // Illegal to allocate memory after fork and before execvp
-+ InjectiveMultimap fd_shuffle1, fd_shuffle2;
-+ fd_shuffle1.reserve(fds_to_remap.size());
-+ fd_shuffle2.reserve(fds_to_remap.size());
-+
-+ pid_t pid = fork();
-+ if (pid < 0)
-+ return false;
-+
-+ if (pid == 0) {
-+ for (file_handle_mapping_vector::const_iterator
-+ it = fds_to_remap.begin(); it != fds_to_remap.end(); ++it) {
-+ fd_shuffle1.push_back(InjectionArc(it->first, it->second, false));
-+ fd_shuffle2.push_back(InjectionArc(it->first, it->second, false));
-+ }
-+
-+ if (!ShuffleFileDescriptors(&fd_shuffle1))
-+ _exit(127);
-+
-+ CloseSuperfluousFds(fd_shuffle2);
-+
-+ for (size_t i = 0; i < argv.size(); i++)
-+ argv_cstr[i] = const_cast<char*>(argv[i].c_str());
-+ argv_cstr[argv.size()] = NULL;
-+
-+ if (privs == UNPRIVILEGED) {
-+ if (setgid(CHILD_UNPRIVILEGED_GID) != 0) {
-+ DLOG(ERROR) << "FAILED TO setgid() CHILD PROCESS, path: " << argv_cstr[0];
-+ _exit(127);
-+ }
-+ if (setuid(CHILD_UNPRIVILEGED_UID) != 0) {
-+ DLOG(ERROR) << "FAILED TO setuid() CHILD PROCESS, path: " << argv_cstr[0];
-+ _exit(127);
-+ }
-+ if (chdir("/") != 0)
-+ gProcessLog.print("==> could not chdir()\n");
-+ }
-+
-+ for (environment_map::const_iterator it = env_vars_to_set.begin();
-+ it != env_vars_to_set.end(); ++it) {
-+ if (setenv(it->first.c_str(), it->second.c_str(), 1/*overwrite*/))
-+ _exit(127);
-+ }
-+ execv(argv_cstr[0], argv_cstr.get());
-+ // if we get here, we're in serious trouble and should complain loudly
-+ DLOG(ERROR) << "FAILED TO exec() CHILD PROCESS, path: " << argv_cstr[0];
-+ _exit(127);
-+ } else {
-+ gProcessLog.print("==> process %d launched child process %d\n",
-+ GetCurrentProcId(), pid);
-+ if (wait)
-+ HANDLE_EINTR(waitpid(pid, 0, 0));
-+
-+ if (process_handle)
-+ *process_handle = pid;
-+ }
-+
-+ return true;
-+}
-+
-+bool LaunchApp(const CommandLine& cl,
-+ bool wait, bool start_hidden,
-+ ProcessHandle* process_handle) {
-+ file_handle_mapping_vector no_files;
-+ return LaunchApp(cl.argv(), no_files, wait, process_handle);
-+}
-+
-+#endif
-+
-+NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
-+ const ProcessFilter* filter)
-+{
-+ int numEntries;
-+ kvm_t *kvm;
-+ std::string exe(WideToASCII(executable_name));
-+
-+#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD)
-+ kvm = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL);
-+ struct kinfo_proc* procs = kvm_getprocs(kvm, KERN_PROC_UID, getuid(), &numEntries);
-+ if (procs != NULL && numEntries > 0) {
-+ for (int i = 0; i < numEntries; i++) {
-+# if defined(OS_DRAGONFLY)
-+ if (exe != procs[i].kp_comm) continue;
-+ if (filter && !filter->Includes(procs[i].kp_pid, procs[i].kp_ppid)) continue;
-+ ProcessEntry e;
-+ e.pid = procs[i].kp_pid;
-+ e.ppid = procs[i].kp_ppid;
-+ strlcpy(e.szExeFile, procs[i].kp_comm, sizeof e.szExeFile);
-+ content.push_back(e);
-+# elif defined(OS_FREEBSD)
-+ if (exe != procs[i].ki_comm) continue;
-+ if (filter && !filter->Includes(procs[i].ki_pid, procs[i].ki_ppid)) continue;
-+ ProcessEntry e;
-+ e.pid = procs[i].ki_pid;
-+ e.ppid = procs[i].ki_ppid;
-+ strlcpy(e.szExeFile, procs[i].ki_comm, sizeof e.szExeFile);
-+ content.push_back(e);
-+# endif
-+#else
-+ kvm = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, NULL);
-+#if defined(OS_OPENBSD)
-+ struct kinfo_proc* procs = kvm_getprocs(kvm, KERN_PROC_UID, getuid(), sizeof(struct kinfo_proc), &numEntries);
-+#else
-+ struct kinfo_proc2* procs = kvm_getproc2(kvm, KERN_PROC_UID, getuid(), sizeof(struct kinfo_proc2), &numEntries);
-+#endif
-+ if (procs != NULL && numEntries > 0) {
-+ for (int i = 0; i < numEntries; i++) {
-+ if (exe != procs[i].p_comm) continue;
-+ if (filter && !filter->Includes(procs[i].p_pid, procs[i].p_ppid)) continue;
-+ ProcessEntry e;
-+ e.pid = procs[i].p_pid;
-+ e.ppid = procs[i].p_ppid;
-+ strlcpy(e.szExeFile, procs[i].p_comm, sizeof e.szExeFile);
-+ content.push_back(e);
-+#endif
-+ }
-+ }
-+ nextEntry = 0;
-+ kvm_close(kvm);
-+}
-+
-+NamedProcessIterator::~NamedProcessIterator() {
-+}
-+
-+const ProcessEntry* NamedProcessIterator::NextProcessEntry() {
-+ if (nextEntry >= content.size()) return NULL;
-+ return &content[nextEntry++];
-+}
-+
-+bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
-+ return false;
-+}
-+
-+} // namespace base
-$NetBSD: patch-ipc_chromium_src_base_process__util__posix.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- ipc/chromium/src/base/process_util_posix.cc.orig 2011-12-20 23:28:19.000000000 +0000
-+++ ipc/chromium/src/base/process_util_posix.cc
-@@ -116,6 +116,11 @@ void CloseSuperfluousFds(const base::Inj
- #elif defined(OS_MACOSX)
- static const rlim_t kSystemDefaultMaxFds = 256;
- static const char kFDDir[] = "/dev/fd";
-+#elif defined(OS_BSD)
-+ // the getrlimit below should never fail, so whatever ..
-+ static const rlim_t kSystemDefaultMaxFds = 1024;
-+ // at least /dev/fd will exist
-+ static const char kFDDir[] = "/dev/fd";
- #endif
-
- // Get the maximum number of FDs possible.
-@@ -199,7 +204,7 @@ void CloseSuperfluousFds(const base::Inj
- void SetAllFDsToCloseOnExec() {
- #if defined(OS_LINUX)
- const char fd_dir[] = "/proc/self/fd";
--#elif defined(OS_MACOSX)
-+#elif defined(OS_MACOSX) || defined(OS_BSD)
- const char fd_dir[] = "/dev/fd";
- #endif
- ScopedDIR dir_closer(opendir(fd_dir));
-$NetBSD: patch-ipc_chromium_src_base_sys__info__posix.cc,v 1.2 2011/11/27 13:09:00 tnn Exp $
-
---- ipc/chromium/src/base/sys_info_posix.cc.orig 2011-11-04 21:34:00.000000000 +0000
-+++ ipc/chromium/src/base/sys_info_posix.cc
-@@ -18,6 +18,11 @@
- #include <mach/mach_init.h>
- #endif
-
-+#if defined(OS_NETBSD)
-+#include <sys/param.h>
-+#include <sys/sysctl.h>
-+#endif
-+
- #include "base/logging.h"
- #include "base/string_util.h"
-
-@@ -26,7 +31,11 @@ namespace base {
- int SysInfo::NumberOfProcessors() {
- // It seems that sysconf returns the number of "logical" processors on both
- // mac and linux. So we get the number of "online logical" processors.
-+#ifdef _SC_NPROCESSORS_ONLN
- static long res = sysconf(_SC_NPROCESSORS_ONLN);
-+#else
-+ static long res = 1;
-+#endif
- if (res == -1) {
- NOTREACHED();
- return 1;
-@@ -52,6 +61,20 @@ int64 SysInfo::AmountOfPhysicalMemory()
- }
-
- return static_cast<int64>(hostinfo.max_mem);
-+#elif defined(OS_NETBSD)
-+ int mib[2];
-+ int rc;
-+ int64_t memSize;
-+ size_t len = sizeof(memSize);
-+
-+ mib[0] = CTL_HW;
-+ mib[1] = HW_PHYSMEM64;
-+ rc = sysctl( mib, 2, &memSize, &len, NULL, 0 );
-+ if (-1 != rc) {
-+ return memSize;
-+ }
-+ return 0;
-+
- #else
- long pages = sysconf(_SC_PHYS_PAGES);
- long page_size = sysconf(_SC_PAGE_SIZE);
-diff --git ipc/chromium/src/base/time_posix.cc ipc/chromium/src/base/time_posix.cc
-index abf2a56..48791f6 100644
---- ipc/chromium/src/base/time_posix.cc
-+++ ipc/chromium/src/base/time_posix.cc
-@@ -167,7 +167,7 @@ TimeTicks TimeTicks::Now() {
- // With numer and denom = 1 (the expected case), the 64-bit absolute time
- // reported in nanoseconds is enough to last nearly 585 years.
-
--#elif defined(__OpenBSD__) || defined(OS_POSIX) && \
-+#elif defined(OS_OPENBSD) || defined(OS_POSIX) && \
- defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0
-
- struct timespec ts;
-$NetBSD: patch-ipc_chromium_src_build_build__config.h,v 1.4 2012/04/01 15:18:45 ryoon Exp $
-
---- ipc/chromium/src/build/build_config.h.orig 2012-03-13 01:36:53.000000000 +0000
-+++ ipc/chromium/src/build/build_config.h
-@@ -19,6 +19,12 @@
- #define OS_MACOSX 1
- #elif defined(__linux__) || defined(ANDROID)
- #define OS_LINUX 1
-+#elif defined(__DragonFly__)
-+#define OS_DRAGONFLY 1
-+#elif defined(__FreeBSD__)
-+#define OS_FREEBSD 1
-+#elif defined(__NetBSD__)
-+#define OS_NETBSD 1
- #elif defined(__OpenBSD__)
- #define OS_OPENBSD 1
- #elif defined(_WIN32)
-@@ -27,9 +33,16 @@
- #error Please add support for your platform in build/build_config.h
- #endif
-
-+// For access to standard BSD features, use OS_BSD instead of a
-+// more specific macro.
-+#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD) \
-+ || defined(OS_NETBSD) || defined(OS_OPENBSD)
-+#define OS_BSD 1
-+#endif
-+
- // For access to standard POSIX features, use OS_POSIX instead of a more
- // specific macro.
--#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_OPENBSD)
-+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD)
- #define OS_POSIX 1
- #endif
-
-diff --git ipc/chromium/src/chrome/common/ipc_channel_posix.cc ipc/chromium/src/chrome/common/ipc_channel_posix.cc
-index bd866ee..2ea5b19 100644
---- ipc/chromium/src/chrome/common/ipc_channel_posix.cc
-+++ ipc/chromium/src/chrome/common/ipc_channel_posix.cc
-@@ -7,6 +7,7 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <stddef.h>
-+#include <unistd.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <sys/stat.h>
-$NetBSD: patch-ipc_chromium_src_chrome_common_ipc__channel__posix.h,v 1.1 2011/07/11 12:46:14 tnn Exp $
-
---- ipc/chromium/src/chrome/common/ipc_channel_posix.h.orig 2011-06-15 21:57:27.000000000 +0000
-+++ ipc/chromium/src/chrome/common/ipc_channel_posix.h
-@@ -92,7 +92,7 @@ class Channel::ChannelImpl : public Mess
- };
-
- // This is a control message buffer large enough to hold kMaxReadFDs
--#if defined(OS_MACOSX)
-+#if defined(OS_MACOSX) || defined(OS_NETBSD)
- // TODO(agl): OSX appears to have non-constant CMSG macros!
- char input_cmsg_buf_[1024];
- #else
-$NetBSD: patch-ipc_chromium_src_chrome_common_ipc__message__utils.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- ipc/chromium/src/chrome/common/ipc_message_utils.h.orig 2011-12-20 23:28:19.000000000 +0000
-+++ ipc/chromium/src/chrome/common/ipc_message_utils.h
-@@ -195,7 +195,7 @@
- };
- #endif
-
--#if !(defined(OS_MACOSX) || defined(OS_OPENBSD) || defined(OS_WIN) || (defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)) || defined(ARCH_CPU_S390))
-+#if !(defined(OS_MACOSX) || defined(OS_OPENBSD) || defined(OS_WIN) || ((defined(OS_BSD) || defined(OS_LINUX)) && defined(ARCH_CPU_64_BITS)) || defined(ARCH_CPU_S390))
- // There size_t is a synonym for |unsigned long| ...
- template <>
- struct ParamTraits<size_t> {
-@@ -248,7 +248,7 @@
- };
- #endif // defined(OS_MACOSX)
-
--#if !(defined(OS_LINUX) && defined(ARCH_CPU_64_BITS))
-+#if !((defined(OS_BSD) || defined(OS_LINUX)) && defined(ARCH_CPU_64_BITS))
- // int64 is |long int| on 64-bit systems, uint64 is |unsigned long|
- template <>
- struct ParamTraits<int64> {
-$NetBSD: patch-ipc_chromium_src_chrome_common_transport__dib.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- ipc/chromium/src/chrome/common/transport_dib.h.orig 2011-12-20 23:28:19.000000000 +0000
-+++ ipc/chromium/src/chrome/common/transport_dib.h
-@@ -7,7 +7,7 @@
-
- #include "base/basictypes.h"
-
--#if defined(OS_WIN) || defined(OS_MACOSX)
-+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_BSD)
- #include "base/shared_memory.h"
- #endif
-
-@@ -66,7 +66,7 @@ class TransportDIB {
- uint32 sequence_num;
- };
- typedef HandleAndSequenceNum Id;
--#elif defined(OS_MACOSX)
-+#elif defined(OS_MACOSX) || defined(OS_BSD)
- typedef base::SharedMemoryHandle Handle;
- // On Mac, the inode number of the backing file is used as an id.
- typedef base::SharedMemoryId Id;
-@@ -108,7 +108,7 @@ class TransportDIB {
-
- private:
- TransportDIB();
--#if defined(OS_WIN) || defined(OS_MACOSX)
-+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_BSD)
- explicit TransportDIB(base::SharedMemoryHandle dib);
- base::SharedMemory shared_memory_;
- uint32 sequence_num_;
-$NetBSD: patch-ipc_glue_GeckoChildProcessHost.cpp,v 1.2 2012/03/15 08:30:06 ryoon Exp $
-
---- ipc/glue/GeckoChildProcessHost.cpp.orig 2011-12-20 23:28:19.000000000 +0000
-+++ ipc/glue/GeckoChildProcessHost.cpp
-@@ -430,7 +430,7 @@
- // and passing wstrings from one config to the other is unsafe. So
- // we split the logic here.
-
--#if defined(OS_LINUX) || defined(OS_MACOSX)
-+#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD)
- base::environment_map newEnvVars;
- // XPCOM may not be initialized in some subprocesses. We don't want
- // to initialize XPCOM just for the directory service, especially
-@@ -445,8 +445,8 @@
- if (NS_SUCCEEDED(rv)) {
- nsCString path;
- greDir->GetNativePath(path);
--# ifdef OS_LINUX
--# ifdef MOZ_WIDGET_ANDROID
-+# if defined(OS_LINUX) || defined(OS_BSD)
-+# if defined(MOZ_WIDGET_ANDROID) || defined(OS_BSD)
- path += "/lib";
- # endif // MOZ_WIDGET_ANDROID
- const char *ld_library_path = PR_GetEnv("LD_LIBRARY_PATH");
-@@ -557,7 +557,7 @@
- childArgv.push_back(pidstring);
-
- #if defined(MOZ_CRASHREPORTER)
--# if defined(OS_LINUX)
-+# if defined(OS_LINUX) || defined(OS_BSD)
- int childCrashFd, childCrashRemapFd;
- if (!CrashReporter::CreateNotificationPipeForChild(
- &childCrashFd, &childCrashRemapFd))
-@@ -594,7 +594,7 @@
- #endif
-
- base::LaunchApp(childArgv, mFileMap,
--#if defined(OS_LINUX) || defined(OS_MACOSX)
-+#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD)
- newEnvVars, privs,
- #endif
- false, &process, arch);
-diff --git ipc/glue/SharedMemorySysV.h ipc/glue/SharedMemorySysV.h
-index f37998d..b05dc7b 100644
---- ipc/glue/SharedMemorySysV.h
-+++ ipc/glue/SharedMemorySysV.h
-@@ -8,7 +8,7 @@
- #ifndef mozilla_ipc_SharedMemorySysV_h
- #define mozilla_ipc_SharedMemorySysV_h
-
--#if defined(OS_LINUX) && !defined(ANDROID)
-+#if (defined(OS_LINUX) && !defined(ANDROID)) || defined(OS_BSD)
-
- // SysV shared memory isn't available on Windows, but we define the
- // following macro so that #ifdefs are clearer (compared to #ifdef
-$NetBSD: patch-mm,v 1.13 2012/06/05 18:09:21 ryoon Exp $
-
---- toolkit/library/Makefile.in.orig 2012-05-23 18:57:09.000000000 +0000
-+++ toolkit/library/Makefile.in
-@@ -534,6 +538,12 @@ EXTRA_DSO_LDOPTS += -lelf -ldemangle
- endif
- endif
-
-+ifneq (,$(filter DragonFly FreeBSD NetBSD OpenBSD,$(OS_ARCH)))
-+OS_LIBS += $(call EXPAND_LIBNAME,kvm)
-+# keep `environ' unresolved, see bug 14426 for binutils
-+EXTRA_DSO_LDOPTS += -Wl,--warn-unresolved-symbols
-+endif
-+
- ifeq ($(OS_ARCH),WINNT)
- OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 version winspool comdlg32 imm32 msimg32 shlwapi psapi ws2_32 dbghelp rasapi32 rasdlg iphlpapi uxtheme setupapi secur32 sensorsapi portabledeviceguids windowscodecs wininet)
- ifdef ACCESSIBILITY
diff --git a/www/firefox/files/patch-bug783505 b/www/firefox/files/patch-bug783505
new file mode 100644
index 000000000000..ab4ebe941457
--- /dev/null
+++ b/www/firefox/files/patch-bug783505
@@ -0,0 +1,52 @@
+commit b5f97ee
+Author: Rafael Ávila de Espíndola <respindola@mozilla.com>
+Date: Mon Aug 20 10:28:08 2012 -0400
+
+ Bug 783505 - OS X gcc builds failing. r=jorendorff.
+ This patch adds a workaround for
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39608
+---
+ js/src/jstypedarray.cpp | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git js/src/jstypedarray.cpp js/src/jstypedarray.cpp
+index 1eaeea0..1957086 100644
+--- js/src/jstypedarray.cpp
++++ js/src/jstypedarray.cpp
+@@ -1423,8 +1423,14 @@ class TypedArrayTemplate
+ Getter(JSContext *cx, unsigned argc, Value *vp)
+ {
+ CallArgs args = CallArgsFromVp(argc, vp);
++ // FIXME: Hack to keep us building with gcc 4.2. Remove this once we
++ // drop support for gcc 4.2. See bug 783505 for the details.
++#if !defined(__clang__) && defined(__GNUC__) && __GNUC_MINOR__ <= 2
++ return CallNonGenericMethod(cx, IsThisClass, GetterImpl<ValueGetter>, args);
++#else
+ return CallNonGenericMethod<ThisTypeArray::IsThisClass,
+ ThisTypeArray::GetterImpl<ValueGetter> >(cx, args);
++#endif
+ }
+
+ // Define an accessor for a read-only property that invokes a native getter
+--- build/autoconf/gcc-pr39608.m4~
++++ build/autoconf/gcc-pr39608.m4
+@@ -31,7 +31,6 @@ AC_LANG_RESTORE
+
+ AC_MSG_RESULT($ac_have_gcc_pr39608)
+ if test "$ac_have_gcc_pr39608" = "yes"; then
+- echo This compiler would fail to build firefox, plase upgrade.
+- exit 1
++ echo This compiler may fail to build firefox, plase upgrade.
+ fi
+ ])
+--- js/src/build/autoconf/gcc-pr39608.m4~
++++ js/src/build/autoconf/gcc-pr39608.m4
+@@ -31,7 +31,6 @@ AC_LANG_RESTORE
+
+ AC_MSG_RESULT($ac_have_gcc_pr39608)
+ if test "$ac_have_gcc_pr39608" = "yes"; then
+- echo This compiler would fail to build firefox, plase upgrade.
+- exit 1
++ echo This compiler may fail to build firefox, plase upgrade.
+ fi
+ ])
diff --git a/www/firefox/files/patch-bug787804 b/www/firefox/files/patch-bug787804
new file mode 100644
index 000000000000..fd15771519d9
--- /dev/null
+++ b/www/firefox/files/patch-bug787804
@@ -0,0 +1,3557 @@
+commit 74997f1
+Author: Jan Varga <jan.varga@gmail.com>
+Date: Mon Dec 17 20:25:10 2012 +0100
+
+ Bug 787804 - Rewrite quota handling (eliminate test_quota.c). r=bent,asuth,vladan
+---
+ db/sqlite3/README.MOZILLA | 4 +-
+ db/sqlite3/src/sqlite.def | 1 +
+ db/sqlite3/src/test_quota.c | 2001 --------------------
+ db/sqlite3/src/test_quota.h | 274 ---
+ dom/Makefile.in | 1 +
+ dom/dom-config.mk | 1 +
+ dom/file/FileStreamWrappers.cpp | 11 -
+ dom/file/LockedFile.cpp | 8 +-
+ dom/file/nsIFileStorage.h | 40 +-
+ dom/indexedDB/FileManager.cpp | 33 +-
+ dom/indexedDB/FileManager.h | 20 +-
+ dom/indexedDB/FileStream.cpp | 321 ----
+ dom/indexedDB/FileStream.h | 140 --
+ dom/indexedDB/IDBDatabase.cpp | 6 +
+ dom/indexedDB/IDBFactory.cpp | 28 +-
+ dom/indexedDB/IDBFactory.h | 8 +-
+ dom/indexedDB/IDBFileHandle.cpp | 25 +-
+ dom/indexedDB/IDBObjectStore.cpp | 10 +-
+ dom/indexedDB/IDBTransaction.cpp | 3 +-
+ dom/indexedDB/IndexedDatabaseInlines.h | 13 +
+ dom/indexedDB/IndexedDatabaseManager.cpp | 162 +-
+ dom/indexedDB/IndexedDatabaseManager.h | 11 +-
+ dom/indexedDB/Makefile.in | 2 -
+ dom/indexedDB/OpenDatabaseHelper.cpp | 104 +-
+ dom/indexedDB/OpenDatabaseHelper.h | 12 +-
+ dom/indexedDB/nsIStandardFileStream.idl | 60 -
+ dom/indexedDB/test/Makefile.in | 2 +
+ dom/indexedDB/test/file.js | 21 +-
+ dom/indexedDB/test/test_file_quota.html | 14 +-
+ dom/indexedDB/test/test_filehandle_quota.html | 5 +-
+ dom/quota/FileStreams.cpp | 123 ++
+ dom/quota/FileStreams.h | 115 ++
+ dom/quota/Makefile.in | 33 +
+ dom/quota/QuotaCommon.h | 23 +
+ dom/quota/QuotaManager.cpp | 294 +++
+ dom/quota/QuotaManager.h | 147 ++
+ layout/build/Makefile.in | 1 +
+ netwerk/base/src/Makefile.in | 1 +
+ netwerk/base/src/nsFileStreams.cpp | 103 +-
+ netwerk/base/src/nsFileStreams.h | 12 +-
+ storage/public/Makefile.in | 1 -
+ storage/public/mozIStorageService.idl | 13 +-
+ .../public/mozIStorageServiceQuotaManagement.idl | 99 -
+ storage/public/storage.h | 1 -
+ storage/src/TelemetryVFS.cpp | 35 +-
+ storage/src/mozStorageConnection.cpp | 85 +-
+ storage/src/mozStorageConnection.h | 27 +-
+ storage/src/mozStorageService.cpp | 168 +-
+ storage/src/mozStorageService.h | 3 -
+ toolkit/toolkit-makefiles.sh | 1 +
+ 50 files changed, 1239 insertions(+), 3387 deletions(-)
+
+diff --git dom/Makefile.in dom/Makefile.in
+index 672e065..47cd253 100644
+--- dom/Makefile.in
++++ dom/Makefile.in
+@@ -58,6 +58,7 @@ PARALLEL_DIRS += \
+ media \
+ messages \
+ power \
++ quota \
+ settings \
+ sms \
+ mms \
+diff --git dom/dom-config.mk dom/dom-config.mk
+index d0f46cc..1cf57ed 100644
+--- dom/dom-config.mk
++++ dom/dom-config.mk
+@@ -8,6 +8,7 @@ DOM_SRCDIRS = \
+ dom/encoding \
+ dom/file \
+ dom/power \
++ dom/quota \
+ dom/media \
+ dom/network/src \
+ dom/settings \
+diff --git dom/file/FileStreamWrappers.cpp dom/file/FileStreamWrappers.cpp
+index 2283266..c4cf102 100644
+--- dom/file/FileStreamWrappers.cpp
++++ dom/file/FileStreamWrappers.cpp
+@@ -8,7 +8,6 @@
+
+ #include "nsIFileStorage.h"
+ #include "nsISeekableStream.h"
+-#include "nsIStandardFileStream.h"
+ #include "mozilla/Attributes.h"
+
+ #include "FileHelper.h"
+@@ -246,16 +245,6 @@ FileOutputStreamWrapper::Close()
+ nsresult rv = NS_OK;
+
+ if (!mFirstTime) {
+- // We must flush buffers of the stream on the same thread on which we wrote
+- // some data.
+- nsCOMPtr<nsIStandardFileStream> sstream = do_QueryInterface(mFileStream);
+- if (sstream) {
+- rv = sstream->FlushBuffers();
+- if (NS_FAILED(rv)) {
+- NS_WARNING("Failed to flush buffers of the stream!");
+- }
+- }
+-
+ NS_ASSERTION(PR_GetCurrentThread() == mWriteThread,
+ "Unsetting thread locals on wrong thread!");
+ mFileHelper->mFileStorage->UnsetThreadLocals();
+diff --git dom/file/LockedFile.cpp dom/file/LockedFile.cpp
+index 0fca730..926df91 100644
+--- dom/file/LockedFile.cpp
++++ dom/file/LockedFile.cpp
+@@ -953,10 +953,10 @@ FinishHelper::Run()
+ }
+
+ for (uint32_t index = 0; index < mParallelStreams.Length(); index++) {
+- nsCOMPtr<nsIOutputStream> ostream =
++ nsCOMPtr<nsIInputStream> stream =
+ do_QueryInterface(mParallelStreams[index]);
+
+- if (NS_FAILED(ostream->Close())) {
++ if (NS_FAILED(stream->Close())) {
+ NS_WARNING("Failed to close stream!");
+ }
+
+@@ -964,9 +964,9 @@ FinishHelper::Run()
+ }
+
+ if (mStream) {
+- nsCOMPtr<nsIOutputStream> ostream = do_QueryInterface(mStream);
++ nsCOMPtr<nsIInputStream> stream = do_QueryInterface(mStream);
+
+- if (NS_FAILED(ostream->Close())) {
++ if (NS_FAILED(stream->Close())) {
+ NS_WARNING("Failed to close stream!");
+ }
+
+diff --git dom/file/nsIFileStorage.h dom/file/nsIFileStorage.h
+index 92bb608..e985f0a 100644
+--- dom/file/nsIFileStorage.h
++++ dom/file/nsIFileStorage.h
+@@ -10,14 +10,17 @@
+ #include "nsISupports.h"
+
+ #define NS_FILESTORAGE_IID \
+- {0xbba9c2ff, 0x85c9, 0x47c1, \
+- { 0xaf, 0xce, 0x0a, 0x7e, 0x6f, 0x21, 0x50, 0x95 } }
++ {0xa0801944, 0x2f1c, 0x4203, \
++ { 0x9c, 0xaa, 0xaa, 0x47, 0xe0, 0x0c, 0x67, 0x92 } }
+
+ class nsIFileStorage : public nsISupports
+ {
+ public:
+ NS_DECLARE_STATIC_IID_ACCESSOR(NS_FILESTORAGE_IID)
+
++ virtual const nsACString&
++ StorageOrigin() = 0;
++
+ virtual nsISupports*
+ StorageId() = 0;
+
+@@ -36,20 +39,23 @@ public:
+
+ NS_DEFINE_STATIC_IID_ACCESSOR(nsIFileStorage, NS_FILESTORAGE_IID)
+
+-#define NS_DECL_NSIFILESTORAGE \
+- virtual nsISupports* \
+- StorageId(); \
+- \
+- virtual bool \
+- IsStorageInvalidated(); \
+- \
+- virtual bool \
+- IsStorageShuttingDown(); \
+- \
+- virtual void \
+- SetThreadLocals(); \
+- \
+- virtual void \
+- UnsetThreadLocals();
++#define NS_DECL_NSIFILESTORAGE \
++ virtual const nsACString& \
++ StorageOrigin() MOZ_OVERRIDE; \
++ \
++ virtual nsISupports* \
++ StorageId() MOZ_OVERRIDE; \
++ \
++ virtual bool \
++ IsStorageInvalidated() MOZ_OVERRIDE; \
++ \
++ virtual bool \
++ IsStorageShuttingDown() MOZ_OVERRIDE; \
++ \
++ virtual void \
++ SetThreadLocals() MOZ_OVERRIDE; \
++ \
++ virtual void \
++ UnsetThreadLocals() MOZ_OVERRIDE;
+
+ #endif // nsIFileStorage_h__
+diff --git dom/indexedDB/FileManager.cpp dom/indexedDB/FileManager.cpp
+index 9db56e8..4ed6e9e 100644
+--- dom/indexedDB/FileManager.cpp
++++ dom/indexedDB/FileManager.cpp
+@@ -7,8 +7,8 @@
+ #include "FileManager.h"
+
+ #include "mozIStorageConnection.h"
+-#include "mozIStorageServiceQuotaManagement.h"
+ #include "mozIStorageStatement.h"
++#include "nsIInputStream.h"
+ #include "nsISimpleEnumerator.h"
+
+ #include "mozStorageCID.h"
+@@ -18,6 +18,8 @@
+ #include "IndexedDatabaseManager.h"
+ #include "OpenDatabaseHelper.h"
+
++#include "IndexedDatabaseInlines.h"
++
+ #define JOURNAL_DIRECTORY_NAME "journals"
+
+ USING_INDEXEDDB_NAMESPACE
+@@ -262,13 +264,11 @@ FileManager::GetFileForId(nsIFile* aDirectory, int64_t aId)
+
+ // static
+ nsresult
+-FileManager::InitDirectory(mozIStorageServiceQuotaManagement* aService,
+- nsIFile* aDirectory,
++FileManager::InitDirectory(nsIFile* aDirectory,
+ nsIFile* aDatabaseFile,
+- FactoryPrivilege aPrivilege)
++ const nsACString& aOrigin)
+ {
+ NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
+- NS_ASSERTION(aService, "Null service!");
+ NS_ASSERTION(aDirectory, "Null directory!");
+ NS_ASSERTION(aDatabaseFile, "Null database file!");
+
+@@ -310,8 +310,8 @@ FileManager::InitDirectory(mozIStorageServiceQuotaManagement* aService,
+
+ if (hasElements) {
+ nsCOMPtr<mozIStorageConnection> connection;
+- rv = OpenDatabaseHelper::CreateDatabaseConnection(
+- NullString(), aDatabaseFile, aDirectory, getter_AddRefs(connection));
++ rv = OpenDatabaseHelper::CreateDatabaseConnection(aDatabaseFile,
++ aDirectory, NullString(), aOrigin, getter_AddRefs(connection));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ mozStorageTransaction transaction(connection, false);
+@@ -377,12 +377,17 @@ FileManager::InitDirectory(mozIStorageServiceQuotaManagement* aService,
+ }
+ }
+
+- if (aPrivilege == Chrome) {
+- return NS_OK;
+- }
++ return NS_OK;
++}
++
++// static
++nsresult
++FileManager::GetUsage(nsIFile* aDirectory, uint64_t* aUsage)
++{
++ uint64_t usage = 0;
+
+ nsCOMPtr<nsISimpleEnumerator> entries;
+- rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
++ nsresult rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ bool hasMore;
+@@ -402,9 +407,13 @@ FileManager::InitDirectory(mozIStorageServiceQuotaManagement* aService,
+ continue;
+ }
+
+- rv = aService->UpdateQuotaInformationForFile(file);
++ int64_t fileSize;
++ rv = file->GetFileSize(&fileSize);
+ NS_ENSURE_SUCCESS(rv, rv);
++
++ IncrementUsage(&usage, uint64_t(fileSize));
+ }
+
++ *aUsage = usage;
+ return NS_OK;
+ }
+diff --git dom/indexedDB/FileManager.h dom/indexedDB/FileManager.h
+index 2c72d0a..370d4a8 100644
+--- dom/indexedDB/FileManager.h
++++ dom/indexedDB/FileManager.h
+@@ -24,10 +24,10 @@ class FileManager
+ friend class FileInfo;
+
+ public:
+- FileManager(const nsACString& aOrigin,
++ FileManager(const nsACString& aOrigin, FactoryPrivilege aPrivilege,
+ const nsAString& aDatabaseName)
+- : mOrigin(aOrigin), mDatabaseName(aDatabaseName), mLastFileId(0),
+- mInvalidated(false)
++ : mOrigin(aOrigin), mPrivilege(aPrivilege), mDatabaseName(aDatabaseName),
++ mLastFileId(0), mInvalidated(false)
+ { }
+
+ ~FileManager()
+@@ -40,6 +40,11 @@ public:
+ return mOrigin;
+ }
+
++ const FactoryPrivilege& Privilege() const
++ {
++ return mPrivilege;
++ }
++
+ const nsAString& DatabaseName() const
+ {
+ return mDatabaseName;
+@@ -68,12 +73,15 @@ public:
+ static already_AddRefed<nsIFile> GetFileForId(nsIFile* aDirectory,
+ int64_t aId);
+
+- static nsresult InitDirectory(mozIStorageServiceQuotaManagement* aService,
+- nsIFile* aDirectory, nsIFile* aDatabaseFile,
+- FactoryPrivilege aPrivilege);
++ static nsresult InitDirectory(nsIFile* aDirectory,
++ nsIFile* aDatabaseFile,
++ const nsACString& aOrigin);
++
++ static nsresult GetUsage(nsIFile* aDirectory, uint64_t* aUsage);
+
+ private:
+ nsCString mOrigin;
++ FactoryPrivilege mPrivilege;
+ nsString mDatabaseName;
+
+ nsString mDirectoryPath;
+diff --git dom/indexedDB/FileStream.cpp dom/indexedDB/FileStream.cpp
+deleted file mode 100644
+index dddf5d5..0000000
+--- dom/indexedDB/FileStream.cpp
++++ /dev/null
+@@ -1,321 +0,0 @@
+-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+-/* vim: set ts=2 et sw=2 tw=80: */
+-/* This Source Code Form is subject to the terms of the Mozilla Public
+- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+- * You can obtain one at http://mozilla.org/MPL/2.0/. */
+-
+-#include "FileStream.h"
+-
+-#include "nsIFile.h"
+-
+-#include "nsThreadUtils.h"
+-#include "test_quota.h"
+-
+-USING_INDEXEDDB_NAMESPACE
+-
+-NS_IMPL_THREADSAFE_ADDREF(FileStream)
+-NS_IMPL_THREADSAFE_RELEASE(FileStream)
+-
+-NS_INTERFACE_MAP_BEGIN(FileStream)
+- NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStandardFileStream)
+- NS_INTERFACE_MAP_ENTRY(nsISeekableStream)
+- NS_INTERFACE_MAP_ENTRY(nsIInputStream)
+- NS_INTERFACE_MAP_ENTRY(nsIOutputStream)
+- NS_INTERFACE_MAP_ENTRY(nsIStandardFileStream)
+- NS_INTERFACE_MAP_ENTRY(nsIFileMetadata)
+-NS_INTERFACE_MAP_END
+-
+-NS_IMETHODIMP
+-FileStream::Seek(int32_t aWhence, int64_t aOffset)
+-{
+- // TODO: Add support for 64 bit file sizes, bug 752431
+- NS_ENSURE_TRUE(aOffset <= INT32_MAX, NS_ERROR_INVALID_ARG);
+-
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- int whence;
+- switch (aWhence) {
+- case nsISeekableStream::NS_SEEK_SET:
+- whence = SEEK_SET;
+- break;
+- case nsISeekableStream::NS_SEEK_CUR:
+- whence = SEEK_CUR;
+- break;
+- case nsISeekableStream::NS_SEEK_END:
+- whence = SEEK_END;
+- break;
+- default:
+- return NS_ERROR_INVALID_ARG;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- int rc = sqlite3_quota_fseek(mQuotaFile, aOffset, whence);
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+-
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Tell(int64_t* aResult)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- long rc = sqlite3_quota_ftell(mQuotaFile);
+- NS_ENSURE_TRUE(rc >= 0, NS_BASE_STREAM_OSERROR);
+-
+- *aResult = rc;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::SetEOF()
+-{
+- int64_t pos;
+- nsresult rv = Tell(&pos);
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- int rc = sqlite3_quota_ftruncate(mQuotaFile, pos);
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+-
+- return NS_OK;
+-}
+-
+-
+-NS_IMETHODIMP
+-FileStream::Close()
+-{
+- CleanUpOpen();
+-
+- if (mQuotaFile) {
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- int rc = sqlite3_quota_fclose(mQuotaFile);
+- mQuotaFile = nullptr;
+-
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+- }
+-
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Available(uint64_t* aResult)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- long rc = sqlite3_quota_file_available(mQuotaFile);
+- NS_ENSURE_TRUE(rc >= 0, NS_BASE_STREAM_OSERROR);
+-
+- *aResult = rc;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Read(char* aBuf, uint32_t aCount, uint32_t* aResult)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- size_t bytesRead = sqlite3_quota_fread(aBuf, 1, aCount, mQuotaFile);
+- if (bytesRead < aCount && sqlite3_quota_ferror(mQuotaFile)) {
+- return NS_BASE_STREAM_OSERROR;
+- }
+-
+- *aResult = bytesRead;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure,
+- uint32_t aCount, uint32_t* aResult)
+-{
+- NS_NOTREACHED("Don't call me!");
+- return NS_ERROR_NOT_IMPLEMENTED;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::IsNonBlocking(bool *aNonBlocking)
+-{
+- *aNonBlocking = false;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Write(const char* aBuf, uint32_t aCount, uint32_t *aResult)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- size_t bytesWritten = sqlite3_quota_fwrite(aBuf, 1, aCount, mQuotaFile);
+- if (bytesWritten < aCount) {
+- return NS_BASE_STREAM_OSERROR;
+- }
+-
+- *aResult = bytesWritten;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Flush()
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- int rc = sqlite3_quota_fflush(mQuotaFile, 1);
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+-
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::WriteFrom(nsIInputStream *inStr, uint32_t count, uint32_t *_retval)
+-{
+- return NS_ERROR_NOT_IMPLEMENTED;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::WriteSegments(nsReadSegmentFun reader, void * closure, uint32_t count, uint32_t *_retval)
+-{
+- NS_NOTREACHED("Don't call me!");
+- return NS_ERROR_NOT_IMPLEMENTED;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Init(nsIFile* aFile, const nsAString& aMode, int32_t aFlags)
+-{
+- NS_ASSERTION(!mQuotaFile && !mDeferredOpen, "Already initialized!");
+-
+- nsresult rv = aFile->GetPath(mFilePath);
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- mMode = aMode;
+- mFlags = aFlags;
+-
+- if (mFlags & nsIStandardFileStream::FLAGS_DEFER_OPEN) {
+- mDeferredOpen = true;
+- return NS_OK;
+- }
+-
+- return DoOpen();
+-}
+-
+-NS_IMETHODIMP
+-FileStream::GetSize(int64_t* _retval)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- // TODO: Use sqlite3_quota_file_size() here, bug 760783
+- int64_t rc = sqlite3_quota_file_truesize(mQuotaFile);
+-
+- NS_ASSERTION(rc >= 0, "The file is not under quota management!");
+-
+- *_retval = rc;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::GetLastModified(int64_t* _retval)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- time_t mtime;
+- int rc = sqlite3_quota_file_mtime(mQuotaFile, &mtime);
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+-
+- *_retval = mtime * PR_MSEC_PER_SEC;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::FlushBuffers()
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- int rc = sqlite3_quota_fflush(mQuotaFile, 0);
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+-
+- return NS_OK;
+-}
+-
+-nsresult
+-FileStream::DoOpen()
+-{
+- NS_ASSERTION(!mFilePath.IsEmpty(), "Must have a file path");
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- quota_FILE* quotaFile =
+- sqlite3_quota_fopen(NS_ConvertUTF16toUTF8(mFilePath).get(),
+- NS_ConvertUTF16toUTF8(mMode).get());
+-
+- CleanUpOpen();
+-
+- if (!quotaFile) {
+- return NS_BASE_STREAM_OSERROR;
+- }
+-
+- mQuotaFile = quotaFile;
+-
+- return NS_OK;
+-}
+diff --git dom/indexedDB/FileStream.h dom/indexedDB/FileStream.h
+deleted file mode 100644
+index 09648b1..0000000
+--- dom/indexedDB/FileStream.h
++++ /dev/null
+@@ -1,140 +0,0 @@
+-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+-/* vim: set ts=2 et sw=2 tw=80: */
+-/* This Source Code Form is subject to the terms of the Mozilla Public
+- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+- * You can obtain one at http://mozilla.org/MPL/2.0/. */
+-
+-#ifndef mozilla_dom_indexeddb_filestream_h__
+-#define mozilla_dom_indexeddb_filestream_h__
+-
+-#include "IndexedDatabase.h"
+-
+-#include "nsIFileStreams.h"
+-#include "nsIInputStream.h"
+-#include "nsIOutputStream.h"
+-#include "nsISeekableStream.h"
+-#include "nsIStandardFileStream.h"
+-
+-class nsIFile;
+-struct quota_FILE;
+-
+-BEGIN_INDEXEDDB_NAMESPACE
+-
+-class FileStream : public nsISeekableStream,
+- public nsIInputStream,
+- public nsIOutputStream,
+- public nsIStandardFileStream,
+- public nsIFileMetadata
+-{
+-public:
+- FileStream()
+- : mFlags(0),
+- mDeferredOpen(false),
+- mQuotaFile(nullptr)
+- { }
+-
+- virtual ~FileStream()
+- {
+- Close();
+- }
+-
+- NS_DECL_ISUPPORTS
+- NS_DECL_NSISEEKABLESTREAM
+- NS_DECL_NSISTANDARDFILESTREAM
+- NS_DECL_NSIFILEMETADATA
+-
+- // nsIInputStream
+- NS_IMETHOD
+- Close();
+-
+- NS_IMETHOD
+- Available(uint64_t* _retval);
+-
+- NS_IMETHOD
+- Read(char* aBuf, uint32_t aCount, uint32_t* _retval);
+-
+- NS_IMETHOD
+- ReadSegments(nsWriteSegmentFun aWriter, void* aClosure, uint32_t aCount,
+- uint32_t* _retval);
+-
+- NS_IMETHOD
+- IsNonBlocking(bool* _retval);
+-
+- // nsIOutputStream
+-
+- // Close() already declared
+-
+- NS_IMETHOD
+- Flush();
+-
+- NS_IMETHOD
+- Write(const char* aBuf, uint32_t aCount, uint32_t* _retval);
+-
+- NS_IMETHOD
+- WriteFrom(nsIInputStream* aFromStream, uint32_t aCount, uint32_t* _retval);
+-
+- NS_IMETHOD
+- WriteSegments(nsReadSegmentFun aReader, void* aClosure, uint32_t aCount,
+- uint32_t* _retval);
+-
+- // IsNonBlocking() already declared
+-
+-protected:
+- /**
+- * Cleans up data prepared in Init.
+- */
+- void
+- CleanUpOpen()
+- {
+- mFilePath.Truncate();
+- mDeferredOpen = false;
+- }
+-
+- /**
+- * Open the file. This is called either from Init
+- * or from DoPendingOpen (if FLAGS_DEFER_OPEN is used when initializing this
+- * stream). The default behavior of DoOpen is to open the file and save the
+- * file descriptor.
+- */
+- virtual nsresult
+- DoOpen();
+-
+- /**
+- * If there is a pending open, do it now. It's important for this to be
+- * inlined since we do it in almost every stream API call.
+- */
+- nsresult
+- DoPendingOpen()
+- {
+- if (!mDeferredOpen) {
+- return NS_OK;
+- }
+-
+- return DoOpen();
+- }
+-
+- /**
+- * Data we need to do an open.
+- */
+- nsString mFilePath;
+- nsString mMode;
+-
+- /**
+- * Flags describing our behavior. See the IDL file for possible values.
+- */
+- int32_t mFlags;
+-
+- /**
+- * Whether we have a pending open (see FLAGS_DEFER_OPEN in the IDL file).
+- */
+- bool mDeferredOpen;
+-
+- /**
+- * File descriptor for opened file.
+- */
+- quota_FILE* mQuotaFile;
+-};
+-
+-END_INDEXEDDB_NAMESPACE
+-
+-#endif // mozilla_dom_indexeddb_filestream_h__
+diff --git dom/indexedDB/IDBDatabase.cpp dom/indexedDB/IDBDatabase.cpp
+index 63500b0..8842daf 100644
+--- dom/indexedDB/IDBDatabase.cpp
++++ dom/indexedDB/IDBDatabase.cpp
+@@ -779,6 +779,12 @@ IDBDatabase::Close()
+ return NS_OK;
+ }
+
++const nsACString&
++IDBDatabase::StorageOrigin()
++{
++ return Origin();
++}
++
+ nsISupports*
+ IDBDatabase::StorageId()
+ {
+diff --git dom/indexedDB/IDBFactory.cpp dom/indexedDB/IDBFactory.cpp
+index 1007df1..c1f573e 100644
+--- dom/indexedDB/IDBFactory.cpp
++++ dom/indexedDB/IDBFactory.cpp
+@@ -253,8 +253,26 @@ IDBFactory::Create(ContentParent* aContentParent,
+ }
+
+ // static
++already_AddRefed<nsIFileURL>
++IDBFactory::GetDatabaseFileURL(nsIFile* aDatabaseFile, const nsACString& aOrigin)
++{
++ nsCOMPtr<nsIURI> uri;
++ nsresult rv = NS_NewFileURI(getter_AddRefs(uri), aDatabaseFile);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ nsCOMPtr<nsIFileURL> fileUrl = do_QueryInterface(uri);
++ NS_ASSERTION(fileUrl, "This should always succeed!");
++
++ rv = fileUrl->SetQuery(NS_LITERAL_CSTRING("origin=") + aOrigin);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ return fileUrl.forget();
++}
++
++// static
+ already_AddRefed<mozIStorageConnection>
+-IDBFactory::GetConnection(const nsAString& aDatabaseFilePath)
++IDBFactory::GetConnection(const nsAString& aDatabaseFilePath,
++ const nsACString& aOrigin)
+ {
+ NS_ASSERTION(IndexedDatabaseManager::IsMainProcess(), "Wrong process!");
+ NS_ASSERTION(StringEndsWith(aDatabaseFilePath, NS_LITERAL_STRING(".sqlite")),
+@@ -271,13 +289,15 @@ IDBFactory::GetConnection(const nsAString& aDatabaseFilePath)
+ NS_ENSURE_SUCCESS(rv, nullptr);
+ NS_ENSURE_TRUE(exists, nullptr);
+
+- nsCOMPtr<mozIStorageServiceQuotaManagement> ss =
++ nsCOMPtr<nsIFileURL> dbFileUrl = GetDatabaseFileURL(dbFile, aOrigin);
++ NS_ENSURE_TRUE(dbFileUrl, nullptr);
++
++ nsCOMPtr<mozIStorageService> ss =
+ do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID);
+ NS_ENSURE_TRUE(ss, nullptr);
+
+ nsCOMPtr<mozIStorageConnection> connection;
+- rv = ss->OpenDatabaseWithVFS(dbFile, NS_LITERAL_CSTRING("quota"),
+- getter_AddRefs(connection));
++ rv = ss->OpenDatabaseWithFileURL(dbFileUrl, getter_AddRefs(connection));
+ NS_ENSURE_SUCCESS(rv, nullptr);
+
+ // Turn on foreign key constraints and recursive triggers.
+diff --git dom/indexedDB/IDBFactory.h dom/indexedDB/IDBFactory.h
+index d5461f7..49dad42 100644
+--- dom/indexedDB/IDBFactory.h
++++ dom/indexedDB/IDBFactory.h
+@@ -15,6 +15,8 @@
+ #include "nsCycleCollectionParticipant.h"
+
+ class nsIAtom;
++class nsIFile;
++class nsIFileURL;
+ class nsPIDOMWindow;
+
+ namespace mozilla {
+@@ -75,8 +77,12 @@ public:
+ static nsresult Create(ContentParent* aContentParent,
+ IDBFactory** aFactory);
+
++ static already_AddRefed<nsIFileURL>
++ GetDatabaseFileURL(nsIFile* aDatabaseFile, const nsACString& aOrigin);
++
+ static already_AddRefed<mozIStorageConnection>
+- GetConnection(const nsAString& aDatabaseFilePath);
++ GetConnection(const nsAString& aDatabaseFilePath,
++ const nsACString& aOrigin);
+
+ static nsresult
+ LoadDatabaseInformation(mozIStorageConnection* aConnection,
+diff --git dom/indexedDB/IDBFileHandle.cpp dom/indexedDB/IDBFileHandle.cpp
+index e0340ff..f71fd56 100644
+--- dom/indexedDB/IDBFileHandle.cpp
++++ dom/indexedDB/IDBFileHandle.cpp
+@@ -6,15 +6,14 @@
+
+ #include "IDBFileHandle.h"
+
+-#include "nsIStandardFileStream.h"
+-
+ #include "mozilla/dom/file/File.h"
++#include "mozilla/dom/quota/FileStreams.h"
+ #include "nsDOMClassInfoID.h"
+
+-#include "FileStream.h"
+ #include "IDBDatabase.h"
+
+ USING_INDEXEDDB_NAMESPACE
++USING_QUOTA_NAMESPACE
+
+ namespace {
+
+@@ -68,22 +67,22 @@ IDBFileHandle::Create(IDBDatabase* aDatabase,
+ already_AddRefed<nsISupports>
+ IDBFileHandle::CreateStream(nsIFile* aFile, bool aReadOnly)
+ {
+- nsRefPtr<FileStream> stream = new FileStream();
++ const nsACString& origin = mFileStorage->StorageOrigin();
++
++ nsCOMPtr<nsISupports> result;
+
+- nsString streamMode;
+ if (aReadOnly) {
+- streamMode.AssignLiteral("rb");
++ nsRefPtr<FileInputStream> stream = FileInputStream::Create(
++ origin, aFile, -1, -1, nsIFileInputStream::DEFER_OPEN);
++ result = NS_ISUPPORTS_CAST(nsIFileInputStream*, stream);
+ }
+ else {
+- streamMode.AssignLiteral("r+b");
++ nsRefPtr<FileStream> stream = FileStream::Create(
++ origin, aFile, -1, -1, nsIFileStream::DEFER_OPEN);
++ result = NS_ISUPPORTS_CAST(nsIFileStream*, stream);
+ }
++ NS_ENSURE_TRUE(result, nullptr);
+
+- nsresult rv = stream->Init(aFile, streamMode,
+- nsIStandardFileStream::FLAGS_DEFER_OPEN);
+- NS_ENSURE_SUCCESS(rv, nullptr);
+-
+- nsCOMPtr<nsISupports> result =
+- NS_ISUPPORTS_CAST(nsIStandardFileStream*, stream);
+ return result.forget();
+ }
+
+diff --git dom/indexedDB/IDBObjectStore.cpp dom/indexedDB/IDBObjectStore.cpp
+index 746d473..1f16d26 100644
+--- dom/indexedDB/IDBObjectStore.cpp
++++ dom/indexedDB/IDBObjectStore.cpp
+@@ -17,6 +17,7 @@
+ #include "mozilla/dom/ContentParent.h"
+ #include "mozilla/dom/StructuredCloneTags.h"
+ #include "mozilla/dom/ipc/Blob.h"
++#include "mozilla/dom/quota/FileStreams.h"
+ #include "mozilla/storage.h"
+ #include "nsContentUtils.h"
+ #include "nsDOMClassInfo.h"
+@@ -27,10 +28,8 @@
+ #include "nsServiceManagerUtils.h"
+ #include "nsThreadUtils.h"
+ #include "snappy/snappy.h"
+-#include "test_quota.h"
+
+ #include "AsyncConnectionHelper.h"
+-#include "FileStream.h"
+ #include "IDBCursor.h"
+ #include "IDBEvents.h"
+ #include "IDBFileHandle.h"
+@@ -51,6 +50,7 @@
+ USING_INDEXEDDB_NAMESPACE
+ using namespace mozilla::dom;
+ using namespace mozilla::dom::indexedDB::ipc;
++using mozilla::dom::quota::FileOutputStream;
+
+ namespace {
+
+@@ -2734,9 +2734,9 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
+ nativeFile = fileManager->GetFileForId(directory, id);
+ NS_ENSURE_TRUE(nativeFile, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- nsRefPtr<FileStream> outputStream = new FileStream();
+- rv = outputStream->Init(nativeFile, NS_LITERAL_STRING("wb"), 0);
+- NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
++ nsRefPtr<FileOutputStream> outputStream = FileOutputStream::Create(
++ mObjectStore->Transaction()->Database()->Origin(), nativeFile);
++ NS_ENSURE_TRUE(outputStream, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+ rv = CopyData(inputStream, outputStream);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+diff --git dom/indexedDB/IDBTransaction.cpp dom/indexedDB/IDBTransaction.cpp
+index fcef7cc..a5345e2 100644
+--- dom/indexedDB/IDBTransaction.cpp
++++ dom/indexedDB/IDBTransaction.cpp
+@@ -352,7 +352,8 @@ IDBTransaction::GetOrCreateConnection(mozIStorageConnection** aResult)
+
+ if (!mConnection) {
+ nsCOMPtr<mozIStorageConnection> connection =
+- IDBFactory::GetConnection(mDatabase->FilePath());
++ IDBFactory::GetConnection(mDatabase->FilePath(),
++ mDatabase->Origin());
+ NS_ENSURE_TRUE(connection, NS_ERROR_FAILURE);
+
+ nsresult rv;
+diff --git dom/indexedDB/IndexedDatabaseInlines.h dom/indexedDB/IndexedDatabaseInlines.h
+index 62e65d6..f27d60c 100644
+--- dom/indexedDB/IndexedDatabaseInlines.h
++++ dom/indexedDB/IndexedDatabaseInlines.h
+@@ -79,4 +79,17 @@ AppendConditionClause(const nsACString& aColumnName,
+ aResult += NS_LITERAL_CSTRING(" :") + aArgName;
+ }
+
++inline void
++IncrementUsage(uint64_t* aUsage, uint64_t aDelta)
++{
++ // Watch for overflow!
++ if ((UINT64_MAX - *aUsage) < aDelta) {
++ NS_WARNING("Usage exceeds the maximum!");
++ *aUsage = UINT64_MAX;
++ }
++ else {
++ *aUsage += aDelta;
++ }
++}
++
+ END_INDEXEDDB_NAMESPACE
+diff --git dom/indexedDB/IndexedDatabaseManager.cpp dom/indexedDB/IndexedDatabaseManager.cpp
+index e4ad647..88f09da 100644
+--- dom/indexedDB/IndexedDatabaseManager.cpp
++++ dom/indexedDB/IndexedDatabaseManager.cpp
+@@ -22,6 +22,7 @@
+ #include "nsITimer.h"
+
+ #include "mozilla/dom/file/FileService.h"
++#include "mozilla/dom/quota/QuotaManager.h"
+ #include "mozilla/dom/TabContext.h"
+ #include "mozilla/LazyIdleThread.h"
+ #include "mozilla/Preferences.h"
+@@ -36,7 +37,6 @@
+ #include "nsThreadUtils.h"
+ #include "nsXPCOM.h"
+ #include "nsXPCOMPrivate.h"
+-#include "test_quota.h"
+ #include "xpcpublic.h"
+
+ #include "AsyncConnectionHelper.h"
+@@ -48,6 +48,8 @@
+ #include "OpenDatabaseHelper.h"
+ #include "TransactionThreadPool.h"
+
++#include "IndexedDatabaseInlines.h"
++
+ // The amount of time, in milliseconds, that our IO thread will stay alive
+ // after the last event it processes.
+ #define DEFAULT_THREAD_TIMEOUT_MS 30000
+@@ -70,6 +72,7 @@ using namespace mozilla::services;
+ using namespace mozilla::dom;
+ using mozilla::Preferences;
+ using mozilla::dom::file::FileService;
++using mozilla::dom::quota::QuotaManager;
+
+ static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
+
+@@ -103,29 +106,6 @@ GetDatabaseBaseFilename(const nsAString& aFilename,
+ return true;
+ }
+
+-class QuotaCallback MOZ_FINAL : public mozIStorageQuotaCallback
+-{
+-public:
+- NS_DECL_ISUPPORTS
+-
+- NS_IMETHOD
+- QuotaExceeded(const nsACString& aFilename,
+- int64_t aCurrentSizeLimit,
+- int64_t aCurrentTotalSize,
+- nsISupports* aUserData,
+- int64_t* _retval)
+- {
+- if (IndexedDatabaseManager::QuotaIsLifted()) {
+- *_retval = 0;
+- return NS_OK;
+- }
+-
+- return NS_ERROR_FAILURE;
+- }
+-};
+-
+-NS_IMPL_THREADSAFE_ISUPPORTS1(QuotaCallback, mozIStorageQuotaCallback)
+-
+ // Adds all databases in the hash to the given array.
+ template <class T>
+ PLDHashOperator
+@@ -440,8 +420,8 @@ IndexedDatabaseManager::GetOrCreate()
+ NS_LITERAL_CSTRING("IndexedDB I/O"),
+ LazyIdleThread::ManualShutdown);
+
+- // We need one quota callback object to hand to SQLite.
+- instance->mQuotaCallbackSingleton = new QuotaCallback();
++ // Make sure that the quota manager is up.
++ NS_ENSURE_TRUE(QuotaManager::GetOrCreate(), nullptr);
+
+ // Make a timer here to avoid potential failures later. We don't actually
+ // initialize the timer until shutdown.
+@@ -996,37 +976,15 @@ IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
+ return NS_OK;
+ }
+
+- // First figure out the filename pattern we'll use.
+- nsCOMPtr<nsIFile> patternFile;
+- rv = directory->Clone(getter_AddRefs(patternFile));
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- rv = patternFile->Append(NS_LITERAL_STRING("*"));
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- nsString pattern;
+- rv = patternFile->GetPath(pattern);
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- // Now tell SQLite to start tracking this pattern for content.
+- nsCOMPtr<mozIStorageServiceQuotaManagement> ss =
+- do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID);
+- NS_ENSURE_TRUE(ss, NS_ERROR_FAILURE);
+-
+- if (aPrivilege != Chrome) {
+- rv = ss->SetQuotaForFilenamePattern(NS_ConvertUTF16toUTF8(pattern),
+- GetIndexedDBQuotaMB() * 1024 * 1024,
+- mQuotaCallbackSingleton, nullptr);
+- NS_ENSURE_SUCCESS(rv, rv);
+- }
+-
+ // We need to see if there are any files in the directory already. If they
+ // are database files then we need to cleanup stored files (if it's needed)
+- // and also tell SQLite about all of them.
++ // and also initialize the quota.
+
+ nsAutoTArray<nsString, 20> subdirsToProcess;
+ nsAutoTArray<nsCOMPtr<nsIFile> , 20> unknownFiles;
+
++ uint64_t usage = 0;
++
+ nsTHashtable<nsStringHashKey> validSubdirs;
+ validSubdirs.Init(20);
+
+@@ -1068,20 +1026,28 @@ IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
+ continue;
+ }
+
+- nsCOMPtr<nsIFile> fileManagerDirectory;
+- rv = directory->Clone(getter_AddRefs(fileManagerDirectory));
++ nsCOMPtr<nsIFile> fmDirectory;
++ rv = directory->Clone(getter_AddRefs(fmDirectory));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- rv = fileManagerDirectory->Append(dbBaseFilename);
++ rv = fmDirectory->Append(dbBaseFilename);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- rv = FileManager::InitDirectory(ss, fileManagerDirectory, file,
+- aPrivilege);
++ rv = FileManager::InitDirectory(fmDirectory, file, aOrigin);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (aPrivilege != Chrome) {
+- rv = ss->UpdateQuotaInformationForFile(file);
++ uint64_t fileUsage;
++ rv = FileManager::GetUsage(fmDirectory, &fileUsage);
+ NS_ENSURE_SUCCESS(rv, rv);
++
++ IncrementUsage(&usage, fileUsage);
++
++ int64_t fileSize;
++ rv = file->GetFileSize(&fileSize);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ IncrementUsage(&usage, uint64_t(fileSize));
+ }
+
+ validSubdirs.PutEntry(dbBaseFilename);
+@@ -1117,12 +1083,39 @@ IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
+ }
+ }
+
++ if (aPrivilege != Chrome) {
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->InitQuotaForOrigin(aOrigin, GetIndexedDBQuotaMB(), usage);
++ }
++
+ mInitializedOrigins.AppendElement(aOrigin);
+
+ NS_ADDREF(*aDirectory = directory);
+ return NS_OK;
+ }
+
++void
++IndexedDatabaseManager::UninitializeOriginsByPattern(
++ const nsACString& aPattern)
++{
++#ifdef DEBUG
++ {
++ bool correctThread;
++ NS_ASSERTION(NS_SUCCEEDED(mIOThread->IsOnCurrentThread(&correctThread)) &&
++ correctThread,
++ "Running on the wrong thread!");
++ }
++#endif
++
++ for (int32_t i = mInitializedOrigins.Length() - 1; i >= 0; i--) {
++ if (PatternMatchesOrigin(aPattern, mInitializedOrigins[i])) {
++ mInitializedOrigins.RemoveElementAt(i);
++ }
++ }
++}
++
+ bool
+ IndexedDatabaseManager::QuotaIsLiftedInternal()
+ {
+@@ -1250,16 +1243,14 @@ IndexedDatabaseManager::GetFileManager(const nsACString& aOrigin,
+ }
+
+ void
+-IndexedDatabaseManager::AddFileManager(const nsACString& aOrigin,
+- const nsAString& aDatabaseName,
+- FileManager* aFileManager)
++IndexedDatabaseManager::AddFileManager(FileManager* aFileManager)
+ {
+ NS_ASSERTION(aFileManager, "Null file manager!");
+
+ nsTArray<nsRefPtr<FileManager> >* array;
+- if (!mFileManagers.Get(aOrigin, &array)) {
++ if (!mFileManagers.Get(aFileManager->Origin(), &array)) {
+ array = new nsTArray<nsRefPtr<FileManager> >();
+- mFileManagers.Put(aOrigin, array);
++ mFileManagers.Put(aFileManager->Origin(), array);
+ }
+
+ array->AppendElement(aFileManager);
+@@ -1783,6 +1774,13 @@ OriginClearRunnable::DeleteFiles(IndexedDatabaseManager* aManager)
+ // correctly...
+ NS_ERROR("Failed to remove directory!");
+ }
++
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->RemoveQuotaForPattern(mOriginOrPattern);
++
++ aManager->UninitializeOriginsByPattern(mOriginOrPattern);
+ }
+ }
+
+@@ -1880,19 +1878,6 @@ IndexedDatabaseManager::AsyncUsageRunnable::Cancel()
+ }
+ }
+
+-inline void
+-IncrementUsage(uint64_t* aUsage, uint64_t aDelta)
+-{
+- // Watch for overflow!
+- if ((INT64_MAX - *aUsage) <= aDelta) {
+- NS_WARNING("Database sizes exceed max we can report!");
+- *aUsage = INT64_MAX;
+- }
+- else {
+- *aUsage += aDelta;
+- }
+-}
+-
+ nsresult
+ IndexedDatabaseManager::AsyncUsageRunnable::TakeShortcut()
+ {
+@@ -2295,25 +2280,22 @@ IndexedDatabaseManager::AsyncDeleteFileRunnable::Run()
+ nsCOMPtr<nsIFile> file = mFileManager->GetFileForId(directory, mFileId);
+ NS_ENSURE_TRUE(file, NS_ERROR_FAILURE);
+
+- nsString filePath;
+- nsresult rv = file->GetPath(filePath);
+- NS_ENSURE_SUCCESS(rv, rv);
++ nsresult rv;
++ int64_t fileSize;
+
+- int rc = sqlite3_quota_remove(NS_ConvertUTF16toUTF8(filePath).get());
+- if (rc != SQLITE_OK) {
+- NS_WARNING("Failed to delete stored file!");
+- return NS_ERROR_FAILURE;
++ if (mFileManager->Privilege() != Chrome) {
++ rv = file->GetFileSize(&fileSize);
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
+ }
+
+- // sqlite3_quota_remove won't actually remove anything if we're not tracking
+- // the quota here. Manually remove the file if it exists.
+- bool exists;
+- rv = file->Exists(&exists);
+- NS_ENSURE_SUCCESS(rv, rv);
++ rv = file->Remove(false);
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
+
+- if (exists) {
+- rv = file->Remove(false);
+- NS_ENSURE_SUCCESS(rv, rv);
++ if (mFileManager->Privilege() != Chrome) {
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->DecreaseUsageForOrigin(mFileManager->Origin(), fileSize);
+ }
+
+ directory = mFileManager->GetJournalDirectory();
+diff --git dom/indexedDB/IndexedDatabaseManager.h dom/indexedDB/IndexedDatabaseManager.h
+index f9fbbf2..1ea5425 100644
+--- dom/indexedDB/IndexedDatabaseManager.h
++++ dom/indexedDB/IndexedDatabaseManager.h
+@@ -23,7 +23,6 @@
+
+ #define INDEXEDDB_MANAGER_CONTRACTID "@mozilla.org/dom/indexeddb/manager;1"
+
+-class mozIStorageQuotaCallback;
+ class nsIAtom;
+ class nsIFile;
+ class nsITimer;
+@@ -134,6 +133,8 @@ public:
+ FactoryPrivilege aPrivilege,
+ nsIFile** aDirectory);
+
++ void UninitializeOriginsByPattern(const nsACString& aPattern);
++
+ // Determine if the quota is lifted for the Window the current thread is
+ // using.
+ static inline bool
+@@ -172,9 +173,7 @@ public:
+ const nsAString& aDatabaseName);
+
+ void
+- AddFileManager(const nsACString& aOrigin,
+- const nsAString& aDatabaseName,
+- FileManager* aFileManager);
++ AddFileManager(FileManager* aFileManager);
+
+ void InvalidateFileManagersForPattern(const nsACString& aPattern);
+
+@@ -502,10 +501,6 @@ private:
+ // A timer that gets activated at shutdown to ensure we close all databases.
+ nsCOMPtr<nsITimer> mShutdownTimer;
+
+- // A single threadsafe instance of our quota callback. Created on the main
+- // thread during GetOrCreate().
+- nsCOMPtr<mozIStorageQuotaCallback> mQuotaCallbackSingleton;
+-
+ // A list of all successfully initialized origins. This list isn't protected
+ // by any mutex but it is only ever touched on the IO thread.
+ nsTArray<nsCString> mInitializedOrigins;
+diff --git dom/indexedDB/Makefile.in dom/indexedDB/Makefile.in
+index fef0858..09d4853 100644
+--- dom/indexedDB/Makefile.in
++++ dom/indexedDB/Makefile.in
+@@ -25,7 +25,6 @@ CPPSRCS = \
+ DatabaseInfo.cpp \
+ FileInfo.cpp \
+ FileManager.cpp \
+- FileStream.cpp \
+ IDBCursor.cpp \
+ IDBDatabase.cpp \
+ IDBEvents.cpp \
+@@ -93,7 +92,6 @@ XPIDLSRCS = \
+ nsIIDBVersionChangeEvent.idl \
+ nsIIDBOpenDBRequest.idl \
+ nsIIndexedDatabaseManager.idl \
+- nsIStandardFileStream.idl \
+ $(NULL)
+
+ DIRS += ipc
+diff --git dom/indexedDB/OpenDatabaseHelper.cpp dom/indexedDB/OpenDatabaseHelper.cpp
+index e71cad4..4cd7f61 100644
+--- dom/indexedDB/OpenDatabaseHelper.cpp
++++ dom/indexedDB/OpenDatabaseHelper.cpp
+@@ -8,11 +8,12 @@
+
+ #include "nsIFile.h"
+
++#include "mozilla/dom/quota/QuotaManager.h"
+ #include "mozilla/storage.h"
+ #include "nsEscape.h"
++#include "nsNetUtil.h"
+ #include "nsThreadUtils.h"
+ #include "snappy/snappy.h"
+-#include "test_quota.h"
+
+ #include "nsIBFCacheEntry.h"
+ #include "IDBEvents.h"
+@@ -21,6 +22,7 @@
+
+ using namespace mozilla;
+ USING_INDEXEDDB_NAMESPACE
++USING_QUOTA_NAMESPACE
+
+ namespace {
+
+@@ -1632,15 +1634,15 @@ OpenDatabaseHelper::DoDatabaseWork()
+ rv = dbFile->GetPath(mDatabaseFilePath);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- nsCOMPtr<nsIFile> fileManagerDirectory;
+- rv = dbDirectory->Clone(getter_AddRefs(fileManagerDirectory));
++ nsCOMPtr<nsIFile> fmDirectory;
++ rv = dbDirectory->Clone(getter_AddRefs(fmDirectory));
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- rv = fileManagerDirectory->Append(filename);
++ rv = fmDirectory->Append(filename);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+ nsCOMPtr<mozIStorageConnection> connection;
+- rv = CreateDatabaseConnection(mName, dbFile, fileManagerDirectory,
++ rv = CreateDatabaseConnection(dbFile, fmDirectory, mName, mASCIIOrigin,
+ getter_AddRefs(connection));
+ if (NS_FAILED(rv) &&
+ NS_ERROR_GET_MODULE(rv) != NS_ERROR_MODULE_DOM_INDEXEDDB) {
+@@ -1691,12 +1693,12 @@ OpenDatabaseHelper::DoDatabaseWork()
+
+ nsRefPtr<FileManager> fileManager = mgr->GetFileManager(mASCIIOrigin, mName);
+ if (!fileManager) {
+- fileManager = new FileManager(mASCIIOrigin, mName);
++ fileManager = new FileManager(mASCIIOrigin, mPrivilege, mName);
+
+- rv = fileManager->Init(fileManagerDirectory, connection);
++ rv = fileManager->Init(fmDirectory, connection);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- mgr->AddFileManager(mASCIIOrigin, mName, fileManager);
++ mgr->AddFileManager(fileManager);
+ }
+
+ mFileManager = fileManager.forget();
+@@ -1707,23 +1709,26 @@ OpenDatabaseHelper::DoDatabaseWork()
+ // static
+ nsresult
+ OpenDatabaseHelper::CreateDatabaseConnection(
+- const nsAString& aName,
+ nsIFile* aDBFile,
+- nsIFile* aFileManagerDirectory,
++ nsIFile* aFMDirectory,
++ const nsAString& aName,
++ const nsACString& aOrigin,
+ mozIStorageConnection** aConnection)
+ {
+ NS_ASSERTION(IndexedDatabaseManager::IsMainProcess(), "Wrong process!");
+ NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
+
+- NS_NAMED_LITERAL_CSTRING(quotaVFSName, "quota");
++ nsCOMPtr<nsIFileURL> dbFileUrl =
++ IDBFactory::GetDatabaseFileURL(aDBFile, aOrigin);
++ NS_ENSURE_TRUE(dbFileUrl, NS_ERROR_FAILURE);
+
+- nsCOMPtr<mozIStorageServiceQuotaManagement> ss =
++ nsCOMPtr<mozIStorageService> ss =
+ do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID);
+ NS_ENSURE_TRUE(ss, NS_ERROR_FAILURE);
+
+ nsCOMPtr<mozIStorageConnection> connection;
+- nsresult rv = ss->OpenDatabaseWithVFS(aDBFile, quotaVFSName,
+- getter_AddRefs(connection));
++ nsresult rv =
++ ss->OpenDatabaseWithFileURL(dbFileUrl, getter_AddRefs(connection));
+ if (rv == NS_ERROR_FILE_CORRUPTED) {
+ // If we're just opening the database during origin initialization, then
+ // we don't want to erase any files. The failure here will fail origin
+@@ -1737,21 +1742,20 @@ OpenDatabaseHelper::CreateDatabaseConnection(
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ bool exists;
+- rv = aFileManagerDirectory->Exists(&exists);
++ rv = aFMDirectory->Exists(&exists);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (exists) {
+ bool isDirectory;
+- rv = aFileManagerDirectory->IsDirectory(&isDirectory);
++ rv = aFMDirectory->IsDirectory(&isDirectory);
+ NS_ENSURE_SUCCESS(rv, rv);
+ NS_ENSURE_TRUE(isDirectory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- rv = aFileManagerDirectory->Remove(true);
++ rv = aFMDirectory->Remove(true);
+ NS_ENSURE_SUCCESS(rv, rv);
+ }
+
+- rv = ss->OpenDatabaseWithVFS(aDBFile, quotaVFSName,
+- getter_AddRefs(connection));
++ rv = ss->OpenDatabaseWithFileURL(dbFileUrl, getter_AddRefs(connection));
+ }
+ NS_ENSURE_SUCCESS(rv, rv);
+
+@@ -2347,6 +2351,8 @@ DeleteDatabaseHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
+ {
+ NS_ASSERTION(!aConnection, "How did we get a connection here?");
+
++ const FactoryPrivilege& privilege = mOpenHelper->Privilege();
++
+ IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get();
+ NS_ASSERTION(mgr, "This should never fail!");
+
+@@ -2372,59 +2378,57 @@ DeleteDatabaseHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
+ rv = dbFile->Exists(&exists);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- int rc;
+-
+ if (exists) {
+- nsString dbFilePath;
+- rv = dbFile->GetPath(dbFilePath);
+- NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
++ int64_t fileSize;
+
+- rc = sqlite3_quota_remove(NS_ConvertUTF16toUTF8(dbFilePath).get());
+- if (rc != SQLITE_OK) {
+- NS_WARNING("Failed to delete db file!");
+- return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
++ if (privilege != Chrome) {
++ rv = dbFile->GetFileSize(&fileSize);
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+ }
+
+- // sqlite3_quota_remove won't actually remove anything if we're not tracking
+- // the quota here. Manually remove the file if it exists.
+- rv = dbFile->Exists(&exists);
++ rv = dbFile->Remove(false);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- if (exists) {
+- rv = dbFile->Remove(false);
+- NS_ENSURE_SUCCESS(rv, rv);
++ if (privilege != Chrome) {
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->DecreaseUsageForOrigin(mASCIIOrigin, fileSize);
+ }
+ }
+
+- nsCOMPtr<nsIFile> fileManagerDirectory;
+- rv = directory->Clone(getter_AddRefs(fileManagerDirectory));
+- NS_ENSURE_SUCCESS(rv, rv);
++ nsCOMPtr<nsIFile> fmDirectory;
++ rv = directory->Clone(getter_AddRefs(fmDirectory));
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- rv = fileManagerDirectory->Append(filename);
++ rv = fmDirectory->Append(filename);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- rv = fileManagerDirectory->Exists(&exists);
++ rv = fmDirectory->Exists(&exists);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+ if (exists) {
+ bool isDirectory;
+- rv = fileManagerDirectory->IsDirectory(&isDirectory);
++ rv = fmDirectory->IsDirectory(&isDirectory);
+ NS_ENSURE_SUCCESS(rv, rv);
+ NS_ENSURE_TRUE(isDirectory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- nsString fileManagerDirectoryPath;
+- rv = fileManagerDirectory->GetPath(fileManagerDirectoryPath);
+- NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
++ uint64_t usage = 0;
+
+- rc = sqlite3_quota_remove(
+- NS_ConvertUTF16toUTF8(fileManagerDirectoryPath).get());
+- if (rc != SQLITE_OK) {
+- NS_WARNING("Failed to delete file directory!");
+- return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
++ if (privilege != Chrome) {
++ rv = FileManager::GetUsage(fmDirectory, &usage);
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+ }
+
+- rv = fileManagerDirectory->Remove(true);
+- NS_ENSURE_SUCCESS(rv, rv);
++ rv = fmDirectory->Remove(true);
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
++
++ if (privilege != Chrome) {
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->DecreaseUsageForOrigin(mASCIIOrigin, usage);
++ }
+ }
+
+ return NS_OK;
+diff --git dom/indexedDB/OpenDatabaseHelper.h dom/indexedDB/OpenDatabaseHelper.h
+index 587301b..5a3d987 100644
+--- dom/indexedDB/OpenDatabaseHelper.h
++++ dom/indexedDB/OpenDatabaseHelper.h
+@@ -77,10 +77,16 @@ public:
+ return mDatabase;
+ }
+
++ const FactoryPrivilege& Privilege() const
++ {
++ return mPrivilege;
++ }
++
+ static
+- nsresult CreateDatabaseConnection(const nsAString& aName,
+- nsIFile* aDBFile,
+- nsIFile* aFileManagerDirectory,
++ nsresult CreateDatabaseConnection(nsIFile* aDBFile,
++ nsIFile* aFMDirectory,
++ const nsAString& aName,
++ const nsACString& aOrigin,
+ mozIStorageConnection** aConnection);
+
+ protected:
+diff --git dom/indexedDB/nsIStandardFileStream.idl dom/indexedDB/nsIStandardFileStream.idl
+deleted file mode 100644
+index 265c3ed..0000000
+--- dom/indexedDB/nsIStandardFileStream.idl
++++ /dev/null
+@@ -1,60 +0,0 @@
+-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+-/* vim: set ts=2 et sw=2 tw=80: */
+-/* This Source Code Form is subject to the terms of the Mozilla Public
+- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+- * You can obtain one at http://mozilla.org/MPL/2.0/. */
+-
+-#include "nsISupports.idl"
+-
+-interface nsIFile;
+-
+-/**
+- * A stream that allows you to read from a file or stream to a file
+- * using standard file APIs.
+- */
+-[scriptable, uuid(ebbbb779-92a3-4b2a-b7cf-6efbe904c453)]
+-interface nsIStandardFileStream : nsISupports
+-{
+- /**
+- * If this is set, the file will be opened (i.e., a call to
+- * fopen done) only when we do an actual operation on the stream,
+- * or more specifically, when one of the following is called:
+- * - Seek
+- * - Tell
+- * - SetEOF
+- * - Available
+- * - Read
+- * - Write
+- * - Flush
+- * - GetSize
+- * - GetLastModified
+- * - Sync
+- *
+- * FLAGS_DEFER_OPEN is useful if we use the stream on a background
+- * thread, so that the opening and possible |stat|ing of the file
+- * happens there as well.
+- *
+- * @note Using this flag results in the file not being opened
+- * during the call to Init. This means that any errors that might
+- * happen when this flag is not set would happen during the
+- * first read. Also, the file is not locked when Init is called,
+- * so it might be deleted before we try to read from it.
+- */
+- const long FLAGS_DEFER_OPEN = 1 << 0;
+-
+- /**
+- * @param file file to read from or stream to
+- * @param mode file open mode (see fopen documentation)
+- * @param flags flags specifying various behaviors of the class
+- * (see enumerations in the class)
+- */
+- void init(in nsIFile file,
+- in AString mode,
+- in long flags);
+-
+- /**
+- * Flush all written content held in memory buffers out to disk.
+- * This is the equivalent of fflush()
+- */
+- void flushBuffers();
+-};
+diff --git dom/indexedDB/test/Makefile.in dom/indexedDB/test/Makefile.in
+index 9c79b14..4c9a201 100644
+--- dom/indexedDB/test/Makefile.in
++++ dom/indexedDB/test/Makefile.in
+@@ -54,11 +54,13 @@ MOCHITEST_FILES = \
+ test_file_os_delete.html \
+ test_file_put_get_object.html \
+ test_file_put_get_values.html \
++ test_file_quota.html \
+ test_file_replace.html \
+ test_file_resurrection_delete.html \
+ test_file_resurrection_transaction_abort.html \
+ test_file_sharing.html \
+ test_file_transaction_abort.html \
++ test_filehandle_quota.html \
+ test_filehandle_serialization.html \
+ test_filehandle_store_snapshot.html \
+ test_getAll.html \
+diff --git dom/indexedDB/test/file.js dom/indexedDB/test/file.js
+index 07bd10a..3c6194a 100644
+--- dom/indexedDB/test/file.js
++++ dom/indexedDB/test/file.js
+@@ -3,6 +3,8 @@
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
++const DEFAULT_QUOTA = 50 * 1024 * 1024;
++
+ var bufferCache = [];
+ var utils = SpecialPowers.getDOMWindowUtils(window);
+
+@@ -184,25 +186,6 @@ function getUsage(usageHandler)
+ idbManager.getUsageForURI(uri, callback);
+ }
+
+-function getUsageSync()
+-{
+- let usage;
+-
+- getUsage(function(aUsage, aFileUsage) {
+- usage = aUsage;
+- });
+-
+- let comp = SpecialPowers.wrap(Components);
+- let thread = comp.classes["@mozilla.org/thread-manager;1"]
+- .getService(comp.interfaces.nsIThreadManager)
+- .currentThread;
+- while (!usage) {
+- thread.processNextEvent(true);
+- }
+-
+- return usage;
+-}
+-
+ function scheduleGC()
+ {
+ SpecialPowers.exactGC(window, continueToNextStep);
+diff --git dom/indexedDB/test/test_file_quota.html dom/indexedDB/test/test_file_quota.html
+index b07880d..9fbc0c0 100644
+--- dom/indexedDB/test/test_file_quota.html
++++ dom/indexedDB/test/test_file_quota.html
+@@ -13,14 +13,12 @@
+ function testSteps()
+ {
+ const READ_WRITE = IDBTransaction.READ_WRITE;
+- const DEFAULT_QUOTA_MB = 50;
+
+ const name = window.location.pathname;
+
+ const objectStoreName = "Blobs";
+
+- const testData = { key: 0, value: {} };
+- const fileData = { key: 1, file: null };
++ const fileData = { key: 1, file: getNullFile("random.bin", DEFAULT_QUOTA) };
+
+ let request = indexedDB.open(name, 1);
+ request.onerror = errorHandler;
+@@ -32,21 +30,17 @@
+
+ let db = event.target.result;
+
+- let objectStore = db.createObjectStore(objectStoreName, { });
+- objectStore.add(testData.value, testData.key);
+-
+- let size = (DEFAULT_QUOTA_MB + 1) * 1024 * 1024 - getUsageSync();
+- fileData.file = getNullFile("random.bin", size);
++ db.createObjectStore(objectStoreName, { });
+
+ event = yield;
+
+ is(event.type, "success", "Got correct event type");
+
+ trans = db.transaction([objectStoreName], READ_WRITE);
+- objectStore = trans.objectStore(objectStoreName);
++ let objectStore = trans.objectStore(objectStoreName);
+
+ request = objectStore.add(fileData.file, fileData.key);
+- request.addEventListener("error", new ExpectError("UnknownError"));
++ request.addEventListener("error", new ExpectError("UnknownError", true));
+ request.onsuccess = unexpectedSuccessHandler;
+ event = yield;
+
+diff --git dom/indexedDB/test/test_filehandle_quota.html dom/indexedDB/test/test_filehandle_quota.html
+index addaf01..0506279 100644
+--- dom/indexedDB/test/test_filehandle_quota.html
++++ dom/indexedDB/test/test_filehandle_quota.html
+@@ -13,7 +13,6 @@
+ function testSteps()
+ {
+ const READ_WRITE = IDBTransaction.READ_WRITE;
+- const DEFAULT_QUOTA_MB = 50;
+
+ const name = window.location.pathname;
+
+@@ -39,10 +38,10 @@
+
+ let lockedFile = fileHandle.open("readwrite");
+
+- let blob = getNullBlob((50 + 1) * 1024 * 1024 - getUsageSync());
++ let blob = getNullBlob(DEFAULT_QUOTA);
+
+ request = lockedFile.write(blob);
+- request.addEventListener("error", new ExpectError("UnknownError"));
++ request.addEventListener("error", new ExpectError("UnknownError", true));
+ request.onsuccess = unexpectedSuccessHandler;
+ event = yield;
+
+diff --git dom/quota/FileStreams.cpp dom/quota/FileStreams.cpp
+new file mode 100644
+index 0000000..9de244f
+--- /dev/null
++++ dom/quota/FileStreams.cpp
+@@ -0,0 +1,123 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#include "FileStreams.h"
++
++USING_QUOTA_NAMESPACE
++
++template <class FileStreamBase>
++NS_IMETHODIMP
++FileQuotaStream<FileStreamBase>::SetEOF()
++{
++ nsresult rv = FileStreamBase::SetEOF();
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ if (mQuotaObject) {
++ int64_t offset;
++ nsresult rv = FileStreamBase::Tell(&offset);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ mQuotaObject->UpdateSize(offset);
++ }
++
++ return NS_OK;
++}
++
++template <class FileStreamBase>
++NS_IMETHODIMP
++FileQuotaStream<FileStreamBase>::Close()
++{
++ nsresult rv = FileStreamBase::Close();
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ mQuotaObject = nullptr;
++
++ return NS_OK;
++}
++
++template <class FileStreamBase>
++nsresult
++FileQuotaStream<FileStreamBase>::DoOpen()
++{
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ NS_ASSERTION(!mQuotaObject, "Creating quota object more than once?");
++ mQuotaObject = quotaManager->GetQuotaObject(mOrigin,
++ FileStreamBase::mOpenParams.localFile);
++
++ nsresult rv = FileStreamBase::DoOpen();
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ if (mQuotaObject && (FileStreamBase::mOpenParams.ioFlags & PR_TRUNCATE)) {
++ mQuotaObject->UpdateSize(0);
++ }
++
++ return NS_OK;
++}
++
++template <class FileStreamBase>
++NS_IMETHODIMP
++FileQuotaStreamWithWrite<FileStreamBase>::Write(const char* aBuf,
++ uint32_t aCount,
++ uint32_t* _retval)
++{
++ nsresult rv;
++
++ if (FileQuotaStreamWithWrite::mQuotaObject) {
++ int64_t offset;
++ rv = FileStreamBase::Tell(&offset);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ if (!FileQuotaStreamWithWrite::
++ mQuotaObject->MaybeAllocateMoreSpace(offset, aCount)) {
++ return NS_ERROR_FAILURE;
++ }
++ }
++
++ rv = FileStreamBase::Write(aBuf, aCount, _retval);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ return NS_OK;
++}
++
++NS_IMPL_ISUPPORTS_INHERITED0(FileInputStream, nsFileInputStream)
++
++already_AddRefed<FileInputStream>
++FileInputStream::Create(const nsACString& aOrigin, nsIFile* aFile,
++ int32_t aIOFlags, int32_t aPerm,
++ int32_t aBehaviorFlags)
++{
++ nsRefPtr<FileInputStream> stream = new FileInputStream(aOrigin);
++ nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++ return stream.forget();
++}
++
++NS_IMPL_ISUPPORTS_INHERITED0(FileOutputStream, nsFileOutputStream)
++
++already_AddRefed<FileOutputStream>
++FileOutputStream::Create(const nsACString& aOrigin, nsIFile* aFile,
++ int32_t aIOFlags, int32_t aPerm,
++ int32_t aBehaviorFlags)
++{
++ nsRefPtr<FileOutputStream> stream = new FileOutputStream(aOrigin);
++ nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++ return stream.forget();
++}
++
++NS_IMPL_ISUPPORTS_INHERITED0(FileStream, nsFileStream)
++
++already_AddRefed<FileStream>
++FileStream::Create(const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags,
++ int32_t aPerm, int32_t aBehaviorFlags)
++{
++ nsRefPtr<FileStream> stream = new FileStream(aOrigin);
++ nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++ return stream.forget();
++}
+diff --git dom/quota/FileStreams.h dom/quota/FileStreams.h
+new file mode 100644
+index 0000000..77bfad4
+--- /dev/null
++++ dom/quota/FileStreams.h
+@@ -0,0 +1,115 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef mozilla_dom_quota_filestreams_h__
++#define mozilla_dom_quota_filestreams_h__
++
++#include "QuotaCommon.h"
++
++#include "nsFileStreams.h"
++
++#include "QuotaManager.h"
++
++BEGIN_QUOTA_NAMESPACE
++
++template <class FileStreamBase>
++class FileQuotaStream : public FileStreamBase
++{
++public:
++ // nsFileStreamBase override
++ NS_IMETHOD
++ SetEOF() MOZ_OVERRIDE;
++
++ NS_IMETHOD
++ Close() MOZ_OVERRIDE;
++
++protected:
++ FileQuotaStream(const nsACString& aOrigin)
++ : mOrigin(aOrigin)
++ { }
++
++ // nsFileStreamBase override
++ virtual nsresult
++ DoOpen() MOZ_OVERRIDE;
++
++ nsCString mOrigin;
++ nsRefPtr<QuotaObject> mQuotaObject;
++};
++
++template <class FileStreamBase>
++class FileQuotaStreamWithWrite : public FileQuotaStream<FileStreamBase>
++{
++public:
++ // nsFileStreamBase override
++ NS_IMETHOD
++ Write(const char* aBuf, uint32_t aCount, uint32_t* _retval) MOZ_OVERRIDE;
++
++protected:
++ FileQuotaStreamWithWrite(const nsACString& aOrigin)
++ : FileQuotaStream<FileStreamBase>(aOrigin)
++ { }
++};
++
++class FileInputStream : public FileQuotaStream<nsFileInputStream>
++{
++public:
++ NS_DECL_ISUPPORTS_INHERITED
++
++ static already_AddRefed<FileInputStream>
++ Create(const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
++ int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
++
++private:
++ FileInputStream(const nsACString& aOrigin)
++ : FileQuotaStream<nsFileInputStream>(aOrigin)
++ { }
++
++ virtual ~FileInputStream() {
++ Close();
++ }
++};
++
++class FileOutputStream : public FileQuotaStreamWithWrite<nsFileOutputStream>
++{
++public:
++ NS_DECL_ISUPPORTS_INHERITED
++
++ static already_AddRefed<FileOutputStream>
++ Create(const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
++ int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
++
++private:
++ FileOutputStream(const nsACString& aOrigin)
++ : FileQuotaStreamWithWrite<nsFileOutputStream>(aOrigin)
++ { }
++
++ virtual ~FileOutputStream() {
++ Close();
++ }
++};
++
++class FileStream : public FileQuotaStreamWithWrite<nsFileStream>
++{
++public:
++ NS_DECL_ISUPPORTS_INHERITED
++
++ static already_AddRefed<FileStream>
++ Create(const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
++ int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
++
++private:
++ FileStream(const nsACString& aOrigin)
++ : FileQuotaStreamWithWrite<nsFileStream>(aOrigin)
++ { }
++
++ virtual ~FileStream() {
++ Close();
++ }
++};
++
++END_QUOTA_NAMESPACE
++
++#endif /* mozilla_dom_quota_filestreams_h__ */
+diff --git dom/quota/Makefile.in dom/quota/Makefile.in
+new file mode 100644
+index 0000000..49be551
+--- /dev/null
++++ dom/quota/Makefile.in
+@@ -0,0 +1,33 @@
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distributed with this file,
++# You can obtain one at http://mozilla.org/MPL/2.0/.
++
++DEPTH = ../..
++topsrcdir = @top_srcdir@
++srcdir = @srcdir@
++VPATH = @srcdir@
++
++include $(DEPTH)/config/autoconf.mk
++
++MODULE = dom
++LIBRARY_NAME = domquota_s
++XPIDL_MODULE = dom_quota
++LIBXUL_LIBRARY = 1
++FORCE_STATIC_LIB = 1
++
++include $(topsrcdir)/dom/dom-config.mk
++
++EXPORTS_NAMESPACES = mozilla/dom/quota
++
++CPPSRCS = \
++ FileStreams.cpp \
++ QuotaManager.cpp \
++ $(NULL)
++
++EXPORTS_mozilla/dom/quota = \
++ FileStreams.h \
++ QuotaCommon.h \
++ QuotaManager.h \
++ $(NULL)
++
++include $(topsrcdir)/config/rules.mk
+diff --git dom/quota/QuotaCommon.h dom/quota/QuotaCommon.h
+new file mode 100644
+index 0000000..a415d17
+--- /dev/null
++++ dom/quota/QuotaCommon.h
+@@ -0,0 +1,23 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
++ * You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef mozilla_dom_quota_quotacommon_h__
++#define mozilla_dom_quota_quotacommon_h__
++
++#include "nsAutoPtr.h"
++#include "nsCOMPtr.h"
++#include "nsDebug.h"
++#include "nsStringGlue.h"
++#include "nsTArray.h"
++
++#define BEGIN_QUOTA_NAMESPACE \
++ namespace mozilla { namespace dom { namespace quota {
++#define END_QUOTA_NAMESPACE \
++ } /* namespace quota */ } /* namespace dom */ } /* namespace mozilla */
++#define USING_QUOTA_NAMESPACE \
++ using namespace mozilla::dom::quota;
++
++#endif // mozilla_dom_quota_quotacommon_h__
+diff --git dom/quota/QuotaManager.cpp dom/quota/QuotaManager.cpp
+new file mode 100644
+index 0000000..b251606
+--- /dev/null
++++ dom/quota/QuotaManager.cpp
+@@ -0,0 +1,294 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
++ * You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#include "QuotaManager.h"
++
++#include "nsIFile.h"
++
++#include "mozilla/ClearOnShutdown.h"
++#include "nsComponentManagerUtils.h"
++
++#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
++
++USING_QUOTA_NAMESPACE
++
++namespace {
++
++nsAutoPtr<QuotaManager> gInstance;
++
++PLDHashOperator
++RemoveQuotaForPatternCallback(const nsACString& aKey,
++ nsRefPtr<OriginInfo>& aValue,
++ void* aUserArg)
++{
++ NS_ASSERTION(!aKey.IsEmpty(), "Empty key!");
++ NS_ASSERTION(aValue, "Null pointer!");
++ NS_ASSERTION(aUserArg, "Null pointer!");
++
++ const nsACString* pattern =
++ static_cast<const nsACString*>(aUserArg);
++
++ if (StringBeginsWith(aKey, *pattern)) {
++ return PL_DHASH_REMOVE;
++ }
++
++ return PL_DHASH_NEXT;
++}
++
++} // anonymous namespace
++
++void
++QuotaObject::AddRef()
++{
++ QuotaManager* quotaManager = QuotaManager::Get();
++ if (!quotaManager) {
++ NS_ERROR("Null quota manager, this shouldn't happen, possible leak!");
++
++ NS_AtomicIncrementRefcnt(mRefCnt);
++
++ return;
++ }
++
++ MutexAutoLock lock(quotaManager->mQuotaMutex);
++
++ ++mRefCnt;
++}
++
++void
++QuotaObject::Release()
++{
++ QuotaManager* quotaManager = QuotaManager::Get();
++ if (!quotaManager) {
++ NS_ERROR("Null quota manager, this shouldn't happen, possible leak!");
++
++ nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt);
++ if (count == 0) {
++ mRefCnt = 1;
++ delete this;
++ }
++
++ return;
++ }
++
++ {
++ MutexAutoLock lock(quotaManager->mQuotaMutex);
++
++ --mRefCnt;
++
++ if (mRefCnt > 0) {
++ return;
++ }
++
++ if (mOriginInfo) {
++ mOriginInfo->mQuotaObjects.Remove(mPath);
++ }
++ }
++
++ delete this;
++}
++
++void
++QuotaObject::UpdateSize(int64_t aSize)
++{
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ MutexAutoLock lock(quotaManager->mQuotaMutex);
++
++ if (mOriginInfo) {
++ mOriginInfo->mUsage -= mSize;
++ mSize = aSize;
++ mOriginInfo->mUsage += mSize;
++ }
++}
++
++bool
++QuotaObject::MaybeAllocateMoreSpace(int64_t aOffset, int32_t aCount)
++{
++ int64_t end = aOffset + aCount;
++
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ MutexAutoLock lock(quotaManager->mQuotaMutex);
++
++ if (mSize >= end || !mOriginInfo) {
++ return true;
++ }
++
++ int64_t newUsage = mOriginInfo->mUsage - mSize + end;
++ if (newUsage > mOriginInfo->mLimit) {
++ if (!indexedDB::IndexedDatabaseManager::QuotaIsLifted()) {
++ return false;
++ }
++
++ nsCString origin = mOriginInfo->mOrigin;
++
++ mOriginInfo->LockedClearOriginInfos();
++ NS_ASSERTION(!mOriginInfo,
++ "Should have cleared in LockedClearOriginInfos!");
++
++ quotaManager->mOriginInfos.Remove(origin);
++
++ mSize = end;
++
++ return true;
++ }
++
++ mOriginInfo->mUsage = newUsage;
++ mSize = end;
++
++ return true;
++}
++
++#ifdef DEBUG
++void
++OriginInfo::LockedClearOriginInfos()
++{
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->mQuotaMutex.AssertCurrentThreadOwns();
++
++ mQuotaObjects.EnumerateRead(ClearOriginInfoCallback, nullptr);
++}
++#endif
++
++// static
++PLDHashOperator
++OriginInfo::ClearOriginInfoCallback(const nsAString& aKey,
++ QuotaObject* aValue,
++ void* aUserArg)
++{
++ NS_ASSERTION(!aKey.IsEmpty(), "Empty key!");
++ NS_ASSERTION(aValue, "Null pointer!");
++
++ aValue->mOriginInfo = nullptr;
++
++ return PL_DHASH_NEXT;
++}
++
++// static
++QuotaManager*
++QuotaManager::GetOrCreate()
++{
++ if (!gInstance) {
++ NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
++
++ gInstance = new QuotaManager();
++
++ ClearOnShutdown(&gInstance);
++ }
++
++ return gInstance;
++}
++
++// static
++QuotaManager*
++QuotaManager::Get()
++{
++ // Does not return an owning reference.
++ return gInstance;
++}
++
++void
++QuotaManager::InitQuotaForOrigin(const nsACString& aOrigin,
++ int64_t aLimit,
++ int64_t aUsage)
++{
++ OriginInfo* info = new OriginInfo(aOrigin, aLimit * 1024 * 1024, aUsage);
++
++ MutexAutoLock lock(mQuotaMutex);
++
++ NS_ASSERTION(!mOriginInfos.GetWeak(aOrigin), "Replacing an existing entry!");
++ mOriginInfos.Put(aOrigin, info);
++}
++
++void
++QuotaManager::DecreaseUsageForOrigin(const nsACString& aOrigin,
++ int64_t aSize)
++{
++ MutexAutoLock lock(mQuotaMutex);
++
++ nsRefPtr<OriginInfo> originInfo;
++ mOriginInfos.Get(aOrigin, getter_AddRefs(originInfo));
++
++ if (originInfo) {
++ originInfo->mUsage -= aSize;
++ }
++}
++
++void
++QuotaManager::RemoveQuotaForPattern(const nsACString& aPattern)
++{
++ NS_ASSERTION(!aPattern.IsEmpty(), "Empty pattern!");
++
++ MutexAutoLock lock(mQuotaMutex);
++
++ mOriginInfos.Enumerate(RemoveQuotaForPatternCallback,
++ const_cast<nsACString*>(&aPattern));
++}
++
++already_AddRefed<QuotaObject>
++QuotaManager::GetQuotaObject(const nsACString& aOrigin,
++ nsIFile* aFile)
++{
++ NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
++
++ nsString path;
++ nsresult rv = aFile->GetPath(path);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ int64_t fileSize;
++
++ bool exists;
++ rv = aFile->Exists(&exists);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ if (exists) {
++ rv = aFile->GetFileSize(&fileSize);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++ }
++ else {
++ fileSize = 0;
++ }
++
++ QuotaObject* info = nullptr;
++ {
++ MutexAutoLock lock(mQuotaMutex);
++
++ nsRefPtr<OriginInfo> originInfo;
++ mOriginInfos.Get(aOrigin, getter_AddRefs(originInfo));
++
++ if (!originInfo) {
++ return nullptr;
++ }
++
++ originInfo->mQuotaObjects.Get(path, &info);
++
++ if (!info) {
++ info = new QuotaObject(originInfo, path, fileSize);
++ originInfo->mQuotaObjects.Put(path, info);
++ }
++ }
++
++ nsRefPtr<QuotaObject> result = info;
++ return result.forget();
++}
++
++already_AddRefed<QuotaObject>
++QuotaManager::GetQuotaObject(const nsACString& aOrigin,
++ const nsAString& aPath)
++{
++ nsresult rv;
++ nsCOMPtr<nsIFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ rv = file->InitWithPath(aPath);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ return GetQuotaObject(aOrigin, file);
++}
+diff --git dom/quota/QuotaManager.h dom/quota/QuotaManager.h
+new file mode 100644
+index 0000000..e19acdd
+--- /dev/null
++++ dom/quota/QuotaManager.h
+@@ -0,0 +1,147 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
++ * You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef mozilla_dom_quota_quotamanager_h__
++#define mozilla_dom_quota_quotamanager_h__
++
++#include "QuotaCommon.h"
++
++#include "mozilla/Mutex.h"
++#include "nsDataHashtable.h"
++#include "nsRefPtrHashtable.h"
++#include "nsThreadUtils.h"
++
++BEGIN_QUOTA_NAMESPACE
++
++class OriginInfo;
++class QuotaManager;
++
++class QuotaObject
++{
++ friend class OriginInfo;
++ friend class QuotaManager;
++
++public:
++ void
++ AddRef();
++
++ void
++ Release();
++
++ void
++ UpdateSize(int64_t aSize);
++
++ bool
++ MaybeAllocateMoreSpace(int64_t aOffset, int32_t aCount);
++
++private:
++ QuotaObject(OriginInfo* aOriginInfo, const nsAString& aPath, int64_t aSize)
++ : mOriginInfo(aOriginInfo), mPath(aPath), mSize(aSize)
++ { }
++
++ virtual ~QuotaObject()
++ { }
++
++ nsAutoRefCnt mRefCnt;
++
++ OriginInfo* mOriginInfo;
++ nsString mPath;
++ int64_t mSize;
++};
++
++class OriginInfo
++{
++ friend class QuotaManager;
++ friend class QuotaObject;
++
++public:
++ OriginInfo(const nsACString& aOrigin, int64_t aLimit, int64_t aUsage)
++ : mOrigin(aOrigin), mLimit(aLimit), mUsage(aUsage)
++ {
++ mQuotaObjects.Init();
++ }
++
++ NS_INLINE_DECL_THREADSAFE_REFCOUNTING(OriginInfo)
++
++private:
++ void
++#ifdef DEBUG
++ LockedClearOriginInfos();
++#else
++ LockedClearOriginInfos()
++ {
++ mQuotaObjects.EnumerateRead(ClearOriginInfoCallback, nullptr);
++ }
++#endif
++
++ static PLDHashOperator
++ ClearOriginInfoCallback(const nsAString& aKey,
++ QuotaObject* aValue, void* aUserArg);
++
++ nsDataHashtable<nsStringHashKey, QuotaObject*> mQuotaObjects;
++
++ nsCString mOrigin;
++ int64_t mLimit;
++ int64_t mUsage;
++};
++
++class QuotaManager
++{
++ friend class nsAutoPtr<QuotaManager>;
++ friend class OriginInfo;
++ friend class QuotaObject;
++
++public:
++ // Returns a non-owning reference.
++ static QuotaManager*
++ GetOrCreate();
++
++ // Returns a non-owning reference.
++ static QuotaManager*
++ Get();
++
++ void
++ InitQuotaForOrigin(const nsACString& aOrigin,
++ int64_t aLimit,
++ int64_t aUsage);
++
++ void
++ DecreaseUsageForOrigin(const nsACString& aOrigin,
++ int64_t aSize);
++
++ void
++ RemoveQuotaForPattern(const nsACString& aPattern);
++
++ already_AddRefed<QuotaObject>
++ GetQuotaObject(const nsACString& aOrigin,
++ nsIFile* aFile);
++
++ already_AddRefed<QuotaObject>
++ GetQuotaObject(const nsACString& aOrigin,
++ const nsAString& aPath);
++
++private:
++ QuotaManager()
++ : mQuotaMutex("QuotaManager.mQuotaMutex")
++ {
++ NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
++
++ mOriginInfos.Init();
++ }
++
++ virtual ~QuotaManager()
++ {
++ NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
++ }
++
++ mozilla::Mutex mQuotaMutex;
++
++ nsRefPtrHashtable<nsCStringHashKey, OriginInfo> mOriginInfos;
++};
++
++END_QUOTA_NAMESPACE
++
++#endif /* mozilla_dom_quota_quotamanager_h__ */
+diff --git layout/build/Makefile.in layout/build/Makefile.in
+index e6b32da..496b55f 100644
+--- layout/build/Makefile.in
++++ layout/build/Makefile.in
+@@ -69,6 +69,7 @@ SHARED_LIBRARY_LIBS = \
+ $(DEPTH)/dom/encoding/$(LIB_PREFIX)domencoding_s.$(LIB_SUFFIX) \
+ $(DEPTH)/dom/file/$(LIB_PREFIX)domfile_s.$(LIB_SUFFIX) \
+ $(DEPTH)/dom/power/$(LIB_PREFIX)dom_power_s.$(LIB_SUFFIX) \
++ $(DEPTH)/dom/quota/$(LIB_PREFIX)domquota_s.$(LIB_SUFFIX) \
+ $(DEPTH)/dom/settings/$(LIB_PREFIX)jsdomsettings_s.$(LIB_SUFFIX) \
+ $(DEPTH)/dom/permission/$(LIB_PREFIX)jsdompermissionsettings_s.$(LIB_SUFFIX) \
+ $(DEPTH)/dom/network/src/$(LIB_PREFIX)dom_network_s.$(LIB_SUFFIX) \
+diff --git netwerk/base/src/Makefile.in netwerk/base/src/Makefile.in
+index 0c0d60e..e8cef48 100644
+--- netwerk/base/src/Makefile.in
++++ netwerk/base/src/Makefile.in
+@@ -19,6 +19,7 @@ LIBXUL_LIBRARY = 1
+ EXPORTS = \
+ nsMIMEInputStream.h \
+ nsURLHelper.h \
++ nsFileStreams.h \
+ $(NULL)
+
+ EXPORTS_NAMESPACES = mozilla/net
+diff --git netwerk/base/src/nsFileStreams.cpp netwerk/base/src/nsFileStreams.cpp
+index 2420ffc..ecc26aa 100644
+--- netwerk/base/src/nsFileStreams.cpp
++++ netwerk/base/src/nsFileStreams.cpp
+@@ -51,7 +51,9 @@ nsFileStreamBase::~nsFileStreamBase()
+ Close();
+ }
+
+-NS_IMPL_THREADSAFE_ISUPPORTS1(nsFileStreamBase, nsISeekableStream)
++NS_IMPL_THREADSAFE_ISUPPORTS2(nsFileStreamBase,
++ nsISeekableStream,
++ nsIFileMetadata)
+
+ NS_IMETHODIMP
+ nsFileStreamBase::Seek(int32_t whence, int64_t offset)
+@@ -124,6 +126,52 @@ nsFileStreamBase::SetEOF()
+ return NS_OK;
+ }
+
++NS_IMETHODIMP
++nsFileStreamBase::GetSize(int64_t* _retval)
++{
++ nsresult rv = DoPendingOpen();
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ if (!mFD) {
++ return NS_BASE_STREAM_CLOSED;
++ }
++
++ PRFileInfo64 info;
++ if (PR_GetOpenFileInfo64(mFD, &info) == PR_FAILURE) {
++ return NS_BASE_STREAM_OSERROR;
++ }
++
++ *_retval = int64_t(info.size);
++
++ return NS_OK;
++}
++
++NS_IMETHODIMP
++nsFileStreamBase::GetLastModified(int64_t* _retval)
++{
++ nsresult rv = DoPendingOpen();
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ if (!mFD) {
++ return NS_BASE_STREAM_CLOSED;
++ }
++
++ PRFileInfo64 info;
++ if (PR_GetOpenFileInfo64(mFD, &info) == PR_FAILURE) {
++ return NS_BASE_STREAM_OSERROR;
++ }
++
++ int64_t modTime = int64_t(info.modifyTime);
++ if (modTime == 0) {
++ *_retval = 0;
++ }
++ else {
++ *_retval = modTime / int64_t(PR_USEC_PER_MSEC);
++ }
++
++ return NS_OK;
++}
++
+ nsresult
+ nsFileStreamBase::Close()
+ {
+@@ -934,13 +982,12 @@ nsSafeFileOutputStream::Write(const char *buf, uint32_t count, uint32_t *result)
+ ////////////////////////////////////////////////////////////////////////////////
+ // nsFileStream
+
+-NS_IMPL_ISUPPORTS_INHERITED4(nsFileStream,
++NS_IMPL_ISUPPORTS_INHERITED3(nsFileStream,
+ nsFileStreamBase,
+ nsIInputStream,
+ nsIOutputStream,
+- nsIFileStream,
+- nsIFileMetadata)
+-
++ nsIFileStream)
++
+ NS_IMETHODIMP
+ nsFileStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm,
+ int32_t behaviorFlags)
+@@ -959,50 +1006,4 @@ nsFileStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm,
+ mBehaviorFlags & nsIFileStream::DEFER_OPEN);
+ }
+
+-NS_IMETHODIMP
+-nsFileStream::GetSize(int64_t* _retval)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mFD) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- PRFileInfo64 info;
+- if (PR_GetOpenFileInfo64(mFD, &info) == PR_FAILURE) {
+- return NS_BASE_STREAM_OSERROR;
+- }
+-
+- *_retval = int64_t(info.size);
+-
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-nsFileStream::GetLastModified(int64_t* _retval)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mFD) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- PRFileInfo64 info;
+- if (PR_GetOpenFileInfo64(mFD, &info) == PR_FAILURE) {
+- return NS_BASE_STREAM_OSERROR;
+- }
+-
+- int64_t modTime = int64_t(info.modifyTime);
+- if (modTime == 0) {
+- *_retval = 0;
+- }
+- else {
+- *_retval = modTime / int64_t(PR_USEC_PER_MSEC);
+- }
+-
+- return NS_OK;
+-}
+-
+ ////////////////////////////////////////////////////////////////////////////////
+diff --git netwerk/base/src/nsFileStreams.h netwerk/base/src/nsFileStreams.h
+index 13e5b45..1aa6a82 100644
+--- netwerk/base/src/nsFileStreams.h
++++ netwerk/base/src/nsFileStreams.h
+@@ -24,11 +24,13 @@
+
+ ////////////////////////////////////////////////////////////////////////////////
+
+-class nsFileStreamBase : public nsISeekableStream
++class nsFileStreamBase : public nsISeekableStream,
++ public nsIFileMetadata
+ {
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSISEEKABLESTREAM
++ NS_DECL_NSIFILEMETADATA
+
+ nsFileStreamBase();
+ virtual ~nsFileStreamBase();
+@@ -124,8 +126,8 @@ public:
+ NS_IMETHOD IsNonBlocking(bool* _retval)
+ {
+ return nsFileStreamBase::IsNonBlocking(_retval);
+- }
+-
++ }
++
+ // Overrided from nsFileStreamBase
+ NS_IMETHOD Seek(int32_t aWhence, int64_t aOffset);
+
+@@ -260,13 +262,11 @@ protected:
+ class nsFileStream : public nsFileStreamBase,
+ public nsIInputStream,
+ public nsIOutputStream,
+- public nsIFileStream,
+- public nsIFileMetadata
++ public nsIFileStream
+ {
+ public:
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_NSIFILESTREAM
+- NS_DECL_NSIFILEMETADATA
+ NS_FORWARD_NSIINPUTSTREAM(nsFileStreamBase::)
+
+ // Can't use NS_FORWARD_NSIOUTPUTSTREAM due to overlapping methods
+diff --git storage/public/Makefile.in storage/public/Makefile.in
+index c485d4e..c05e6f3 100644
+--- storage/public/Makefile.in
++++ storage/public/Makefile.in
+@@ -36,7 +36,6 @@ XPIDLSRCS = \
+ mozIStorageCompletionCallback.idl \
+ mozIStorageBaseStatement.idl \
+ mozIStorageAsyncStatement.idl \
+- mozIStorageServiceQuotaManagement.idl \
+ mozIStorageVacuumParticipant.idl \
+ $(NULL)
+ # SEE ABOVE NOTE!
+diff --git storage/public/mozIStorageService.idl storage/public/mozIStorageService.idl
+index 3087a11..483649b 100644
+--- storage/public/mozIStorageService.idl
++++ storage/public/mozIStorageService.idl
+@@ -7,6 +7,7 @@
+
+ interface mozIStorageConnection;
+ interface nsIFile;
++interface nsIFileURL;
+
+ /**
+ * The mozIStorageService interface is intended to be implemented by
+@@ -15,7 +16,7 @@ interface nsIFile;
+ *
+ * This is the only way to open a database connection.
+ */
+-[scriptable, uuid(fe8e95cb-b377-4c8d-bccb-d9198c67542b)]
++[scriptable, uuid(12bfad34-cca3-40fb-8736-d8bf9db61a27)]
+ interface mozIStorageService : nsISupports {
+ /**
+ * Get a connection to a named special database storage.
+@@ -106,6 +107,16 @@ interface mozIStorageService : nsISupports {
+ */
+ mozIStorageConnection openUnsharedDatabase(in nsIFile aDatabaseFile);
+
++ /**
++ * See openDatabase(). Exactly the same only initialized with a file URL.
++ * Custom parameters can be passed to SQLite and VFS implementations through
++ * the query part of the URL.
++ *
++ * @param aURL
++ * A nsIFileURL that represents the database that is to be opened.
++ */
++ mozIStorageConnection openDatabaseWithFileURL(in nsIFileURL aFileURL);
++
+ /*
+ * Utilities
+ */
+diff --git storage/public/mozIStorageServiceQuotaManagement.idl storage/public/mozIStorageServiceQuotaManagement.idl
+deleted file mode 100644
+index ee5086b..0000000
+--- storage/public/mozIStorageServiceQuotaManagement.idl
++++ /dev/null
+@@ -1,99 +0,0 @@
+-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+-/* vim: set ts=2 et sw=2 tw=80: */
+-/* This Source Code Form is subject to the terms of the Mozilla Public
+- * License, v. 2.0. If a copy of the MPL was not distributed with this
+- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+-
+-#include "nsISupports.idl"
+-
+-interface mozIStorageConnection;
+-interface nsIFile;
+-
+-[scriptable, function, uuid(ae94f0a5-ebdf-48f4-9959-085e13235d8d)]
+-interface mozIStorageQuotaCallback : nsISupports
+-{
+- /**
+- * Called when the file size quota for a group of databases is exceeded.
+- *
+- * @param aFilename
+- * The filename of the database that has exceeded the quota.
+- *
+- * @param aCurrentSizeLimit
+- * The current size (in bytes) of the quota.
+- *
+- * @param aCurrentTotalSize
+- * The current size of all databases in the quota group.
+- *
+- * @param aUserData
+- * Any additional data that was provided to the
+- * setQuotaForFilenamePattern function.
+- *
+- * @returns A new quota size. A new quota of 0 will disable the quota callback
+- * and any quota value less than aCurrentTotalSize will cause the
+- * database operation to fail with NS_ERROR_FILE_NO_DEVICE_SPACE.
+- */
+- long long quotaExceeded(in ACString aFilename,
+- in long long aCurrentSizeLimit,
+- in long long aCurrentTotalSize,
+- in nsISupports aUserData);
+-};
+-
+-/**
+- * This is a temporary interface that should eventually merge with
+- * mozIStorageService.
+- */
+-[scriptable, uuid(4d81faf5-fe01-428b-99b8-c94cba12fd72)]
+-interface mozIStorageServiceQuotaManagement : nsISupports
+-{
+- /**
+- * See mozIStorageService.openDatabase. Exactly the same only with a custom
+- * SQLite VFS.
+- */
+- mozIStorageConnection openDatabaseWithVFS(in nsIFile aDatabaseFile,
+- in ACString aVFSName);
+-
+- /**
+- * Set a file size quota for a group of databases matching the given filename
+- * pattern, optionally specifying a callback when the quota is exceeded.
+- *
+- * @param aPattern
+- * A pattern to match filenames for inclusion in the quota system. May
+- * contain the following special characters:
+- * '*' Matches any sequence of zero or more characters.
+- * '?' Matches exactly one character.
+- * [...] Matches one character from the enclosed list of characters.
+- * [^...] Matches one character not in the enclosed list.
+- *
+- * @param aSizeLimit
+- * The size limit (in bytes) for the quota group.
+- *
+- * @param aCallback
+- * A callback that will be used when the quota is exceeded.
+- *
+- * @param aUserData
+- * Additional information to be passed to the callback.
+- */
+- void setQuotaForFilenamePattern(in ACString aPattern,
+- in long long aSizeLimit,
+- in mozIStorageQuotaCallback aCallback,
+- in nsISupports aUserData);
+-
+- /**
+- * Adds, removes, or updates the file size information maintained by the quota
+- * system for files not opened through openDatabaseWithVFS().
+- *
+- * Use this function when you want files to be included in quota calculations
+- * that are either a) not SQLite databases, or b) SQLite databases that have
+- * not been opened.
+- *
+- * This function will have no effect on files that do not match an existing
+- * quota pattern (set previously by setQuotaForFilenamePattern()).
+- *
+- * @param aFile
+- * The file for which quota information should be updated. If the file
+- * exists then its size information will be added or refreshed. If the
+- * file does not exist then the file will be removed from tracking
+- * under the quota system.
+- */
+- void updateQuotaInformationForFile(in nsIFile aFile);
+-};
+diff --git storage/public/storage.h storage/public/storage.h
+index 8e571e2..08f39f3 100644
+--- storage/public/storage.h
++++ storage/public/storage.h
+@@ -24,7 +24,6 @@
+ #include "mozIStorageStatementCallback.h"
+ #include "mozIStorageBindingParamsArray.h"
+ #include "mozIStorageBindingParams.h"
+-#include "mozIStorageServiceQuotaManagement.h"
+ #include "mozIStorageVacuumParticipant.h"
+ #include "mozIStorageCompletionCallback.h"
+ #include "mozIStorageAsyncStatement.h"
+diff --git storage/src/TelemetryVFS.cpp storage/src/TelemetryVFS.cpp
+index 60de5c4..e4fce09 100644
+--- storage/src/TelemetryVFS.cpp
++++ storage/src/TelemetryVFS.cpp
+@@ -10,6 +10,7 @@
+ #include "sqlite3.h"
+ #include "nsThreadUtils.h"
+ #include "mozilla/Util.h"
++#include "mozilla/dom/quota/QuotaManager.h"
+
+ /**
+ * This preference is a workaround to allow users/sysadmins to identify
+@@ -24,6 +25,7 @@
+ namespace {
+
+ using namespace mozilla;
++using namespace mozilla::dom::quota;
+
+ struct Histograms {
+ const char *name;
+@@ -82,9 +84,17 @@ private:
+ };
+
+ struct telemetry_file {
+- sqlite3_file base; // Base class. Must be first
+- Histograms *histograms; // histograms pertaining to this file
+- sqlite3_file pReal[1]; // This contains the vfs that actually does work
++ // Base class. Must be first
++ sqlite3_file base;
++
++ // histograms pertaining to this file
++ Histograms *histograms;
++
++ // quota object for this file
++ nsRefPtr<QuotaObject> quotaObject;
++
++ // This contains the vfs that actually does work
++ sqlite3_file pReal[1];
+ };
+
+ /*
+@@ -99,6 +109,7 @@ xClose(sqlite3_file *pFile)
+ if( rc==SQLITE_OK ){
+ delete p->base.pMethods;
+ p->base.pMethods = NULL;
++ p->quotaObject = nullptr;
+ }
+ return rc;
+ }
+@@ -126,6 +137,9 @@ int
+ xWrite(sqlite3_file *pFile, const void *zBuf, int iAmt, sqlite_int64 iOfst)
+ {
+ telemetry_file *p = (telemetry_file *)pFile;
++ if (p->quotaObject && !p->quotaObject->MaybeAllocateMoreSpace(iOfst, iAmt)) {
++ return SQLITE_FULL;
++ }
+ IOThreadAutoTimer ioTimer(p->histograms->writeMS);
+ int rc;
+ rc = p->pReal->pMethods->xWrite(p->pReal, zBuf, iAmt, iOfst);
+@@ -144,6 +158,9 @@ xTruncate(sqlite3_file *pFile, sqlite_int64 size)
+ int rc;
+ Telemetry::AutoTimer<Telemetry::MOZ_SQLITE_TRUNCATE_MS> timer;
+ rc = p->pReal->pMethods->xTruncate(p->pReal, size);
++ if (rc == SQLITE_OK && p->quotaObject) {
++ p->quotaObject->UpdateSize(size);
++ }
+ return rc;
+ }
+
+@@ -300,6 +317,18 @@ xOpen(sqlite3_vfs* vfs, const char *zName, sqlite3_file* pFile,
+ break;
+ }
+ p->histograms = h;
++
++ const char* origin;
++ if ((flags & SQLITE_OPEN_URI) &&
++ (origin = sqlite3_uri_parameter(zName, "origin"))) {
++ QuotaManager* quotaManager = QuotaManager::Get();
++ MOZ_ASSERT(quotaManager);
++
++ p->quotaObject = quotaManager->GetQuotaObject(nsDependentCString(origin),
++ NS_ConvertUTF8toUTF16(zName));
++
++ }
++
+ rc = orig_vfs->xOpen(orig_vfs, zName, p->pReal, flags, pOutFlags);
+ if( rc != SQLITE_OK )
+ return rc;
+diff --git storage/src/mozStorageConnection.cpp storage/src/mozStorageConnection.cpp
+index 3afd3e1b..430824a 100644
+--- storage/src/mozStorageConnection.cpp
++++ storage/src/mozStorageConnection.cpp
+@@ -12,6 +12,7 @@
+ #include "nsIMemoryReporter.h"
+ #include "nsThreadUtils.h"
+ #include "nsIFile.h"
++#include "nsIFileURL.h"
+ #include "mozilla/Telemetry.h"
+ #include "mozilla/Mutex.h"
+ #include "mozilla/CondVar.h"
+@@ -471,34 +472,83 @@ Connection::getAsyncExecutionTarget()
+ }
+
+ nsresult
+-Connection::initialize(nsIFile *aDatabaseFile,
+- const char* aVFSName)
++Connection::initialize()
+ {
+ NS_ASSERTION (!mDBConn, "Initialize called on already opened database!");
+ SAMPLE_LABEL("storage", "Connection::initialize");
+
+- int srv;
+- nsresult rv;
++ // in memory database requested, sqlite uses a magic file name
++ int srv = ::sqlite3_open_v2(":memory:", &mDBConn, mFlags, NULL);
++ if (srv != SQLITE_OK) {
++ mDBConn = nullptr;
++ return convertResultCode(srv);
++ }
++
++ return initializeInternal(nullptr);
++}
++
++nsresult
++Connection::initialize(nsIFile *aDatabaseFile)
++{
++ NS_ASSERTION (aDatabaseFile, "Passed null file!");
++ NS_ASSERTION (!mDBConn, "Initialize called on already opened database!");
++ SAMPLE_LABEL("storage", "Connection::initialize");
+
+ mDatabaseFile = aDatabaseFile;
+
+- if (aDatabaseFile) {
+- nsAutoString path;
+- rv = aDatabaseFile->GetPath(path);
+- NS_ENSURE_SUCCESS(rv, rv);
++ nsAutoString path;
++ nsresult rv = aDatabaseFile->GetPath(path);
++ NS_ENSURE_SUCCESS(rv, rv);
+
+- srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn, mFlags,
+- aVFSName);
+- }
+- else {
+- // in memory database requested, sqlite uses a magic file name
+- srv = ::sqlite3_open_v2(":memory:", &mDBConn, mFlags, aVFSName);
++ int srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn,
++ mFlags, NULL);
++ if (srv != SQLITE_OK) {
++ mDBConn = nullptr;
++ return convertResultCode(srv);
+ }
++
++ rv = initializeInternal(aDatabaseFile);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ mDatabaseFile = aDatabaseFile;
++
++ return NS_OK;
++}
++
++nsresult
++Connection::initialize(nsIFileURL *aFileURL)
++{
++ NS_ASSERTION (aFileURL, "Passed null file URL!");
++ NS_ASSERTION (!mDBConn, "Initialize called on already opened database!");
++ SAMPLE_LABEL("storage", "Connection::initialize");
++
++ nsCOMPtr<nsIFile> databaseFile;
++ nsresult rv = aFileURL->GetFile(getter_AddRefs(databaseFile));
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ nsAutoCString spec;
++ rv = aFileURL->GetSpec(spec);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ int srv = ::sqlite3_open_v2(spec.get(), &mDBConn, mFlags, NULL);
+ if (srv != SQLITE_OK) {
+ mDBConn = nullptr;
+ return convertResultCode(srv);
+ }
+
++ rv = initializeInternal(databaseFile);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ mFileURL = aFileURL;
++ mDatabaseFile = databaseFile;
++
++ return NS_OK;
++}
++
++
++nsresult
++Connection::initializeInternal(nsIFile* aDatabaseFile)
++{
+ // Properly wrap the database handle's mutex.
+ sharedDBMutex.initWithMutex(sqlite3_db_mutex(mDBConn));
+
+@@ -522,14 +572,14 @@ Connection::initialize(nsIFile *aDatabaseFile,
+ nsAutoCString pageSizeQuery(MOZ_STORAGE_UNIQUIFY_QUERY_STR
+ "PRAGMA page_size = ");
+ pageSizeQuery.AppendInt(pageSize);
+- rv = ExecuteSimpleSQL(pageSizeQuery);
++ nsresult rv = ExecuteSimpleSQL(pageSizeQuery);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ // Get the current page_size, since it may differ from the specified value.
+ sqlite3_stmt *stmt;
+ NS_NAMED_LITERAL_CSTRING(pragma_page_size,
+ MOZ_STORAGE_UNIQUIFY_QUERY_STR "PRAGMA page_size");
+- srv = prepareStatement(pragma_page_size, &stmt);
++ int srv = prepareStatement(pragma_page_size, &stmt);
+ if (srv == SQLITE_OK) {
+ if (SQLITE_ROW == stepStatement(stmt)) {
+ pageSize = ::sqlite3_column_int64(stmt, 0);
+@@ -962,7 +1012,8 @@ Connection::Clone(bool aReadOnly,
+ nsRefPtr<Connection> clone = new Connection(mStorageService, flags);
+ NS_ENSURE_TRUE(clone, NS_ERROR_OUT_OF_MEMORY);
+
+- nsresult rv = clone->initialize(mDatabaseFile);
++ nsresult rv = mFileURL ? clone->initialize(mFileURL)
++ : clone->initialize(mDatabaseFile);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ // Copy over pragmas from the original connection.
+diff --git storage/src/mozStorageConnection.h storage/src/mozStorageConnection.h
+index b71f5db..97f5cf8 100644
+--- storage/src/mozStorageConnection.h
++++ storage/src/mozStorageConnection.h
+@@ -25,6 +25,7 @@
+
+ struct PRLock;
+ class nsIFile;
++class nsIFileURL;
+ class nsIEventTarget;
+ class nsIThread;
+
+@@ -63,18 +64,27 @@ public:
+ Connection(Service *aService, int aFlags);
+
+ /**
++ * Creates the connection to an in-memory database.
++ */
++ nsresult initialize();
++
++ /**
+ * Creates the connection to the database.
+ *
+ * @param aDatabaseFile
+ * The nsIFile of the location of the database to open, or create if it
+- * does not exist. Passing in nullptr here creates an in-memory
+- * database.
+- * @param aVFSName
+- * The VFS that SQLite will use when opening this database. NULL means
+- * "default".
++ * does not exist.
+ */
+- nsresult initialize(nsIFile *aDatabaseFile,
+- const char* aVFSName = NULL);
++ nsresult initialize(nsIFile *aDatabaseFile);
++
++ /**
++ * Creates the connection to the database.
++ *
++ * @param aFileURL
++ * The nsIFileURL of the location of the database to open, or create if it
++ * does not exist.
++ */
++ nsresult initialize(nsIFileURL *aFileURL);
+
+ // fetch the native handle
+ sqlite3 *GetNativeConnection() { return mDBConn; }
+@@ -155,6 +165,8 @@ public:
+ private:
+ ~Connection();
+
++ nsresult initializeInternal(nsIFile *aDatabaseFile);
++
+ /**
+ * Sets the database into a closed state so no further actions can be
+ * performed.
+@@ -206,6 +218,7 @@ private:
+ int progressHandler();
+
+ sqlite3 *mDBConn;
++ nsCOMPtr<nsIFileURL> mFileURL;
+ nsCOMPtr<nsIFile> mDatabaseFile;
+
+ /**
+diff --git storage/src/mozStorageService.cpp storage/src/mozStorageService.cpp
+index 00661d6..862a7da 100644
+--- storage/src/mozStorageService.cpp
++++ storage/src/mozStorageService.cpp
+@@ -24,8 +24,6 @@
+ #include "mozilla/Preferences.h"
+
+ #include "sqlite3.h"
+-#include "test_quota.h"
+-#include "test_quota.c"
+
+ #ifdef SQLITE_OS_WIN
+ // "windows.h" was included and it can #define lots of things we care about...
+@@ -35,61 +33,6 @@
+ #include "nsIPromptService.h"
+ #include "nsIMemoryReporter.h"
+
+-namespace {
+-
+-class QuotaCallbackData
+-{
+-public:
+- QuotaCallbackData(mozIStorageQuotaCallback *aCallback,
+- nsISupports *aUserData)
+- : callback(aCallback), userData(aUserData)
+- {
+- MOZ_COUNT_CTOR(QuotaCallbackData);
+- }
+-
+- ~QuotaCallbackData()
+- {
+- MOZ_COUNT_DTOR(QuotaCallbackData);
+- }
+-
+- static void Callback(const char *zFilename,
+- sqlite3_int64 *piLimit,
+- sqlite3_int64 iSize,
+- void *pArg)
+- {
+- NS_ASSERTION(zFilename && strlen(zFilename), "Null or empty filename!");
+- NS_ASSERTION(piLimit, "Null pointer!");
+-
+- QuotaCallbackData *data = static_cast<QuotaCallbackData*>(pArg);
+- if (!data) {
+- // No callback specified, return immediately.
+- return;
+- }
+-
+- NS_ASSERTION(data->callback, "Should never have a null callback!");
+-
+- nsDependentCString filename(zFilename);
+-
+- int64_t newLimit;
+- if (NS_SUCCEEDED(data->callback->QuotaExceeded(filename, *piLimit,
+- iSize, data->userData,
+- &newLimit))) {
+- *piLimit = newLimit;
+- }
+- }
+-
+- static void Destroy(void *aUserData)
+- {
+- delete static_cast<QuotaCallbackData*>(aUserData);
+- }
+-
+-private:
+- nsCOMPtr<mozIStorageQuotaCallback> callback;
+- nsCOMPtr<nsISupports> userData;
+-};
+-
+-} // anonymous namespace
+-
+ ////////////////////////////////////////////////////////////////////////////////
+ //// Defines
+
+@@ -345,11 +288,10 @@ private:
+ ////////////////////////////////////////////////////////////////////////////////
+ //// Service
+
+-NS_IMPL_THREADSAFE_ISUPPORTS3(
++NS_IMPL_THREADSAFE_ISUPPORTS2(
+ Service,
+ mozIStorageService,
+- nsIObserver,
+- mozIStorageServiceQuotaManagement
++ nsIObserver
+ )
+
+ Service *Service::gService = nullptr;
+@@ -438,10 +380,6 @@ Service::~Service()
+
+ // Shutdown the sqlite3 API. Warn if shutdown did not turn out okay, but
+ // there is nothing actionable we can do in that case.
+- rc = ::sqlite3_quota_shutdown();
+- if (rc != SQLITE_OK)
+- NS_WARNING("sqlite3 did not shutdown cleanly.");
+-
+ rc = ::sqlite3_shutdown();
+ if (rc != SQLITE_OK)
+ NS_WARNING("sqlite3 did not shutdown cleanly.");
+@@ -636,9 +574,6 @@ Service::initialize()
+ } else {
+ NS_WARNING("Failed to register telemetry VFS");
+ }
+- rc = ::sqlite3_quota_initialize("telemetry-vfs", 0);
+- if (rc != SQLITE_OK)
+- return convertResultCode(rc);
+
+ // Set the default value for the toolkit.storage.synchronous pref. It will be
+ // updated with the user preference on the main thread.
+@@ -739,28 +674,24 @@ Service::OpenSpecialDatabase(const char *aStorageKey,
+ // connection to use a memory DB.
+ }
+ else if (::strcmp(aStorageKey, "profile") == 0) {
+-
+ rv = NS_GetSpecialDirectory(NS_APP_STORAGE_50_FILE,
+ getter_AddRefs(storageFile));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- nsString filename;
+- storageFile->GetPath(filename);
+- nsCString filename8 = NS_ConvertUTF16toUTF8(filename.get());
+ // fall through to DB initialization
+ }
+ else {
+ return NS_ERROR_INVALID_ARG;
+ }
+
+- Connection *msc = new Connection(this, SQLITE_OPEN_READWRITE);
+- NS_ENSURE_TRUE(msc, NS_ERROR_OUT_OF_MEMORY);
++ nsRefPtr<Connection> msc = new Connection(this, SQLITE_OPEN_READWRITE);
+
+- rv = msc->initialize(storageFile);
++ rv = storageFile ? msc->initialize(storageFile) : msc->initialize();
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- NS_ADDREF(*_connection = msc);
++ msc.forget(_connection);
+ return NS_OK;
++
+ }
+
+ NS_IMETHODIMP
+@@ -774,12 +705,11 @@ Service::OpenDatabase(nsIFile *aDatabaseFile,
+ int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_SHAREDCACHE |
+ SQLITE_OPEN_CREATE;
+ nsRefPtr<Connection> msc = new Connection(this, flags);
+- NS_ENSURE_TRUE(msc, NS_ERROR_OUT_OF_MEMORY);
+
+ nsresult rv = msc->initialize(aDatabaseFile);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- NS_ADDREF(*_connection = msc);
++ msc.forget(_connection);
+ return NS_OK;
+ }
+
+@@ -794,12 +724,30 @@ Service::OpenUnsharedDatabase(nsIFile *aDatabaseFile,
+ int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_PRIVATECACHE |
+ SQLITE_OPEN_CREATE;
+ nsRefPtr<Connection> msc = new Connection(this, flags);
+- NS_ENSURE_TRUE(msc, NS_ERROR_OUT_OF_MEMORY);
+
+ nsresult rv = msc->initialize(aDatabaseFile);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- NS_ADDREF(*_connection = msc);
++ msc.forget(_connection);
++ return NS_OK;
++}
++
++NS_IMETHODIMP
++Service::OpenDatabaseWithFileURL(nsIFileURL *aFileURL,
++ mozIStorageConnection **_connection)
++{
++ NS_ENSURE_ARG(aFileURL);
++
++ // Always ensure that SQLITE_OPEN_CREATE is passed in for compatibility
++ // reasons.
++ int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_SHAREDCACHE |
++ SQLITE_OPEN_CREATE | SQLITE_OPEN_URI;
++ nsRefPtr<Connection> msc = new Connection(this, flags);
++
++ nsresult rv = msc->initialize(aFileURL);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ msc.forget(_connection);
+ return NS_OK;
+ }
+
+@@ -885,67 +833,5 @@ Service::Observe(nsISupports *, const char *aTopic, const PRUnichar *)
+ return NS_OK;
+ }
+
+-////////////////////////////////////////////////////////////////////////////////
+-//// mozIStorageServiceQuotaManagement
+-
+-NS_IMETHODIMP
+-Service::OpenDatabaseWithVFS(nsIFile *aDatabaseFile,
+- const nsACString &aVFSName,
+- mozIStorageConnection **_connection)
+-{
+- NS_ENSURE_ARG(aDatabaseFile);
+-
+- // Always ensure that SQLITE_OPEN_CREATE is passed in for compatibility
+- // reasons.
+- int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_SHAREDCACHE |
+- SQLITE_OPEN_CREATE;
+- nsRefPtr<Connection> msc = new Connection(this, flags);
+- NS_ENSURE_TRUE(msc, NS_ERROR_OUT_OF_MEMORY);
+-
+- nsresult rv = msc->initialize(aDatabaseFile,
+- PromiseFlatCString(aVFSName).get());
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- NS_ADDREF(*_connection = msc);
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-Service::SetQuotaForFilenamePattern(const nsACString &aPattern,
+- int64_t aSizeLimit,
+- mozIStorageQuotaCallback *aCallback,
+- nsISupports *aUserData)
+-{
+- NS_ENSURE_FALSE(aPattern.IsEmpty(), NS_ERROR_INVALID_ARG);
+-
+- nsAutoPtr<QuotaCallbackData> data;
+- if (aSizeLimit && aCallback) {
+- data = new QuotaCallbackData(aCallback, aUserData);
+- }
+-
+- int rc = ::sqlite3_quota_set(PromiseFlatCString(aPattern).get(),
+- aSizeLimit, QuotaCallbackData::Callback,
+- data, QuotaCallbackData::Destroy);
+- NS_ENSURE_TRUE(rc == SQLITE_OK, convertResultCode(rc));
+-
+- data.forget();
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-Service::UpdateQuotaInformationForFile(nsIFile *aFile)
+-{
+- NS_ENSURE_ARG_POINTER(aFile);
+-
+- nsString path;
+- nsresult rv = aFile->GetPath(path);
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- int rc = ::sqlite3_quota_file(NS_ConvertUTF16toUTF8(path).get());
+- NS_ENSURE_TRUE(rc == SQLITE_OK, convertResultCode(rc));
+-
+- return NS_OK;
+-}
+-
+ } // namespace storage
+ } // namespace mozilla
+diff --git storage/src/mozStorageService.h storage/src/mozStorageService.h
+index 21c1ff8..3f5a546 100644
+--- storage/src/mozStorageService.h
++++ storage/src/mozStorageService.h
+@@ -15,7 +15,6 @@
+ #include "mozilla/Mutex.h"
+
+ #include "mozIStorageService.h"
+-#include "mozIStorageServiceQuotaManagement.h"
+
+ class nsIMemoryReporter;
+ class nsIMemoryMultiReporter;
+@@ -28,7 +27,6 @@ namespace storage {
+ class Connection;
+ class Service : public mozIStorageService
+ , public nsIObserver
+- , public mozIStorageServiceQuotaManagement
+ {
+ public:
+ /**
+@@ -58,7 +56,6 @@ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_MOZISTORAGESERVICE
+ NS_DECL_NSIOBSERVER
+- NS_DECL_MOZISTORAGESERVICEQUOTAMANAGEMENT
+
+ /**
+ * Obtains an already AddRefed pointer to XPConnect. This is used by
+diff --git toolkit/toolkit-makefiles.sh toolkit/toolkit-makefiles.sh
+index 6a7d714..8f1bbe0 100644
+--- toolkit/toolkit-makefiles.sh
++++ toolkit/toolkit-makefiles.sh
+@@ -68,6 +68,7 @@ MAKEFILES_dom="
+ dom/plugins/base/Makefile
+ dom/plugins/ipc/Makefile
+ dom/power/Makefile
++ dom/quota/Makefile
+ dom/settings/Makefile
+ dom/sms/Makefile
+ dom/sms/interfaces/Makefile
diff --git a/www/firefox/files/patch-bug788039 b/www/firefox/files/patch-bug788039
deleted file mode 100644
index a678de2eab4f..000000000000
--- a/www/firefox/files/patch-bug788039
+++ /dev/null
@@ -1,48 +0,0 @@
-# Bug 788039 - With no prefix search libevent via pkg-config.
-
---- configure.in~
-+++ configure.in
-@@ -3854,7 +3854,7 @@ fi
- dnl system libevent Support
- dnl ========================================================
- MOZ_ARG_WITH_STRING(system-libevent,
--[ --with-system-libevent=[PFX]
-+[ --with-system-libevent[=PFX]
- Use system libevent [installed at prefix PFX]],
- LIBEVENT_DIR=$withval)
-
-@@ -3863,10 +3863,11 @@ _SAVE_LDFLAGS=$LDFLAGS
- _SAVE_LIBS=$LIBS
- if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
- MOZ_NATIVE_LIBEVENT=
-+elif test "$LIBEVENT_DIR" = yes; then
-+ PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
-+ MOZ_NATIVE_LIBEVENT=1,
-+ AC_MSG_ERROR([--with-system-libevent requested but libevent package not found]))
- else
-- if test "${LIBEVENT_DIR}" = "yes"; then
-- LIBEVENT_DIR=/usr
-- fi
- CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
- LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
- MOZ_CHECK_HEADER(event.h,
-@@ -3876,16 +3877,16 @@ else
- AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
- AC_CHECK_LIB(event, event_init,
- [MOZ_NATIVE_LIBEVENT=1
-- MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
-+ MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
- MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
-- [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
-+ [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
- fi
- CFLAGS=$_SAVE_CFLAGS
- LDFLAGS=$_SAVE_LDFLAGS
- LIBS=$_SAVE_LIBS
-
- AC_SUBST(MOZ_NATIVE_LIBEVENT)
--AC_SUBST(MOZ_LIBEVENT_INCLUDES)
-+AC_SUBST(MOZ_LIBEVENT_CFLAGS)
- AC_SUBST(MOZ_LIBEVENT_LIBS)
-
- dnl ========================================================
diff --git a/www/firefox/files/patch-bug788108 b/www/firefox/files/patch-bug788108
deleted file mode 100644
index 80ff18649882..000000000000
--- a/www/firefox/files/patch-bug788108
+++ /dev/null
@@ -1,20 +0,0 @@
---- content/base/public/nsContentUtils.h~
-+++ content/base/public/nsContentUtils.h
-@@ -18,17 +18,6 @@
- #include <ieeefp.h>
- #endif
-
--//A trick to handle IEEE floating point exceptions on FreeBSD - E.D.
--#ifdef __FreeBSD__
--#include <ieeefp.h>
--#if !defined(__i386__) && !defined(__x86_64__)
--static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP;
--#else
--static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP|FP_X_DNML;
--#endif
--static fp_except_t oldmask = fpsetmask(~allmask);
--#endif
--
- #include "nsAString.h"
- #include "nsIStatefulFrame.h"
- #include "nsNodeInfoManager.h"
diff --git a/www/firefox/files/patch-bug789436 b/www/firefox/files/patch-bug789436
deleted file mode 100644
index 6d1e7069b858..000000000000
--- a/www/firefox/files/patch-bug789436
+++ /dev/null
@@ -1,27 +0,0 @@
---- toolkit/xre/nsAppRunner.cpp~
-+++ toolkit/xre/nsAppRunner.cpp
-@@ -1388,11 +1388,6 @@ static int MSCRTReportHook( int aReportType, char *aMessage, int *oReturnValue)
-
- #endif
-
--#if defined(FREEBSD)
--// pick up fpsetmask prototype.
--#include <ieeefp.h>
--#endif
--
- static inline void
- DumpVersion()
- {
-@@ -4136,12 +4131,5 @@ SetupErrorHandling(const char* progname)
-
- // Unbuffer stdout, needed for tinderbox tests.
- setbuf(stdout, 0);
--
--#if defined(FREEBSD)
-- // Disable all SIGFPE's on FreeBSD, as it has non-IEEE-conformant fp
-- // trap behavior that trips up on floating-point tests performed by
-- // the JS engine. See bugzilla bug 9967 details.
-- fpsetmask(0);
--#endif
- }
-
diff --git a/www/firefox/files/patch-bug789693 b/www/firefox/files/patch-bug789693
deleted file mode 100644
index 1d2b790a35d5..000000000000
--- a/www/firefox/files/patch-bug789693
+++ /dev/null
@@ -1,109 +0,0 @@
---- toolkit/components/startup/nsAppStartup.cpp
-+++ toolkit/components/startup/nsAppStartup.cpp
-@@ -50,18 +50,41 @@
- #include <sys/syscall.h>
- #endif
-
--#ifdef XP_MACOSX
-+#if defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \
-+ || defined(__NetBSD__) || defined(__OpenBSD__)
-+#include <sys/param.h>
- #include <sys/sysctl.h>
- #endif
-
--#ifdef __OpenBSD__
--#include <sys/param.h>
--#include <sys/sysctl.h>
-+#if defined(__DragonFly__) || defined(__FreeBSD__)
-+#include <sys/user.h>
- #endif
-
- #include "mozilla/Telemetry.h"
- #include "mozilla/StartupTimeline.h"
-
-+#if defined(__NetBSD__)
-+#undef KERN_PROC
-+#define KERN_PROC KERN_PROC2
-+#define KINFO_PROC struct kinfo_proc2
-+#else
-+#define KINFO_PROC struct kinfo_proc
-+#endif
-+
-+#if defined(XP_MACOSX)
-+#define KP_START_SEC kp_proc.p_un.__p_starttime.tv_sec
-+#define KP_START_USEC kp_proc.p_un.__p_starttime.tv_usec
-+#elif defined(__DragonFly__)
-+#define KP_START_SEC kp_start.tv_sec
-+#define KP_START_USEC kp_start.tv_usec
-+#elif defined(__FreeBSD__)
-+#define KP_START_SEC ki_start.tv_sec
-+#define KP_START_USEC ki_start.tv_usec
-+#else
-+#define KP_START_SEC p_ustart_sec
-+#define KP_START_USEC p_ustart_usec
-+#endif
-+
- static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
-
- #define kPrefLastSuccess "toolkit.startup.last_success"
-@@ -836,42 +859,30 @@ CalculateProcessCreationTimestamp()
- #endif
- return timestamp;
- }
--#elif defined(XP_MACOSX)
-+#elif defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \
-+ || defined(__NetBSD__) || defined(__OpenBSD__)
- static PRTime
- CalculateProcessCreationTimestamp()
- {
-- int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() };
-- size_t buffer_size;
-- if (sysctl(mib, 4, NULL, &buffer_size, NULL, 0))
-- return 0;
-+ int mib[] = {
-+ CTL_KERN,
-+ KERN_PROC,
-+ KERN_PROC_PID,
-+ getpid(),
-+#if defined(__NetBSD__) || defined(__OpenBSD__)
-+ sizeof(KINFO_PROC),
-+ 1,
-+#endif
-+ };
-+ u_int miblen = sizeof(mib) / sizeof(mib[0]);
-
-- struct kinfo_proc *proc = (kinfo_proc*) malloc(buffer_size);
-- if (sysctl(mib, 4, proc, &buffer_size, NULL, 0)) {
-- free(proc);
-- return 0;
-- }
-- PRTime starttime = static_cast<PRTime>(proc->kp_proc.p_un.__p_starttime.tv_sec) * PR_USEC_PER_SEC;
-- starttime += proc->kp_proc.p_un.__p_starttime.tv_usec;
-- free(proc);
-- return starttime;
--}
--#elif defined(__OpenBSD__)
--static PRTime
--CalculateProcessCreationTimestamp()
--{
-- int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid(), sizeof(struct kinfo_proc), 1 };
-- size_t buffer_size;
-- if (sysctl(mib, 6, NULL, &buffer_size, NULL, 0))
-+ KINFO_PROC proc;
-+ size_t buffer_size = sizeof(proc);
-+ if (sysctl(mib, miblen, &proc, &buffer_size, NULL, 0))
- return 0;
-
-- struct kinfo_proc *proc = (struct kinfo_proc*) malloc(buffer_size);
-- if (sysctl(mib, 6, proc, &buffer_size, NULL, 0)) {
-- free(proc);
-- return 0;
-- }
-- PRTime starttime = static_cast<PRTime>(proc->p_ustart_sec) * PR_USEC_PER_SEC;
-- starttime += proc->p_ustart_usec;
-- free(proc);
-+ PRTime starttime = static_cast<PRTime>(proc.KP_START_SEC) * PR_USEC_PER_SEC;
-+ starttime += proc.KP_START_USEC;
- return starttime;
- }
- #else
diff --git a/www/firefox/files/patch-bug791305 b/www/firefox/files/patch-bug791305
index 534e7f2d9cac..ef75e4a17bb5 100644
--- a/www/firefox/files/patch-bug791305
+++ b/www/firefox/files/patch-bug791305
@@ -15,93 +15,383 @@ Date: Fri Sep 14 15:54:55 2012 -0400
image/decoders/nsJPEGDecoder.cpp | 311 ++-------------------------------------
2 files changed, 20 insertions(+), 297 deletions(-)
+diff --git configure.in configure.in
+index f0aeb5d..1c01010 100644
+--- configure.in
++++ configure.in
+@@ -4027,11 +4027,7 @@ if test "$MOZ_NATIVE_JPEG" = 1; then
+ #include <jpeglib.h> ],
+ [ #if JPEG_LIB_VERSION < $MOZJPEG
+ #error "Insufficient JPEG library version ($MOZJPEG required)."
+- #endif
+- #ifndef JCS_EXTENSIONS
+- #error "libjpeg-turbo JCS_EXTENSIONS required"
+- #endif
+- ],
++ #endif ],
+ MOZ_NATIVE_JPEG=1,
+ AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
+ fi
diff --git image/decoders/nsJPEGDecoder.cpp image/decoders/nsJPEGDecoder.cpp
-index c1fb515..1d2a259 100644
+index 8fa8200..1d2a259 100644
--- image/decoders/nsJPEGDecoder.cpp
+++ image/decoders/nsJPEGDecoder.cpp
-@@ -22,6 +22,13 @@
+@@ -21,13 +21,28 @@
+
extern "C" {
#include "iccjpeg.h"
+-}
+#ifdef JCS_EXTENSIONS
-+#if defined(IS_BIG_ENDIAN)
-+#define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_XRGB
-+#else
-+#define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_BGRX
-+#endif
+ #if defined(IS_BIG_ENDIAN)
+ #define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_XRGB
+ #else
+ #define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_BGRX
+ #endif
+#else
- /* Colorspace conversion (copied from jpegint.h) */
- struct jpeg_color_deconverter {
- JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
-@@ -34,6 +41,7 @@ METHODDEF(void)
- ycc_rgb_convert_argb (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows);
++/* Colorspace conversion (copied from jpegint.h) */
++struct jpeg_color_deconverter {
++ JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
++ JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
++ JSAMPIMAGE input_buf, JDIMENSION input_row,
++ JSAMPARRAY output_buf, int num_rows));
++};
++
++METHODDEF(void)
++ycc_rgb_convert_argb (j_decompress_ptr cinfo,
++ JSAMPIMAGE input_buf, JDIMENSION input_row,
++ JSAMPARRAY output_buf, int num_rows);
+#endif
- }
++}
static void cmyk_convert_rgb(JSAMPROW row, JDIMENSION width);
-@@ -329,7 +340,18 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
+
+@@ -324,6 +340,7 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, uint32_t aCount)
case JCS_GRAYSCALE:
case JCS_RGB:
case JCS_YCbCr:
+#ifdef JCS_EXTENSIONS
-+ // if we're not color managing we can decode directly to
-+ // MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB
-+ if (mCMSMode != eCMSMode_All) {
-+ mInfo.out_color_space = MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB;
-+ mInfo.out_color_components = 4;
-+ } else {
-+ mInfo.out_color_space = JCS_RGB;
-+ }
+ // if we're not color managing we can decode directly to
+ // MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB
+ if (mCMSMode != eCMSMode_All) {
+@@ -332,6 +349,9 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, uint32_t aCount)
+ } else {
+ mInfo.out_color_space = JCS_RGB;
+ }
+#else
- mInfo.out_color_space = JCS_RGB;
++ mInfo.out_color_space = JCS_RGB;
+#endif
break;
case JCS_CMYK:
case JCS_YCCK:
-@@ -397,6 +419,7 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
+@@ -399,6 +419,15 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, uint32_t aCount)
return; /* I/O suspension */
}
+#ifndef JCS_EXTENSIONS
- /* Force to use our YCbCr to Packed RGB converter when possible */
- if (!mTransform && (mCMSMode != eCMSMode_All) &&
- mInfo.jpeg_color_space == JCS_YCbCr && mInfo.out_color_space == JCS_RGB) {
-@@ -404,6 +427,7 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
- mInfo.out_color_components = 4; /* Packed ARGB pixels are always 4 bytes...*/
- mInfo.cconvert->color_convert = ycc_rgb_convert_argb;
- }
++ /* Force to use our YCbCr to Packed RGB converter when possible */
++ if (!mTransform && (mCMSMode != eCMSMode_All) &&
++ mInfo.jpeg_color_space == JCS_YCbCr && mInfo.out_color_space == JCS_RGB) {
++ /* Special case for the most common case: transform from YCbCr direct into packed ARGB */
++ mInfo.out_color_components = 4; /* Packed ARGB pixels are always 4 bytes...*/
++ mInfo.cconvert->color_convert = ycc_rgb_convert_argb;
++ }
+#endif
/* If this is a progressive JPEG ... */
mState = mInfo.buffered_image ? JPEG_DECOMPRESS_PROGRESSIVE : JPEG_DECOMPRESS_SEQUENTIAL;
-@@ -542,7 +566,11 @@ nsJPEGDecoder::OutputScanlines(bool* suspend)
- PRUint32 *imageRow = ((PRUint32*)mImageData) +
+@@ -544,7 +573,11 @@ nsJPEGDecoder::OutputScanlines(bool* suspend)
+ uint32_t *imageRow = ((uint32_t*)mImageData) +
(mInfo.output_scanline * mInfo.output_width);
+#ifdef JCS_EXTENSIONS
-+ if (mInfo.out_color_space == MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB) {
+ if (mInfo.out_color_space == MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB) {
+#else
- if (mInfo.cconvert->color_convert == ycc_rgb_convert_argb) {
++ if (mInfo.cconvert->color_convert == ycc_rgb_convert_argb) {
+#endif
/* Special case: scanline will be directly converted into packed ARGB */
if (jpeg_read_scanlines(&mInfo, (JSAMPARRAY)&imageRow, 1) != 1) {
*suspend = true; /* suspend */
-@@ -858,6 +887,7 @@ term_source (j_decompress_ptr jd)
+@@ -854,6 +887,282 @@ term_source (j_decompress_ptr jd)
} // namespace mozilla
+#ifndef JCS_EXTENSIONS
- /**************** YCbCr -> Cairo's RGB24/ARGB32 conversion: most common case **************/
-
- /*
-@@ -1130,7 +1160,8 @@ ycc_rgb_convert_argb (j_decompress_ptr cinfo,
- }
- }
- }
++/**************** YCbCr -> Cairo's RGB24/ARGB32 conversion: most common case **************/
++
++/*
++ * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
++ * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
++ * The conversion equations to be implemented are therefore
++ * R = Y + 1.40200 * Cr
++ * G = Y - 0.34414 * Cb - 0.71414 * Cr
++ * B = Y + 1.77200 * Cb
++ * where Cb and Cr represent the incoming values less CENTERJSAMPLE.
++ * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
++ *
++ * To avoid floating-point arithmetic, we represent the fractional constants
++ * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
++ * the products by 2^16, with appropriate rounding, to get the correct answer.
++ * Notice that Y, being an integral input, does not contribute any fraction
++ * so it need not participate in the rounding.
++ *
++ * For even more speed, we avoid doing any multiplications in the inner loop
++ * by precalculating the constants times Cb and Cr for all possible values.
++ * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
++ * for 12-bit samples it is still acceptable. It's not very reasonable for
++ * 16-bit samples, but if you want lossless storage you shouldn't be changing
++ * colorspace anyway.
++ * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
++ * values for the G calculation are left scaled up, since we must add them
++ * together before rounding.
++ */
++
++#define SCALEBITS 16 /* speediest right-shift on some machines */
++
++/* Use static tables for color processing. */
++/* Four tables, each 256 entries of 4 bytes totals 4K which is not bad... */
++
++const int Cr_r_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ -0xb3, -0xb2, -0xb1, -0xaf, -0xae, -0xac,
++ -0xab, -0xaa, -0xa8, -0xa7, -0xa5, -0xa4,
++ -0xa3, -0xa1, -0xa0, -0x9e, -0x9d, -0x9c,
++ -0x9a, -0x99, -0x97, -0x96, -0x95, -0x93,
++ -0x92, -0x90, -0x8f, -0x8e, -0x8c, -0x8b,
++ -0x89, -0x88, -0x87, -0x85, -0x84, -0x82,
++ -0x81, -0x80, -0x7e, -0x7d, -0x7b, -0x7a,
++ -0x79, -0x77, -0x76, -0x74, -0x73, -0x72,
++ -0x70, -0x6f, -0x6d, -0x6c, -0x6b, -0x69,
++ -0x68, -0x66, -0x65, -0x64, -0x62, -0x61,
++ -0x5f, -0x5e, -0x5d, -0x5b, -0x5a, -0x58,
++ -0x57, -0x56, -0x54, -0x53, -0x51, -0x50,
++ -0x4f, -0x4d, -0x4c, -0x4a, -0x49, -0x48,
++ -0x46, -0x45, -0x43, -0x42, -0x40, -0x3f,
++ -0x3e, -0x3c, -0x3b, -0x39, -0x38, -0x37,
++ -0x35, -0x34, -0x32, -0x31, -0x30, -0x2e,
++ -0x2d, -0x2b, -0x2a, -0x29, -0x27, -0x26,
++ -0x24, -0x23, -0x22, -0x20, -0x1f, -0x1d,
++ -0x1c, -0x1b, -0x19, -0x18, -0x16, -0x15,
++ -0x14, -0x12, -0x11, -0x0f, -0x0e, -0x0d,
++ -0x0b, -0x0a, -0x08, -0x07, -0x06, -0x04,
++ -0x03, -0x01, 0x00, 0x01, 0x03, 0x04,
++ 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0d,
++ 0x0e, 0x0f, 0x11, 0x12, 0x14, 0x15,
++ 0x16, 0x18, 0x19, 0x1b, 0x1c, 0x1d,
++ 0x1f, 0x20, 0x22, 0x23, 0x24, 0x26,
++ 0x27, 0x29, 0x2a, 0x2b, 0x2d, 0x2e,
++ 0x30, 0x31, 0x32, 0x34, 0x35, 0x37,
++ 0x38, 0x39, 0x3b, 0x3c, 0x3e, 0x3f,
++ 0x40, 0x42, 0x43, 0x45, 0x46, 0x48,
++ 0x49, 0x4a, 0x4c, 0x4d, 0x4f, 0x50,
++ 0x51, 0x53, 0x54, 0x56, 0x57, 0x58,
++ 0x5a, 0x5b, 0x5d, 0x5e, 0x5f, 0x61,
++ 0x62, 0x64, 0x65, 0x66, 0x68, 0x69,
++ 0x6b, 0x6c, 0x6d, 0x6f, 0x70, 0x72,
++ 0x73, 0x74, 0x76, 0x77, 0x79, 0x7a,
++ 0x7b, 0x7d, 0x7e, 0x80, 0x81, 0x82,
++ 0x84, 0x85, 0x87, 0x88, 0x89, 0x8b,
++ 0x8c, 0x8e, 0x8f, 0x90, 0x92, 0x93,
++ 0x95, 0x96, 0x97, 0x99, 0x9a, 0x9c,
++ 0x9d, 0x9e, 0xa0, 0xa1, 0xa3, 0xa4,
++ 0xa5, 0xa7, 0xa8, 0xaa, 0xab, 0xac,
++ 0xae, 0xaf, 0xb1, 0xb2,
++ };
++
++const int Cb_b_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ -0xe3, -0xe1, -0xdf, -0xde, -0xdc, -0xda,
++ -0xd8, -0xd6, -0xd5, -0xd3, -0xd1, -0xcf,
++ -0xce, -0xcc, -0xca, -0xc8, -0xc6, -0xc5,
++ -0xc3, -0xc1, -0xbf, -0xbe, -0xbc, -0xba,
++ -0xb8, -0xb7, -0xb5, -0xb3, -0xb1, -0xaf,
++ -0xae, -0xac, -0xaa, -0xa8, -0xa7, -0xa5,
++ -0xa3, -0xa1, -0x9f, -0x9e, -0x9c, -0x9a,
++ -0x98, -0x97, -0x95, -0x93, -0x91, -0x90,
++ -0x8e, -0x8c, -0x8a, -0x88, -0x87, -0x85,
++ -0x83, -0x81, -0x80, -0x7e, -0x7c, -0x7a,
++ -0x78, -0x77, -0x75, -0x73, -0x71, -0x70,
++ -0x6e, -0x6c, -0x6a, -0x69, -0x67, -0x65,
++ -0x63, -0x61, -0x60, -0x5e, -0x5c, -0x5a,
++ -0x59, -0x57, -0x55, -0x53, -0x52, -0x50,
++ -0x4e, -0x4c, -0x4a, -0x49, -0x47, -0x45,
++ -0x43, -0x42, -0x40, -0x3e, -0x3c, -0x3a,
++ -0x39, -0x37, -0x35, -0x33, -0x32, -0x30,
++ -0x2e, -0x2c, -0x2b, -0x29, -0x27, -0x25,
++ -0x23, -0x22, -0x20, -0x1e, -0x1c, -0x1b,
++ -0x19, -0x17, -0x15, -0x13, -0x12, -0x10,
++ -0x0e, -0x0c, -0x0b, -0x09, -0x07, -0x05,
++ -0x04, -0x02, 0x00, 0x02, 0x04, 0x05,
++ 0x07, 0x09, 0x0b, 0x0c, 0x0e, 0x10,
++ 0x12, 0x13, 0x15, 0x17, 0x19, 0x1b,
++ 0x1c, 0x1e, 0x20, 0x22, 0x23, 0x25,
++ 0x27, 0x29, 0x2b, 0x2c, 0x2e, 0x30,
++ 0x32, 0x33, 0x35, 0x37, 0x39, 0x3a,
++ 0x3c, 0x3e, 0x40, 0x42, 0x43, 0x45,
++ 0x47, 0x49, 0x4a, 0x4c, 0x4e, 0x50,
++ 0x52, 0x53, 0x55, 0x57, 0x59, 0x5a,
++ 0x5c, 0x5e, 0x60, 0x61, 0x63, 0x65,
++ 0x67, 0x69, 0x6a, 0x6c, 0x6e, 0x70,
++ 0x71, 0x73, 0x75, 0x77, 0x78, 0x7a,
++ 0x7c, 0x7e, 0x80, 0x81, 0x83, 0x85,
++ 0x87, 0x88, 0x8a, 0x8c, 0x8e, 0x90,
++ 0x91, 0x93, 0x95, 0x97, 0x98, 0x9a,
++ 0x9c, 0x9e, 0x9f, 0xa1, 0xa3, 0xa5,
++ 0xa7, 0xa8, 0xaa, 0xac, 0xae, 0xaf,
++ 0xb1, 0xb3, 0xb5, 0xb7, 0xb8, 0xba,
++ 0xbc, 0xbe, 0xbf, 0xc1, 0xc3, 0xc5,
++ 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xcf,
++ 0xd1, 0xd3, 0xd5, 0xd6, 0xd8, 0xda,
++ 0xdc, 0xde, 0xdf, 0xe1,
++ };
++
++const int Cr_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ 0x5b6900, 0x5ab22e, 0x59fb5c, 0x59448a, 0x588db8, 0x57d6e6,
++ 0x572014, 0x566942, 0x55b270, 0x54fb9e, 0x5444cc, 0x538dfa,
++ 0x52d728, 0x522056, 0x516984, 0x50b2b2, 0x4ffbe0, 0x4f450e,
++ 0x4e8e3c, 0x4dd76a, 0x4d2098, 0x4c69c6, 0x4bb2f4, 0x4afc22,
++ 0x4a4550, 0x498e7e, 0x48d7ac, 0x4820da, 0x476a08, 0x46b336,
++ 0x45fc64, 0x454592, 0x448ec0, 0x43d7ee, 0x43211c, 0x426a4a,
++ 0x41b378, 0x40fca6, 0x4045d4, 0x3f8f02, 0x3ed830, 0x3e215e,
++ 0x3d6a8c, 0x3cb3ba, 0x3bfce8, 0x3b4616, 0x3a8f44, 0x39d872,
++ 0x3921a0, 0x386ace, 0x37b3fc, 0x36fd2a, 0x364658, 0x358f86,
++ 0x34d8b4, 0x3421e2, 0x336b10, 0x32b43e, 0x31fd6c, 0x31469a,
++ 0x308fc8, 0x2fd8f6, 0x2f2224, 0x2e6b52, 0x2db480, 0x2cfdae,
++ 0x2c46dc, 0x2b900a, 0x2ad938, 0x2a2266, 0x296b94, 0x28b4c2,
++ 0x27fdf0, 0x27471e, 0x26904c, 0x25d97a, 0x2522a8, 0x246bd6,
++ 0x23b504, 0x22fe32, 0x224760, 0x21908e, 0x20d9bc, 0x2022ea,
++ 0x1f6c18, 0x1eb546, 0x1dfe74, 0x1d47a2, 0x1c90d0, 0x1bd9fe,
++ 0x1b232c, 0x1a6c5a, 0x19b588, 0x18feb6, 0x1847e4, 0x179112,
++ 0x16da40, 0x16236e, 0x156c9c, 0x14b5ca, 0x13fef8, 0x134826,
++ 0x129154, 0x11da82, 0x1123b0, 0x106cde, 0x0fb60c, 0x0eff3a,
++ 0x0e4868, 0x0d9196, 0x0cdac4, 0x0c23f2, 0x0b6d20, 0x0ab64e,
++ 0x09ff7c, 0x0948aa, 0x0891d8, 0x07db06, 0x072434, 0x066d62,
++ 0x05b690, 0x04ffbe, 0x0448ec, 0x03921a, 0x02db48, 0x022476,
++ 0x016da4, 0x00b6d2, 0x000000, -0x00b6d2, -0x016da4, -0x022476,
++ -0x02db48, -0x03921a, -0x0448ec, -0x04ffbe, -0x05b690, -0x066d62,
++ -0x072434, -0x07db06, -0x0891d8, -0x0948aa, -0x09ff7c, -0x0ab64e,
++ -0x0b6d20, -0x0c23f2, -0x0cdac4, -0x0d9196, -0x0e4868, -0x0eff3a,
++ -0x0fb60c, -0x106cde, -0x1123b0, -0x11da82, -0x129154, -0x134826,
++ -0x13fef8, -0x14b5ca, -0x156c9c, -0x16236e, -0x16da40, -0x179112,
++ -0x1847e4, -0x18feb6, -0x19b588, -0x1a6c5a, -0x1b232c, -0x1bd9fe,
++ -0x1c90d0, -0x1d47a2, -0x1dfe74, -0x1eb546, -0x1f6c18, -0x2022ea,
++ -0x20d9bc, -0x21908e, -0x224760, -0x22fe32, -0x23b504, -0x246bd6,
++ -0x2522a8, -0x25d97a, -0x26904c, -0x27471e, -0x27fdf0, -0x28b4c2,
++ -0x296b94, -0x2a2266, -0x2ad938, -0x2b900a, -0x2c46dc, -0x2cfdae,
++ -0x2db480, -0x2e6b52, -0x2f2224, -0x2fd8f6, -0x308fc8, -0x31469a,
++ -0x31fd6c, -0x32b43e, -0x336b10, -0x3421e2, -0x34d8b4, -0x358f86,
++ -0x364658, -0x36fd2a, -0x37b3fc, -0x386ace, -0x3921a0, -0x39d872,
++ -0x3a8f44, -0x3b4616, -0x3bfce8, -0x3cb3ba, -0x3d6a8c, -0x3e215e,
++ -0x3ed830, -0x3f8f02, -0x4045d4, -0x40fca6, -0x41b378, -0x426a4a,
++ -0x43211c, -0x43d7ee, -0x448ec0, -0x454592, -0x45fc64, -0x46b336,
++ -0x476a08, -0x4820da, -0x48d7ac, -0x498e7e, -0x4a4550, -0x4afc22,
++ -0x4bb2f4, -0x4c69c6, -0x4d2098, -0x4dd76a, -0x4e8e3c, -0x4f450e,
++ -0x4ffbe0, -0x50b2b2, -0x516984, -0x522056, -0x52d728, -0x538dfa,
++ -0x5444cc, -0x54fb9e, -0x55b270, -0x566942, -0x572014, -0x57d6e6,
++ -0x588db8, -0x59448a, -0x59fb5c, -0x5ab22e,
++ };
++
++const int Cb_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ 0x2c8d00, 0x2c34e6, 0x2bdccc, 0x2b84b2, 0x2b2c98, 0x2ad47e,
++ 0x2a7c64, 0x2a244a, 0x29cc30, 0x297416, 0x291bfc, 0x28c3e2,
++ 0x286bc8, 0x2813ae, 0x27bb94, 0x27637a, 0x270b60, 0x26b346,
++ 0x265b2c, 0x260312, 0x25aaf8, 0x2552de, 0x24fac4, 0x24a2aa,
++ 0x244a90, 0x23f276, 0x239a5c, 0x234242, 0x22ea28, 0x22920e,
++ 0x2239f4, 0x21e1da, 0x2189c0, 0x2131a6, 0x20d98c, 0x208172,
++ 0x202958, 0x1fd13e, 0x1f7924, 0x1f210a, 0x1ec8f0, 0x1e70d6,
++ 0x1e18bc, 0x1dc0a2, 0x1d6888, 0x1d106e, 0x1cb854, 0x1c603a,
++ 0x1c0820, 0x1bb006, 0x1b57ec, 0x1affd2, 0x1aa7b8, 0x1a4f9e,
++ 0x19f784, 0x199f6a, 0x194750, 0x18ef36, 0x18971c, 0x183f02,
++ 0x17e6e8, 0x178ece, 0x1736b4, 0x16de9a, 0x168680, 0x162e66,
++ 0x15d64c, 0x157e32, 0x152618, 0x14cdfe, 0x1475e4, 0x141dca,
++ 0x13c5b0, 0x136d96, 0x13157c, 0x12bd62, 0x126548, 0x120d2e,
++ 0x11b514, 0x115cfa, 0x1104e0, 0x10acc6, 0x1054ac, 0x0ffc92,
++ 0x0fa478, 0x0f4c5e, 0x0ef444, 0x0e9c2a, 0x0e4410, 0x0debf6,
++ 0x0d93dc, 0x0d3bc2, 0x0ce3a8, 0x0c8b8e, 0x0c3374, 0x0bdb5a,
++ 0x0b8340, 0x0b2b26, 0x0ad30c, 0x0a7af2, 0x0a22d8, 0x09cabe,
++ 0x0972a4, 0x091a8a, 0x08c270, 0x086a56, 0x08123c, 0x07ba22,
++ 0x076208, 0x0709ee, 0x06b1d4, 0x0659ba, 0x0601a0, 0x05a986,
++ 0x05516c, 0x04f952, 0x04a138, 0x04491e, 0x03f104, 0x0398ea,
++ 0x0340d0, 0x02e8b6, 0x02909c, 0x023882, 0x01e068, 0x01884e,
++ 0x013034, 0x00d81a, 0x008000, 0x0027e6, -0x003034, -0x00884e,
++ -0x00e068, -0x013882, -0x01909c, -0x01e8b6, -0x0240d0, -0x0298ea,
++ -0x02f104, -0x03491e, -0x03a138, -0x03f952, -0x04516c, -0x04a986,
++ -0x0501a0, -0x0559ba, -0x05b1d4, -0x0609ee, -0x066208, -0x06ba22,
++ -0x07123c, -0x076a56, -0x07c270, -0x081a8a, -0x0872a4, -0x08cabe,
++ -0x0922d8, -0x097af2, -0x09d30c, -0x0a2b26, -0x0a8340, -0x0adb5a,
++ -0x0b3374, -0x0b8b8e, -0x0be3a8, -0x0c3bc2, -0x0c93dc, -0x0cebf6,
++ -0x0d4410, -0x0d9c2a, -0x0df444, -0x0e4c5e, -0x0ea478, -0x0efc92,
++ -0x0f54ac, -0x0facc6, -0x1004e0, -0x105cfa, -0x10b514, -0x110d2e,
++ -0x116548, -0x11bd62, -0x12157c, -0x126d96, -0x12c5b0, -0x131dca,
++ -0x1375e4, -0x13cdfe, -0x142618, -0x147e32, -0x14d64c, -0x152e66,
++ -0x158680, -0x15de9a, -0x1636b4, -0x168ece, -0x16e6e8, -0x173f02,
++ -0x17971c, -0x17ef36, -0x184750, -0x189f6a, -0x18f784, -0x194f9e,
++ -0x19a7b8, -0x19ffd2, -0x1a57ec, -0x1ab006, -0x1b0820, -0x1b603a,
++ -0x1bb854, -0x1c106e, -0x1c6888, -0x1cc0a2, -0x1d18bc, -0x1d70d6,
++ -0x1dc8f0, -0x1e210a, -0x1e7924, -0x1ed13e, -0x1f2958, -0x1f8172,
++ -0x1fd98c, -0x2031a6, -0x2089c0, -0x20e1da, -0x2139f4, -0x21920e,
++ -0x21ea28, -0x224242, -0x229a5c, -0x22f276, -0x234a90, -0x23a2aa,
++ -0x23fac4, -0x2452de, -0x24aaf8, -0x250312, -0x255b2c, -0x25b346,
++ -0x260b60, -0x26637a, -0x26bb94, -0x2713ae, -0x276bc8, -0x27c3e2,
++ -0x281bfc, -0x287416, -0x28cc30, -0x29244a, -0x297c64, -0x29d47e,
++ -0x2a2c98, -0x2a84b2, -0x2adccc, -0x2b34e6,
++ };
++
++
++/* We assume that right shift corresponds to signed division by 2 with
++ * rounding towards minus infinity. This is correct for typical "arithmetic
++ * shift" instructions that shift in copies of the sign bit. But some
++ * C compilers implement >> with an unsigned shift. For these machines you
++ * must define RIGHT_SHIFT_IS_UNSIGNED.
++ * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
++ * It is only applied with constant shift counts. SHIFT_TEMPS must be
++ * included in the variables of any routine using RIGHT_SHIFT.
++ */
++
++#ifdef RIGHT_SHIFT_IS_UNSIGNED
++#define SHIFT_TEMPS INT32 shift_temp;
++#define RIGHT_SHIFT(x,shft) \
++ ((shift_temp = (x)) < 0 ? \
++ (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
++ (shift_temp >> (shft)))
++#else
++#define SHIFT_TEMPS
++#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
+#endif
-
-
++
++
++METHODDEF(void)
++ycc_rgb_convert_argb (j_decompress_ptr cinfo,
++ JSAMPIMAGE input_buf, JDIMENSION input_row,
++ JSAMPARRAY output_buf, int num_rows)
++{
++ JDIMENSION num_cols = cinfo->output_width;
++ JSAMPLE * range_limit = cinfo->sample_range_limit;
++
++ SHIFT_TEMPS
++
++ /* This is used if we don't have SSE2 */
++
++ while (--num_rows >= 0) {
++ JSAMPROW inptr0 = input_buf[0][input_row];
++ JSAMPROW inptr1 = input_buf[1][input_row];
++ JSAMPROW inptr2 = input_buf[2][input_row];
++ input_row++;
++ uint32_t *outptr = (uint32_t *) *output_buf++;
++ for (JDIMENSION col = 0; col < num_cols; col++) {
++ int y = GETJSAMPLE(inptr0[col]);
++ int cb = GETJSAMPLE(inptr1[col]);
++ int cr = GETJSAMPLE(inptr2[col]);
++ JSAMPLE * range_limit_y = range_limit + y;
++ /* Range-limiting is essential due to noise introduced by DCT losses. */
++ outptr[col] = 0xFF000000 |
++ ( range_limit_y[Cr_r_tab[cr]] << 16 ) |
++ ( range_limit_y[((int) RIGHT_SHIFT(Cb_g_tab[cb] + Cr_g_tab[cr], SCALEBITS))] << 8 ) |
++ ( range_limit_y[Cb_b_tab[cb]] );
++ }
++ }
++}
++#endif
++
++
/**************** Inverted CMYK -> RGB conversion **************/
/*
+ * Input is (Inverted) CMYK stored as 4 bytes per pixel.
diff --git a/www/firefox/files/patch-bug791366 b/www/firefox/files/patch-bug791366
deleted file mode 100644
index 2be866d928cd..000000000000
--- a/www/firefox/files/patch-bug791366
+++ /dev/null
@@ -1,95 +0,0 @@
-diff --git xpcom/base/nsMemoryReporterManager.cpp xpcom/base/nsMemoryReporterManager.cpp
-index a9aff58..674e757 100644
---- xpcom/base/nsMemoryReporterManager.cpp
-+++ xpcom/base/nsMemoryReporterManager.cpp
-@@ -32,7 +32,7 @@ using namespace mozilla;
- # include "jemalloc.h"
- #endif // MOZ_MEMORY
-
--#if defined(XP_LINUX) || defined(XP_MACOSX) || defined(SOLARIS)
-+#ifdef XP_UNIX
-
- #include <sys/time.h>
- #include <sys/resource.h>
-@@ -95,6 +95,81 @@ static nsresult GetResident(PRInt64 *n)
- return GetProcSelfStatmField(1, n);
- }
-
-+#elif defined(__DragonFly__) || defined(__FreeBSD__) \
-+ || defined(__NetBSD__) || defined(__OpenBSD__)
-+
-+#include <sys/param.h>
-+#include <sys/sysctl.h>
-+#if defined(__DragonFly__) || defined(__FreeBSD__)
-+#include <sys/user.h>
-+#endif
-+
-+#include <unistd.h>
-+
-+#if defined(__NetBSD__)
-+#undef KERN_PROC
-+#define KERN_PROC KERN_PROC2
-+#define KINFO_PROC struct kinfo_proc2
-+#else
-+#define KINFO_PROC struct kinfo_proc
-+#endif
-+
-+#if defined(__DragonFly__)
-+#define KP_SIZE(kp) (kp.kp_vm_map_size)
-+#define KP_RSS(kp) (kp.kp_vm_rssize * getpagesize())
-+#elif defined(__FreeBSD__)
-+#define KP_SIZE(kp) (kp.ki_size)
-+#define KP_RSS(kp) (kp.ki_rssize * getpagesize())
-+#elif defined(__NetBSD__)
-+#define KP_SIZE(kp) (kp.p_vm_msize * getpagesize())
-+#define KP_RSS(kp) (kp.p_vm_rssize * getpagesize())
-+#elif defined(__OpenBSD__)
-+#define KP_SIZE(kp) ((kp.p_vm_dsize + kp.p_vm_ssize \
-+ + kp.p_vm_tsize) * getpagesize())
-+#define KP_RSS(kp) (kp.p_vm_rssize * getpagesize())
-+#endif
-+
-+static nsresult GetKinfoProcSelf(KINFO_PROC *proc)
-+{
-+ int mib[] = {
-+ CTL_KERN,
-+ KERN_PROC,
-+ KERN_PROC_PID,
-+ getpid(),
-+#if defined(__NetBSD__) || defined(__OpenBSD__)
-+ sizeof(KINFO_PROC),
-+ 1,
-+#endif
-+ };
-+ u_int miblen = sizeof(mib) / sizeof(mib[0]);
-+ size_t size = sizeof(KINFO_PROC);
-+ if (sysctl(mib, miblen, proc, &size, NULL, 0))
-+ return NS_ERROR_FAILURE;
-+
-+ return NS_OK;
-+}
-+
-+#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
-+static nsresult GetVsize(PRInt64 *n)
-+{
-+ KINFO_PROC proc;
-+ nsresult rv = GetKinfoProcSelf(&proc);
-+ if (NS_SUCCEEDED(rv))
-+ *n = KP_SIZE(proc);
-+
-+ return rv;
-+}
-+
-+static nsresult GetResident(PRInt64 *n)
-+{
-+ KINFO_PROC proc;
-+ nsresult rv = GetKinfoProcSelf(&proc);
-+ if (NS_SUCCEEDED(rv))
-+ *n = KP_RSS(proc);
-+
-+ return rv;
-+}
-+
- #elif defined(SOLARIS)
-
- #include <procfs.h>
diff --git a/www/firefox/files/patch-bug798354 b/www/firefox/files/patch-bug798354
new file mode 100644
index 000000000000..09ee2bfbead9
--- /dev/null
+++ b/www/firefox/files/patch-bug798354
@@ -0,0 +1,15 @@
+--- ipc/chromium/src/chrome/common/ipc_channel_posix.cc~
++++ ipc/chromium/src/chrome/common/ipc_channel_posix.cc
+@@ -133,7 +133,12 @@ int ChannelNameToClientFD(const std::string& channel_id) {
+ }
+
+ //------------------------------------------------------------------------------
++#if !defined(__clang__) && defined(__GNUC__) && __GNUC_MINOR__ <= 2
++sockaddr_un sizecheck;
++const size_t kMaxPipeNameLength = sizeof(sizecheck.sun_path);
++#else
+ const size_t kMaxPipeNameLength = sizeof(sockaddr_un::sun_path);
++#endif
+
+ // Creates a Fifo with the specified name ready to listen on.
+ bool CreateServerFifo(const std::string& pipe_name, int* server_listen_fd) {
diff --git a/www/firefox/files/patch-bug799441 b/www/firefox/files/patch-bug799441
deleted file mode 100644
index 98bc613ba60d..000000000000
--- a/www/firefox/files/patch-bug799441
+++ /dev/null
@@ -1,116 +0,0 @@
-commit b9accdd
-Author: Mike Hommey <mh+mozilla@glandium.org>
-Date: Thu Oct 18 14:47:10 2012 +0200
-
- Bug 799441 - Build GIO module in libxul. r=ted
----
- configure.in | 6 ++++++
- extensions/gio/Makefile.in | 14 +++-----------
- toolkit/library/Makefile.in | 5 +++++
- toolkit/library/nsStaticXULComponents.cpp | 7 +++++++
- toolkit/toolkit-tiers.mk | 4 ++++
- 5 files changed, 25 insertions(+), 11 deletions(-)
-
-diff --git configure.in configure.in
-index a9fb5f1..37e6db8 100644
---- configure.in
-+++ configure.in
-@@ -6086,6 +6086,12 @@ if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; th
- MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
- fi
-
-+if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
-+ MOZ_GIO_COMPONENT=1
-+ MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
-+fi
-+AC_SUBST(MOZ_GIO_COMPONENT)
-+
- if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
- AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
- MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
-diff --git extensions/gio/Makefile.in extensions/gio/Makefile.in
-index ccf2846..79112a8 100644
---- extensions/gio/Makefile.in
-+++ extensions/gio/Makefile.in
-@@ -14,6 +14,9 @@ MODULE = nkgio
- LIBRARY_NAME = nkgio
- SHORT_LIBNAME = nkgio
- IS_COMPONENT = 1
-+EXPORT_LIBRARY = 1
-+MODULE_NAME = nsGIOModule
-+LIBXUL_LIBRARY = 1
-
- CPPSRCS = \
- nsGIOProtocolHandler.cpp \
-@@ -21,15 +24,4 @@ CPPSRCS = \
-
- LOCAL_INCLUDES = $(MOZ_GIO_CFLAGS)
-
--EXTRA_DSO_LDOPTS = \
-- $(XPCOM_GLUE_LDOPTS) \
-- $(MOZ_COMPONENT_LIBS) \
-- $(MOZ_GIO_LIBS) \
-- $(NULL)
--
--# make sure this component is never statically linked into the main
--# application. this is necessary since we don't want to force users
--# to install gio in order to use the rest of mozilla ;-)
--FORCE_SHARED_LIB= 1
--
- include $(topsrcdir)/config/rules.mk
-diff --git toolkit/library/Makefile.in toolkit/library/Makefile.in
-index 7f9046e..6499758 100644
---- toolkit/library/Makefile.in
-+++ toolkit/library/Makefile.in
-@@ -333,6 +333,11 @@ COMPONENT_LIBS += gkdebug
- endif
- endif
-
-+ifdef MOZ_GIO_COMPONENT
-+DEFINES += -DMOZ_GIO_COMPONENT
-+COMPONENT_LIBS += nkgio
-+endif
-+
- ifdef MOZ_APP_COMPONENT_LIBS
- COMPONENT_LIBS += $(MOZ_APP_COMPONENT_LIBS)
- endif
-diff --git toolkit/library/nsStaticXULComponents.cpp toolkit/library/nsStaticXULComponents.cpp
-index e1d90f2..85b21a2 100644
---- toolkit/library/nsStaticXULComponents.cpp
-+++ toolkit/library/nsStaticXULComponents.cpp
-@@ -164,6 +164,12 @@
- #define PROFILER_MODULE
- #endif
-
-+#if defined(MOZ_GIO_COMPONENT)
-+#define GIO_MODULE MODULE(nsGIOModule)
-+#else
-+#define GIO_MODULE
-+#endif
-+
- #define XUL_MODULES \
- MODULE(nsUConvModule) \
- MODULE(nsI18nModule) \
-@@ -220,6 +226,7 @@
- MODULE(nsTelemetryModule) \
- MODULE(jsinspector) \
- MODULE(jsdebugger) \
-+ GIO_MODULE \
- /* end of list */
-
- #define MODULE(_name) \
-diff --git toolkit/toolkit-tiers.mk toolkit/toolkit-tiers.mk
-index e87d7af..4b16d23 100644
---- toolkit/toolkit-tiers.mk
-+++ toolkit/toolkit-tiers.mk
-@@ -252,6 +252,10 @@ tier_platform_dirs += js/ductwork/debugger
-
- tier_platform_dirs += other-licenses/snappy
-
-+ifdef MOZ_GIO_COMPONENT
-+tier_platform_dirs += extensions/gio
-+endif
-+
- ifdef APP_LIBXUL_STATICDIRS
- # Applications can cheat and ask for code to be
- # built before libxul so libxul can be linked against it.
diff --git a/www/firefox/files/patch-bug800401 b/www/firefox/files/patch-bug800401
new file mode 100644
index 000000000000..97e430a9a95f
--- /dev/null
+++ b/www/firefox/files/patch-bug800401
@@ -0,0 +1,91 @@
+commit a564d64
+Author: Ehsan Akhgari <ehsan@mozilla.com>
+Date: Thu Oct 11 13:42:12 2012 -0400
+
+ Bug 800401 - Make sure that the WebRTC build system does not impose the -Werror flag on all Linux/Mac builds; r=jesup
+
+ In the future, we need to hook these up to the FAIL_ON_WARNINGS machinery.
+---
+ media/mtransport/third_party/nICEr/nicer.gyp | 2 --
+ media/mtransport/third_party/nrappkit/nrappkit.gyp | 2 --
+ media/webrtc/signaling/signaling.gyp | 6 ------
+ 3 files changed, 10 deletions(-)
+
+diff --git media/mtransport/third_party/nICEr/nicer.gyp media/mtransport/third_party/nICEr/nicer.gyp
+index 26ec0c5..0e1f8b4 100644
+--- media/mtransport/third_party/nICEr/nicer.gyp
++++ media/mtransport/third_party/nICEr/nicer.gyp
+@@ -132,7 +132,6 @@
+ ## Mac
+ [ 'OS == "mac"', {
+ 'cflags_mozilla': [
+- '-Werror',
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+@@ -183,7 +182,6 @@
+ ## Linux
+ [ 'OS == "linux"', {
+ 'cflags': [
+- '-Werror',
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+diff --git media/mtransport/third_party/nrappkit/nrappkit.gyp media/mtransport/third_party/nrappkit/nrappkit.gyp
+index f9a5c19..3cc8e1c 100644
+--- media/mtransport/third_party/nrappkit/nrappkit.gyp
++++ media/mtransport/third_party/nrappkit/nrappkit.gyp
+@@ -150,7 +150,6 @@
+ ## Mac
+ [ 'OS == "mac"', {
+ 'cflags_mozilla': [
+- '-Werror',
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+@@ -200,7 +199,6 @@
+ ## Linux
+ [ 'OS == "linux"', {
+ 'cflags': [
+- '-Werror',
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+diff --git media/webrtc/signaling/signaling.gyp media/webrtc/signaling/signaling.gyp
+index 1ec0ee2..175996f 100644
+--- media/webrtc/signaling/signaling.gyp
++++ media/webrtc/signaling/signaling.gyp
+@@ -184,7 +184,6 @@
+ ],
+
+ 'cflags_mozilla': [
+- '-Werror',
+ ],
+ }],
+ ['OS=="win"', {
+@@ -212,8 +211,6 @@
+ ],
+
+ 'cflags_mozilla': [
+- '-Werror',
+- '-Wno-error=conversion'
+ ],
+ }],
+ ],
+@@ -633,7 +630,6 @@
+ ],
+
+ 'cflags_mozilla': [
+- '-Werror',
+ ],
+ }],
+ ['OS=="win"', {
+@@ -752,8 +748,6 @@
+ ],
+
+ 'cflags_mozilla': [
+- '-Werror',
+- '-Wno-error=conversion'
+ ],
+ }],
+ ],
diff --git a/www/firefox/files/patch-bug806139 b/www/firefox/files/patch-bug806139
index 56791e71fb61..e4bd1ba30ce1 100644
--- a/www/firefox/files/patch-bug806139
+++ b/www/firefox/files/patch-bug806139
@@ -11,10 +11,10 @@
#ifdef MOZ_MEDIA_PLUGINS
--- content/html/content/src/nsHTMLMediaElement.cpp~
+++ content/html/content/src/nsHTMLMediaElement.cpp
-@@ -2114,12 +2114,14 @@ const char nsHTMLMediaElement::gH264Type
- "video/quicktime",
- };
+@@ -2135,12 +2135,14 @@ nsHTMLMediaElement::IsWebMType(const nsA
+ #endif
+ #if defined(MOZ_GSTREAMER) || defined(MOZ_WIDGET_GONK)
-char const *const nsHTMLMediaElement::gH264Codecs[7] = {
+char const *const nsHTMLMediaElement::gH264Codecs[9] = {
"avc1.42E01E",
diff --git a/www/firefox/files/patch-bug807492 b/www/firefox/files/patch-bug807492
new file mode 100644
index 000000000000..78eaccfcf165
--- /dev/null
+++ b/www/firefox/files/patch-bug807492
@@ -0,0 +1,2188 @@
+diff --git config/system-headers config/system-headers
+index 9bd1efa..1095a01 100644
+--- config/system-headers
++++ config/system-headers
+@@ -1066,8 +1066,10 @@ gst/app/gstappsink.h
+ gst/app/gstappsrc.h
+ gst/video/video.h
+ sys/msg.h
+ sys/ipc.h
+ sys/thr.h
+ sys/user.h
+ kvm.h
+ spawn.h
++err.h
++xlocale.h
+diff --git configure.in configure.in
+index c167461..8346c11 100644
+--- configure.in
++++ configure.in
+@@ -1413,16 +1413,27 @@ if test "$GNU_CC"; then
+ _SAVE_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS -mssse3"
+ AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
+ [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
+ AC_MSG_RESULT([no]))
+ CFLAGS=$_SAVE_CFLAGS
+ AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
+
++ # Check for -msse4.1 on $CC
++ AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
++ HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
++ _SAVE_CFLAGS=$CFLAGS
++ CFLAGS="$CFLAGS -msse4.1"
++ AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
++ [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
++ AC_MSG_RESULT([no]))
++ CFLAGS=$_SAVE_CFLAGS
++ AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
++
+ # Turn on GNU-specific warnings:
+ # -Wall - turn on a lot of warnings
+ # -pedantic - this is turned on below
+ # -Wpointer-arith - enabled with -pedantic, but good to have even if not
+ # -Wdeclaration-after-statement - MSVC doesn't like these
+ # -Werror=return-type - catches missing returns, zero false positives
+ # -Wtype-limits - catches overflow bugs, few false positives
+ # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
+@@ -5232,17 +5243,17 @@ dnl Turn off webrtc for OS's we don't handle yet, but allow
+ dnl --enable-webrtc to override. Can disable for everything in
+ dnl the master list above.
+ if test -n "$MOZ_WEBRTC"; then
+ case "$target" in
+ *-android*|*-linuxandroid*)
+ dnl Make sure doesn't get matched by *-linux*
+ MOZ_WEBRTC=
+ ;;
+- *-linux*|*-mingw*|*-darwin*)
++ *-linux*|*-mingw*|*-darwin*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
+ dnl Leave enabled
+ ;;
+ *)
+ dnl default to disabled for all others
+ MOZ_WEBRTC=
+ ;;
+ esac
+ fi
+@@ -8909,16 +8920,21 @@ if test "${OS_TARGET}" = "WINNT"; then
+ if test "$HAVE_64BIT_OS"; then
+ OS_BITS=64
+ else
+ OS_BITS=32
+ fi
+ EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
+ fi
+
++# Don't try to compile sse4.1 code if toolchain doesn't support
++if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
++ EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
++fi
++
+ if test -n "$MOZ_WEBRTC"; then
+ AC_MSG_RESULT("generating WebRTC Makefiles...")
+
+ WEBRTC_CONFIG="-D build_with_mozilla=1 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
+
+ GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
+
+ $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
+diff --git js/src/config/system-headers js/src/config/system-headers
+index 9bd1efa..1095a01 100644
+--- js/src/config/system-headers
++++ js/src/config/system-headers
+@@ -1066,8 +1066,10 @@ gst/app/gstappsink.h
+ gst/app/gstappsrc.h
+ gst/video/video.h
+ sys/msg.h
+ sys/ipc.h
+ sys/thr.h
+ sys/user.h
+ kvm.h
+ spawn.h
++err.h
++xlocale.h
+diff --git media/mtransport/objs.mk media/mtransport/objs.mk
+index f1fc85f..141e8ca 100644
+--- media/mtransport/objs.mk
++++ media/mtransport/objs.mk
+@@ -18,22 +18,26 @@ LOCAL_INCLUDES += \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/util/libekr \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/log \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/registry \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/stats \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/plugin \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/event \
+ $(NULL)
+
+-ifeq ($(OS_ARCH), Darwin)
++ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
+ LOCAL_INCLUDES += \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/generic/include \
+ $(NULL)
++ifeq ($(OS_ARCH), Darwin)
+ DEFINES += -DDARWIN
++else
++DEFINES += -DBSD
++endif
+ endif
+
+ ifeq ($(OS_ARCH), Linux)
+ LOCAL_INCLUDES += \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/linux/include \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/generic/include \
+ $(NULL)
+ DEFINES += -DLINUX
+diff --git media/mtransport/test/Makefile.in media/mtransport/test/Makefile.in
+index c1d5bf4..2ecf2c7 100644
+--- media/mtransport/test/Makefile.in
++++ media/mtransport/test/Makefile.in
+@@ -67,22 +67,24 @@ DEFINES += -D__Userspace_os_FreeBSD=1
+ else
+ #default_fallback; probably doesn't work
+ DEFINES += -D__Userspace_os_$(OS_TARGET)=1
+ endif
+ endif
+ endif
+ endif
+
+-ifeq ($(OS_ARCH), Darwin)
++ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
+ LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include
++ifeq ($(OS_TARGET), Darwin)
+ DEFINES += \
+ -DGTEST_USE_OWN_TR1_TUPLE=1 \
+ $(NULL)
+ endif
++endif
+
+ ifeq ($(OS_ARCH), Linux)
+ LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/linux/include
+ endif
+
+ ifneq ($(OS_TARGET),WINNT)
+ CPP_UNIT_TESTS = \
+ ice_unittest.cpp \
+diff --git media/mtransport/third_party/nICEr/nicer.gyp media/mtransport/third_party/nICEr/nicer.gyp
+index 0e1f8b4..9a4b995 100644
+--- media/mtransport/third_party/nICEr/nicer.gyp
++++ media/mtransport/third_party/nICEr/nicer.gyp
+@@ -124,26 +124,36 @@
+ 'R_DEFINED_UINT2=uint16_t',
+ 'R_DEFINED_INT4=int32_t',
+ 'R_DEFINED_UINT4=uint32_t',
+ 'R_DEFINED_INT8=int64_t',
+ 'R_DEFINED_UINT8=uint64_t',
+ ],
+
+ 'conditions' : [
+- ## Mac
++ ## Mac and BSDs
+ [ 'OS == "mac"', {
++ 'defines' : [
++ 'DARWIN',
++ 'HAVE_XLOCALE',
++ ],
++ }],
++ [ 'os_bsd == 1', {
++ 'defines' : [
++ 'BSD',
++ ],
++ }],
++ [ 'OS == "mac" or os_bsd == 1', {
+ 'cflags_mozilla': [
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+ '-Wmissing-prototypes',
+ ],
+ 'defines' : [
+- 'DARWIN',
+ 'HAVE_LIBM=1',
+ 'HAVE_STRDUP=1',
+ 'HAVE_STRLCPY=1',
+ 'HAVE_SYS_TIME_H=1',
+ 'HAVE_VFPRINTF=1',
+ 'NEW_STDIO'
+ 'RETSIGTYPE=void',
+ 'TIME_WITH_SYS_TIME_H=1',
+diff --git media/mtransport/third_party/nICEr/src/stun/addrs.c media/mtransport/third_party/nICEr/src/stun/addrs.c
+index b0b66b2..04fea94 100644
+--- media/mtransport/third_party/nICEr/src/stun/addrs.c
++++ media/mtransport/third_party/nICEr/src/stun/addrs.c
+@@ -69,17 +69,17 @@ static char *RCSSTRING __UNUSED__="$Id: addrs.c,v 1.2 2008/04/28 18:21:30 ekr Ex
+ #include <netdb.h>
+ #endif /* UNIX */
+
+ #include "stun.h"
+ #include "addrs.h"
+
+
+
+-#ifdef DARWIN
++#if defined(BSD) || defined(DARWIN)
+ /*
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+@@ -675,17 +675,17 @@ nr_stun_remove_duplicate_addrs(nr_transport_addr addrs[], int remove_loopback, i
+ }
+
+ int
+ nr_stun_get_addrs(nr_transport_addr addrs[], int maxaddrs, int drop_loopback, int *count)
+ {
+ int _status=0;
+ int i;
+
+-#ifdef DARWIN
++#if defined(BSD) || defined(DARWIN)
+ _status = stun_get_mib_addrs(addrs, maxaddrs, count);
+ #elif defined(WIN32)
+ _status = stun_get_win32_addrs(addrs, maxaddrs, count);
+ #elif defined(__sparc__)
+ _status = stun_get_sparc_addrs(addrs, maxaddrs, count);
+ #else
+ _status = stun_get_siocgifconf_addrs(addrs, maxaddrs, count);
+ #endif
+diff --git media/mtransport/third_party/nICEr/src/stun/stun.h media/mtransport/third_party/nICEr/src/stun/stun.h
+index a3c51f9..eb65ac8 100644
+--- media/mtransport/third_party/nICEr/src/stun/stun.h
++++ media/mtransport/third_party/nICEr/src/stun/stun.h
+@@ -40,17 +40,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #include <sys/param.h>
+ #include <sys/socket.h>
+ #include <net/if.h>
+ #ifndef LINUX
+ #include <net/if_var.h>
+ #include <net/if_dl.h>
+ #include <net/if_types.h>
+ #endif
++#ifndef BSD
+ #include <net/route.h>
++#endif
+ #include <netinet/in.h>
+ #ifndef LINUX
+ #include <netinet/in_var.h>
+ #endif
+ #include <arpa/inet.h>
+ #include <netdb.h>
+ #endif
+ #include <time.h>
+diff --git media/mtransport/third_party/nICEr/src/util/mbslen.c media/mtransport/third_party/nICEr/src/util/mbslen.c
+index cc260b7..66af2d7 100644
+--- media/mtransport/third_party/nICEr/src/util/mbslen.c
++++ media/mtransport/third_party/nICEr/src/util/mbslen.c
+@@ -38,50 +38,58 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ #include <errno.h>
+ #include <csi_platform.h>
+
+ #include <assert.h>
+ #include <locale.h>
+ #include <stdlib.h>
+ #include <wchar.h>
+-#ifdef DARWIN
++
++#ifdef __FreeBSD__
++#include <osreldate.h>
++# if __FreeBSD_version > 900044
++# define HAVE_XLOCALE
++# endif
++#endif
++
++#ifdef HAVE_XLOCALE
+ #include <xlocale.h>
+-#endif /* DARWIN */
++#endif /* HAVE_XLOCALE */
+
+ #include "nr_api.h"
+ #include "mbslen.h"
+
+ /* get number of characters in a mult-byte character string */
+ int
+ mbslen(const char *s, size_t *ncharsp)
+ {
+-#ifdef DARWIN
++#ifdef HAVE_XLOCALE
+ static locale_t loc = 0;
+ static int initialized = 0;
+-#endif /* DARWIN */
++#endif /* HAVE_XLOCALE */
+ #ifdef WIN32
+ char *my_locale=0;
+ unsigned int i;
+ #endif /* WIN32 */
+ int _status;
+ size_t nbytes;
+ int nchars;
+ mbstate_t mbs;
+
+-#ifdef DARWIN
++#ifdef HAVE_XLOCALE
+ if (! initialized) {
+ initialized = 1;
+ loc = newlocale(LC_CTYPE_MASK, "UTF-8", LC_GLOBAL_LOCALE);
+ }
+
+ if (loc == 0) {
+ /* unable to create the UTF-8 locale */
+ assert(loc != 0); /* should never happen */
+-#endif /* DARWIN */
++#endif /* HAVE_XLOCALE */
+
+ #ifdef WIN32
+ if (!setlocale(LC_CTYPE, 0))
+ ABORT(R_INTERNAL);
+
+ if (!(my_locale = r_strdup(setlocale(LC_CTYPE, 0))))
+ ABORT(R_NO_MEMORY);
+
+@@ -91,28 +99,28 @@ mbslen(const char *s, size_t *ncharsp)
+ if (!strstr(my_locale, "UTF-8"))
+ ABORT(R_NOT_FOUND);
+ #else
+ /* can't count UTF-8 characters with mbrlen if the locale isn't UTF-8 */
+ if (! strcasestr(setlocale(LC_CTYPE, 0), "UTF-8"))
+ ABORT(R_NOT_FOUND);
+ #endif
+
+-#ifdef DARWIN
++#ifdef HAVE_XLOCALE
+ }
+-#endif /* DARWIN */
++#endif /* HAVE_XLOCALE */
+
+ memset(&mbs, 0, sizeof(mbs));
+ nchars = 0;
+
+-#ifdef DARWIN
++#ifdef HAVE_XLOCALE
+ while (*s != '\0' && (nbytes = mbrlen_l(s, strlen(s), &mbs, loc)) != 0)
+ #else
+ while (*s != '\0' && (nbytes = mbrlen(s, strlen(s), &mbs)) != 0)
+-#endif /* DARWIN */
++#endif /* HAVE_XLOCALE */
+ {
+ if (nbytes == (size_t)-1) /* should never happen */ {
+ assert(0);
+ ABORT(R_INTERNAL);
+ }
+ if (nbytes == (size_t)-2) /* encoding error */ {
+ assert(0);
+ ABORT(R_BAD_DATA);
+diff --git media/mtransport/third_party/nrappkit/nrappkit.gyp media/mtransport/third_party/nrappkit/nrappkit.gyp
+index 3cc8e1c..74016c6 100644
+--- media/mtransport/third_party/nrappkit/nrappkit.gyp
++++ media/mtransport/third_party/nrappkit/nrappkit.gyp
+@@ -142,26 +142,35 @@
+ 'R_DEFINED_UINT2=uint16_t',
+ 'R_DEFINED_INT4=int32_t',
+ 'R_DEFINED_UINT4=uint32_t',
+ 'R_DEFINED_INT8=int64_t',
+ 'R_DEFINED_UINT8=uint64_t',
+ ],
+
+ 'conditions' : [
+- ## Mac
++ ## Mac and BSDs
+ [ 'OS == "mac"', {
++ 'defines' : [
++ 'DARWIN',
++ ],
++ }],
++ [ 'os_bsd == 1', {
++ 'defines' : [
++ 'BSD',
++ ],
++ }],
++ [ 'OS == "mac" or os_bsd == 1', {
+ 'cflags_mozilla': [
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+ '-Wmissing-prototypes',
+ ],
+ 'defines' : [
+- 'DARWIN',
+ 'HAVE_LIBM=1',
+ 'HAVE_STRDUP=1',
+ 'HAVE_STRLCPY=1',
+ 'HAVE_SYS_TIME_H=1',
+ 'HAVE_VFPRINTF=1',
+ 'NEW_STDIO'
+ 'RETSIGTYPE=void',
+ 'TIME_WITH_SYS_TIME_H=1',
+diff --git media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h
+index 15452e3..2c9651a 100644
+--- media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h
++++ media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h
+@@ -37,16 +37,21 @@
+ */
+
+
+ #ifndef _platform_h
+ #define _platform_h
+
+ #include <unistd.h>
+
++#ifdef BSD
++/* Hack version of addr2ascii (in util/util.c) */
++char *addr2ascii(int af, const void *addrp, int len,char *buf);
++#endif
++
+ #define STDIO_BYTES_BUFFERED(fp) (fp->_r)
+
+ #ifdef NR_SOCKET_IS_VOID_PTR
+ typedef void* NR_SOCKET;
+ #else
+ typedef int NR_SOCKET;
+ #define NR_SOCKET_READ(sock,buf,count) read((sock),(buf),(count))
+ #define NR_SOCKET_WRITE(sock,buf,count) write((sock),(buf),(count))
+diff --git media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h
+index bcb1ec0..bb73591 100644
+--- media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h
++++ media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h
+@@ -28,17 +28,17 @@
+ *
+ * @(#)queue.h 8.5 (Berkeley) 8/20/94
+ * $FreeBSD$
+ */
+
+ #ifndef _SYS_QUEUE_H_
+ #define _SYS_QUEUE_H_
+
+-#ifndef DARWIN
++#if !defined(BSD) && !defined(DARWIN)
+ #include <stddef.h>
+ #define __offsetof offsetof
+ #endif
+
+ #define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = STAILQ_FIRST((head)); \
+ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+diff --git media/mtransport/third_party/nrappkit/src/util/util.c media/mtransport/third_party/nrappkit/src/util/util.c
+index 3aced8b..be020bb 100644
+--- media/mtransport/third_party/nrappkit/src/util/util.c
++++ media/mtransport/third_party/nrappkit/src/util/util.c
+@@ -36,16 +36,19 @@
+ ekr@rtfm.com Wed Dec 26 17:19:36 2001
+ */
+
+
+ static char *RCSSTRING __UNUSED__ ="$Id: util.c,v 1.5 2007/11/21 00:09:13 adamcain Exp $";
+
+ #ifndef WIN32
+ #include <sys/uio.h>
++#include <sys/socket.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
+ #include <pwd.h>
+ #include <dirent.h>
+ #endif
+ #include <string.h>
+ #include <ctype.h>
+ #include <sys/stat.h>
+ #ifdef OPENSSL
+ #include <openssl/evp.h>
+@@ -431,17 +434,17 @@ int nr_reg_uint8_fetch_and_check(NR_registry key, UINT8 min, UINT8 max, int log_
+ abort:
+ if(die && _status){
+ r_log(log_fac,LOG_CRIT,"Exiting due to invalid configuration (key '%s')",key);
+ exit(1);
+ }
+ return(_status);
+ }
+
+-#if defined(LINUX) || defined(WIN32)
++#if defined(LINUX) || defined(BSD) || defined(WIN32)
+ /* Hack version of addr2ascii */
+ char *addr2ascii(int af, const void *addrp, int len,char *buf)
+ {
+ static char buf2[256];
+ char *ret;
+ struct in_addr *addr=(struct in_addr *)addrp;
+
+ if (! buf)
+diff --git media/webrtc/signaling/signaling.gyp media/webrtc/signaling/signaling.gyp
+index f0cbf870..ba0f801 100644
+--- media/webrtc/signaling/signaling.gyp
++++ media/webrtc/signaling/signaling.gyp
+@@ -208,16 +208,29 @@
+ 'SIPCC_BUILD',
+ 'HAVE_WINSOCK2_H',
+ 'CPR_STDINT_INCLUDE=\\"mozilla/StandardInteger.h\\"'
+ ],
+
+ 'cflags_mozilla': [
+ ],
+ }],
++ ['os_bsd==1', {
++ 'include_dirs': [
++ ],
++ 'defines': [
++ # avoiding pointless ifdef churn
++ 'SIP_OS_OSX',
++ 'OSX',
++ 'SECLIB_OPENSSL',
++ ],
++
++ 'cflags_mozilla': [
++ ],
++ }],
+ ['OS=="mac"', {
+ 'include_dirs': [
+ ],
+ 'defines': [
+ 'SIP_OS_OSX',
+ 'OSX',
+ '_FORTIFY_SOURCE=2',
+ ],
+@@ -701,17 +714,17 @@
+ 'EXTERNAL_TICK_REQUIRED',
+ 'GIPS_VER=3480',
+ ],
+
+ 'cflags_mozilla': [
+ ],
+
+ }],
+- ['OS=="mac"', {
++ ['OS=="mac" or os_bsd==1', {
+
+ 'include_dirs': [
+ ],
+
+ 'sources': [
+ # SIPSTACK
+ './src/sipcc/core/sipstack/sip_platform_task.c',
+
+@@ -746,24 +759,23 @@
+ './src/sipcc/cpr/darwin/cpr_darwin_timers_using_select.c',
+ './src/sipcc/cpr/darwin/cpr_darwin_tst.h',
+ './src/sipcc/cpr/darwin/cpr_darwin_types.h',
+ ],
+
+
+ 'defines' : [
+ 'SIP_OS_OSX',
+- '_POSIX_SOURCE',
++ # using BSD extensions, leave _POSIX_SOURCE undefined
+ 'CPR_MEMORY_LITTLE_ENDIAN',
+ 'NO_SOCKET_POLLING',
+ 'USE_TIMER_SELECT_BASED',
+ 'FULL_BUILD',
+ 'STUBBED_OUT',
+ 'USE_PRINTF',
+- '_DARWIN_C_SOURCE',
+ 'NO_NSPR_10_SUPPORT',
+ ],
+
+ 'cflags_mozilla': [
+ ],
+ }],
+ ],
+
+diff --git media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c
+index a7c47e1..4f191de 100644
+--- media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c
++++ media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c
+@@ -352,21 +352,25 @@ cprGetMessage (cprMsgQueue_t msgQueue, b
+ {
+ static const char fname[] = "cprGetMessage";
+
+ void *buffer = 0;
+ cpr_msg_queue_t *msgq;
+ cpr_msgq_node_t *node;
+ struct timespec timeout;
+ struct timeval tv;
++#ifndef __APPLE__
++ struct timezone tz;
++#else
+ // On the iPhone, there is a DarwinAlias problem with "timezone"
+ struct _timezone {
+ int tz_minuteswest; /* of Greenwich */
+ int tz_dsttime; /* type of dst correction to apply */
+ } tz;
++#endif
+
+ /* Initialize ppUserData */
+ if (ppUserData) {
+ *ppUserData = NULL;
+ }
+
+ msgq = (cpr_msg_queue_t *) msgQueue;
+ if (msgq == NULL) {
+diff --git media/webrtc/signaling/test/Makefile.in media/webrtc/signaling/test/Makefile.in
+index a30e330..cfbd8a3 100644
+--- media/webrtc/signaling/test/Makefile.in
++++ media/webrtc/signaling/test/Makefile.in
+@@ -22,32 +22,32 @@ LIBS = \
+ $(DEPTH)/media/webrtc/signalingtest/signaling_ecc/$(LIB_PREFIX)ecc.$(LIB_SUFFIX) \
+ $(DEPTH)/media/webrtc/signalingtest/signaling_sipcc/$(LIB_PREFIX)sipcc.$(LIB_SUFFIX) \
+ $(DEPTH)/layout/media/$(LIB_PREFIX)gkmedias.$(LIB_SUFFIX) \
+ $(DEPTH)/media/webrtc/trunk/testing/gtest_gtest/$(LIB_PREFIX)gtest.$(LIB_SUFFIX) \
+ $(DEPTH)/netwerk/srtp/src/$(LIB_PREFIX)nksrtp_s.$(LIB_SUFFIX) \
+ $(NULL)
+
+ ifdef MOZ_SYDNEYAUDIO
+-ifeq ($(OS_ARCH),Linux)
++ifneq (,$(filter Linux DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
+ LIBS += \
+ $(MOZ_ALSA_LIBS) \
+ $(NULL)
+ endif
+ endif
+
+ ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
+ LIBS += \
+ $(XLIBS) \
+ $(MOZ_GTK2_LIBS) \
+ -lgthread-2.0 \
+ $(NULL)
+ endif
+
+-ifeq ($(OS_ARCH),Linux)
++ifneq (,$(filter Linux DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
+ LIBS += \
+ $(MOZ_CAIRO_OSLIBS) \
+ $(NULL)
+ endif
+
+ ifeq ($(OS_ARCH),Darwin)
+ LIBS += \
+ -framework AudioToolbox \
+diff --git media/webrtc/trunk/build/common.gypi media/webrtc/trunk/build/common.gypi
+index 6ca2f70..5d261cb 100644
+--- media/webrtc/trunk/build/common.gypi
++++ media/webrtc/trunk/build/common.gypi
+@@ -75,22 +75,31 @@
+ # ash. This rule should be removed for the future when Windows is
+ # using the aura windows without the ash interface.
+ ['use_aura==1 and OS=="win"', {
+ 'use_ash%': 1,
+ }],
+ ['use_ash==1', {
+ 'use_aura%': 1,
+ }],
++
++ # A flag for BSD platforms
++ ['OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or \
++ OS=="openbsd"', {
++ 'os_bsd%': 1,
++ }, {
++ 'os_bsd%': 0,
++ }],
+ ],
+ },
+ # Copy conditionally-set variables out one scope.
+ 'chromeos%': '<(chromeos)',
+ 'use_aura%': '<(use_aura)',
+ 'use_ash%': '<(use_ash)',
++ 'os_bsd%': '<(os_bsd)',
+ 'use_openssl%': '<(use_openssl)',
+ 'use_ibus%': '<(use_ibus)',
+ 'enable_viewport%': '<(enable_viewport)',
+ 'enable_hidpi%': '<(enable_hidpi)',
+ 'enable_touch_ui%': '<(enable_touch_ui)',
+ 'android_upstream_bringup%': '<(android_upstream_bringup)',
+ 'buildtype%': '<(buildtype)',
+
+@@ -114,17 +123,17 @@
+ # Set default value of toolkit_views based on OS.
+ ['OS=="win" or chromeos==1 or use_aura==1', {
+ 'toolkit_views%': 1,
+ }, {
+ 'toolkit_views%': 0,
+ }],
+
+ # Set toolkit_uses_gtk for the Chromium browser on Linux.
+- ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_aura==0', {
++ ['(OS=="linux" or OS=="solaris" or os_bsd==1) and use_aura==0', {
+ 'toolkit_uses_gtk%': 1,
+ }, {
+ 'toolkit_uses_gtk%': 0,
+ }],
+
+ # Enable HiDPI on Mac OS and Chrome OS.
+ ['OS=="mac" or chromeos==1', {
+ 'enable_hidpi%': 1,
+@@ -139,16 +148,17 @@
+
+ # Copy conditionally-set variables out one scope.
+ 'chromeos%': '<(chromeos)',
+ 'host_arch%': '<(host_arch)',
+ 'toolkit_views%': '<(toolkit_views)',
+ 'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
+ 'use_aura%': '<(use_aura)',
+ 'use_ash%': '<(use_ash)',
++ 'os_bsd%': '<(os_bsd)',
+ 'use_openssl%': '<(use_openssl)',
+ 'use_ibus%': '<(use_ibus)',
+ 'enable_viewport%': '<(enable_viewport)',
+ 'enable_hidpi%': '<(enable_hidpi)',
+ 'enable_touch_ui%': '<(enable_touch_ui)',
+ 'android_upstream_bringup%': '<(android_upstream_bringup)',
+ 'android_build_type%': '<(android_build_type)',
+
+@@ -397,25 +407,18 @@
+
+ # A flag for POSIX platforms
+ ['OS=="win"', {
+ 'os_posix%': 0,
+ }, {
+ 'os_posix%': 1,
+ }],
+
+- # A flag for BSD platforms
+- ['OS=="freebsd" or OS=="openbsd"', {
+- 'os_bsd%': 1,
+- }, {
+- 'os_bsd%': 0,
+- }],
+-
+ # NSS usage.
+- ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_openssl==0', {
++ ['(OS=="linux" or OS=="solaris" or os_bsd==1) and use_openssl==0', {
+ 'use_nss%': 1,
+ }, {
+ 'use_nss%': 0,
+ }],
+
+ # Flags to use X11 on non-Mac POSIX platforms
+ ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android"', {
+ 'use_glib%': 0,
+diff --git media/webrtc/trunk/src/build/common.gypi media/webrtc/trunk/src/build/common.gypi
+index 9ca9f7c..d5c4ab9 100644
+--- media/webrtc/trunk/src/build/common.gypi
++++ media/webrtc/trunk/src/build/common.gypi
+@@ -101,16 +101,23 @@
+ 'enable_protobuf%': 1,
+ 'include_tests%': 1,
+
+ # TODO(andrew): For now, disable the Chrome plugins, which causes a
+ # flood of chromium-style warnings. Investigate enabling them:
+ # http://code.google.com/p/webrtc/issues/detail?id=163
+ 'clang_use_chrome_plugins%': 0,
+ }],
++ ['OS=="linux" or OS=="solaris" or os_bsd==1', {
++ 'include_alsa_audio%': 1,
++ 'include_v4l2_video_capture%': 1,
++ }, {
++ 'include_alsa_audio%': 0,
++ 'include_v4l2_video_capture%': 0,
++ }],
+ ], # conditions
+ },
+ 'target_defaults': {
+ 'include_dirs': [
+ # TODO(andrew): we should be able to just use <(webrtc_root) here.
+ '..','../..',
+ ],
+ 'defines': [
+@@ -174,16 +181,28 @@
+ 'defines': [
+ 'WEBRTC_LINUX',
+ 'WEBRTC_THREAD_RR',
+ # TODO(andrew): can we select this automatically?
+ # Define this if the Linux system does not support CLOCK_MONOTONIC.
+ #'WEBRTC_CLOCK_TYPE_REALTIME',
+ ],
+ }],
++ ['os_bsd==1', {
++ 'defines': [
++ 'WEBRTC_BSD',
++ 'WEBRTC_THREAD_RR',
++ ],
++ }],
++ ['OS=="dragonfly" or OS=="netbsd"', {
++ 'defines': [
++ # doesn't support pthread_condattr_setclock
++ 'WEBRTC_CLOCK_TYPE_REALTIME',
++ ],
++ }],
+ ['OS=="mac"', {
+ 'defines': [
+ 'WEBRTC_MAC',
+ 'WEBRTC_MAC_INTEL', # TODO(andrew): remove this.
+ 'WEBRTC_THREAD_RR',
+ 'WEBRTC_CLOCK_TYPE_REALTIME',
+ ],
+ }],
+diff --git media/webrtc/trunk/src/modules/audio_device/main/source/audio_device.gypi media/webrtc/trunk/src/modules/audio_device/main/source/audio_device.gypi
+index 8457737..4d0f322 100644
+--- media/webrtc/trunk/src/modules/audio_device/main/source/audio_device.gypi
++++ media/webrtc/trunk/src/modules/audio_device/main/source/audio_device.gypi
+@@ -41,21 +41,25 @@
+ 'audio_device_utility.h',
+ 'audio_device_impl.cc',
+ 'audio_device_impl.h',
+ 'audio_device_config.h',
+ 'dummy/audio_device_dummy.h',
+ 'dummy/audio_device_utility_dummy.h',
+ ],
+ 'conditions': [
+- ['OS=="linux"', {
++ ['include_alsa_audio==1', {
+ 'include_dirs': [
+ 'linux',
+ ],
+- }], # OS==linux
++ 'defines': [
++ # avoiding pointless ifdef churn
++ 'WEBRTC_LINUX',
++ ],
++ }], # include_alsa_audio==1
+ ['OS=="mac"', {
+ 'include_dirs': [
+ 'mac',
+ ],
+ }], # OS==mac
+ ['OS=="win"', {
+ 'include_dirs': [
+ 'win',
+@@ -111,24 +115,26 @@
+ 'link_settings': {
+ 'libraries': [
+ '-llog',
+ '-lOpenSLES',
+ ],
+ },
+ }],
+ ['OS=="linux"', {
+- 'defines': [
+- 'LINUX_ALSA',
+- ],
+ 'link_settings': {
+ 'libraries': [
+ '-ldl',
+ ],
+ },
++ }],
++ ['include_alsa_audio==1', {
++ 'defines': [
++ 'LINUX_ALSA',
++ ],
+ 'conditions': [
+ ['include_pulse_audio==1', {
+ 'defines': [
+ 'LINUX_PULSE',
+ ],
+ 'sources': [
+ 'linux/audio_device_pulse_linux.cc',
+ 'linux/audio_device_pulse_linux.h',
+diff --git media/webrtc/trunk/src/modules/audio_device/main/source/audio_device_utility.cc media/webrtc/trunk/src/modules/audio_device/main/source/audio_device_utility.cc
+index 203f09a..0b0b70e 100644
+--- media/webrtc/trunk/src/modules/audio_device/main/source/audio_device_utility.cc
++++ media/webrtc/trunk/src/modules/audio_device/main/source/audio_device_utility.cc
+@@ -41,17 +41,17 @@ bool AudioDeviceUtility::StringCompare(
+ const char* str1 , const char* str2,
+ const WebRtc_UWord32 length)
+ {
+ return ((_strnicmp(str1, str2, length) == 0) ? true : false);
+ }
+
+ } // namespace webrtc
+
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+ // ============================================================================
+ // Linux & Mac
+ // ============================================================================
+
+ #include <sys/time.h> // gettimeofday
+ #include <time.h> // gettimeofday
+ #include <string.h> // strncasecmp
+@@ -104,11 +104,11 @@ WebRtc_UWord32 AudioDeviceUtility::GetTimeInMS()
+ bool AudioDeviceUtility::StringCompare(
+ const char* str1 , const char* str2, const WebRtc_UWord32 length)
+ {
+ return (strncasecmp(str1, str2, length) == 0)?true: false;
+ }
+
+ } // namespace webrtc
+
+-#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+
+diff --git media/webrtc/trunk/src/modules/rtp_rtcp/source/forward_error_correction.cc media/webrtc/trunk/src/modules/rtp_rtcp/source/forward_error_correction.cc
+index bdad224..39e1132 100644
+--- media/webrtc/trunk/src/modules/rtp_rtcp/source/forward_error_correction.cc
++++ media/webrtc/trunk/src/modules/rtp_rtcp/source/forward_error_correction.cc
+@@ -7,16 +7,17 @@
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+ #include "modules/rtp_rtcp/source/forward_error_correction.h"
+
+ #include <algorithm>
+ #include <cassert>
++#include <cstdlib> // for abs()
+ #include <cstring>
+ #include <iterator>
+
+ #include "modules/rtp_rtcp/source/forward_error_correction_internal.h"
+ #include "modules/rtp_rtcp/source/rtp_utility.h"
+ #include "system_wrappers/interface/trace.h"
+
+ namespace webrtc {
+diff --git media/webrtc/trunk/src/modules/rtp_rtcp/source/rtp_utility.cc media/webrtc/trunk/src/modules/rtp_rtcp/source/rtp_utility.cc
+index 298d479..37b70c9 100644
+--- media/webrtc/trunk/src/modules/rtp_rtcp/source/rtp_utility.cc
++++ media/webrtc/trunk/src/modules/rtp_rtcp/source/rtp_utility.cc
+@@ -13,17 +13,17 @@
+ #include <cassert>
+ #include <cmath> // ceil
+ #include <cstring> // memcpy
+
+ #if defined(_WIN32)
+ #include <Windows.h> // FILETIME
+ #include <WinSock.h> // timeval
+ #include <MMSystem.h> // timeGetTime
+-#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC))
++#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC))
+ #include <sys/time.h> // gettimeofday
+ #include <time.h>
+ #endif
+ #if (defined(_DEBUG) && defined(_WIN32) && (_MSC_VER >= 1400))
+ #include <stdio.h>
+ #endif
+
+ #include "system_wrappers/interface/tick_util.h"
+@@ -151,17 +151,17 @@ void get_time(WindowsHelpTimer* help_timer, FILETIME& current_time) {
+ virtual WebRtc_Word64 GetTimeInMS();
+
+ virtual void CurrentNTP(WebRtc_UWord32& secs, WebRtc_UWord32& frac);
+
+ private:
+ WindowsHelpTimer* _helpTimer;
+ };
+
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+ // A clock reading times from the POSIX API.
+ class UnixSystemClock : public RtpRtcpClock {
+ public:
+ UnixSystemClock() {}
+ virtual ~UnixSystemClock() {}
+
+ virtual WebRtc_Word64 GetTimeInMS();
+@@ -209,17 +209,17 @@ void WindowsSystemClock::CurrentNTP(WebRtc_UWord32& secs,
+ } else if (dtemp < -1) {
+ dtemp += 1;
+ secs--;
+ }
+ dtemp *= NTP_FRAC;
+ frac = (WebRtc_UWord32)dtemp;
+ }
+
+-#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC))
++#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC))
+
+ WebRtc_Word64 UnixSystemClock::GetTimeInMS() {
+ return TickTime::MillisecondTimestamp();
+ }
+
+ // Use the system time.
+ void UnixSystemClock::CurrentNTP(WebRtc_UWord32& secs, WebRtc_UWord32& frac) {
+ double dtemp;
+@@ -248,17 +248,17 @@ void UnixSystemClock::CurrentNTP(WebRtc_UWord32& secs, WebRtc_UWord32& frac) {
+ // Note that this is a POD. Only PODs are allowed to have static storage
+ // duration according to the Google Style guide.
+ static WindowsHelpTimer global_help_timer = {0, 0, {{ 0, 0}, 0}, 0};
+ #endif
+
+ RtpRtcpClock* GetSystemClock() {
+ #if defined(_WIN32)
+ return new WindowsSystemClock(&global_help_timer);
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ return new UnixSystemClock();
+ #else
+ return NULL;
+ #endif
+ }
+
+ WebRtc_UWord32 GetCurrentRTP(RtpRtcpClock* clock, WebRtc_UWord32 freq) {
+ const bool use_global_clock = (clock == NULL);
+@@ -313,17 +313,17 @@ bool OldTimestamp(uint32_t newTimestamp,
+ * Misc utility routines
+ */
+
+ #if defined(_WIN32)
+ bool StringCompare(const char* str1, const char* str2,
+ const WebRtc_UWord32 length) {
+ return (_strnicmp(str1, str2, length) == 0) ? true : false;
+ }
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ bool StringCompare(const char* str1, const char* str2,
+ const WebRtc_UWord32 length) {
+ return (strncasecmp(str1, str2, length) == 0) ? true : false;
+ }
+ #endif
+
+ #if !defined(WEBRTC_LITTLE_ENDIAN) && !defined(WEBRTC_BIG_ENDIAN)
+ #error Either WEBRTC_LITTLE_ENDIAN or WEBRTC_BIG_ENDIAN must be defined
+diff --git media/webrtc/trunk/src/modules/udp_transport/source/udp_transport_impl.cc media/webrtc/trunk/src/modules/udp_transport/source/udp_transport_impl.cc
+index e50db5d..70ad8a8 100644
+--- media/webrtc/trunk/src/modules/udp_transport/source/udp_transport_impl.cc
++++ media/webrtc/trunk/src/modules/udp_transport/source/udp_transport_impl.cc
+@@ -13,60 +13,62 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <time.h>
+
+ #if defined(_WIN32)
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ #include <arpa/inet.h>
+ #include <ctype.h>
+ #include <fcntl.h>
+ #include <netdb.h>
++#include <sys/socket.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <stdlib.h>
+ #include <sys/ioctl.h>
+-#include <sys/socket.h>
+ #include <sys/time.h>
+ #include <unistd.h>
+ #ifndef MAC_IPHONE
+ #include <net/if_arp.h>
+ #endif
+ #endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
+
+ #if defined(WEBRTC_MAC)
+-#include <ifaddrs.h>
+ #include <machine/types.h>
+ #endif
++#if defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
++#include <ifaddrs.h>
++#endif
+ #if defined(WEBRTC_LINUX)
+ #include <linux/netlink.h>
+ #include <linux/rtnetlink.h>
+ #endif
+
+ #include "common_types.h"
+ #include "critical_section_wrapper.h"
+ #include "rw_lock_wrapper.h"
+ #include "trace.h"
+ #include "typedefs.h"
+ #include "udp_socket_manager_wrapper.h"
+
+-#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ #define GetLastError() errno
+
+ #define IFRSIZE ((int)(size * sizeof (struct ifreq)))
+
+ #define NLMSG_OK_NO_WARNING(nlh,len) \
+ ((len) >= (int)sizeof(struct nlmsghdr) && \
+ (int)(nlh)->nlmsg_len >= (int)sizeof(struct nlmsghdr) && \
+ (int)(nlh)->nlmsg_len <= (len))
+
+-#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+ namespace webrtc {
+
+ class SocketFactory : public UdpTransportImpl::SocketFactoryInterface {
+ public:
+ UdpSocketWrapper* CreateSocket(const WebRtc_Word32 id,
+ UdpSocketManager* mgr,
+ CallbackObj obj,
+@@ -2366,17 +2368,17 @@ WebRtc_UWord32 UdpTransport::InetAddrIPV4(const char* ip)
+ {
+ return ::inet_addr(ip);
+ }
+
+ WebRtc_Word32 UdpTransport::InetPresentationToNumeric(WebRtc_Word32 af,
+ const char* src,
+ void* dst)
+ {
+-#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ const WebRtc_Word32 result = inet_pton(af, src, dst);
+ return result > 0 ? 0 : -1;
+
+ #elif defined(_WIN32)
+ SocketAddress temp;
+ int length=sizeof(SocketAddress);
+
+ if(af == AF_INET)
+@@ -2488,17 +2490,17 @@ WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(char n_localIP[16])
+ break;
+ };
+ }
+ freeaddrinfo(result);
+ WEBRTC_TRACE(kTraceWarning, kTraceTransport, -1,
+ "getaddrinfo failed to find address");
+ return -1;
+
+-#elif defined(WEBRTC_MAC)
++#elif defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ struct ifaddrs* ptrIfAddrs = NULL;
+ struct ifaddrs* ptrIfAddrsStart = NULL;
+
+ getifaddrs(&ptrIfAddrsStart);
+ ptrIfAddrs = ptrIfAddrsStart;
+ while(ptrIfAddrs)
+ {
+ if(ptrIfAddrs->ifa_addr->sa_family == AF_INET6)
+@@ -2680,17 +2682,17 @@ WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP)
+ }
+ else
+ {
+ WebRtc_Word32 error = WSAGetLastError();
+ WEBRTC_TRACE(kTraceWarning, kTraceTransport, -1,
+ "gethostbyname failed, error:%d", error);
+ return -1;
+ }
+-#elif (defined(WEBRTC_MAC))
++#elif (defined(WEBRTC_BSD) || defined(WEBRTC_MAC))
+ char localname[255];
+ if (gethostname(localname, 255) != -1)
+ {
+ hostent* localHost;
+ localHost = gethostbyname(localname);
+ if(localHost)
+ {
+ if(localHost->h_addrtype != AF_INET)
+@@ -2819,17 +2821,17 @@ WebRtc_Word32 UdpTransport::IPAddress(const SocketAddress& address,
+ }
+
+ source_port = address._sockaddr_in6.sin6_port;
+ }
+ // Convert port number to network byte order.
+ sourcePort = htons(source_port);
+ return 0;
+
+- #elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++ #elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ WebRtc_Word32 ipFamily = address._sockaddr_storage.sin_family;
+ const void* ptrNumericIP = NULL;
+
+ if(ipFamily == AF_INET)
+ {
+ ptrNumericIP = &(address._sockaddr_in.sin_addr);
+ }
+ else if(ipFamily == AF_INET6)
+diff --git media/webrtc/trunk/src/modules/utility/source/rtp_dump_impl.cc media/webrtc/trunk/src/modules/utility/source/rtp_dump_impl.cc
+index 69a52ec..7ac226c 100644
+--- media/webrtc/trunk/src/modules/utility/source/rtp_dump_impl.cc
++++ media/webrtc/trunk/src/modules/utility/source/rtp_dump_impl.cc
+@@ -14,17 +14,17 @@
+ #include <stdio.h>
+
+ #include "critical_section_wrapper.h"
+ #include "trace.h"
+
+ #if defined(_WIN32)
+ #include <Windows.h>
+ #include <mmsystem.h>
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ #include <string.h>
+ #include <sys/time.h>
+ #include <time.h>
+ #endif
+
+ #if (defined(_DEBUG) && defined(_WIN32))
+ #define DEBUG_PRINT(expr) OutputDebugString(##expr)
+ #define DEBUG_PRINTP(expr, p) \
+@@ -233,17 +233,17 @@ bool RtpDumpImpl::RTCP(const WebRtc_UWord8* packet) const
+ return is_rtcp;
+ }
+
+ // TODO (hellner): why is TickUtil not used here?
+ inline WebRtc_UWord32 RtpDumpImpl::GetTimeInMS() const
+ {
+ #if defined(_WIN32)
+ return timeGetTime();
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ struct timeval tv;
+ struct timezone tz;
+ unsigned long val;
+
+ gettimeofday(&tv, &tz);
+ val = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ return val;
+ #else
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
+index 653ee16..8d6fd68 100644
+--- media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
++++ media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
+@@ -14,17 +14,23 @@
+ #include <unistd.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+
+ //v4l includes
++#if defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
++#include <sys/videoio.h>
++#elif defined(__sun)
++#include <sys/videodev2.h>
++#else
+ #include <linux/videodev2.h>
++#endif
+
+ #include "ref_count.h"
+ #include "trace.h"
+
+
+ namespace webrtc
+ {
+ namespace videocapturemodule
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
+index 12df1b3..424ea0a 100644
+--- media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
++++ media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
+@@ -7,22 +7,30 @@
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+ #include <sys/ioctl.h>
+ #include <unistd.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+-#include <linux/videodev2.h>
+ #include <errno.h>
+ #include <stdio.h>
+ #include <sys/mman.h>
+ #include <string.h>
+
++//v4l includes
++#if defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
++#include <sys/videoio.h>
++#elif defined(__sun)
++#include <sys/videodev2.h>
++#else
++#include <linux/videodev2.h>
++#endif
++
+ #include <iostream>
+ #include <new>
+
+ #include "ref_count.h"
+ #include "trace.h"
+ #include "thread_wrapper.h"
+ #include "critical_section_wrapper.h"
+ #include "video_capture_linux.h"
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/device_info_impl.cc media/webrtc/trunk/src/modules/video_capture/main/source/device_info_impl.cc
+index e3f7bb5..882cede 100644
+--- media/webrtc/trunk/src/modules/video_capture/main/source/device_info_impl.cc
++++ media/webrtc/trunk/src/modules/video_capture/main/source/device_info_impl.cc
+@@ -49,17 +49,17 @@ WebRtc_Word32 DeviceInfoImpl::NumberOfCapabilities(
+ if (!deviceUniqueIdUTF8)
+ return -1;
+
+ _apiLock.AcquireLockShared();
+
+ if (_lastUsedDeviceNameLength == strlen((char*) deviceUniqueIdUTF8))
+ {
+ // Is it the same device that is asked for again.
+-#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX)
++#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
+ if(strncasecmp((char*)_lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength)==0)
+ #else
+ if (_strnicmp((char*) _lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength) == 0)
+ #endif
+@@ -86,17 +86,17 @@ WebRtc_Word32 DeviceInfoImpl::GetCapability(const char* deviceUniqueIdUTF8,
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "deviceUniqueIdUTF8 parameter not set in call to GetCapability");
+ return -1;
+ }
+ ReadLockScoped cs(_apiLock);
+
+ if ((_lastUsedDeviceNameLength != strlen((char*) deviceUniqueIdUTF8))
+-#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX)
++#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
+ || (strncasecmp((char*)_lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength)!=0))
+ #else
+ || (_strnicmp((char*) _lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength) != 0))
+ #endif
+@@ -150,17 +150,17 @@ WebRtc_Word32 DeviceInfoImpl::GetBestMatchedCapability(
+ {
+
+
+ if (!deviceUniqueIdUTF8)
+ return -1;
+
+ ReadLockScoped cs(_apiLock);
+ if ((_lastUsedDeviceNameLength != strlen((char*) deviceUniqueIdUTF8))
+-#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX)
++#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
+ || (strncasecmp((char*)_lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength)!=0))
+ #else
+ || (_strnicmp((char*) _lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength) != 0))
+ #endif
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
+index 0a9765e..8d4bbf4 100644
+--- media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
++++ media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
+@@ -50,17 +50,17 @@
+ ['include_internal_video_capture==0', {
+ 'sources': [
+ 'External/device_info_external.cc',
+ 'External/video_capture_external.cc',
+ ],
+ },{ # include_internal_video_capture == 1
+ 'conditions': [
+ # DEFINE PLATFORM SPECIFIC SOURCE FILES
+- ['OS=="linux"', {
++ ['include_v4l2_video_capture==1', {
+ 'include_dirs': [
+ 'Linux',
+ ],
+ 'sources': [
+ 'Linux/device_info_linux.h',
+ 'Linux/video_capture_linux.h',
+ 'Linux/device_info_linux.cc',
+ 'Linux/video_capture_linux.cc',
+@@ -157,31 +157,35 @@
+ '../interface',
+ ],
+ 'sources': [
+ '../test/video_capture_unittest.cc',
+ '../test/video_capture_main_mac.mm',
+ ],
+ 'conditions': [
+ # DEFINE PLATFORM SPECIFIC INCLUDE AND CFLAGS
+- ['OS=="mac" or OS=="linux"', {
++ ['OS!="win" and OS!="android"', {
+ 'cflags': [
+ '-Wno-write-strings',
+ ],
+ 'ldflags': [
+ '-lpthread -lm',
+ ],
+ }],
+- ['OS=="linux"', {
++ ['include_v4l2_video_capture==1', {
+ 'libraries': [
+- '-lrt',
+ '-lXext',
+ '-lX11',
+ ],
+ }],
++ ['OS=="linux"', {
++ 'libraries': [
++ '-lrt',
++ ],
++ }],
+ ['OS=="mac"', {
+ 'dependencies': [
+ # Link with a special main for mac so we can use the webcam.
+ '<(webrtc_root)/test/test.gyp:test_support_main_threaded_mac',
+ ],
+ 'xcode_settings': {
+ # TODO(andrew): CoreAudio and AudioToolbox shouldn't be needed.
+ 'OTHER_LDFLAGS': [
+diff --git media/webrtc/trunk/src/system_wrappers/interface/tick_util.h media/webrtc/trunk/src/system_wrappers/interface/tick_util.h
+index 0cd85d0..45591be 100644
+--- media/webrtc/trunk/src/system_wrappers/interface/tick_util.h
++++ media/webrtc/trunk/src/system_wrappers/interface/tick_util.h
+@@ -161,17 +161,17 @@ inline TickTime TickTime::Now()
+ // so it must have been a wrap around.
+ if(old > 0xf0000000 && now < 0x0fffffff)
+ {
+ numWrapTimeGetTime++;
+ }
+ }
+ result._ticks = now + (numWrapTimeGetTime<<32);
+ #endif
+-#elif defined(WEBRTC_LINUX)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
+ struct timespec ts;
+ // TODO(wu): Remove CLOCK_REALTIME implementation.
+ #ifdef WEBRTC_CLOCK_TYPE_REALTIME
+ clock_gettime(CLOCK_REALTIME, &ts);
+ #else
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ #endif
+ result._ticks = 1000000000LL * static_cast<WebRtc_Word64>(ts.tv_sec) + static_cast<WebRtc_Word64>(ts.tv_nsec);
+@@ -203,17 +203,17 @@ inline WebRtc_Word64 TickTime::MillisecondTimestamp()
+ #if _WIN32
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (now._ticks * 1000) / qpfreq.QuadPart;
+ #else
+ return now._ticks;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ return now._ticks / 1000000LL;
+ #else
+ return now._ticks / 1000LL;
+ #endif
+ }
+
+ inline WebRtc_Word64 TickTime::MicrosecondTimestamp()
+ {
+@@ -222,17 +222,17 @@ inline WebRtc_Word64 TickTime::MicrosecondTimestamp()
+ #if _WIN32
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (now._ticks * 1000) / (qpfreq.QuadPart/1000);
+ #else
+ return now._ticks *1000LL;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ return now._ticks / 1000LL;
+ #else
+ return now._ticks;
+ #endif
+ }
+
+ inline WebRtc_Word64 TickTime::Ticks() const
+ {
+@@ -244,34 +244,34 @@ inline WebRtc_Word64 TickTime::MillisecondsToTicks(const WebRtc_Word64 ms)
+ #if _WIN32
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (qpfreq.QuadPart * ms) / 1000;
+ #else
+ return ms;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ return ms * 1000000LL;
+ #else
+ return ms * 1000LL;
+ #endif
+ }
+
+ inline WebRtc_Word64 TickTime::TicksToMilliseconds(const WebRtc_Word64 ticks)
+ {
+ #if _WIN32
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (ticks * 1000) / qpfreq.QuadPart;
+ #else
+ return ticks;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ return ticks / 1000000LL;
+ #else
+ return ticks / 1000LL;
+ #endif
+ }
+
+ inline TickTime& TickTime::operator+=(const WebRtc_Word64& ticks)
+ {
+@@ -294,17 +294,17 @@ inline WebRtc_Word64 TickInterval::Milliseconds() const
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (_interval * 1000) / qpfreq.QuadPart;
+ #else
+ // _interval is in ms
+ return _interval;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ // _interval is in ns
+ return _interval / 1000000;
+ #else
+ // _interval is usecs
+ return _interval / 1000;
+ #endif
+ }
+
+@@ -314,17 +314,17 @@ inline WebRtc_Word64 TickInterval::Microseconds() const
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (_interval * 1000000) / qpfreq.QuadPart;
+ #else
+ // _interval is in ms
+ return _interval *1000LL;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ // _interval is in ns
+ return _interval / 1000;
+ #else
+ // _interval is usecs
+ return _interval;
+ #endif
+ }
+
+diff --git media/webrtc/trunk/src/system_wrappers/source/aligned_malloc.cc media/webrtc/trunk/src/system_wrappers/source/aligned_malloc.cc
+index bb10c6b..4878d71 100644
+--- media/webrtc/trunk/src/system_wrappers/source/aligned_malloc.cc
++++ media/webrtc/trunk/src/system_wrappers/source/aligned_malloc.cc
+@@ -7,24 +7,21 @@
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+ #include "aligned_malloc.h"
+
+ #include <assert.h>
+ #include <memory.h>
+-
+-#ifdef WEBRTC_ANDROID
+ #include <stdlib.h>
+-#endif
+
+ #if WEBRTC_MAC
+ #include <malloc/malloc.h>
+-#else
++#elif WEBRTC_WIN
+ #include <malloc.h>
+ #endif
+
+ #if _WIN32
+ #include <windows.h>
+ #else
+ #include <stdint.h>
+ #endif
+diff --git media/webrtc/trunk/src/system_wrappers/source/atomic32_posix.cc media/webrtc/trunk/src/system_wrappers/source/atomic32_posix.cc
+index 05b0e57..993456c 100644
+--- media/webrtc/trunk/src/system_wrappers/source/atomic32_posix.cc
++++ media/webrtc/trunk/src/system_wrappers/source/atomic32_posix.cc
+@@ -7,17 +7,16 @@
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+ #include "atomic32.h"
+
+ #include <assert.h>
+ #include <inttypes.h>
+-#include <malloc.h>
+
+ #include "common_types.h"
+
+ namespace webrtc {
+
+ Atomic32::Atomic32(WebRtc_Word32 initialValue) : _value(initialValue)
+ {
+ assert(Is32bitAligned());
+diff --git media/webrtc/trunk/src/system_wrappers/source/condition_variable.cc media/webrtc/trunk/src/system_wrappers/source/condition_variable.cc
+index b37d037..fcea221 100644
+--- media/webrtc/trunk/src/system_wrappers/source/condition_variable.cc
++++ media/webrtc/trunk/src/system_wrappers/source/condition_variable.cc
+@@ -3,35 +3,33 @@
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
++#include "condition_variable_wrapper.h"
++
+ #if defined(_WIN32)
+ #include <windows.h>
+- #include "condition_variable_wrapper.h"
+ #include "condition_variable_win.h"
+-#elif defined(WEBRTC_LINUX)
+- #include <pthread.h>
+- #include "condition_variable_wrapper.h"
+- #include "condition_variable_posix.h"
+-#elif defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL)
+ #include <pthread.h>
+- #include "condition_variable_wrapper.h"
+ #include "condition_variable_posix.h"
++#else
++ #include <stddef.h> // for NULL
+ #endif
+
+ namespace webrtc {
+ ConditionVariableWrapper*
+ ConditionVariableWrapper::CreateConditionVariable()
+ {
+ #if defined(_WIN32)
+ return new ConditionVariableWindows;
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL)
+ return ConditionVariablePosix::Create();
+ #else
+ return NULL;
+ #endif
+ }
+ } // namespace webrtc
+diff --git media/webrtc/trunk/src/system_wrappers/source/condition_variable_posix.cc media/webrtc/trunk/src/system_wrappers/source/condition_variable_posix.cc
+index 48835ab..16c6033 100644
+--- media/webrtc/trunk/src/system_wrappers/source/condition_variable_posix.cc
++++ media/webrtc/trunk/src/system_wrappers/source/condition_variable_posix.cc
+@@ -90,17 +90,17 @@ void ConditionVariablePosix::SleepCS(CriticalSectionWrapper& critSect)
+ bool
+ ConditionVariablePosix::SleepCS(
+ CriticalSectionWrapper& critSect,
+ unsigned long maxTimeInMS)
+ {
+ const unsigned long INFINITE = 0xFFFFFFFF;
+
+ const int MILLISECONDS_PER_SECOND = 1000;
+-#ifndef WEBRTC_LINUX
++#if !defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD)
+ const int MICROSECONDS_PER_MILLISECOND = 1000;
+ #endif
+ const int NANOSECONDS_PER_SECOND = 1000000000;
+ const int NANOSECONDS_PER_MILLISECOND = 1000000;
+
+ CriticalSectionPosix* cs = reinterpret_cast<CriticalSectionPosix*>(
+ &critSect);
+
+diff --git media/webrtc/trunk/src/system_wrappers/source/cpu.cc media/webrtc/trunk/src/system_wrappers/source/cpu.cc
+index 3df5d18..4cd3ddf 100644
+--- media/webrtc/trunk/src/system_wrappers/source/cpu.cc
++++ media/webrtc/trunk/src/system_wrappers/source/cpu.cc
+@@ -11,28 +11,28 @@
+ #include "cpu_wrapper.h"
+
+ #if defined(_WIN32)
+ #include "cpu_win.h"
+ #elif defined(WEBRTC_MAC)
+ #include "cpu_mac.h"
+ #elif defined(WEBRTC_MAC_INTEL)
+ #include "cpu_mac.h"
+-#elif defined(WEBRTC_ANDROID)
++#elif defined(WEBRTC_ANDROID) || defined(WEBRTC_BSD)
+ // Not implemented yet, might be possible to use Linux implementation
+ #else // defined(WEBRTC_LINUX)
+ #include "cpu_linux.h"
+ #endif
+
+ namespace webrtc {
+ CpuWrapper* CpuWrapper::CreateCpu()
+ {
+ #if defined(_WIN32)
+ return new CpuWindows();
+ #elif (defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL))
+ return new CpuWrapperMac();
+-#elif defined(WEBRTC_ANDROID)
++#elif defined(WEBRTC_ANDROID) || defined(WEBRTC_BSD)
+ return 0;
+ #else
+ return new CpuLinux();
+ #endif
+ }
+ } // namespace webrtc
+diff --git media/webrtc/trunk/src/system_wrappers/source/cpu_info.cc media/webrtc/trunk/src/system_wrappers/source/cpu_info.cc
+index e367abf..e14d7af 100644
+--- media/webrtc/trunk/src/system_wrappers/source/cpu_info.cc
++++ media/webrtc/trunk/src/system_wrappers/source/cpu_info.cc
+@@ -7,25 +7,27 @@
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+ #include "cpu_info.h"
+
+ #if defined(_WIN32)
+ #include <Windows.h>
+-#elif defined(WEBRTC_MAC)
++#elif defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+ #elif defined(WEBRTC_MAC_INTEL)
+ // Intentionally empty
+ #elif defined(WEBRTC_ANDROID)
+ // Not implemented yet, might be possible to use Linux implementation
+-#else // defined(WEBRTC_LINUX)
++#elif defined(WEBRTC_LINUX)
+ #include <sys/sysinfo.h>
++#else // defined(_SC_NPROCESSORS_ONLN)
++#include <unistd.h>
+ #endif
+
+ #include "trace.h"
+
+ namespace webrtc {
+
+ WebRtc_UWord32 CpuInfo::_numberOfCores = 0;
+
+@@ -40,31 +42,40 @@ WebRtc_UWord32 CpuInfo::DetectNumberOfCores()
+ WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
+ "Available number of cores:%d", _numberOfCores);
+
+ #elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
+ _numberOfCores = get_nprocs();
+ WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
+ "Available number of cores:%d", _numberOfCores);
+
+-#elif (defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL))
+- int name[] = {CTL_HW, HW_AVAILCPU};
++#elif (defined(WEBRTC_BSD) || defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL))
++ int name[] = {
++ CTL_HW,
++#ifdef HW_AVAILCPU
++ HW_AVAILCPU,
++#else
++ HW_NCPU,
++#endif
++ };
+ int ncpu;
+ size_t size = sizeof(ncpu);
+ if(0 == sysctl(name, 2, &ncpu, &size, NULL, 0))
+ {
+ _numberOfCores = static_cast<WebRtc_UWord32>(ncpu);
+ WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
+ "Available number of cores:%d", _numberOfCores);
+ } else
+ {
+ WEBRTC_TRACE(kTraceError, kTraceUtility, -1,
+ "Failed to get number of cores");
+ _numberOfCores = 1;
+ }
++#elif defined(_SC_NPROCESSORS_ONLN)
++ _numberOfCores = sysconf(_SC_NPROCESSORS_ONLN);
+ #else
+ WEBRTC_TRACE(kTraceWarning, kTraceUtility, -1,
+ "No function to get number of cores");
+ _numberOfCores = 1;
+ #endif
+ }
+ return _numberOfCores;
+ }
+diff --git media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc
+index 6334490..852ebaa 100644
+--- media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc
++++ media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc
+@@ -53,16 +53,25 @@
+ #include <sched.h>
+ #include <sys/syscall.h>
+ #include <linux/unistd.h>
+ #include <sys/prctl.h>
+ #endif
+
+ #if defined(WEBRTC_MAC)
+ #include <mach/mach.h>
++#elif defined(__NetBSD__)
++#include <lwp.h>
++#elif defined(__FreeBSD__)
++#include <sys/param.h>
++#include <sys/thr.h>
++#endif
++
++#if defined(WEBRTC_BSD) && !defined(__NetBSD__)
++#include <pthread_np.h>
+ #endif
+
+ #include "system_wrappers/interface/critical_section_wrapper.h"
+ #include "system_wrappers/interface/event_wrapper.h"
+ #include "system_wrappers/interface/trace.h"
+
+ namespace webrtc {
+ extern "C"
+@@ -116,16 +125,28 @@ ThreadPosix::ThreadPosix(ThreadRunFunction func, ThreadObj obj,
+ }
+ }
+
+ uint32_t ThreadWrapper::GetThreadId() {
+ #if defined(WEBRTC_ANDROID) || defined(WEBRTC_LINUX)
+ return static_cast<uint32_t>(syscall(__NR_gettid));
+ #elif defined(WEBRTC_MAC)
+ return static_cast<uint32_t>(mach_thread_self());
++#elif defined(__NetBSD__)
++ return _lwp_self();
++#elif defined(__DragonFly__)
++ return lwp_gettid();
++#elif defined(__FreeBSD__)
++# if __FreeBSD_version > 900030
++ return pthread_getthreadid_np();
++# else
++ long lwpid;
++ thr_self(&lwpid);
++ return lwpid;
++# endif
+ #else
+ return reinterpret_cast<uint32_t>(pthread_self());
+ #endif
+ }
+
+ int ThreadPosix::Construct()
+ {
+ int result = 0;
+@@ -154,16 +175,17 @@ ThreadPosix::~ThreadPosix()
+ {
+ pthread_attr_destroy(&_attr);
+ delete _event;
+ delete _crit_state;
+ }
+
+ #define HAS_THREAD_ID !defined(MAC_IPHONE) && !defined(MAC_IPHONE_SIM) && \
+ !defined(WEBRTC_MAC) && !defined(WEBRTC_MAC_INTEL) && \
++ !defined(WEBRTC_BSD) && \
+ !defined(MAC_DYLIB) && !defined(MAC_INTEL_DYLIB)
+ #if HAS_THREAD_ID
+ bool ThreadPosix::Start(unsigned int& threadID)
+ #else
+ bool ThreadPosix::Start(unsigned int& /*threadID*/)
+ #endif
+ {
+ if (!_runFunction)
+@@ -229,31 +251,39 @@ bool ThreadPosix::Start(unsigned int& /*threadID*/)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ // CPU_ZERO and CPU_SET are not available in NDK r7, so disable
+ // SetAffinity on Android for now.
+-#if (defined(WEBRTC_LINUX) && (!defined(WEBRTC_ANDROID)))
++#if defined(__FreeBSD__) || (defined(WEBRTC_LINUX) && (!defined(WEBRTC_ANDROID)))
+ bool ThreadPosix::SetAffinity(const int* processorNumbers,
+ const unsigned int amountOfProcessors) {
+ if (!processorNumbers || (amountOfProcessors == 0)) {
+ return false;
+ }
++#if defined(__FreeBSD__)
++ cpuset_t mask;
++#else
+ cpu_set_t mask;
++#endif
+ CPU_ZERO(&mask);
+
+ for (unsigned int processor = 0;
+ processor < amountOfProcessors;
+ processor++) {
+ CPU_SET(processorNumbers[processor], &mask);
+ }
+-#if defined(WEBRTC_ANDROID)
++#if defined(__FreeBSD__)
++ const int result = pthread_setaffinity_np(_thread,
++ sizeof(mask),
++ &mask);
++#elif defined(WEBRTC_ANDROID)
+ // Android.
+ const int result = syscall(__NR_sched_setaffinity,
+ _pid,
+ sizeof(mask),
+ &mask);
+ #else
+ // "Normal" Linux.
+ const int result = sched_setaffinity(_pid,
+@@ -340,16 +370,20 @@ void ThreadPosix::Run()
+ #endif
+ // The event the Start() is waiting for.
+ _event->Set();
+
+ if (_setThreadName)
+ {
+ #ifdef WEBRTC_LINUX
+ prctl(PR_SET_NAME, (unsigned long)_name, 0, 0, 0);
++#elif defined(__NetBSD__)
++ pthread_setname_np(pthread_self(), "%s", (void *)_name);
++#elif defined(WEBRTC_BSD)
++ pthread_set_name_np(pthread_self(), _name);
+ #endif
+ WEBRTC_TRACE(kTraceStateInfo, kTraceUtility,-1,
+ "Thread with name:%s started ", _name);
+ } else
+ {
+ WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
+ "Thread without name started");
+ }
+diff --git media/webrtc/trunk/src/video_engine/vie_defines.h media/webrtc/trunk/src/video_engine/vie_defines.h
+index 2cc18cc7..2c042a0 100644
+--- media/webrtc/trunk/src/video_engine/vie_defines.h
++++ media/webrtc/trunk/src/video_engine/vie_defines.h
+@@ -168,17 +168,17 @@ inline int ChannelId(const int moduleId) {
+
+ // Example: "Oct 10 2002 12:05:30 r".
+ #define BUILDINFO BUILDDATE TEXT(" ") BUILDTIME TEXT(" ") BUILDMODE
+ #define RENDER_MODULE_TYPE kRenderWindows
+ #endif
+
+ // Linux specific.
+ #ifndef WEBRTC_ANDROID
+-#ifdef WEBRTC_LINUX
++#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
+ // Build information macros.
+ #if defined(_DEBUG)
+ #define BUILDMODE "d"
+ #elif defined(DEBUG)
+ #define BUILDMODE "d"
+ #elif defined(NDEBUG)
+ #define BUILDMODE "r"
+ #else
+diff --git media/webrtc/trunk/src/voice_engine/voe_network_impl.cc media/webrtc/trunk/src/voice_engine/voe_network_impl.cc
+index 174abca..f8a2b2d 100644
+--- media/webrtc/trunk/src/voice_engine/voe_network_impl.cc
++++ media/webrtc/trunk/src/voice_engine/voe_network_impl.cc
+@@ -467,17 +467,17 @@ int VoENetworkImpl::SetSendTOS(int channel,
+ int DSCP,
+ int priority,
+ bool useSetSockopt)
+ {
+ WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
+ "SetSendTOS(channel=%d, DSCP=%d, useSetSockopt=%d)",
+ channel, DSCP, useSetSockopt);
+
+-#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_MAC)
++#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD) && !defined(WEBRTC_MAC)
+ _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceWarning,
+ "SetSendTOS() is not supported on this platform");
+ return -1;
+ #endif
+
+ #ifndef WEBRTC_EXTERNAL_TRANSPORT
+ if (!_shared->statistics().Initialized())
+ {
+@@ -523,17 +523,17 @@ int VoENetworkImpl::SetSendTOS(int channel,
+ return -1;
+ }
+ if (channelPtr->ExternalTransport())
+ {
+ _shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceError,
+ "SetSendTOS() external transport is enabled");
+ return -1;
+ }
+-#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ useSetSockopt = true;
+ WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
+ " force useSetSockopt=true since there is no alternative"
+ " implementation");
+ #endif
+
+ return channelPtr->SetSendTOS(DSCP, priority, useSetSockopt);
+ #else
+@@ -546,17 +546,17 @@ int VoENetworkImpl::SetSendTOS(int channel,
+ int VoENetworkImpl::GetSendTOS(int channel,
+ int& DSCP,
+ int& priority,
+ bool& useSetSockopt)
+ {
+ WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
+ "GetSendTOS(channel=%d)", channel);
+
+-#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_MAC)
++#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD) && !defined(WEBRTC_MAC)
+ _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceWarning,
+ "GetSendTOS() is not supported on this platform");
+ return -1;
+ #endif
+ #ifndef WEBRTC_EXTERNAL_TRANSPORT
+ if (!_shared->statistics().Initialized())
+ {
+ _shared->SetLastError(VE_NOT_INITED, kTraceError);
+diff --git media/webrtc/trunk/src/voice_engine/voice_engine_defines.h media/webrtc/trunk/src/voice_engine/voice_engine_defines.h
+index 7d4c729..4104719 100644
+--- media/webrtc/trunk/src/voice_engine/voice_engine_defines.h
++++ media/webrtc/trunk/src/voice_engine/voice_engine_defines.h
+@@ -434,41 +434,44 @@ namespace webrtc
+
+ #else
+ #define ANDROID_NOT_SUPPORTED(stat)
+ #endif // #ifdef WEBRTC_LINUX
+
+ // *** WEBRTC_MAC ***
+ // including iPhone
+
+-#ifdef WEBRTC_MAC
++#if defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+ #include <pthread.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <sched.h>
+ #include <sys/time.h>
+ #include <time.h>
++
++#ifdef WEBRTC_MAC
+ #include <AudioUnit/AudioUnit.h>
+ #if !defined(MAC_IPHONE) && !defined(MAC_IPHONE_SIM)
+ #include <CoreServices/CoreServices.h>
+ #include <CoreAudio/CoreAudio.h>
+ #include <AudioToolbox/DefaultAudioOutput.h>
+ #include <AudioToolbox/AudioConverter.h>
+ #include <CoreAudio/HostTime.h>
+ #endif
++#endif // WEBRTC_MAC
+
+ #define DWORD unsigned long int
+ #define WINAPI
+ #define LPVOID void *
+ #define FALSE 0
+ #define TRUE 1
+ #define SOCKADDR_IN struct sockaddr_in
+ #define UINT unsigned int
+@@ -576,13 +579,13 @@ namespace webrtc
+ // Defines
+ // ----------------------------------------------------------------------------
+
+ #define IPHONE_NOT_SUPPORTED()
+ #endif
+
+ #else
+ #define IPHONE_NOT_SUPPORTED()
+-#endif // #ifdef WEBRTC_MAC
++#endif // #if defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+
+
+ #endif // WEBRTC_VOICE_ENGINE_VOICE_ENGINE_DEFINES_H
+diff --git media/webrtc/trunk/third_party/libyuv/libyuv.gyp media/webrtc/trunk/third_party/libyuv/libyuv.gyp
+index 6f4eb9e..5f044ad 100644
+--- media/webrtc/trunk/third_party/libyuv/libyuv.gyp
++++ media/webrtc/trunk/third_party/libyuv/libyuv.gyp
+@@ -4,16 +4,17 @@
+ # that can be found in the LICENSE file in the root of the source
+ # tree. An additional intellectual property rights grant can be found
+ # in the file PATENTS. All contributing project authors may
+ # be found in the AUTHORS file in the root of the source tree.
+
+ {
+ 'variables': {
+ 'use_system_libjpeg%': 0,
++ 'yuv_disable_asm%': 0,
+ },
+ 'targets': [
+ {
+ 'target_name': 'libyuv',
+ 'type': 'static_library',
+ 'conditions': [
+ ['use_system_libjpeg==0', {
+ 'dependencies': [
+@@ -43,16 +44,21 @@
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ 'include',
+ '.',
+ ],
+ },
+ 'conditions': [
++ ['yuv_disable_asm==1', {
++ 'defines': [
++ 'YUV_DISABLE_ASM',
++ ],
++ }],
+ ['build_with_mozilla==1', {
+ 'include_dirs': [
+ '$(DEPTH)/dist/include',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '$(DEPTH)/dist/include',
+ ],
+diff --git media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
+index 338d0b7..2241d41 100644
+--- media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
++++ media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
+@@ -4,16 +4,17 @@
+
+ # Python 2.5 needs this for the with statement.
+ from __future__ import with_statement
+
+ import collections
+ import gyp
+ import gyp.common
+ import sys
++import platform
+ import os
+ import re
+ import shlex
+
+ generator_wants_sorted_dependencies = True
+
+ generator_default_variables = {
+ }
+@@ -111,30 +112,44 @@ endif
+
+ def ensure_directory_exists(path):
+ dir = os.path.dirname(path)
+ if dir and not os.path.exists(dir):
+ os.makedirs(dir)
+
+ def GetFlavor(params):
+ """Returns |params.flavor| if it's set, the system's default flavor else."""
++ system = platform.system().lower()
+ flavors = {
+- 'win32': 'win',
+- 'darwin': 'mac',
+- 'sunos5': 'solaris',
+- 'freebsd7': 'freebsd',
+- 'freebsd8': 'freebsd',
++ 'microsoft': 'win',
++ 'windows' : 'win',
++ 'darwin' : 'mac',
++ 'sunos' : 'solaris',
++ 'dragonfly': 'bsd',
++ 'freebsd' : 'bsd',
++ 'netbsd' : 'bsd',
++ 'openbsd' : 'bsd',
+ }
+- flavor = flavors.get(sys.platform, 'linux')
+- return params.get('flavor', flavor)
++
++ if 'flavor' in params:
++ return params['flavor']
++ if system.startswith('cygwin'):
++ return 'win'
++ if system in flavors:
++ return flavors[system]
++
++ return 'linux'
+
+
+ def CalculateVariables(default_variables, params):
++ flavor = GetFlavor(params)
++ if flavor == 'bsd':
++ flavor = platform.system().lower()
+ generator_flags = params.get('generator_flags', {})
+- default_variables['OS'] = generator_flags.get('os', GetFlavor(params))
++ default_variables['OS'] = generator_flags.get('os', flavor)
+
+
+ def CalculateGeneratorInputInfo(params):
+ """Calculate the generator specific info that gets fed to input (called by
+ gyp)."""
+ generator_flags = params.get('generator_flags', {})
+ if generator_flags.get('adjust_static_libraries', False):
+ global generator_wants_static_library_dependencies_adjusted
diff --git a/www/firefox/files/patch-bug815025 b/www/firefox/files/patch-bug815025
new file mode 100644
index 000000000000..8207a72f8695
--- /dev/null
+++ b/www/firefox/files/patch-bug815025
@@ -0,0 +1,27 @@
+--- mfbt/SHA1.h~
++++ mfbt/SHA1.h
+@@ -27,6 +27,11 @@
+ #include "mozilla/StandardInteger.h"
+ #include "mozilla/Types.h"
+
++#if !defined(__clang__) && defined(__GNUC__) && __GNUC_MINOR__ <= 3
++/* c++/36107: mark SHA1Sum constructor as weak manually */
++__asm__(".weak _ZN7mozilla7SHA1SumC1Ev");
++#endif
++
+ namespace mozilla {
+ class SHA1Sum {
+ union {
+@@ -39,7 +43,12 @@ class SHA1Sum {
+
+ public:
+ static const unsigned int HashSize = 20;
++#if !defined(__clang__) && defined(__GNUC__) && __GNUC_MINOR__ <= 3
++ /* c++/36107: gcc42 fails to remove *INTERNAL* from produced asm */
++ MOZ_IMPORT_API() SHA1Sum();
++#else
+ MFBT_API() SHA1Sum();
++#endif
+ MFBT_API(void) update(const void* dataIn, uint32_t len);
+ MFBT_API(void) finish(uint8_t hashout[20]);
+ };
diff --git a/www/firefox/files/patch-bug817481 b/www/firefox/files/patch-bug817481
new file mode 100644
index 000000000000..d2155017b565
--- /dev/null
+++ b/www/firefox/files/patch-bug817481
@@ -0,0 +1,26 @@
+commit 93d56d2
+Author: Makoto Kato <m_kato@ga2.so-net.ne.jp>
+Date: Mon Dec 3 17:01:16 2012 +0900
+
+ Bug 817481 - Build failure on WebRTC unit test with --with-system-libvpx. r=jesup
+---
+ media/webrtc/signaling/test/Makefile.in | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git media/webrtc/signaling/test/Makefile.in media/webrtc/signaling/test/Makefile.in
+index 81a38ff..e10e869 100644
+--- media/webrtc/signaling/test/Makefile.in
++++ media/webrtc/signaling/test/Makefile.in
+@@ -34,6 +34,12 @@ LIBS += \
+ endif
+ endif
+
++ifdef MOZ_NATIVE_LIBVPX
++LIBS += \
++ $(MOZ_LIBVPX_LIBS) \
++ $(NULL)
++endif
++
+ ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
+ LIBS += \
+ $(XLIBS) \
diff --git a/www/firefox/files/patch-bug826985 b/www/firefox/files/patch-bug826985
new file mode 100644
index 000000000000..22f98fd20720
--- /dev/null
+++ b/www/firefox/files/patch-bug826985
@@ -0,0 +1,370 @@
+commit d18000b
+Author: Henrik Gulbrandsen <henrik@gulbra.net>
+Date: Fri Jan 4 13:49:22 2013 +0100
+
+ Bug 826985 - Support more video formats for WebRTC via libv4l2 on Linux.
+---
+ configure.in | 13 ++++++
+ .../main/source/Linux/device_info_linux.cc | 30 ++++++++------
+ .../main/source/Linux/video_capture_linux.cc | 47 ++++++++++++----------
+ .../video_capture/main/source/video_capture.gypi | 1 +
+ toolkit/library/Makefile.in | 3 ++
+ 5 files changed, 60 insertions(+), 34 deletions(-)
+
+diff --git configure.in configure.in
+index 6d05f9c..297615f 100644
+--- configure.in
++++ configure.in
+@@ -5270,6 +5270,17 @@ if test -n "$MOZ_WEBRTC"; then
+ MOZ_VP8=1
+ MOZ_VP8_ENCODER=1
+ MOZ_VP8_ERROR_CONCEALMENT=1
++ dnl use libv4l on Linux to support more cameras
++ case "$target" in
++ *-android*|*-linuxandroid*)
++ ;;
++ *-linux*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
++ MOZ_WEBRTC_LIBV4L=1
++ PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2, ,
++ [echo "$MOZ_LIBV4L2_PKG_ERRORS"
++ AC_MSG_ERROR([WebRTC on Linux needs libv4l2 for video format conversion.])])
++ ;;
++ esac
+ dnl enable once Signaling lands
+ MOZ_WEBRTC_SIGNALING=1
+ AC_DEFINE(MOZ_WEBRTC_SIGNALING)
+@@ -5288,6 +5299,7 @@ fi
+ AC_SUBST(MOZ_WEBRTC)
+ AC_SUBST(MOZ_WEBRTC_SIGNALING)
+ AC_SUBST(MOZ_PEERCONNECTION)
++AC_SUBST(MOZ_WEBRTC_LIBV4L)
+ AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
+ AC_SUBST(MOZ_SCTP)
+ AC_SUBST(MOZ_SRTP)
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
+index 653ee16..270f064 100644
+--- media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
++++ media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
+@@ -26,6 +26,7 @@
+ #else
+ #include <linux/videodev2.h>
+ #endif
++#include <libv4l2.h>
+
+ #include "ref_count.h"
+ #include "trace.h"
+@@ -68,9 +69,9 @@ WebRtc_UWord32 DeviceInfoLinux::NumberOfDevices()
+ for (int n = 0; n < 64; n++)
+ {
+ sprintf(device, "/dev/video%d", n);
+- if ((fd = open(device, O_RDONLY)) != -1)
++ if ((fd = v4l2_open(device, O_RDONLY)) != -1)
+ {
+- close(fd);
++ v4l2_close(fd);
+ count++;
+ }
+ }
+@@ -97,14 +98,14 @@ WebRtc_Word32 DeviceInfoLinux::GetDeviceName(
+ for (int n = 0; n < 64; n++)
+ {
+ sprintf(device, "/dev/video%d", n);
+- if ((fd = open(device, O_RDONLY)) != -1)
++ if ((fd = v4l2_open(device, O_RDONLY)) != -1)
+ {
+ if (count == deviceNumber) {
+ // Found the device
+ found = true;
+ break;
+ } else {
+- close(fd);
++ v4l2_close(fd);
+ count++;
+ }
+ }
+@@ -115,21 +116,26 @@ WebRtc_Word32 DeviceInfoLinux::GetDeviceName(
+
+ // query device capabilities
+ struct v4l2_capability cap;
+- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0)
++ if (v4l2_ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "error in querying the device capability for device %s. errno = %d",
+ device, errno);
+- close(fd);
++ v4l2_close(fd);
+ return -1;
+ }
+
+- close(fd);
++ v4l2_close(fd);
+
+ char cameraName[64];
+ memset(deviceNameUTF8, 0, deviceNameLength);
+ memcpy(cameraName, cap.card, sizeof(cap.card));
+
++ if (cameraName[0] == '\0')
++ {
++ sprintf(cameraName, "Camera at /dev/video%d", deviceNumber);
++ }
++
+ if (deviceNameLength >= strlen(cameraName))
+ {
+ memcpy(deviceNameUTF8, cameraName, strlen(cameraName));
+@@ -181,13 +187,13 @@ WebRtc_Word32 DeviceInfoLinux::CreateCapabilityMap(
+ for (int n = 0; n < 64; ++n)
+ {
+ sprintf(device, "/dev/video%d", n);
+- fd = open(device, O_RDONLY);
++ fd = v4l2_open(device, O_RDONLY);
+ if (fd == -1)
+ continue;
+
+ // query device capabilities
+ struct v4l2_capability cap;
+- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0)
++ if (v4l2_ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0)
+ {
+ if (cap.bus_info[0] != 0)
+ {
+@@ -209,7 +215,7 @@ WebRtc_Word32 DeviceInfoLinux::CreateCapabilityMap(
+ }
+ }
+ }
+- close(fd); // close since this is not the matching device
++ v4l2_close(fd); // close since this is not the matching device
+ }
+
+ if (!found)
+@@ -228,7 +234,7 @@ WebRtc_Word32 DeviceInfoLinux::CreateCapabilityMap(
+ }
+
+ int size = FillCapabilityMap(fd);
+- close(fd);
++ v4l2_close(fd);
+
+ // Store the new used device name
+ _lastUsedDeviceNameLength = deviceUniqueIdUTF8Length;
+@@ -282,7 +288,7 @@ WebRtc_Word32 DeviceInfoLinux::FillCapabilityMap(int fd)
+ video_fmt.fmt.pix.width = size[i][0];
+ video_fmt.fmt.pix.height = size[i][1];
+
+- if (ioctl(fd, VIDIOC_TRY_FMT, &video_fmt) >= 0)
++ if (v4l2_ioctl(fd, VIDIOC_TRY_FMT, &video_fmt) >= 0)
+ {
+ if ((video_fmt.fmt.pix.width == size[i][0])
+ && (video_fmt.fmt.pix.height == size[i][1]))
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
+index 12df1b3..4ddc9d4 100644
+--- media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
++++ media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
+@@ -25,6 +25,7 @@
+ #else
+ #include <linux/videodev2.h>
+ #endif
++#include <libv4l2.h>
+
+ #include <new>
+
+@@ -79,11 +82,11 @@ WebRtc_Word32 VideoCaptureModuleV4L2::Init(const char* deviceUniqueIdUTF8)
+ for (n = 0; n < 64; n++)
+ {
+ sprintf(device, "/dev/video%d", n);
+- if ((fd = open(device, O_RDONLY)) != -1)
++ if ((fd = v4l2_open(device, O_RDONLY)) != -1)
+ {
+ // query device capabilities
+ struct v4l2_capability cap;
+- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0)
++ if (v4l2_ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0)
+ {
+ if (cap.bus_info[0] != 0)
+ {
+@@ -91,13 +94,13 @@ WebRtc_Word32 VideoCaptureModuleV4L2::Init(const char* deviceUniqueIdUTF8)
+ (const char*) deviceUniqueIdUTF8,
+ strlen((const char*) deviceUniqueIdUTF8)) == 0) //match with device id
+ {
+- close(fd);
++ v4l2_close(fd);
+ found = true;
+ break; // fd matches with device unique id supplied
+ }
+ }
+ }
+- close(fd); // close since this is not the matching device
++ v4l2_close(fd); // close since this is not the matching device
+ }
+ }
+ if (!found)
+@@ -117,7 +120,7 @@ VideoCaptureModuleV4L2::~VideoCaptureModuleV4L2()
+ delete _captureCritSect;
+ }
+ if (_deviceFd != -1)
+- close(_deviceFd);
++ v4l2_close(_deviceFd);
+ }
+
+ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+@@ -142,7 +145,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ char device[20];
+ sprintf(device, "/dev/video%d", (int) _deviceId);
+
+- if ((_deviceFd = open(device, O_RDWR | O_NONBLOCK, 0)) < 0)
++ if ((_deviceFd = v4l2_open(device, O_RDWR | O_NONBLOCK, 0)) < 0)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "error in opening %s errono = %d", device, errno);
+@@ -175,7 +178,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ for (int i = 0; i < nFormats; i++)
+ {
+ video_fmt.fmt.pix.pixelformat = fmts[i];
+- if (ioctl(_deviceFd, VIDIOC_TRY_FMT, &video_fmt) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_TRY_FMT, &video_fmt) < 0)
+ {
+ continue;
+ }
+@@ -200,7 +203,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ _captureVideoType = kVideoMJPEG;
+
+ //set format and frame size now
+- if (ioctl(_deviceFd, VIDIOC_S_FMT, &video_fmt) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_S_FMT, &video_fmt) < 0)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "error in VIDIOC_S_FMT, errno = %d", errno);
+@@ -217,7 +220,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ struct v4l2_streamparm streamparms;
+ memset(&streamparms, 0, sizeof(streamparms));
+ streamparms.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+- if (ioctl(_deviceFd, VIDIOC_G_PARM, &streamparms) < 0) {
++ if (v4l2_ioctl(_deviceFd, VIDIOC_G_PARM, &streamparms) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "error in VIDIOC_G_PARM errno = %d", errno);
+ driver_framerate_support = false;
+@@ -230,7 +233,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ streamparms.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ streamparms.parm.capture.timeperframe.numerator = 1;
+ streamparms.parm.capture.timeperframe.denominator = capability.maxFPS;
+- if (ioctl(_deviceFd, VIDIOC_S_PARM, &streamparms) < 0) {
++ if (v4l2_ioctl(_deviceFd, VIDIOC_S_PARM, &streamparms) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "Failed to set the framerate. errno=%d", errno);
+ driver_framerate_support = false;
+@@ -268,7 +271,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ // Needed to start UVC camera - from the uvcview application
+ enum v4l2_buf_type type;
+ type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+- if (ioctl(_deviceFd, VIDIOC_STREAMON, &type) == -1)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_STREAMON, &type) == -1)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "Failed to turn on stream");
+@@ -303,7 +306,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StopCapture()
+ _captureThread = NULL;
+
+ DeAllocateVideoBuffers();
+- close(_deviceFd);
++ v4l2_close(_deviceFd);
+ _deviceFd = -1;
+ }
+
+@@ -321,7 +324,7 @@ bool VideoCaptureModuleV4L2::AllocateVideoBuffers()
+ rbuffer.memory = V4L2_MEMORY_MMAP;
+ rbuffer.count = kNoOfV4L2Bufffers;
+
+- if (ioctl(_deviceFd, VIDIOC_REQBUFS, &rbuffer) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_REQBUFS, &rbuffer) < 0)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "Could not get buffers from device. errno = %d", errno);
+@@ -344,24 +347,24 @@ bool VideoCaptureModuleV4L2::AllocateVideoBuffers()
+ buffer.memory = V4L2_MEMORY_MMAP;
+ buffer.index = i;
+
+- if (ioctl(_deviceFd, VIDIOC_QUERYBUF, &buffer) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_QUERYBUF, &buffer) < 0)
+ {
+ return false;
+ }
+
+- _pool[i].start = mmap(NULL, buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED,
++ _pool[i].start = v4l2_mmap(NULL, buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED,
+ _deviceFd, buffer.m.offset);
+
+ if (MAP_FAILED == _pool[i].start)
+ {
+ for (unsigned int j = 0; j < i; j++)
+- munmap(_pool[j].start, _pool[j].length);
++ v4l2_munmap(_pool[j].start, _pool[j].length);
+ return false;
+ }
+
+ _pool[i].length = buffer.length;
+
+- if (ioctl(_deviceFd, VIDIOC_QBUF, &buffer) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_QBUF, &buffer) < 0)
+ {
+ return false;
+ }
+@@ -373,14 +376,14 @@ bool VideoCaptureModuleV4L2::DeAllocateVideoBuffers()
+ {
+ // unmap buffers
+ for (int i = 0; i < _buffersAllocatedByDevice; i++)
+- munmap(_pool[i].start, _pool[i].length);
++ v4l2_munmap(_pool[i].start, _pool[i].length);
+
+ delete[] _pool;
+
+ // turn off stream
+ enum v4l2_buf_type type;
+ type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+- if (ioctl(_deviceFd, VIDIOC_STREAMOFF, &type) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_STREAMOFF, &type) < 0)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "VIDIOC_STREAMOFF error. errno: %d", errno);
+@@ -438,7 +441,7 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
+ buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ buf.memory = V4L2_MEMORY_MMAP;
+ // dequeue a buffer - repeat until dequeued properly!
+- while (ioctl(_deviceFd, VIDIOC_DQBUF, &buf) < 0)
++ while (v4l2_ioctl(_deviceFd, VIDIOC_DQBUF, &buf) < 0)
+ {
+ if (errno != EINTR)
+ {
+@@ -457,7 +460,7 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
+ IncomingFrame((unsigned char*) _pool[buf.index].start,
+ buf.bytesused, frameInfo);
+ // enqueue the buffer again
+- if (ioctl(_deviceFd, VIDIOC_QBUF, &buf) == -1)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_QBUF, &buf) == -1)
+ {
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, _id,
+ "Failed to enqueue capture buffer");
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
+index 8d38102..3e8f76b 100644
+--- media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
++++ media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
+@@ -179,6 +179,7 @@
+ 'libraries': [
+ '-lXext',
+ '-lX11',
++ '-lv4l2',
+ ],
+ }],
+ ['OS=="linux"', {
+diff --git toolkit/library/Makefile.in toolkit/library/Makefile.in
+index 0440c26..8f6c735 100644
+--- toolkit/library/Makefile.in
++++ toolkit/library/Makefile.in
+@@ -411,6 +411,9 @@ EXTRA_DSO_LDOPTS += \
+ $(DEPTH)/media/webrtc/signaling/signaling_sipcc/$(LIB_PREFIX)sipcc.$(LIB_SUFFIX) \
+ $(NULL)
+ endif
++ifdef MOZ_WEBRTC_LIBV4L
++EXTRA_DSO_LDOPTS += $(MOZ_LIBV4L2_LIBS)
++endif
+ ifdef MOZ_WEBRTC_IN_LIBXUL
+ include $(topsrcdir)/media/webrtc/shared_libs.mk
+ EXTRA_DSO_LDOPTS += $(WEBRTC_LIBS)
diff --git a/www/firefox/files/patch-bug828003 b/www/firefox/files/patch-bug828003
new file mode 100644
index 000000000000..f30c317d81ee
--- /dev/null
+++ b/www/firefox/files/patch-bug828003
@@ -0,0 +1,36 @@
+--- gfx/qcms/qcmstypes.h
++++ gfx/qcms/qcmstypes.h
+@@ -7,30 +7,12 @@
+ #include "mozilla/StandardInteger.h"
+
+ /* prtypes.h defines IS_LITTLE_ENDIAN and IS_BIG ENDIAN */
++/* stdint.h defines int*_t and uintptr_t */
+
+-#if defined (__SVR4) && defined (__sun)
+-/* int_types.h gets included somehow, so avoid redefining the types differently */
+-#include <sys/int_types.h>
+-#elif defined (_AIX)
++#if defined (_AIX)
+ #include <sys/types.h>
+-#elif defined(__OpenBSD__)
+-#include <inttypes.h>
+-#elif !defined(ANDROID)
+-typedef int8_t int8_t;
+-typedef uint8_t uint8_t;
+-typedef int16_t int16_t;
+-typedef uint16_t uint16_t;
+-typedef int32_t int32_t;
+-typedef uint32_t uint32_t;
+-typedef int64_t int64_t;
+-typedef uint64_t uint64_t;
+-
+-#ifdef __OS2__
+-/* OS/2's stdlib typdefs uintptr_t. So we'll just include that so we don't collide */
++#elif __OS2__
+ #include <stdlib.h>
+-#elif !defined(__intptr_t_defined) && !defined(_UINTPTR_T_DEFINED)
+-typedef unsigned long uintptr_t;
+-#endif
+ #endif
+
+ #else // MOZ_QCMS
diff --git a/www/firefox/files/patch-content-base-src-nsTextFragmentImpl.h b/www/firefox/files/patch-content-base-src-nsTextFragmentImpl.h
new file mode 100644
index 000000000000..2ab569ee0b56
--- /dev/null
+++ b/www/firefox/files/patch-content-base-src-nsTextFragmentImpl.h
@@ -0,0 +1,14 @@
+--- content/base/src/nsTextFragmentImpl.h.orig 2013-01-05 00:44:29.000000000 +0100
++++ content/base/src/nsTextFragmentImpl.h 2013-01-10 13:02:12.291088273 +0100
+@@ -16,7 +16,11 @@
+ };
+
+ template<> struct Non8BitParameters<8> {
++#if !defined(__clang__) && defined(__GNUC__) && __GNUC_MINOR__ <= 2
++ static inline size_t mask() { return 0xff00ff00ff00ff00ULL; }
++#else
+ static inline size_t mask() { return 0xff00ff00ff00ff00; }
++#endif
+ static inline uint32_t alignMask() { return 0x7; }
+ static inline uint32_t numUnicharsPerWord() { return 4; }
+ };
diff --git a/www/firefox/files/patch-content-media-nsAudioStream.cpp b/www/firefox/files/patch-content-media-nsAudioStream.cpp
index bd0f0d4963db..f65a6678b05a 100644
--- a/www/firefox/files/patch-content-media-nsAudioStream.cpp
+++ b/www/firefox/files/patch-content-media-nsAudioStream.cpp
@@ -1,14 +1,11 @@
--- content/media/nsAudioStream.cpp~
+++ content/media/nsAudioStream.cpp
-@@ -298,7 +298,11 @@ static int PrefChanged(const char* aPref
- gVolumeScale = NS_MAX<double>(0, PR_strtod(utf8.get(), nsnull));
+@@ -298,7 +298,7 @@ static int PrefChanged(const char* aPref, void* aClosure)
+ gVolumeScale = NS_MAX<double>(0, PR_strtod(utf8.get(), nullptr));
}
} else if (strcmp(aPref, PREF_USE_CUBEB) == 0) {
-+#if defined(__FreeBSD__) && __FreeBSD_version < 800097
-+ bool value = Preferences::GetBool(aPref, false);
-+#else
+-#ifdef MOZ_WIDGET_GONK
++#if defined(MOZ_WIDGET_GONK) || defined(__FreeBSD__) && __FreeBSD_version < 800097
+ bool value = Preferences::GetBool(aPref, false);
+ #else
bool value = Preferences::GetBool(aPref, true);
-+#endif
- mozilla::MutexAutoLock lock(*gAudioPrefsLock);
- gUseCubeb = value;
- } else if (strcmp(aPref, PREF_CUBEB_LATENCY) == 0) {
diff --git a/www/firefox/files/patch-gfx-qcms-qcmstypes.h b/www/firefox/files/patch-gfx-qcms-qcmstypes.h
deleted file mode 100644
index 33d9e3356b77..000000000000
--- a/www/firefox/files/patch-gfx-qcms-qcmstypes.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- gfx/qcms/qcmstypes.h.orig 2010-11-22 12:01:36.000000000 +0100
-+++ gfx/qcms/qcmstypes.h 2010-11-22 12:02:42.000000000 +0100
-@@ -25,7 +25,7 @@
- #ifdef __OS2__
- /* OS/2's stdlib typdefs uintptr_t. So we'll just include that so we don't collide */
- #include <stdlib.h>
--#elif !defined(__intptr_t_defined) && !defined(_UINTPTR_T_DEFINED)
-+#elif !defined(__intptr_t_defined) && !defined(_INTPTR_T_DECLARED)
- typedef PRUptrdiff uintptr_t;
- #endif
- #endif
diff --git a/www/firefox/files/patch-ipc-chromium-src-base-platform_thread_posix.cc b/www/firefox/files/patch-ipc-chromium-src-base-platform_thread_posix.cc
new file mode 100644
index 000000000000..a1e2dfb828f8
--- /dev/null
+++ b/www/firefox/files/patch-ipc-chromium-src-base-platform_thread_posix.cc
@@ -0,0 +1,16 @@
+--- ipc/chromium/src/base/platform_thread_posix.cc~
++++ ipc/chromium/src/base/platform_thread_posix.cc
+@@ -16,7 +16,13 @@
+ #include <sys/prctl.h>
+ #elif defined(OS_FREEBSD)
+ #include <sys/param.h>
++#if __FreeBSD_version > 802500
+ #include <sys/thr.h>
++#else
++_Pragma("GCC visibility push(default)")
++extern "C" int thr_self(long *);
++_Pragma("GCC visibility pop")
++#endif
+ #endif
+
+ #if !defined(OS_MACOSX)
diff --git a/www/firefox/files/patch-media-webrtc-trunk-src-modules-audio_device-main-source-linux-latebindingsymboltable_linux.cc b/www/firefox/files/patch-media-webrtc-trunk-src-modules-audio_device-main-source-linux-latebindingsymboltable_linux.cc
new file mode 100644
index 000000000000..401aedb6ef8f
--- /dev/null
+++ b/www/firefox/files/patch-media-webrtc-trunk-src-modules-audio_device-main-source-linux-latebindingsymboltable_linux.cc
@@ -0,0 +1,37 @@
+--- media/webrtc/trunk/src/modules/audio_device/main/source/linux/latebindingsymboltable_linux.cc~
++++ media/webrtc/trunk/src/modules/audio_device/main/source/linux/latebindingsymboltable_linux.cc
+@@ -31,6 +31,10 @@
+ #include <dlfcn.h>
+ #endif
+
++#ifdef __FreeBSD__
++#include <osreldate.h>
++#endif
++
+ // TODO(grunell): Either put inside webrtc namespace or use webrtc:: instead.
+ using namespace webrtc;
+
+@@ -38,7 +42,11 @@ namespace webrtc_adm_linux {
+
+ inline static const char *GetDllError() {
+ #ifdef WEBRTC_LINUX
++#if __FreeBSD_version < 800505
++ const char *err = dlerror();
++#else
+ char *err = dlerror();
++#endif
+ if (err) {
+ return err;
+ } else {
+@@ -78,7 +86,11 @@ static bool LoadSymbol(DllHandle handle,
+ void **symbol) {
+ #ifdef WEBRTC_LINUX
+ *symbol = dlsym(handle, symbol_name);
++#if __FreeBSD_version < 800505
++ const char *err = dlerror();
++#else
+ char *err = dlerror();
++#endif
+ if (err) {
+ WEBRTC_TRACE(kTraceError, kTraceAudioDevice, -1,
+ "Error loading symbol %s : %d", symbol_name, err);
diff --git a/www/firefox/files/patch-media-webrtc-trunk-src-system_wrappers-source-spreadsortlib-spreadsort.hpp b/www/firefox/files/patch-media-webrtc-trunk-src-system_wrappers-source-spreadsortlib-spreadsort.hpp
new file mode 100644
index 000000000000..922f913334c0
--- /dev/null
+++ b/www/firefox/files/patch-media-webrtc-trunk-src-system_wrappers-source-spreadsortlib-spreadsort.hpp
@@ -0,0 +1,16 @@
+--- media/webrtc/trunk/src/system_wrappers/source/spreadsortlib/spreadsort.hpp~
++++ media/webrtc/trunk/src/system_wrappers/source/spreadsortlib/spreadsort.hpp
+@@ -21,6 +21,13 @@ Scott McMurray
+ #include "constants.hpp"
+ #include <cstring>
+
++#ifdef __FreeBSD__
++# include <osreldate.h>
++# if __FreeBSD_version < 900506
++# define getchar boost_getchar
++# endif
++#endif
++
+ namespace boost {
+ namespace detail {
+ //This only works on unsigned data types
diff --git a/www/firefox/files/patch-media-webrtc-trunk-src-system_wrappers-source-thread_posix.cc b/www/firefox/files/patch-media-webrtc-trunk-src-system_wrappers-source-thread_posix.cc
new file mode 100644
index 000000000000..ad54b06424f4
--- /dev/null
+++ b/www/firefox/files/patch-media-webrtc-trunk-src-system_wrappers-source-thread_posix.cc
@@ -0,0 +1,16 @@
+--- media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc~
++++ media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc
+@@ -62,7 +62,13 @@
+ #include <lwp.h>
+ #elif defined(__FreeBSD__)
+ #include <sys/param.h>
++#if __FreeBSD_version > 802500
+ #include <sys/thr.h>
++#else
++_Pragma("GCC visibility push(default)")
++extern "C" int thr_self(long *);
++_Pragma("GCC visibility pop")
++#endif
+ #endif
+
+ #if defined(WEBRTC_BSD) && !defined(__NetBSD__)
diff --git a/www/firefox/files/patch-media-webrtc-trunk-testing-gtest-include-gtest-internal-gtest-port.h b/www/firefox/files/patch-media-webrtc-trunk-testing-gtest-include-gtest-internal-gtest-port.h
new file mode 100644
index 000000000000..14c7d3a684a9
--- /dev/null
+++ b/www/firefox/files/patch-media-webrtc-trunk-testing-gtest-include-gtest-internal-gtest-port.h
@@ -0,0 +1,17 @@
+--- media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-port.h.orig 2012-12-09 16:28:45.641625374 +0100
++++ media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-port.h 2012-12-09 19:09:11.664625374 +0100
+@@ -490,10 +490,10 @@
+ # define GTEST_ENV_HAS_TR1_TUPLE_ 1
+ # endif
+
+-// C++11 specifies that <tuple> provides std::tuple. Users can't use
+-// gtest in C++11 mode until their standard library is at least that
+-// compliant.
+-# if GTEST_LANG_CXX11
++// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
++// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
++// can build with clang but need to use gcc4.2's libstdc++).
++# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
+ # define GTEST_ENV_HAS_STD_TUPLE_ 1
+ # endif
+
diff --git a/www/firefox/files/patch-python-psutil-psutil-_psutil_bsd.c b/www/firefox/files/patch-python-psutil-psutil-_psutil_bsd.c
new file mode 100644
index 000000000000..3eddeeec9238
--- /dev/null
+++ b/www/firefox/files/patch-python-psutil-psutil-_psutil_bsd.c
@@ -0,0 +1,13 @@
+--- python/psutil/psutil/_psutil_bsd.c.orig 2012-08-16 23:07:37.000000000 +0800
++++ python/psutil/psutil/_psutil_bsd.c 2012-09-27 14:50:20.843763756 +0800
+@@ -1376,8 +1376,10 @@
+ strlcat(opts, ",noclusterr", sizeof(opts));
+ if (flags & MNT_NOCLUSTERW)
+ strlcat(opts, ",noclusterw", sizeof(opts));
++#if __FreeBSD_version >= 800000
+ if (flags & MNT_NFS4ACLS)
+ strlcat(opts, ",nfs4acls", sizeof(opts));
++#endif
+
+ py_tuple = Py_BuildValue("(ssss)", fs[i].f_mntfromname, // device
+ fs[i].f_mntonname, // mount point
diff --git a/www/firefox/files/patch-xpcom-base-AvailableMemoryTracker.cpp b/www/firefox/files/patch-xpcom-base-AvailableMemoryTracker.cpp
new file mode 100644
index 000000000000..5499f4fbe9e3
--- /dev/null
+++ b/www/firefox/files/patch-xpcom-base-AvailableMemoryTracker.cpp
@@ -0,0 +1,10 @@
+--- xpcom/base/AvailableMemoryTracker.cpp~
++++ xpcom/base/AvailableMemoryTracker.cpp
+@@ -499,6 +499,6 @@ nsJemallocFreeDirtyPagesRunnable::Run()
+ MOZ_ASSERT(NS_IsMainThread());
+
+ #if defined(MOZ_JEMALLOC)
+- mallctl("arenas.purge", nullptr, 0, nullptr, 0);
++// mallctl("arenas.purge", nullptr, 0, nullptr, 0);
+ #elif defined(MOZ_MEMORY)
+ jemalloc_free_dirty_pages();
diff --git a/www/firefox/files/patch-z-bug815916 b/www/firefox/files/patch-z-bug815916
new file mode 100644
index 000000000000..8ca886e2e839
--- /dev/null
+++ b/www/firefox/files/patch-z-bug815916
@@ -0,0 +1,27 @@
+--- media/webrtc/signaling/test/Makefile.in~
++++ media/webrtc/signaling/test/Makefile.in
+@@ -34,12 +34,24 @@ LIBS += \
+ endif
+ endif
+
++ifdef MOZ_NATIVE_JPEG
++LIBS += \
++ $(MOZ_JPEG_LIBS) \
++ $(NULL)
++endif
++
+ ifdef MOZ_NATIVE_LIBVPX
+ LIBS += \
+ $(MOZ_LIBVPX_LIBS) \
+ $(NULL)
+ endif
+
++ifndef MOZ_TREE_PIXMAN
++LIBS += \
++ $(MOZ_PIXMAN_LIBS) \
++ $(NULL)
++endif
++
+ ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
+ LIBS += \
+ $(XLIBS) \
diff --git a/www/seamonkey-i18n/Makefile b/www/seamonkey-i18n/Makefile
index 33a942014205..d840800b9e89 100644
--- a/www/seamonkey-i18n/Makefile
+++ b/www/seamonkey-i18n/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= seamonkey-i18n
-PORTVERSION= 2.14.1
+PORTVERSION= 2.15
CATEGORIES= www
MASTER_SITE_SUBDIR= seamonkey/releases/${PORTVERSION}/langpack
PKGNAMEPREFIX=
@@ -18,7 +18,7 @@ PLIST?= ${WRKDIR}/plist
PLISTD?= ${WRKDIR}/plist_dirs
PLISTF?= ${WRKDIR}/plist_files
-USE_SEAMONKEY= 14
+USE_SEAMONKEY= 15
USE_XPI= seamonkey linux-seamonkey
USE_SUBMAKE= yes
diff --git a/www/seamonkey-i18n/distinfo b/www/seamonkey-i18n/distinfo
index 7d85c9084959..838a4d0302a8 100644
--- a/www/seamonkey-i18n/distinfo
+++ b/www/seamonkey-i18n/distinfo
@@ -1,46 +1,46 @@
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.ca.langpack.xpi) = 75507d8b5895d5818e637f068492f38b671d73010a1579388805654f0b0b794a
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.ca.langpack.xpi) = 772004
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.cs.langpack.xpi) = 19395dd448f0eaa4d10331b8d80d7f95a8d7330ae519a4a9da8d0db742678b75
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.cs.langpack.xpi) = 778722
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.de.langpack.xpi) = f2c930336bc3b1281faa443d9fe1e4089a183eab53cfdf3d675eac08d9bf6919
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.de.langpack.xpi) = 800689
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.en-GB.langpack.xpi) = 75f184308ca69efab9fed22351124635b783365f1db529e16c06a0ca6ee5ae96
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.en-GB.langpack.xpi) = 746982
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.en-US.langpack.xpi) = c582e85b84c7eb61dc387bc5b6f10e104af6edcb32a0fa8d04d6620653bc01b3
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.en-US.langpack.xpi) = 747026
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.es-AR.langpack.xpi) = 2f3ed0a73fac554a922656ecd0705e33c431c3db4e9201ebe42027c7abeb4507
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.es-AR.langpack.xpi) = 820217
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.es-ES.langpack.xpi) = 28250855fbea69495a56551240c2af4389d9036929d8c5f42b0023376464f9a9
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.es-ES.langpack.xpi) = 768614
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.fi.langpack.xpi) = a5cb0d6158579e37e951318869a210e29dae1e3bef75b211d2a441a1cf20136e
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.fi.langpack.xpi) = 818996
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.fr.langpack.xpi) = 2f62dcecca69ca497ee45fcc93501f31335b55766f97011cb466b33ff1ec2458
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.fr.langpack.xpi) = 776944
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.hu.langpack.xpi) = 838ace84a91d9ebbe7a096765feba1d60e2800afe3a89520d74c02cbea1d71a6
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.hu.langpack.xpi) = 810670
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.it.langpack.xpi) = 0415aa891156de313c336bee73eba37adc3c59f02f23ffab167618a752c144d7
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.it.langpack.xpi) = 717945
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.ja-JP-mac.langpack.xpi) = b6ff39685284960ef8cecbe1ac64e43533a3aba861a818b7d477bb64461af073
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.ja-JP-mac.langpack.xpi) = 848617
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.ja.langpack.xpi) = dbf14e5d5dd2ac1a65e418ee07dae662df1d39546a2aa6e1171f9ce9c3e497d9
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.ja.langpack.xpi) = 823862
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.lt.langpack.xpi) = 73a62426303863c5ae81a2f3ba924557bb88c5b49687d3e38945e5a986c008e4
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.lt.langpack.xpi) = 922034
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.nb-NO.langpack.xpi) = 795495c325e5f886887a7ac977856ef930bec8c0b6c4f02a7385b8560d407ecc
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.nb-NO.langpack.xpi) = 766191
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.nl.langpack.xpi) = 69b952305543d93af9064798bac5ec89deadbc11e1dfe2de853d6cc157e3302a
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.nl.langpack.xpi) = 763368
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.pl.langpack.xpi) = 4cc26bbc0192a02c09026f24b7046b4653257fc0d4b2956fa49e4d829f2d8f53
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.pl.langpack.xpi) = 812917
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.pt-PT.langpack.xpi) = 5852b7caafcadefaa1b45cceba463943a15f7684debd9cf573605e1bad016147
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.pt-PT.langpack.xpi) = 850607
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.ru.langpack.xpi) = b916ee5adc840912d7dec22f456ff8660aa6919dd0b4c1d68f248907fd45a9db
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.ru.langpack.xpi) = 870793
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.sk.langpack.xpi) = f211a776085251a7ed577aa97991cfa206057b650432d0a49e537c4368c7b304
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.sk.langpack.xpi) = 804676
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.sv-SE.langpack.xpi) = 86d55f42cb38dae5df8b740179c4f6abe4982761a7324e589a7ffac5035c1f5c
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.sv-SE.langpack.xpi) = 790140
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.tr.langpack.xpi) = c8a02fe5f56e08de9ab50e2e0a6b038a8aab7773fd47b40e09a62ed5b8ea99a9
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.tr.langpack.xpi) = 829214
-SHA256 (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.uk.langpack.xpi) = a7289ef2120ee8e24a8895b88383597d0aeab376a093b9ef92c55275d9103cba
-SIZE (xpi/seamonkey-i18n-2.14.1/seamonkey-2.14.1.uk.langpack.xpi) = 828102
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.ca.langpack.xpi) = 6d50618890ce0e027a267a660acd5077bd92204ff51a633935dd2e14755bf548
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.ca.langpack.xpi) = 774381
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.cs.langpack.xpi) = 8fccf87607c994fa17fbfe702b540bbb12b07634b2c04b37e0a557d2abe3f48f
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.cs.langpack.xpi) = 780635
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.de.langpack.xpi) = a505f3a527772e0fbabeeec22f9b897f884baf6f37387008cbb2f8f5a59fd122
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.de.langpack.xpi) = 803512
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.en-GB.langpack.xpi) = c212ae7470dde686171a22ebc2f453e24dbc983f56f232fe9bf5df32986f09fb
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.en-GB.langpack.xpi) = 749207
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.en-US.langpack.xpi) = 5a769a47423138f6906d33f286dc537127bd67d19a234b9c025c7427feeac52f
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.en-US.langpack.xpi) = 750320
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.es-AR.langpack.xpi) = 3886c630c357018a753e7811bfff7a2a0b8feb384cb1154cb054125429e7d6a5
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.es-AR.langpack.xpi) = 822641
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.es-ES.langpack.xpi) = 36f2f9b492bb090ef558e3cf2e50c0d4e67f8d438745fcf23828af611d880d24
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.es-ES.langpack.xpi) = 771022
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.fi.langpack.xpi) = 3f167297e49ea07e30c0a9344a78ecc36d41bf52645f826b87d721d21a8b70b9
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.fi.langpack.xpi) = 769725
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.fr.langpack.xpi) = 2ef7cef1d5c10c19c007991873d4862d0f7be58852e40210393c8ecb84d4efde
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.fr.langpack.xpi) = 779197
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.hu.langpack.xpi) = 3c5692c45a0b5c5f57c05611d639b02974756fc00f344c66a507cd6b700ce46b
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.hu.langpack.xpi) = 814029
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.it.langpack.xpi) = 4b6ad130c007c39f77d4f0e4993e9d6972b80561f8d8535a8eed35c685a3fc80
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.it.langpack.xpi) = 720238
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.ja-JP-mac.langpack.xpi) = bbda684ee88b8d6b10fc92fd78802b614b6ea476c36f8513a2316114ba6fbaf1
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.ja-JP-mac.langpack.xpi) = 852408
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.ja.langpack.xpi) = 49527887f98b0f7a0b062888474502067ffa65a1f82b54ead13ffd5eafd2f8d3
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.ja.langpack.xpi) = 827550
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.lt.langpack.xpi) = 13870b04fdec8cff3b482ee1662ce9a4a18f8830902726e6ed4ed294862bf683
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.lt.langpack.xpi) = 793490
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.nb-NO.langpack.xpi) = b7e1d4cb09c7b178ceef9e46f21df0f01ecf605a253f419827d9ff1628edb4ac
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.nb-NO.langpack.xpi) = 768618
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.nl.langpack.xpi) = 7024a0e51f718e2b6d7780e16c173600abf9b7b15cd5a26ec32e20111a44fa76
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.nl.langpack.xpi) = 765521
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.pl.langpack.xpi) = c4e02b93829255fdf11b8d41ce406bf152f18187e4c4a5cd274add7c99413b2e
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.pl.langpack.xpi) = 815325
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.pt-PT.langpack.xpi) = e682683f36279888792b2a0bea5efb19c81f1c4577f3ee0860263ac4be29945a
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.pt-PT.langpack.xpi) = 801658
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.ru.langpack.xpi) = 1d7f61ffb9fc39941ab6f4c33a72ce11799c6124b57a93cca37949b2e87bf018
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.ru.langpack.xpi) = 873512
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.sk.langpack.xpi) = 8ee2cbbe409af42d49d5867f1f099bd38db6c9fdb8b71b6d43433707c30ab913
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.sk.langpack.xpi) = 807146
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.sv-SE.langpack.xpi) = 10ca3e4aa7d6c6d9386ec336e1164d013459d4792989fb74d5ebdfe6034ba4ab
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.sv-SE.langpack.xpi) = 792884
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.tr.langpack.xpi) = b2f4e90228c06c85686b5f8d0fbf37105aceba9ce581930937892bb359a882b3
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.tr.langpack.xpi) = 831669
+SHA256 (xpi/seamonkey-i18n-2.15/seamonkey-2.15.uk.langpack.xpi) = a047bed31c246951a43edf4889dc69c882612bf389f505b612d62457d0246cdd
+SIZE (xpi/seamonkey-i18n-2.15/seamonkey-2.15.uk.langpack.xpi) = 831595
diff --git a/www/seamonkey/Makefile b/www/seamonkey/Makefile
index 2952246e1f45..99b1d56d4967 100644
--- a/www/seamonkey/Makefile
+++ b/www/seamonkey/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= seamonkey
-DISTVERSION= 2.14.1
+DISTVERSION= 2.15
CATEGORIES?= www ipv6
MASTER_SITES= ${MASTER_SITE_MOZILLA_EXTENDED}
MASTER_SITE_SUBDIR= seamonkey/releases/${DISTVERSION}/source
@@ -12,16 +12,17 @@ EXTRACT_ONLY= seamonkey-${DISTVERSION}.source${EXTRACT_SUFX}
MAINTAINER= gecko@FreeBSD.org
COMMENT= The open source, standards compliant web browser
-BUILD_DEPENDS= nspr>=4.9:${PORTSDIR}/devel/nspr \
- nss>=3.13.6_1:${PORTSDIR}/security/nss \
- sqlite3>=3.7.12.1:${PORTSDIR}/databases/sqlite3 \
+BUILD_DEPENDS= nspr>=4.9.3:${PORTSDIR}/devel/nspr \
+ nss>=3.14.1:${PORTSDIR}/security/nss \
+ sqlite3>=3.7.14.1:${PORTSDIR}/databases/sqlite3 \
${PYTHON_SITELIBDIR}/_sqlite3.so:${PORTSDIR}/databases/py-sqlite3 \
unzip:${PORTSDIR}/archivers/unzip
-EM_VERSION= 1.4.6
+EM_VERSION= 1.5.0
USE_AUTOTOOLS= autoconf213:env
USE_PYTHON_BUILD=-2.7
+OBJDIR_BUILD= # in-tree build broken after bug 789837
USE_BZIP2= yes
USE_GMAKE= yes
USE_GECKO= gecko
@@ -44,8 +45,8 @@ MOZ_PKGCONFIG_FILES=
NOT_FOR_ARCHS= ia64
-OPTIONS_DEFINE= CHATZILLA COMPOSER ENIGMAIL GSTREAMER LDAP LIGHTNING MAILNEWS
-OPTIONS_DEFAULT=CHATZILLA COMPOSER ENIGMAIL GIO LDAP LIGHTNING MAILNEWS
+OPTIONS_DEFINE= CHATZILLA COMPOSER ENIGMAIL GSTREAMER LDAP LIGHTNING MAILNEWS WEBRTC
+OPTIONS_DEFAULT=CHATZILLA COMPOSER ENIGMAIL GIO LDAP LIGHTNING MAILNEWS WEBRTC
CHATZILLA_DESC?=Chatzilla IRC module
COMPOSER_DESC?= HTML Composer module
@@ -128,6 +129,8 @@ post-extract:
.endif
post-patch:
+ @${REINPLACE_CMD} -e '/MOZPNG/s/=[0-9]*/=10511/' \
+ ${MOZSRC}/configure.in ${WRKSRC}/configure.in
@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
${WRKSRC}/suite/app/nsSuiteApp.cpp
@${REINPLACE_CMD} -e '/accessibility.typeaheadfind.enablesound/s/true/false/' \
diff --git a/www/seamonkey/distinfo b/www/seamonkey/distinfo
index 714e85c5c6a0..5a52443b8e70 100644
--- a/www/seamonkey/distinfo
+++ b/www/seamonkey/distinfo
@@ -1,4 +1,4 @@
-SHA256 (seamonkey-2.14.1.source.tar.bz2) = 04957ccdae78992871dba1f38e6e1d40e2d34e1b07f8cc5156bc3fb0965dfbf0
-SIZE (seamonkey-2.14.1.source.tar.bz2) = 114328606
-SHA256 (enigmail-1.4.6.tar.gz) = f3771d1faa26676818bab5e2c50dce85013b9de30b82de526159eaa7ca34f036
-SIZE (enigmail-1.4.6.tar.gz) = 1262280
+SHA256 (seamonkey-2.15.source.tar.bz2) = 29ef839f30bb5998cc60adfe16b2e5e64abc14e48cbf10dff98b5b3a5260f5c7
+SIZE (seamonkey-2.15.source.tar.bz2) = 120128259
+SHA256 (enigmail-1.5.0.tar.gz) = 51f55573448586718c8d7e664329d519b02c4b28af4910bcb550961ace9a9e71
+SIZE (enigmail-1.5.0.tar.gz) = 1216071
diff --git a/www/seamonkey/files/extra-bug780531 b/www/seamonkey/files/extra-bug780531
index cbb71630e9a8..f6b85bc13df3 100644
--- a/www/seamonkey/files/extra-bug780531
+++ b/www/seamonkey/files/extra-bug780531
@@ -8,6 +8,6 @@
-arm*)
+case "$target" in
+arm-*-linux*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
- MOZ_SAMPLE_TYPE_S16LE=1
- AC_DEFINE(MOZ_SAMPLE_TYPE_S16LE)
- AC_SUBST(MOZ_SAMPLE_TYPE_S16LE)
+ MOZ_SAMPLE_TYPE_S16=1
+ AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
+ AC_SUBST(MOZ_SAMPLE_TYPE_S16)
diff --git a/www/seamonkey/files/patch-alsapulse b/www/seamonkey/files/patch-alsapulse
index 6dbc3227711c..9e8899fee93c 100644
--- a/www/seamonkey/files/patch-alsapulse
+++ b/www/seamonkey/files/patch-alsapulse
@@ -2,21 +2,18 @@ diff --git mozilla/configure.in mozilla/configure.in
index 5980b76..11f5f77 100644
--- mozilla/configure.in
+++ mozilla/configure.in
-@@ -5600,13 +5600,25 @@ dnl ========================================================
- dnl = Check alsa availability on Linux if using sydneyaudio
- dnl ========================================================
+@@ -5618,11 +5618,25 @@ dnl ========================================================
-+MOZ_ARG_ENABLE_BOOL(alsa,
-+[ --enable-alsa Enable Alsa support (default on Linux)],
-+MOZ_ALSA=1,
-+MOZ_ALSA= MOZ_ALSA_FORCE=$enableval)
-+
dnl If using sydneyaudio with Linux, ensure that the alsa library is available
--if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
-+if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux" -a "$MOZ_ALSA_FORCE" != "no"; then
+ if test -n "$MOZ_SYDNEYAUDIO" -a "$OS_TARGET" = "Linux"; then
+ MOZ_ALSA=1
+fi
+
++MOZ_ARG_ENABLE_BOOL(alsa,
++[ --enable-alsa Enable Alsa support (default on Linux)],
++MOZ_ALSA=1,
++MOZ_ALSA=)
++
+if test -n "$MOZ_ALSA"; then
+ AC_DEFINE(MOZ_CUBEB)
PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
@@ -25,10 +22,21 @@ index 5980b76..11f5f77 100644
fi
+AC_SUBST(MOZ_ALSA)
++AC_SUBST(MOZ_ALSA_CFLAGS)
++AC_SUBST(MOZ_ALSA_LIBS)
+
dnl ========================================================
dnl = Enable PulseAudio
dnl ========================================================
+@@ -8633,8 +8647,6 @@ AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
+ AC_SUBST(MOZ_VP8_ENCODER)
+ AC_SUBST(MOZ_VP8)
+ AC_SUBST(MOZ_OGG)
+-AC_SUBST(MOZ_ALSA_LIBS)
+-AC_SUBST(MOZ_ALSA_CFLAGS)
+ AC_SUBST(VPX_AS)
+ AC_SUBST(VPX_ASFLAGS)
+ AC_SUBST(VPX_DASH_C_FLAG)
diff --git mozilla/media/libcubeb/src/Makefile.in mozilla/media/libcubeb/src/Makefile.in
index 5ab4dd8..c8df26f 100644
--- mozilla/media/libcubeb/src/Makefile.in
diff --git a/www/seamonkey/files/patch-bug713802 b/www/seamonkey/files/patch-bug713802
deleted file mode 100644
index d73541e74bbf..000000000000
--- a/www/seamonkey/files/patch-bug713802
+++ /dev/null
@@ -1,176 +0,0 @@
-commit 20586fa
-Author: Karl Tomlinson <karlt+@karlt.net>
-Date: Thu Sep 27 18:35:06 2012 +1200
-
- b=713802 default enable GIO support and disable GnomeVFS r=glandium
-
- --HG--
- extra : transplant_source : wk%ADr%CA%8EN%AE%C93p/p%0A%26%0E%1D0%F20
----
- browser/confvars.sh | 2 +-
- configure.in | 20 ++++++++++----------
- xulrunner/confvars.sh | 2 +-
- 3 files changed, 12 insertions(+), 12 deletions(-)
-
-diff --git mozilla/browser/confvars.sh mozilla/browser/confvars.sh
-index 40ab494..eae5645 100755
---- mozilla/browser/confvars.sh
-+++ mozilla/browser/confvars.sh
-@@ -21,7 +21,7 @@ MOZ_SERVICES_AITC=1
- MOZ_SERVICES_NOTIFICATIONS=1
- MOZ_SERVICES_SYNC=1
- MOZ_APP_VERSION=$FIREFOX_VERSION
--MOZ_EXTENSIONS_DEFAULT=" gnomevfs"
-+MOZ_EXTENSIONS_DEFAULT=" gio"
- # MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
- # Changing MOZ_*BRANDING_DIRECTORY requires a clobber to ensure correct results,
- # because branding dependencies are broken.
-diff --git mozilla/configure.in mozilla/configure.in
-index 87a9391..2118651 100644
---- mozilla/configure.in
-+++ mozilla/configure.in
-@@ -4846,21 +4846,21 @@ dnl ========================================================
-
- if test "$MOZ_X11"
- then
-- dnl build the gnomevfs extension by default only when the
-+ dnl build the GIO extension by default only when the
- dnl GTK2 toolkit is in use.
- if test "$MOZ_ENABLE_GTK2"
- then
-- MOZ_ENABLE_GNOMEVFS=1
-+ MOZ_ENABLE_GIO=1
- MOZ_ENABLE_GCONF=1
- fi
-
- dnl ========================================================
- dnl = GnomeVFS support module
- dnl ========================================================
-- MOZ_ARG_DISABLE_BOOL(gnomevfs,
-- [ --disable-gnomevfs Disable GnomeVFS support ],
-- MOZ_ENABLE_GNOMEVFS=,
-- MOZ_ENABLE_GNOMEVFS=force)
-+ MOZ_ARG_ENABLE_BOOL(gnomevfs,
-+ [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)],
-+ MOZ_ENABLE_GNOMEVFS=force,
-+ MOZ_ENABLE_GNOMEVFS=)
-
- if test "$MOZ_ENABLE_GNOMEVFS"
- then
-@@ -4884,10 +4884,10 @@ then
- dnl ========================================================
- dnl = GIO support module
- dnl ========================================================
-- MOZ_ARG_ENABLE_BOOL(gio,
-- [ --enable-gio Enable GIO support (default: disabled)],
-- MOZ_ENABLE_GIO=force,
-- MOZ_ENABLE_GIO=)
-+ MOZ_ARG_DISABLE_BOOL(gio,
-+ [ --disable-gio Disable GIO support],
-+ MOZ_ENABLE_GIO=,
-+ MOZ_ENABLE_GIO=force)
-
- if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
- then
-diff --git mozilla/xulrunner/confvars.sh mozilla/xulrunner/confvars.sh
-index 2fa6ead..5fe2c3d 100755
---- mozilla/xulrunner/confvars.sh
-+++ mozilla/xulrunner/confvars.sh
-@@ -10,5 +10,5 @@ MOZ_XULRUNNER=1
- MOZ_CHROME_FILE_FORMAT=omni
- MOZ_APP_VERSION=$MOZILLA_VERSION
- MOZ_PLACES=1
--MOZ_EXTENSIONS_DEFAULT=" gnomevfs"
-+MOZ_EXTENSIONS_DEFAULT=" gio"
- MOZ_URL_CLASSIFIER=1
-diff --git suite/confvars.sh suite/confvars.sh
-index 8c13a33..cdedd30 100755
---- suite/confvars.sh
-+++ suite/confvars.sh
-@@ -15,7 +15,7 @@ MOZ_COMPOSER=1
- MOZ_SUITE=1
- MOZ_BRANDING_DIRECTORY=suite/branding/nightly
- MOZ_OFFICIAL_BRANDING_DIRECTORY=suite/branding/nightly
--MOZ_EXTENSIONS_DEFAULT=" venkman inspector irc gnomevfs"
-+MOZ_EXTENSIONS_DEFAULT=" venkman inspector irc gio"
- MOZ_UPDATER=1
- # This should usually be the same as the value MAR_CHANNEL_ID.
- # If more than one ID is needed, then you should use a comma separated list
-
-commit d884d75
-Author: Karl Tomlinson <karlt+@karlt.net>
-Date: Thu Sep 27 18:34:44 2012 +1200
-
- b=713802 disable gnomevfs extension without --enable-gnomevfs r=glandium
-
- --HG--
- extra : transplant_source : i%07%81%E9%90_%C1%05b%194%9B%1E%93%FC%03%279%F9%8A
----
- configure.in | 12 +++---------
- 1 file changed, 3 insertions(+), 9 deletions(-)
-
-diff --git mozilla/configure.in mozilla/configure.in
-index f2b4041..87a9391 100644
---- mozilla/configure.in
-+++ mozilla/configure.in
-@@ -4875,12 +4875,6 @@ then
- fi
- MOZ_ENABLE_GNOMEVFS=
- ])
-- else
-- if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
-- PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
-- MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
-- ])
-- fi
- fi
-
- AC_SUBST(MOZ_ENABLE_GNOMEVFS)
-@@ -5967,10 +5961,10 @@ MOZ_ARG_ENABLE_STRING(extensions,
- done],
- MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
-
--if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
-+if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
- # Suppress warning on non-X11 platforms
- if test -n "$MOZ_X11"; then
-- AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
-+ AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
- fi
- MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
- fi
-@@ -5983,7 +5977,7 @@ fi
- if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
- # Suppress warning on non-X11 platforms
- if test -n "$MOZ_X11"; then
-- AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
-+ AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
- fi
- MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
- fi
-
-commit ddedeea
-Author: Karl Tomlinson <karlt+@karlt.net>
-Date: Thu Sep 27 13:47:19 2012 +1200
-
- b=713802 link gio extension against libxul for tracemalloc stack functions r=bsmedberg
-
- --HG--
- extra : transplant_source : %C8%A3o%BE%A0z%F7%C8%8A%E6%0E%D4s%7D%90%9C%D9%0F%06%7E
----
- extensions/gio/Makefile.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git mozilla/extensions/gio/Makefile.in mozilla/extensions/gio/Makefile.in
-index 46412c4..ccf2846 100644
---- mozilla/extensions/gio/Makefile.in
-+++ mozilla/extensions/gio/Makefile.in
-@@ -23,7 +23,7 @@ LOCAL_INCLUDES = $(MOZ_GIO_CFLAGS)
-
- EXTRA_DSO_LDOPTS = \
- $(XPCOM_GLUE_LDOPTS) \
-- $(NSPR_LIBS) \
-+ $(MOZ_COMPONENT_LIBS) \
- $(MOZ_GIO_LIBS) \
- $(NULL)
-
diff --git a/www/seamonkey/files/patch-bug722975 b/www/seamonkey/files/patch-bug722975
index 51bc5a4380ef..a77c3d1cdc6b 100644
--- a/www/seamonkey/files/patch-bug722975
+++ b/www/seamonkey/files/patch-bug722975
@@ -7,13 +7,13 @@ Bug 722975 - --enable-system-cairo build is broken after Bug 715658 fixed
diff --git a/mozilla/gfx/thebes/gfxPlatform.cpp b/mozilla/gfx/thebes/gfxPlatform.cpp
--- mozilla/gfx/thebes/gfxPlatform.cpp
+++ mozilla/gfx/thebes/gfxPlatform.cpp
-@@ -484,21 +484,19 @@ gfxPlatform::CreateDrawTargetForSurface(
+@@ -502,21 +502,19 @@ struct SourceSurfaceUserData
+ BackendType mBackendType;
+ };
- cairo_user_data_key_t kSourceSurface;
-
- void SourceBufferDestroy(void *srcBuffer)
+ void SourceBufferDestroy(void *srcSurfUD)
{
- static_cast<SourceSurface*>(srcBuffer)->Release();
+ delete static_cast<SourceSurfaceUserData*>(srcSurfUD);
}
-void SourceSnapshotDetached(cairo_surface_t *nullSurf)
@@ -31,7 +31,7 @@ diff --git a/mozilla/gfx/thebes/gfxPlatform.cpp b/mozilla/gfx/thebes/gfxPlatform
{
void *userData = aSurface->GetData(&kSourceSurface);
-@@ -588,24 +586,19 @@ gfxPlatform::GetSourceSurfaceForSurface(
+@@ -621,24 +619,19 @@ gfxPlatform::GetSourceSurfaceForSurface(
}
srcBuffer = Factory::CreateWrappingDataSourceSurface(imgSurface->Data(),
@@ -53,9 +53,9 @@ diff --git a/mozilla/gfx/thebes/gfxPlatform.cpp b/mozilla/gfx/thebes/gfxPlatform
+ SourceSnapshotDetached, imgSurface.get());
}
- srcBuffer->AddRef();
- aSurface->SetData(&kSourceSurface, srcBuffer, SourceBufferDestroy);
+ SourceSurfaceUserData *srcSurfUD = new SourceSurfaceUserData;
+ srcSurfUD->mBackendType = aTarget->GetType();
+ srcSurfUD->mSrcSurface = srcBuffer;
+ aSurface->SetData(&kSourceSurface, srcSurfUD, SourceBufferDestroy);
return srcBuffer;
- }
-
diff --git a/www/seamonkey/files/patch-bug753046 b/www/seamonkey/files/patch-bug753046
deleted file mode 100644
index 8dbb09a9b55e..000000000000
--- a/www/seamonkey/files/patch-bug753046
+++ /dev/null
@@ -1,1213 +0,0 @@
-# Bug 753046 - Add support for DragonFly/NetBSD
-
-$NetBSD: patch-dom_plugins_ipc_PluginModuleChild.cpp,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/dom/plugins/ipc/PluginModuleChild.cpp.orig 2011-12-20 23:28:14.000000000 +0000
-+++ mozilla/dom/plugins/ipc/PluginModuleChild.cpp
-@@ -5,6 +5,7 @@
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
- #ifdef MOZ_WIDGET_QT
-+#include <unistd.h> // for _exit()
- #include <QtCore/QTimer>
- #include "nsQAppInstance.h"
- #include "NestedLoopTimer.h"
-@@ -228,7 +228,7 @@ PluginModuleChild::Init(const std::strin
-
- // TODO: use PluginPRLibrary here
-
--#if defined(OS_LINUX)
-+#if defined(OS_LINUX) || defined(OS_BSD)
- mShutdownFunc =
- (NP_PLUGINSHUTDOWN) PR_FindFunctionSymbol(mLibrary, "NP_Shutdown");
-
-@@ -1790,7 +1790,7 @@ PluginModuleChild::AnswerNP_GetEntryPoin
- PLUGIN_LOG_DEBUG_METHOD;
- AssertPluginThread();
-
--#if defined(OS_LINUX)
-+#if defined(OS_LINUX) || defined(OS_BSD)
- return true;
- #elif defined(OS_WIN) || defined(OS_MACOSX)
- *_retval = mGetEntryPointsFunc(&mFunctions);
-@@ -1823,7 +1823,7 @@ PluginModuleChild::AnswerNP_Initialize(N
- SendBackUpXResources(FileDescriptor(xSocketFd, false/*don't close*/));
- #endif
-
--#if defined(OS_LINUX)
-+#if defined(OS_LINUX) || defined(OS_BSD)
- *_retval = mInitializeFunc(&sBrowserFuncs, &mFunctions);
- return true;
- #elif defined(OS_WIN) || defined(OS_MACOSX)
-$NetBSD: patch-dom_plugins_ipc_PluginModuleChild.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/dom/plugins/ipc/PluginModuleChild.h.orig 2011-12-20 23:28:14.000000000 +0000
-+++ mozilla/dom/plugins/ipc/PluginModuleChild.h
-@@ -340,7 +340,7 @@ private:
-
- // we get this from the plugin
- NP_PLUGINSHUTDOWN mShutdownFunc;
--#ifdef OS_LINUX
-+#if defined(OS_LINUX) || defined(OS_BSD)
- NP_PLUGINUNIXINIT mInitializeFunc;
- #elif defined(OS_WIN) || defined(OS_MACOSX)
- NP_PLUGININIT mInitializeFunc;
-$NetBSD: patch-ipc_chromium_Makefile.in,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/ipc/chromium/Makefile.in.orig 2012-02-16 06:40:33.000000000 +0000
-+++ mozilla/ipc/chromium/Makefile.in
-@@ -278,6 +278,33 @@ endif
-
- endif # } OS_LINUX
-
-+ifdef OS_BSD # {
-+
-+CPPSRCS += \
-+ atomicops_internals_x86_gcc.cc \
-+ process_util_bsd.cc \
-+ time_posix.cc \
-+ $(NULL)
-+
-+ifdef MOZ_ENABLE_GTK2
-+CPPSRCS += \
-+ message_pump_glib.cc \
-+ $(NULL)
-+endif
-+
-+ifdef MOZ_ENABLE_QT
-+MOCSRCS = \
-+ moc_message_pump_qt.cc \
-+ $(NULL)
-+
-+CPPSRCS += \
-+ $(MOCSRCS) \
-+ message_pump_qt.cc \
-+ $(NULL)
-+endif
-+
-+endif # } OS_BSD
-+
- # libevent
-
- ifndef MOZ_NATIVE_LIBEVENT # {
-$NetBSD: patch-ipc_chromium_chromium-config.mk,v 1.2 2012/03/15 08:30:06 ryoon Exp $
-
---- mozilla/ipc/chromium/chromium-config.mk.orig 2012-02-16 07:40:33.000000000 +0100
-+++ mozilla/ipc/chromium/chromium-config.mk 2012-03-11 11:05:40.397182000 +0100
-@@ -56,17 +56,6 @@
- -I$(DEPTH)/ipc/ipdl/_ipdlheaders \
- $(NULL)
-
--ifeq ($(OS_ARCH),Darwin) # {
--
--OS_MACOSX = 1
--OS_POSIX = 1
--
--DEFINES += \
-- -DOS_MACOSX=1 \
-- -DOS_POSIX=1 \
-- $(NULL)
--
--else # } {
- ifeq ($(OS_ARCH),WINNT) # {
- OS_LIBS += $(call EXPAND_LIBNAME,psapi shell32 dbghelp)
-
-@@ -93,13 +82,65 @@
- endif
-
- else # } {
--
--OS_LINUX = 1
- OS_POSIX = 1
-+DEFINES += -DOS_POSIX=1
-+
-+ifeq ($(OS_ARCH),Darwin) # {
-+
-+OS_MACOSX = 1
-+DEFINES += \
-+ -DOS_MACOSX=1 \
-+ $(NULL)
-+
-+else # } {
-+ifeq ($(OS_ARCH),DragonFly) # {
-+
-+OS_DRAGONFLY = 1
-+OS_BSD = 1
-+OS_LIBS += $(call EXPAND_LIBNAME,kvm)
-+DEFINES += \
-+ -DOS_DRAGONFLY=1 \
-+ -DOS_BSD=1 \
-+ $(NULL)
-+
-+else # } {
-+ifeq ($(OS_ARCH),FreeBSD) # {
-+
-+OS_FREEBSD = 1
-+OS_BSD = 1
-+OS_LIBS += $(call EXPAND_LIBNAME,kvm)
-+DEFINES += \
-+ -DOS_FREEBSD=1 \
-+ -DOS_BSD=1 \
-+ $(NULL)
-
-+else # } {
-+ifeq ($(OS_ARCH),NetBSD) # {
-+
-+OS_NETBSD = 1
-+OS_BSD = 1
-+OS_LIBS += $(call EXPAND_LIBNAME,kvm)
-+DEFINES += \
-+ -DOS_NETBSD=1 \
-+ -DOS_BSD=1 \
-+ $(NULL)
-+
-+else # } {
-+ifeq ($(OS_ARCH),OpenBSD) # {
-+
-+OS_OPENBSD = 1
-+OS_BSD = 1
-+OS_LIBS += $(call EXPAND_LIBNAME,kvm)
-+DEFINES += \
-+ -DOS_OPENBSD=1 \
-+ -DOS_BSD=1 \
-+ $(NULL)
-+
-+else # } {
-+
-+OS_LINUX = 1
- DEFINES += \
- -DOS_LINUX=1 \
-- -DOS_POSIX=1 \
- $(NULL)
-
- # NB: to stop gcc warnings about exporting template instantiation
-@@ -107,4 +147,8 @@
-
- endif # }
- endif # }
-+endif # }
-+endif # }
-+endif # }
-+endif # }
-
-$NetBSD: patch-ipc_chromium_src_base_base__paths.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/ipc/chromium/src/base/base_paths.h.orig 2011-12-20 23:28:19.000000000 +0000
-+++ mozilla/ipc/chromium/src/base/base_paths.h
-@@ -13,7 +13,7 @@
- #include "base/base_paths_win.h"
- #elif defined(OS_MACOSX)
- #include "base/base_paths_mac.h"
--#elif defined(OS_LINUX)
-+#elif defined(OS_LINUX) || defined(OS_BSD)
- #include "base/base_paths_linux.h"
- #endif
- #include "base/path_service.h"
-$NetBSD: patch-ipc_chromium_src_base_debug__util__posic.cc,v 1.3 2012/04/01 15:18:45 ryoon Exp $
-
---- mozilla/ipc/chromium/src/base/debug_util_posix.cc.orig 2012-03-13 01:36:53.000000000 +0000
-+++ mozilla/ipc/chromium/src/base/debug_util_posix.cc
-@@ -5,7 +5,7 @@
- #include "build/build_config.h"
- #include "base/debug_util.h"
-
--#define MOZ_HAVE_EXECINFO_H (!defined(ANDROID) && !defined(__OpenBSD__))
-+#define MOZ_HAVE_EXECINFO_H (defined(OS_LINUX) && !defined(ANDROID))
-
- #include <errno.h>
- #include <fcntl.h>
-@@ -17,9 +17,16 @@
- #include <unistd.h>
- #if MOZ_HAVE_EXECINFO_H
- #include <execinfo.h>
-+#endif
-+
-+#if defined(OS_MACOSX) || defined(OS_BSD)
- #include <sys/sysctl.h>
- #endif
-
-+#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD)
-+#include <sys/user.h>
-+#endif
-+
- #include "base/basictypes.h"
- #include "base/eintr_wrapper.h"
- #include "base/logging.h"
-@@ -32,7 +37,7 @@ bool DebugUtil::SpawnDebuggerOnProcess(u
- return false;
- }
-
--#if defined(OS_MACOSX)
-+#if defined(OS_MACOSX) || defined(OS_BSD)
-
- // Based on Apple's recommended method as described in
- // http://developer.apple.com/qa/qa2004/qa1361.html
-@@ -71,7 +76,15 @@ bool DebugUtil::BeingDebugged() {
-
- // This process is being debugged if the P_TRACED flag is set.
- is_set = true;
-+#if defined(OS_DRAGONFLY)
-+ being_debugged = (info.kp_flags & P_TRACED) != 0;
-+#elif defined(OS_FREEBSD)
-+ being_debugged = (info.ki_flag & P_TRACED) != 0;
-+#elif defined(OS_OPENBSD)
-+ being_debugged = (info.p_flag & P_TRACED) != 0;
-+#else
- being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0;
-+#endif
- return being_debugged;
- }
-
-diff --git ipc/chromium/src/base/dir_reader_bsd.h ipc/chromium/src/base/dir_reader_bsd.h
-new file mode 100644
-index 0000000..3fc1a87
---- /dev/null
-+++ mozilla/ipc/chromium/src/base/dir_reader_bsd.h
-@@ -0,0 +1,112 @@
-+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+// derived from dir_reader_linux.h
-+
-+#ifndef BASE_DIR_READER_BSD_H_
-+#define BASE_DIR_READER_BSD_H_
-+#pragma once
-+
-+#include <dirent.h>
-+#include <errno.h>
-+#include <fcntl.h>
-+#include <stdint.h>
-+#include <unistd.h>
-+
-+#include "base/logging.h"
-+#include "base/eintr_wrapper.h"
-+
-+// See the comments in dir_reader_posix.h about this.
-+
-+namespace base {
-+
-+class DirReaderBSD {
-+ public:
-+ explicit DirReaderBSD(const char* directory_path)
-+#ifdef O_DIRECTORY
-+ : fd_(open(directory_path, O_RDONLY | O_DIRECTORY)),
-+#else
-+ : fd_(open(directory_path, O_RDONLY)),
-+#endif
-+ offset_(0),
-+ size_(0) {
-+ memset(buf_, 0, sizeof(buf_));
-+ }
-+
-+ ~DirReaderBSD() {
-+ if (fd_ >= 0) {
-+ if (HANDLE_EINTR(close(fd_)))
-+ DLOG(ERROR) << "Failed to close directory handle";
-+ }
-+ }
-+
-+ bool IsValid() const {
-+ return fd_ >= 0;
-+ }
-+
-+ // Move to the next entry returning false if the iteration is complete.
-+ bool Next() {
-+ if (size_) {
-+ struct dirent* dirent = reinterpret_cast<struct dirent*>(&buf_[offset_]);
-+#ifdef OS_DRAGONFLY
-+ offset_ += _DIRENT_DIRSIZ(dirent);
-+#else
-+ offset_ += dirent->d_reclen;
-+#endif
-+ }
-+
-+ if (offset_ != size_)
-+ return true;
-+
-+#ifdef OS_OPENBSD
-+ const int r = getdirentries(fd_, buf_, sizeof(buf_), basep_);
-+#else
-+ const int r = getdents(fd_, buf_, sizeof(buf_));
-+#endif
-+ if (r == 0)
-+ return false;
-+ if (r == -1) {
-+#ifdef OS_OPENBSD
-+ DLOG(ERROR) << "getdirentries returned an error: " << errno;
-+#else
-+ DLOG(ERROR) << "getdents returned an error: " << errno;
-+#endif
-+ return false;
-+ }
-+ size_ = r;
-+ offset_ = 0;
-+ return true;
-+ }
-+
-+ const char* name() const {
-+ if (!size_)
-+ return NULL;
-+
-+ const struct dirent* dirent =
-+ reinterpret_cast<const struct dirent*>(&buf_[offset_]);
-+ return dirent->d_name;
-+ }
-+
-+ int fd() const {
-+ return fd_;
-+ }
-+
-+ static bool IsFallback() {
-+ return false;
-+ }
-+
-+ private:
-+ const int fd_;
-+ char buf_[512];
-+#ifdef OS_OPENBSD
-+ off_t *basep_;
-+#endif
-+ size_t offset_, size_;
-+
-+ DISALLOW_COPY_AND_ASSIGN(DirReaderBSD);
-+};
-+
-+} // namespace base
-+
-+#endif // BASE_DIR_READER_BSD_H_
-diff --git ipc/chromium/src/base/dir_reader_posix.h ipc/chromium/src/base/dir_reader_posix.h
-index 9a34492..62b280c 100644
---- mozilla/ipc/chromium/src/base/dir_reader_posix.h
-+++ mozilla/ipc/chromium/src/base/dir_reader_posix.h
-@@ -18,16 +18,20 @@
- // seems worse than falling back to enumerating all file descriptors so we will
- // probably never implement this on the Mac.
-
--#if defined(OS_LINUX) && !defined(OS_OPENBSD)
-+#if defined(OS_LINUX)
- #include "base/dir_reader_linux.h"
-+#elif defined(OS_BSD)
-+#include "base/dir_reader_bsd.h"
- #else
- #include "base/dir_reader_fallback.h"
- #endif
-
- namespace base {
-
--#if defined(OS_LINUX) && !defined(OS_OPENBSD)
-+#if defined(OS_LINUX)
- typedef DirReaderLinux DirReaderPosix;
-+#elif defined(OS_BSD)
-+typedef DirReaderBSD DirReaderPosix;
- #else
- typedef DirReaderFallback DirReaderPosix;
- #endif
-$NetBSD: patch-ipc_chromium_src_base_file__util__posix.cc,v 1.2 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/ipc/chromium/src/base/file_util_posix.cc.orig 2011-12-20 23:28:19.000000000 +0000
-+++ mozilla/ipc/chromium/src/base/file_util_posix.cc
-@@ -31,7 +31,7 @@
- #include "base/time.h"
-
- // FreeBSD/OpenBSD lacks stat64, but its stat handles files >2GB just fine
--#if defined(OS_FREEBSD) || defined(OS_OPENBSD)
-+#ifndef HAVE_STAT64
- #define stat64 stat
- #endif
-
-$NetBSD: patch-ipc_chromium_src_base_message__loop.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/ipc/chromium/src/base/message_loop.cc.orig 2012-02-16 07:40:33.000000000 +0100
-+++ mozilla/ipc/chromium/src/base/message_loop.cc 2012-02-21 21:24:41.000000000 +0100
-@@ -19,7 +19,7 @@
- #if defined(OS_POSIX)
- #include "base/message_pump_libevent.h"
- #endif
--#if defined(OS_LINUX)
-+#if defined(OS_LINUX) || defined(OS_BSD)
- #ifdef MOZ_WIDGET_GTK2
- #include "base/message_pump_glib.h"
- #endif
-@@ -119,7 +119,7 @@
- if (type_ == TYPE_UI) {
- #if defined(OS_MACOSX)
- pump_ = base::MessagePumpMac::Create();
--#elif defined(OS_LINUX)
-+#elif defined(OS_LINUX) || defined(OS_BSD)
- pump_ = new base::MessagePumpForUI();
- #endif // OS_LINUX
- } else if (type_ == TYPE_IO) {
-$NetBSD: patch-ipc_chromium_src_base_platform__thread.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/ipc/chromium/src/base/platform_thread.h.orig 2011-12-20 23:28:19.000000000 +0000
-+++ mozilla/ipc/chromium/src/base/platform_thread.h
-@@ -22,9 +22,12 @@ typedef void* PlatformThreadHandle; // HANDLE
- #elif defined(OS_POSIX)
- #include <pthread.h>
- typedef pthread_t PlatformThreadHandle;
--#if defined(OS_LINUX)
-+#if defined(OS_LINUX) || defined(OS_OPENBSD)
- #include <unistd.h>
- typedef pid_t PlatformThreadId;
-+#elif defined(OS_BSD)
-+#include <sys/types.h>
-+typedef lwpid_t PlatformThreadId;
- #elif defined(OS_MACOSX)
- #include <mach/mach.h>
- typedef mach_port_t PlatformThreadId;
-$NetBSD: patch-ipc_chromium_src_base_platform__thread__posix.cc,v 1.4 2012/04/01 15:18:45 ryoon Exp $
-
---- mozilla/ipc/chromium/src/base/platform_thread_posix.cc.orig 2012-03-13 01:36:53.000000000 +0000
-+++ mozilla/ipc/chromium/src/base/platform_thread_posix.cc
-@@ -9,16 +9,30 @@
-
- #if defined(OS_MACOSX)
- #include <mach/mach.h>
-+#elif defined(OS_NETBSD)
-+#include <lwp.h>
- #elif defined(OS_LINUX)
- #include <sys/syscall.h>
--#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
- #include <sys/prctl.h>
--#elif !defined(__NetBSD__)
--#include <pthread_np.h>
-+#elif defined(OS_FREEBSD)
-+#include <sys/param.h>
-+#if __FreeBSD_version > 802500
-+#include <sys/thr.h>
-+#else
-+_Pragma("GCC visibility push(default)")
-+extern "C" int thr_self(long *);
-+_Pragma("GCC visibility pop")
-+#endif
- #endif
-+
-+#if !defined(OS_MACOSX)
- #include <unistd.h>
- #endif
-
-+#if defined(OS_BSD) && !defined(OS_NETBSD)
-+#include <pthread_np.h>
-+#endif
-+
- #if defined(OS_MACOSX)
- namespace base {
- void InitThreading();
-@@ -38,9 +45,20 @@ PlatformThreadId PlatformThread::CurrentId() {
- // into the kernel.
- #if defined(OS_MACOSX)
- return mach_thread_self();
--#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
-+#elif defined(OS_NETBSD)
-+ return _lwp_self();
-+#elif defined(OS_DRAGONFLY)
-+ return lwp_gettid();
-+#elif defined(OS_FREEBSD)
-+# if __FreeBSD_version > 900030
-+ return pthread_getthreadid_np();
-+# else
-+ long lwpid;
-+ thr_self(&lwpid);
-+ return lwpid;
-+# endif
-+#elif defined(OS_OPENBSD)
-- // TODO(BSD): find a better thread ID
-- return (intptr_t)(pthread_self());
-+ return (intptr_t) (pthread_self());
- #elif defined(OS_LINUX)
- return syscall(__NR_gettid);
- #endif
-@@ -102,9 +102,9 @@ void PlatformThread::SetName(const char* name) {
- // Note that glibc also has a 'pthread_setname_np' api, but it may not be
- // available everywhere and it's only benefit over using prctl directly is
- // that it can set the name of threads other than the current thread.
--#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
-+#if defined(OS_BSD) && !defined(OS_NETBSD)
- pthread_set_name_np(pthread_self(), name);
--#elif defined(__NetBSD__)
-+#elif defined(OS_NETBSD)
- pthread_setname_np(pthread_self(), "%s", (void *)name);
- #else
- prctl(PR_SET_NAME, reinterpret_cast<uintptr_t>(name), 0, 0, 0);
-$NetBSD: patch-ipc_chromium_src_base_process__util.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/ipc/chromium/src/base/process_util.h.orig 2011-12-21 00:28:19.000000000 +0100
-+++ mozilla/ipc/chromium/src/base/process_util.h 2012-01-31 13:14:54.000000000 +0100
-@@ -280,6 +280,7 @@ class NamedProcessIterator {
- const ProcessEntry* NextProcessEntry();
-
- private:
-+#if !defined(OS_BSD)
- // Determines whether there's another process (regardless of executable)
- // left in the list of all processes. Returns true and sets entry_ to
- // that process's info if there is one, false otherwise.
-@@ -292,18 +292,24 @@
- void InitProcessEntry(ProcessEntry* entry);
-
- std::wstring executable_name_;
-+#endif
-
- #if defined(OS_WIN)
- HANDLE snapshot_;
- bool started_iteration_;
- #elif defined(OS_LINUX)
- DIR *procfs_dir_;
-+#elif defined(OS_BSD)
-+ std::vector<ProcessEntry> content;
-+ size_t nextEntry;
- #elif defined(OS_MACOSX)
- std::vector<kinfo_proc> kinfo_procs_;
- size_t index_of_kinfo_proc_;
- #endif
-+#if !defined(OS_BSD)
- ProcessEntry entry_;
- const ProcessFilter* filter_;
-+#endif
-
- DISALLOW_EVIL_CONSTRUCTORS(NamedProcessIterator);
- };
-$NetBSD: patch-ipc_chromium_src_base_process__util__bsd.cc,v 1.4 2012/04/01 15:18:45 ryoon Exp $
-
---- mozilla/ipc/chromium/src/base/process_util_bsd.cc.orig 2012-04-01 00:04:28.000000000 +0000
-+++ mozilla/ipc/chromium/src/base/process_util_bsd.cc
-@@ -0,0 +1,367 @@
-+// Copyright (c) 2008 The Chromium Authors. All rights reserved.
-+// Use of this source code is governed by a BSD-style license that can be
-+// found in the LICENSE file.
-+
-+// derived from process_util_linux.cc and process_util_mac.cc
-+
-+#include "base/process_util.h"
-+
-+#include <sys/param.h>
-+#include <sys/sysctl.h>
-+#include <sys/wait.h>
-+#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD)
-+#include <sys/user.h>
-+#endif
-+
-+#include <ctype.h>
-+#include <fcntl.h>
-+#include <kvm.h>
-+#include <unistd.h>
-+
-+#include <string>
-+
-+#include "base/debug_util.h"
-+#include "base/eintr_wrapper.h"
-+#include "base/file_util.h"
-+#include "base/logging.h"
-+#include "base/string_tokenizer.h"
-+#include "base/string_util.h"
-+
-+#if (defined(_POSIX_SPAWN) && _POSIX_SPAWN > 0) \
-+ || (defined(OS_NETBSD) && __NetBSD_Version__ >= 599006500)
-+#define HAVE_POSIX_SPAWN 1
-+#endif
-+
-+/*
-+ * On platforms that are not gonk based, we fall back to an arbitrary
-+ * UID. This is generally the UID for user `nobody', albeit it is not
-+ * always the case.
-+ */
-+
-+#if defined(OS_NETBSD) || defined(OS_OPENBSD)
-+# define CHILD_UNPRIVILEGED_UID 32767
-+# define CHILD_UNPRIVILEGED_GID 32767
-+#else
-+# define CHILD_UNPRIVILEGED_UID 65534
-+# define CHILD_UNPRIVILEGED_GID 65534
-+#endif
-+
-+#ifndef __dso_public
-+# ifdef __exported
-+# define __dso_public __exported
-+# else
-+# define __dso_public __attribute__((__visibility__("default")))
-+# endif
-+#endif
-+
-+#ifdef HAVE_POSIX_SPAWN
-+#include <spawn.h>
-+extern "C" char **environ __dso_public;
-+#endif
-+
-+namespace {
-+
-+enum ParsingState {
-+ KEY_NAME,
-+ KEY_VALUE
-+};
-+
-+static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG");
-+
-+} // namespace
-+
-+namespace base {
-+
-+#ifdef HAVE_POSIX_SPAWN
-+
-+void FreeEnvVarsArray(char* array[], int length)
-+{
-+ for (int i = 0; i < length; i++) {
-+ free(array[i]);
-+ }
-+ delete[] array;
-+}
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ bool wait, ProcessHandle* process_handle) {
-+ return LaunchApp(argv, fds_to_remap, environment_map(),
-+ wait, process_handle);
-+}
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ const environment_map& env_vars_to_set,
-+ bool wait, ProcessHandle* process_handle,
-+ ProcessArchitecture arch) {
-+ return LaunchApp(argv, fds_to_remap, env_vars_to_set,
-+ SAME_PRIVILEGES_AS_PARENT,
-+ wait, process_handle);
-+}
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ const environment_map& env_vars_to_set,
-+ ChildPrivileges privs,
-+ bool wait, ProcessHandle* process_handle,
-+ ProcessArchitecture arch) {
-+ bool retval = true;
-+
-+ char* argv_copy[argv.size() + 1];
-+ for (size_t i = 0; i < argv.size(); i++) {
-+ argv_copy[i] = const_cast<char*>(argv[i].c_str());
-+ }
-+ argv_copy[argv.size()] = NULL;
-+
-+ // Make sure we don't leak any FDs to the child process by marking all FDs
-+ // as close-on-exec.
-+ SetAllFDsToCloseOnExec();
-+
-+ // Copy environment to a new char array and add the variables
-+ // in env_vars_to_set.
-+ // Existing variables are overwritten by env_vars_to_set.
-+ int pos = 0;
-+ environment_map combined_env_vars = env_vars_to_set;
-+ while(environ[pos] != NULL) {
-+ std::string varString = environ[pos];
-+ std::string varName = varString.substr(0, varString.find_first_of('='));
-+ std::string varValue = varString.substr(varString.find_first_of('=') + 1);
-+ if (combined_env_vars.find(varName) == combined_env_vars.end()) {
-+ combined_env_vars[varName] = varValue;
-+ }
-+ pos++;
-+ }
-+ int varsLen = combined_env_vars.size() + 1;
-+
-+ char** vars = new char*[varsLen];
-+ int i = 0;
-+ for (environment_map::const_iterator it = combined_env_vars.begin();
-+ it != combined_env_vars.end(); ++it) {
-+ std::string entry(it->first);
-+ entry += "=";
-+ entry += it->second;
-+ vars[i] = strdup(entry.c_str());
-+ i++;
-+ }
-+ vars[i] = NULL;
-+
-+ posix_spawn_file_actions_t file_actions;
-+ if (posix_spawn_file_actions_init(&file_actions) != 0) {
-+ FreeEnvVarsArray(vars, varsLen);
-+ return false;
-+ }
-+
-+ // Turn fds_to_remap array into a set of dup2 calls.
-+ for (file_handle_mapping_vector::const_iterator it = fds_to_remap.begin();
-+ it != fds_to_remap.end();
-+ ++it) {
-+ int src_fd = it->first;
-+ int dest_fd = it->second;
-+
-+ if (src_fd == dest_fd) {
-+ int flags = fcntl(src_fd, F_GETFD);
-+ if (flags != -1) {
-+ fcntl(src_fd, F_SETFD, flags & ~FD_CLOEXEC);
-+ }
-+ } else {
-+ if (posix_spawn_file_actions_adddup2(&file_actions, src_fd, dest_fd) != 0) {
-+ posix_spawn_file_actions_destroy(&file_actions);
-+ FreeEnvVarsArray(vars, varsLen);
-+ return false;
-+ }
-+ }
-+ }
-+
-+ pid_t pid = 0;
-+ int spawn_succeeded = (posix_spawnp(&pid,
-+ argv_copy[0],
-+ &file_actions,
-+ NULL,
-+ argv_copy,
-+ vars) == 0);
-+
-+ FreeEnvVarsArray(vars, varsLen);
-+
-+ posix_spawn_file_actions_destroy(&file_actions);
-+
-+ bool process_handle_valid = pid > 0;
-+ if (!spawn_succeeded || !process_handle_valid) {
-+ retval = false;
-+ } else {
-+ if (wait)
-+ HANDLE_EINTR(waitpid(pid, 0, 0));
-+
-+ if (process_handle)
-+ *process_handle = pid;
-+ }
-+
-+ return retval;
-+}
-+
-+bool LaunchApp(const CommandLine& cl,
-+ bool wait, bool start_hidden, ProcessHandle* process_handle) {
-+ // TODO(playmobil): Do we need to respect the start_hidden flag?
-+ file_handle_mapping_vector no_files;
-+ return LaunchApp(cl.argv(), no_files, wait, process_handle);
-+}
-+
-+#else // no posix_spawn, use fork/exec
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ bool wait, ProcessHandle* process_handle) {
-+ return LaunchApp(argv, fds_to_remap, environment_map(),
-+ wait, process_handle);
-+}
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ const environment_map& env_vars_to_set,
-+ bool wait, ProcessHandle* process_handle,
-+ ProcessArchitecture arch) {
-+ return LaunchApp(argv, fds_to_remap, env_vars_to_set,
-+ SAME_PRIVILEGES_AS_PARENT,
-+ wait, process_handle);
-+}
-+
-+bool LaunchApp(const std::vector<std::string>& argv,
-+ const file_handle_mapping_vector& fds_to_remap,
-+ const environment_map& env_vars_to_set,
-+ ChildPrivileges privs,
-+ bool wait, ProcessHandle* process_handle,
-+ ProcessArchitecture arch) {
-+ scoped_array<char*> argv_cstr(new char*[argv.size() + 1]);
-+ // Illegal to allocate memory after fork and before execvp
-+ InjectiveMultimap fd_shuffle1, fd_shuffle2;
-+ fd_shuffle1.reserve(fds_to_remap.size());
-+ fd_shuffle2.reserve(fds_to_remap.size());
-+
-+ pid_t pid = fork();
-+ if (pid < 0)
-+ return false;
-+
-+ if (pid == 0) {
-+ for (file_handle_mapping_vector::const_iterator
-+ it = fds_to_remap.begin(); it != fds_to_remap.end(); ++it) {
-+ fd_shuffle1.push_back(InjectionArc(it->first, it->second, false));
-+ fd_shuffle2.push_back(InjectionArc(it->first, it->second, false));
-+ }
-+
-+ if (!ShuffleFileDescriptors(&fd_shuffle1))
-+ _exit(127);
-+
-+ CloseSuperfluousFds(fd_shuffle2);
-+
-+ for (size_t i = 0; i < argv.size(); i++)
-+ argv_cstr[i] = const_cast<char*>(argv[i].c_str());
-+ argv_cstr[argv.size()] = NULL;
-+
-+ if (privs == UNPRIVILEGED) {
-+ if (setgid(CHILD_UNPRIVILEGED_GID) != 0) {
-+ DLOG(ERROR) << "FAILED TO setgid() CHILD PROCESS, path: " << argv_cstr[0];
-+ _exit(127);
-+ }
-+ if (setuid(CHILD_UNPRIVILEGED_UID) != 0) {
-+ DLOG(ERROR) << "FAILED TO setuid() CHILD PROCESS, path: " << argv_cstr[0];
-+ _exit(127);
-+ }
-+ if (chdir("/") != 0)
-+ gProcessLog.print("==> could not chdir()\n");
-+ }
-+
-+ for (environment_map::const_iterator it = env_vars_to_set.begin();
-+ it != env_vars_to_set.end(); ++it) {
-+ if (setenv(it->first.c_str(), it->second.c_str(), 1/*overwrite*/))
-+ _exit(127);
-+ }
-+ execv(argv_cstr[0], argv_cstr.get());
-+ // if we get here, we're in serious trouble and should complain loudly
-+ DLOG(ERROR) << "FAILED TO exec() CHILD PROCESS, path: " << argv_cstr[0];
-+ _exit(127);
-+ } else {
-+ gProcessLog.print("==> process %d launched child process %d\n",
-+ GetCurrentProcId(), pid);
-+ if (wait)
-+ HANDLE_EINTR(waitpid(pid, 0, 0));
-+
-+ if (process_handle)
-+ *process_handle = pid;
-+ }
-+
-+ return true;
-+}
-+
-+bool LaunchApp(const CommandLine& cl,
-+ bool wait, bool start_hidden,
-+ ProcessHandle* process_handle) {
-+ file_handle_mapping_vector no_files;
-+ return LaunchApp(cl.argv(), no_files, wait, process_handle);
-+}
-+
-+#endif
-+
-+NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
-+ const ProcessFilter* filter)
-+{
-+ int numEntries;
-+ kvm_t *kvm;
-+ std::string exe(WideToASCII(executable_name));
-+
-+#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD)
-+ kvm = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL);
-+ struct kinfo_proc* procs = kvm_getprocs(kvm, KERN_PROC_UID, getuid(), &numEntries);
-+ if (procs != NULL && numEntries > 0) {
-+ for (int i = 0; i < numEntries; i++) {
-+# if defined(OS_DRAGONFLY)
-+ if (exe != procs[i].kp_comm) continue;
-+ if (filter && !filter->Includes(procs[i].kp_pid, procs[i].kp_ppid)) continue;
-+ ProcessEntry e;
-+ e.pid = procs[i].kp_pid;
-+ e.ppid = procs[i].kp_ppid;
-+ strlcpy(e.szExeFile, procs[i].kp_comm, sizeof e.szExeFile);
-+ content.push_back(e);
-+# elif defined(OS_FREEBSD)
-+ if (exe != procs[i].ki_comm) continue;
-+ if (filter && !filter->Includes(procs[i].ki_pid, procs[i].ki_ppid)) continue;
-+ ProcessEntry e;
-+ e.pid = procs[i].ki_pid;
-+ e.ppid = procs[i].ki_ppid;
-+ strlcpy(e.szExeFile, procs[i].ki_comm, sizeof e.szExeFile);
-+ content.push_back(e);
-+# endif
-+#else
-+ kvm = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, NULL);
-+#if defined(OS_OPENBSD)
-+ struct kinfo_proc* procs = kvm_getprocs(kvm, KERN_PROC_UID, getuid(), sizeof(struct kinfo_proc), &numEntries);
-+#else
-+ struct kinfo_proc2* procs = kvm_getproc2(kvm, KERN_PROC_UID, getuid(), sizeof(struct kinfo_proc2), &numEntries);
-+#endif
-+ if (procs != NULL && numEntries > 0) {
-+ for (int i = 0; i < numEntries; i++) {
-+ if (exe != procs[i].p_comm) continue;
-+ if (filter && !filter->Includes(procs[i].p_pid, procs[i].p_ppid)) continue;
-+ ProcessEntry e;
-+ e.pid = procs[i].p_pid;
-+ e.ppid = procs[i].p_ppid;
-+ strlcpy(e.szExeFile, procs[i].p_comm, sizeof e.szExeFile);
-+ content.push_back(e);
-+#endif
-+ }
-+ }
-+ nextEntry = 0;
-+ kvm_close(kvm);
-+}
-+
-+NamedProcessIterator::~NamedProcessIterator() {
-+}
-+
-+const ProcessEntry* NamedProcessIterator::NextProcessEntry() {
-+ if (nextEntry >= content.size()) return NULL;
-+ return &content[nextEntry++];
-+}
-+
-+bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
-+ return false;
-+}
-+
-+} // namespace base
-$NetBSD: patch-ipc_chromium_src_base_process__util__posix.cc,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/ipc/chromium/src/base/process_util_posix.cc.orig 2011-12-20 23:28:19.000000000 +0000
-+++ mozilla/ipc/chromium/src/base/process_util_posix.cc
-@@ -116,6 +116,11 @@ void CloseSuperfluousFds(const base::Inj
- #elif defined(OS_MACOSX)
- static const rlim_t kSystemDefaultMaxFds = 256;
- static const char kFDDir[] = "/dev/fd";
-+#elif defined(OS_BSD)
-+ // the getrlimit below should never fail, so whatever ..
-+ static const rlim_t kSystemDefaultMaxFds = 1024;
-+ // at least /dev/fd will exist
-+ static const char kFDDir[] = "/dev/fd";
- #endif
-
- // Get the maximum number of FDs possible.
-@@ -199,7 +204,7 @@ void CloseSuperfluousFds(const base::Inj
- void SetAllFDsToCloseOnExec() {
- #if defined(OS_LINUX)
- const char fd_dir[] = "/proc/self/fd";
--#elif defined(OS_MACOSX)
-+#elif defined(OS_MACOSX) || defined(OS_BSD)
- const char fd_dir[] = "/dev/fd";
- #endif
- ScopedDIR dir_closer(opendir(fd_dir));
-$NetBSD: patch-ipc_chromium_src_base_sys__info__posix.cc,v 1.2 2011/11/27 13:09:00 tnn Exp $
-
---- mozilla/ipc/chromium/src/base/sys_info_posix.cc.orig 2011-11-04 21:34:00.000000000 +0000
-+++ mozilla/ipc/chromium/src/base/sys_info_posix.cc
-@@ -18,6 +18,11 @@
- #include <mach/mach_init.h>
- #endif
-
-+#if defined(OS_NETBSD)
-+#include <sys/param.h>
-+#include <sys/sysctl.h>
-+#endif
-+
- #include "base/logging.h"
- #include "base/string_util.h"
-
-@@ -26,7 +31,11 @@ namespace base {
- int SysInfo::NumberOfProcessors() {
- // It seems that sysconf returns the number of "logical" processors on both
- // mac and linux. So we get the number of "online logical" processors.
-+#ifdef _SC_NPROCESSORS_ONLN
- static long res = sysconf(_SC_NPROCESSORS_ONLN);
-+#else
-+ static long res = 1;
-+#endif
- if (res == -1) {
- NOTREACHED();
- return 1;
-@@ -52,6 +61,20 @@ int64 SysInfo::AmountOfPhysicalMemory()
- }
-
- return static_cast<int64>(hostinfo.max_mem);
-+#elif defined(OS_NETBSD)
-+ int mib[2];
-+ int rc;
-+ int64_t memSize;
-+ size_t len = sizeof(memSize);
-+
-+ mib[0] = CTL_HW;
-+ mib[1] = HW_PHYSMEM64;
-+ rc = sysctl( mib, 2, &memSize, &len, NULL, 0 );
-+ if (-1 != rc) {
-+ return memSize;
-+ }
-+ return 0;
-+
- #else
- long pages = sysconf(_SC_PHYS_PAGES);
- long page_size = sysconf(_SC_PAGE_SIZE);
-diff --git ipc/chromium/src/base/time_posix.cc ipc/chromium/src/base/time_posix.cc
-index abf2a56..48791f6 100644
---- mozilla/ipc/chromium/src/base/time_posix.cc
-+++ mozilla/ipc/chromium/src/base/time_posix.cc
-@@ -167,7 +167,7 @@ TimeTicks TimeTicks::Now() {
- // With numer and denom = 1 (the expected case), the 64-bit absolute time
- // reported in nanoseconds is enough to last nearly 585 years.
-
--#elif defined(__OpenBSD__) || defined(OS_POSIX) && \
-+#elif defined(OS_OPENBSD) || defined(OS_POSIX) && \
- defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0
-
- struct timespec ts;
-$NetBSD: patch-ipc_chromium_src_build_build__config.h,v 1.4 2012/04/01 15:18:45 ryoon Exp $
-
---- mozilla/ipc/chromium/src/build/build_config.h.orig 2012-03-13 01:36:53.000000000 +0000
-+++ mozilla/ipc/chromium/src/build/build_config.h
-@@ -19,6 +19,12 @@
- #define OS_MACOSX 1
- #elif defined(__linux__) || defined(ANDROID)
- #define OS_LINUX 1
-+#elif defined(__DragonFly__)
-+#define OS_DRAGONFLY 1
-+#elif defined(__FreeBSD__)
-+#define OS_FREEBSD 1
-+#elif defined(__NetBSD__)
-+#define OS_NETBSD 1
- #elif defined(__OpenBSD__)
- #define OS_OPENBSD 1
- #elif defined(_WIN32)
-@@ -27,9 +33,16 @@
- #error Please add support for your platform in build/build_config.h
- #endif
-
-+// For access to standard BSD features, use OS_BSD instead of a
-+// more specific macro.
-+#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD) \
-+ || defined(OS_NETBSD) || defined(OS_OPENBSD)
-+#define OS_BSD 1
-+#endif
-+
- // For access to standard POSIX features, use OS_POSIX instead of a more
- // specific macro.
--#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_OPENBSD)
-+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD)
- #define OS_POSIX 1
- #endif
-
-diff --git ipc/chromium/src/chrome/common/ipc_channel_posix.cc ipc/chromium/src/chrome/common/ipc_channel_posix.cc
-index bd866ee..2ea5b19 100644
---- mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
-+++ mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
-@@ -7,6 +7,7 @@
- #include <errno.h>
- #include <fcntl.h>
- #include <stddef.h>
-+#include <unistd.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <sys/stat.h>
-$NetBSD: patch-ipc_chromium_src_chrome_common_ipc__channel__posix.h,v 1.1 2011/07/11 12:46:14 tnn Exp $
-
---- mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.h.orig 2011-06-15 21:57:27.000000000 +0000
-+++ mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.h
-@@ -92,7 +92,7 @@ class Channel::ChannelImpl : public Mess
- };
-
- // This is a control message buffer large enough to hold kMaxReadFDs
--#if defined(OS_MACOSX)
-+#if defined(OS_MACOSX) || defined(OS_NETBSD)
- // TODO(agl): OSX appears to have non-constant CMSG macros!
- char input_cmsg_buf_[1024];
- #else
-$NetBSD: patch-ipc_chromium_src_chrome_common_ipc__message__utils.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/ipc/chromium/src/chrome/common/ipc_message_utils.h.orig 2011-12-20 23:28:19.000000000 +0000
-+++ mozilla/ipc/chromium/src/chrome/common/ipc_message_utils.h
-@@ -195,7 +195,7 @@
- };
- #endif
-
--#if !(defined(OS_MACOSX) || defined(OS_OPENBSD) || defined(OS_WIN) || (defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)) || defined(ARCH_CPU_S390))
-+#if !(defined(OS_MACOSX) || defined(OS_OPENBSD) || defined(OS_WIN) || ((defined(OS_BSD) || defined(OS_LINUX)) && defined(ARCH_CPU_64_BITS)) || defined(ARCH_CPU_S390))
- // There size_t is a synonym for |unsigned long| ...
- template <>
- struct ParamTraits<size_t> {
-@@ -248,7 +248,7 @@
- };
- #endif // defined(OS_MACOSX)
-
--#if !(defined(OS_LINUX) && defined(ARCH_CPU_64_BITS))
-+#if !((defined(OS_BSD) || defined(OS_LINUX)) && defined(ARCH_CPU_64_BITS))
- // int64 is |long int| on 64-bit systems, uint64 is |unsigned long|
- template <>
- struct ParamTraits<int64> {
-$NetBSD: patch-ipc_chromium_src_chrome_common_transport__dib.h,v 1.1 2012/03/06 12:34:09 ryoon Exp $
-
---- mozilla/ipc/chromium/src/chrome/common/transport_dib.h.orig 2011-12-20 23:28:19.000000000 +0000
-+++ mozilla/ipc/chromium/src/chrome/common/transport_dib.h
-@@ -7,7 +7,7 @@
-
- #include "base/basictypes.h"
-
--#if defined(OS_WIN) || defined(OS_MACOSX)
-+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_BSD)
- #include "base/shared_memory.h"
- #endif
-
-@@ -66,7 +66,7 @@ class TransportDIB {
- uint32 sequence_num;
- };
- typedef HandleAndSequenceNum Id;
--#elif defined(OS_MACOSX)
-+#elif defined(OS_MACOSX) || defined(OS_BSD)
- typedef base::SharedMemoryHandle Handle;
- // On Mac, the inode number of the backing file is used as an id.
- typedef base::SharedMemoryId Id;
-@@ -108,7 +108,7 @@ class TransportDIB {
-
- private:
- TransportDIB();
--#if defined(OS_WIN) || defined(OS_MACOSX)
-+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_BSD)
- explicit TransportDIB(base::SharedMemoryHandle dib);
- base::SharedMemory shared_memory_;
- uint32 sequence_num_;
-$NetBSD: patch-ipc_glue_GeckoChildProcessHost.cpp,v 1.2 2012/03/15 08:30:06 ryoon Exp $
-
---- mozilla/ipc/glue/GeckoChildProcessHost.cpp.orig 2011-12-20 23:28:19.000000000 +0000
-+++ mozilla/ipc/glue/GeckoChildProcessHost.cpp
-@@ -430,7 +430,7 @@
- // and passing wstrings from one config to the other is unsafe. So
- // we split the logic here.
-
--#if defined(OS_LINUX) || defined(OS_MACOSX)
-+#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD)
- base::environment_map newEnvVars;
- // XPCOM may not be initialized in some subprocesses. We don't want
- // to initialize XPCOM just for the directory service, especially
-@@ -445,8 +445,8 @@
- if (NS_SUCCEEDED(rv)) {
- nsCString path;
- greDir->GetNativePath(path);
--# ifdef OS_LINUX
--# ifdef MOZ_WIDGET_ANDROID
-+# if defined(OS_LINUX) || defined(OS_BSD)
-+# if defined(MOZ_WIDGET_ANDROID) || defined(OS_BSD)
- path += "/lib";
- # endif // MOZ_WIDGET_ANDROID
- const char *ld_library_path = PR_GetEnv("LD_LIBRARY_PATH");
-@@ -557,7 +557,7 @@
- childArgv.push_back(pidstring);
-
- #if defined(MOZ_CRASHREPORTER)
--# if defined(OS_LINUX)
-+# if defined(OS_LINUX) || defined(OS_BSD)
- int childCrashFd, childCrashRemapFd;
- if (!CrashReporter::CreateNotificationPipeForChild(
- &childCrashFd, &childCrashRemapFd))
-@@ -594,7 +594,7 @@
- #endif
-
- base::LaunchApp(childArgv, mFileMap,
--#if defined(OS_LINUX) || defined(OS_MACOSX)
-+#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_BSD)
- newEnvVars, privs,
- #endif
- false, &process, arch);
-diff --git ipc/glue/SharedMemorySysV.h ipc/glue/SharedMemorySysV.h
-index f37998d..b05dc7b 100644
---- mozilla/ipc/glue/SharedMemorySysV.h
-+++ mozilla/ipc/glue/SharedMemorySysV.h
-@@ -8,7 +8,7 @@
- #ifndef mozilla_ipc_SharedMemorySysV_h
- #define mozilla_ipc_SharedMemorySysV_h
-
--#if defined(OS_LINUX) && !defined(ANDROID)
-+#if (defined(OS_LINUX) && !defined(ANDROID)) || defined(OS_BSD)
-
- // SysV shared memory isn't available on Windows, but we define the
- // following macro so that #ifdefs are clearer (compared to #ifdef
-$NetBSD: patch-mm,v 1.13 2012/06/05 18:09:21 ryoon Exp $
-
---- mozilla/toolkit/library/Makefile.in.orig 2012-05-23 18:57:09.000000000 +0000
-+++ mozilla/toolkit/library/Makefile.in
-@@ -534,6 +538,12 @@ EXTRA_DSO_LDOPTS += -lelf -ldemangle
- endif
- endif
-
-+ifneq (,$(filter DragonFly FreeBSD NetBSD OpenBSD,$(OS_ARCH)))
-+OS_LIBS += $(call EXPAND_LIBNAME,kvm)
-+# keep `environ' unresolved, see bug 14426 for binutils
-+EXTRA_DSO_LDOPTS += -Wl,--warn-unresolved-symbols
-+endif
-+
- ifeq ($(OS_ARCH),WINNT)
- OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 version winspool comdlg32 imm32 msimg32 shlwapi psapi ws2_32 dbghelp rasapi32 rasdlg iphlpapi uxtheme setupapi secur32 sensorsapi portabledeviceguids windowscodecs wininet)
- ifdef ACCESSIBILITY
diff --git a/www/seamonkey/files/patch-bug783505 b/www/seamonkey/files/patch-bug783505
new file mode 100644
index 000000000000..d32be963c7b8
--- /dev/null
+++ b/www/seamonkey/files/patch-bug783505
@@ -0,0 +1,52 @@
+commit b5f97ee
+Author: Rafael Ávila de Espíndola <respindola@mozilla.com>
+Date: Mon Aug 20 10:28:08 2012 -0400
+
+ Bug 783505 - OS X gcc builds failing. r=jorendorff.
+ This patch adds a workaround for
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39608
+---
+ js/src/jstypedarray.cpp | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git mozilla/js/src/jstypedarray.cpp mozilla/js/src/jstypedarray.cpp
+index 1eaeea0..1957086 100644
+--- mozilla/js/src/jstypedarray.cpp
++++ mozilla/js/src/jstypedarray.cpp
+@@ -1423,8 +1423,14 @@ class TypedArrayTemplate
+ Getter(JSContext *cx, unsigned argc, Value *vp)
+ {
+ CallArgs args = CallArgsFromVp(argc, vp);
++ // FIXME: Hack to keep us building with gcc 4.2. Remove this once we
++ // drop support for gcc 4.2. See bug 783505 for the details.
++#if !defined(__clang__) && defined(__GNUC__) && __GNUC_MINOR__ <= 2
++ return CallNonGenericMethod(cx, IsThisClass, GetterImpl<ValueGetter>, args);
++#else
+ return CallNonGenericMethod<ThisTypeArray::IsThisClass,
+ ThisTypeArray::GetterImpl<ValueGetter> >(cx, args);
++#endif
+ }
+
+ // Define an accessor for a read-only property that invokes a native getter
+--- mozilla/build/autoconf/gcc-pr39608.m4~
++++ mozilla/build/autoconf/gcc-pr39608.m4
+@@ -31,7 +31,6 @@ AC_LANG_RESTORE
+
+ AC_MSG_RESULT($ac_have_gcc_pr39608)
+ if test "$ac_have_gcc_pr39608" = "yes"; then
+- echo This compiler would fail to build firefox, plase upgrade.
+- exit 1
++ echo This compiler may fail to build firefox, plase upgrade.
+ fi
+ ])
+--- mozilla/js/src/build/autoconf/gcc-pr39608.m4~
++++ mozilla/js/src/build/autoconf/gcc-pr39608.m4
+@@ -31,7 +31,6 @@ AC_LANG_RESTORE
+
+ AC_MSG_RESULT($ac_have_gcc_pr39608)
+ if test "$ac_have_gcc_pr39608" = "yes"; then
+- echo This compiler would fail to build firefox, plase upgrade.
+- exit 1
++ echo This compiler may fail to build firefox, plase upgrade.
+ fi
+ ])
diff --git a/www/seamonkey/files/patch-bug784631 b/www/seamonkey/files/patch-bug784631
deleted file mode 100644
index 6378663b9b70..000000000000
--- a/www/seamonkey/files/patch-bug784631
+++ /dev/null
@@ -1,52 +0,0 @@
-commit 66b3921
-Author: Terrence Cole <terrence@mozilla.com>
-Date: Tue Sep 11 12:31:04 2012 -0700
-
- Bug 784631 - Fix some clang build errors in SpiderMonkey; r=Waldo f=espindola
-
- Computed gotos are not in the C++ standard: clang and gcc differ on semantics.
----
- js/src/jsinterp.cpp | 3 ++-
- js/src/jsutil.h | 8 ++++----
- 2 files changed, 6 insertions(+), 5 deletions(-)
-
-diff --git js/src/jsinterp.cpp js/src/jsinterp.cpp
-index 0094c72..27a64a7 100644
---- mozilla/js/src/jsinterp.cpp
-+++ mozilla/js/src/jsinterp.cpp
-@@ -1231,6 +1231,7 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
- RootedPropertyName rootName0(cx);
- RootedId rootId0(cx);
- RootedShape rootShape0(cx);
-+ DebugOnly<uint32_t> blockDepth;
-
- if (!entryFrame)
- entryFrame = regs.fp();
-@@ -3650,7 +3651,7 @@ BEGIN_CASE(JSOP_LEAVEBLOCK)
- BEGIN_CASE(JSOP_LEAVEFORLETIN)
- BEGIN_CASE(JSOP_LEAVEBLOCKEXPR)
- {
-- DebugOnly<uint32_t> blockDepth = regs.fp()->blockChain().stackDepth();
-+ blockDepth = regs.fp()->blockChain().stackDepth();
-
- regs.fp()->popBlock(cx);
-
-diff --git js/src/jsutil.h js/src/jsutil.h
-index 8838b6f..016a877 100644
---- mozilla/js/src/jsutil.h
-+++ mozilla/js/src/jsutil.h
-@@ -432,10 +432,10 @@ typedef size_t jsbitmap;
- #if defined(__clang__)
- # define JS_SILENCE_UNUSED_VALUE_IN_EXPR(expr) \
- JS_BEGIN_MACRO \
-- _Pragma("clang diagnostic push") \
-- _Pragma("clang diagnostic ignored \"-Wunused-value\"") \
-- expr; \
-- _Pragma("clang diagnostic pop") \
-+ _Pragma("(clang diagnostic push)") \
-+ _Pragma("(clang diagnostic ignored \"-Wunused-value\")") \
-+ {expr;} \
-+ _Pragma("(clang diagnostic pop)") \
- JS_END_MACRO
- #elif (__GNUC__ >= 5) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
- # define JS_SILENCE_UNUSED_VALUE_IN_EXPR(expr) \
diff --git a/www/seamonkey/files/patch-bug786995 b/www/seamonkey/files/patch-bug786995
deleted file mode 100644
index 0dc1385f5876..000000000000
--- a/www/seamonkey/files/patch-bug786995
+++ /dev/null
@@ -1,36 +0,0 @@
-# Bug 786995 - configure should check for SSSE3 support in the whole toolchain
-
---- mozilla/configure.in.orig 2012-09-02 00:37:29.000000000 +0200
-+++ mozilla/configure.in 2012-09-02 00:38:50.000000000 +0200
-@@ -1710,15 +1710,15 @@
- _MOZ_RTTI_FLAGS_OFF=-fno-rtti
-
- # Check for -mssse3 on $CC
-- AC_MSG_CHECKING([for -mssse3 option to $CC])
-- HAVE_COMPILER_FLAG_MSSSE3=
-+ AC_MSG_CHECKING([if toolchain supports -mssse3 option])
-+ HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
- _SAVE_CFLAGS=$CFLAGS
- CFLAGS="$CFLAGS -mssse3"
-- AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
-- [HAVE_COMPILER_FLAG_MSSSE3=1],
-+ AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
-+ [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
- AC_MSG_RESULT([no]))
- CFLAGS=$_SAVE_CFLAGS
-- AC_SUBST(HAVE_COMPILER_FLAG_MSSSE3)
-+ AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
-
- # Turn on GNU-specific warnings:
- # -Wall - turn on a lot of warnings
---- mozilla/gfx/skia/Makefile.in.orig 2012-09-02 00:39:00.000000000 +0200
-+++ mozilla/gfx/skia/Makefile.in 2012-09-02 00:39:21.000000000 +0200
-@@ -365,7 +365,7 @@
- SkUtils_opts_SSE2.cpp \
- opts_check_SSE2.cpp \
- $(NULL)
--ifdef HAVE_COMPILER_FLAG_MSSSE3
-+ifdef HAVE_TOOLCHAIN_SUPPORT_MSSSE3
- DEFINES += -DSK_BUILD_SSSE3
- CPPSRCS += SkBitmapProcState_opts_SSSE3.cpp
- endif
diff --git a/www/seamonkey/files/patch-bug787804 b/www/seamonkey/files/patch-bug787804
new file mode 100644
index 000000000000..517cbd94d7f9
--- /dev/null
+++ b/www/seamonkey/files/patch-bug787804
@@ -0,0 +1,3557 @@
+commit 74997f1
+Author: Jan Varga <jan.varga@gmail.com>
+Date: Mon Dec 17 20:25:10 2012 +0100
+
+ Bug 787804 - Rewrite quota handling (eliminate test_quota.c). r=bent,asuth,vladan
+---
+ db/sqlite3/README.MOZILLA | 4 +-
+ db/sqlite3/src/sqlite.def | 1 +
+ db/sqlite3/src/test_quota.c | 2001 --------------------
+ db/sqlite3/src/test_quota.h | 274 ---
+ dom/Makefile.in | 1 +
+ dom/dom-config.mk | 1 +
+ dom/file/FileStreamWrappers.cpp | 11 -
+ dom/file/LockedFile.cpp | 8 +-
+ dom/file/nsIFileStorage.h | 40 +-
+ dom/indexedDB/FileManager.cpp | 33 +-
+ dom/indexedDB/FileManager.h | 20 +-
+ dom/indexedDB/FileStream.cpp | 321 ----
+ dom/indexedDB/FileStream.h | 140 --
+ dom/indexedDB/IDBDatabase.cpp | 6 +
+ dom/indexedDB/IDBFactory.cpp | 28 +-
+ dom/indexedDB/IDBFactory.h | 8 +-
+ dom/indexedDB/IDBFileHandle.cpp | 25 +-
+ dom/indexedDB/IDBObjectStore.cpp | 10 +-
+ dom/indexedDB/IDBTransaction.cpp | 3 +-
+ dom/indexedDB/IndexedDatabaseInlines.h | 13 +
+ dom/indexedDB/IndexedDatabaseManager.cpp | 162 +-
+ dom/indexedDB/IndexedDatabaseManager.h | 11 +-
+ dom/indexedDB/Makefile.in | 2 -
+ dom/indexedDB/OpenDatabaseHelper.cpp | 104 +-
+ dom/indexedDB/OpenDatabaseHelper.h | 12 +-
+ dom/indexedDB/nsIStandardFileStream.idl | 60 -
+ dom/indexedDB/test/Makefile.in | 2 +
+ dom/indexedDB/test/file.js | 21 +-
+ dom/indexedDB/test/test_file_quota.html | 14 +-
+ dom/indexedDB/test/test_filehandle_quota.html | 5 +-
+ dom/quota/FileStreams.cpp | 123 ++
+ dom/quota/FileStreams.h | 115 ++
+ dom/quota/Makefile.in | 33 +
+ dom/quota/QuotaCommon.h | 23 +
+ dom/quota/QuotaManager.cpp | 294 +++
+ dom/quota/QuotaManager.h | 147 ++
+ layout/build/Makefile.in | 1 +
+ netwerk/base/src/Makefile.in | 1 +
+ netwerk/base/src/nsFileStreams.cpp | 103 +-
+ netwerk/base/src/nsFileStreams.h | 12 +-
+ storage/public/Makefile.in | 1 -
+ storage/public/mozIStorageService.idl | 13 +-
+ .../public/mozIStorageServiceQuotaManagement.idl | 99 -
+ storage/public/storage.h | 1 -
+ storage/src/TelemetryVFS.cpp | 35 +-
+ storage/src/mozStorageConnection.cpp | 85 +-
+ storage/src/mozStorageConnection.h | 27 +-
+ storage/src/mozStorageService.cpp | 168 +-
+ storage/src/mozStorageService.h | 3 -
+ toolkit/toolkit-makefiles.sh | 1 +
+ 50 files changed, 1239 insertions(+), 3387 deletions(-)
+
+diff --git dom/Makefile.in dom/Makefile.in
+index 672e065..47cd253 100644
+--- mozilla/dom/Makefile.in
++++ mozilla/dom/Makefile.in
+@@ -58,6 +58,7 @@ PARALLEL_DIRS += \
+ media \
+ messages \
+ power \
++ quota \
+ settings \
+ sms \
+ mms \
+diff --git dom/dom-config.mk dom/dom-config.mk
+index d0f46cc..1cf57ed 100644
+--- mozilla/dom/dom-config.mk
++++ mozilla/dom/dom-config.mk
+@@ -8,6 +8,7 @@ DOM_SRCDIRS = \
+ dom/encoding \
+ dom/file \
+ dom/power \
++ dom/quota \
+ dom/media \
+ dom/network/src \
+ dom/settings \
+diff --git dom/file/FileStreamWrappers.cpp dom/file/FileStreamWrappers.cpp
+index 2283266..c4cf102 100644
+--- mozilla/dom/file/FileStreamWrappers.cpp
++++ mozilla/dom/file/FileStreamWrappers.cpp
+@@ -8,7 +8,6 @@
+
+ #include "nsIFileStorage.h"
+ #include "nsISeekableStream.h"
+-#include "nsIStandardFileStream.h"
+ #include "mozilla/Attributes.h"
+
+ #include "FileHelper.h"
+@@ -246,16 +245,6 @@ FileOutputStreamWrapper::Close()
+ nsresult rv = NS_OK;
+
+ if (!mFirstTime) {
+- // We must flush buffers of the stream on the same thread on which we wrote
+- // some data.
+- nsCOMPtr<nsIStandardFileStream> sstream = do_QueryInterface(mFileStream);
+- if (sstream) {
+- rv = sstream->FlushBuffers();
+- if (NS_FAILED(rv)) {
+- NS_WARNING("Failed to flush buffers of the stream!");
+- }
+- }
+-
+ NS_ASSERTION(PR_GetCurrentThread() == mWriteThread,
+ "Unsetting thread locals on wrong thread!");
+ mFileHelper->mFileStorage->UnsetThreadLocals();
+diff --git dom/file/LockedFile.cpp dom/file/LockedFile.cpp
+index 0fca730..926df91 100644
+--- mozilla/dom/file/LockedFile.cpp
++++ mozilla/dom/file/LockedFile.cpp
+@@ -953,10 +953,10 @@ FinishHelper::Run()
+ }
+
+ for (uint32_t index = 0; index < mParallelStreams.Length(); index++) {
+- nsCOMPtr<nsIOutputStream> ostream =
++ nsCOMPtr<nsIInputStream> stream =
+ do_QueryInterface(mParallelStreams[index]);
+
+- if (NS_FAILED(ostream->Close())) {
++ if (NS_FAILED(stream->Close())) {
+ NS_WARNING("Failed to close stream!");
+ }
+
+@@ -964,9 +964,9 @@ FinishHelper::Run()
+ }
+
+ if (mStream) {
+- nsCOMPtr<nsIOutputStream> ostream = do_QueryInterface(mStream);
++ nsCOMPtr<nsIInputStream> stream = do_QueryInterface(mStream);
+
+- if (NS_FAILED(ostream->Close())) {
++ if (NS_FAILED(stream->Close())) {
+ NS_WARNING("Failed to close stream!");
+ }
+
+diff --git dom/file/nsIFileStorage.h dom/file/nsIFileStorage.h
+index 92bb608..e985f0a 100644
+--- mozilla/dom/file/nsIFileStorage.h
++++ mozilla/dom/file/nsIFileStorage.h
+@@ -10,14 +10,17 @@
+ #include "nsISupports.h"
+
+ #define NS_FILESTORAGE_IID \
+- {0xbba9c2ff, 0x85c9, 0x47c1, \
+- { 0xaf, 0xce, 0x0a, 0x7e, 0x6f, 0x21, 0x50, 0x95 } }
++ {0xa0801944, 0x2f1c, 0x4203, \
++ { 0x9c, 0xaa, 0xaa, 0x47, 0xe0, 0x0c, 0x67, 0x92 } }
+
+ class nsIFileStorage : public nsISupports
+ {
+ public:
+ NS_DECLARE_STATIC_IID_ACCESSOR(NS_FILESTORAGE_IID)
+
++ virtual const nsACString&
++ StorageOrigin() = 0;
++
+ virtual nsISupports*
+ StorageId() = 0;
+
+@@ -36,20 +39,23 @@ public:
+
+ NS_DEFINE_STATIC_IID_ACCESSOR(nsIFileStorage, NS_FILESTORAGE_IID)
+
+-#define NS_DECL_NSIFILESTORAGE \
+- virtual nsISupports* \
+- StorageId(); \
+- \
+- virtual bool \
+- IsStorageInvalidated(); \
+- \
+- virtual bool \
+- IsStorageShuttingDown(); \
+- \
+- virtual void \
+- SetThreadLocals(); \
+- \
+- virtual void \
+- UnsetThreadLocals();
++#define NS_DECL_NSIFILESTORAGE \
++ virtual const nsACString& \
++ StorageOrigin() MOZ_OVERRIDE; \
++ \
++ virtual nsISupports* \
++ StorageId() MOZ_OVERRIDE; \
++ \
++ virtual bool \
++ IsStorageInvalidated() MOZ_OVERRIDE; \
++ \
++ virtual bool \
++ IsStorageShuttingDown() MOZ_OVERRIDE; \
++ \
++ virtual void \
++ SetThreadLocals() MOZ_OVERRIDE; \
++ \
++ virtual void \
++ UnsetThreadLocals() MOZ_OVERRIDE;
+
+ #endif // nsIFileStorage_h__
+diff --git dom/indexedDB/FileManager.cpp dom/indexedDB/FileManager.cpp
+index 9db56e8..4ed6e9e 100644
+--- mozilla/dom/indexedDB/FileManager.cpp
++++ mozilla/dom/indexedDB/FileManager.cpp
+@@ -7,8 +7,8 @@
+ #include "FileManager.h"
+
+ #include "mozIStorageConnection.h"
+-#include "mozIStorageServiceQuotaManagement.h"
+ #include "mozIStorageStatement.h"
++#include "nsIInputStream.h"
+ #include "nsISimpleEnumerator.h"
+
+ #include "mozStorageCID.h"
+@@ -18,6 +18,8 @@
+ #include "IndexedDatabaseManager.h"
+ #include "OpenDatabaseHelper.h"
+
++#include "IndexedDatabaseInlines.h"
++
+ #define JOURNAL_DIRECTORY_NAME "journals"
+
+ USING_INDEXEDDB_NAMESPACE
+@@ -262,13 +264,11 @@ FileManager::GetFileForId(nsIFile* aDirectory, int64_t aId)
+
+ // static
+ nsresult
+-FileManager::InitDirectory(mozIStorageServiceQuotaManagement* aService,
+- nsIFile* aDirectory,
++FileManager::InitDirectory(nsIFile* aDirectory,
+ nsIFile* aDatabaseFile,
+- FactoryPrivilege aPrivilege)
++ const nsACString& aOrigin)
+ {
+ NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
+- NS_ASSERTION(aService, "Null service!");
+ NS_ASSERTION(aDirectory, "Null directory!");
+ NS_ASSERTION(aDatabaseFile, "Null database file!");
+
+@@ -310,8 +310,8 @@ FileManager::InitDirectory(mozIStorageServiceQuotaManagement* aService,
+
+ if (hasElements) {
+ nsCOMPtr<mozIStorageConnection> connection;
+- rv = OpenDatabaseHelper::CreateDatabaseConnection(
+- NullString(), aDatabaseFile, aDirectory, getter_AddRefs(connection));
++ rv = OpenDatabaseHelper::CreateDatabaseConnection(aDatabaseFile,
++ aDirectory, NullString(), aOrigin, getter_AddRefs(connection));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ mozStorageTransaction transaction(connection, false);
+@@ -377,12 +377,17 @@ FileManager::InitDirectory(mozIStorageServiceQuotaManagement* aService,
+ }
+ }
+
+- if (aPrivilege == Chrome) {
+- return NS_OK;
+- }
++ return NS_OK;
++}
++
++// static
++nsresult
++FileManager::GetUsage(nsIFile* aDirectory, uint64_t* aUsage)
++{
++ uint64_t usage = 0;
+
+ nsCOMPtr<nsISimpleEnumerator> entries;
+- rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
++ nsresult rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ bool hasMore;
+@@ -402,9 +407,13 @@ FileManager::InitDirectory(mozIStorageServiceQuotaManagement* aService,
+ continue;
+ }
+
+- rv = aService->UpdateQuotaInformationForFile(file);
++ int64_t fileSize;
++ rv = file->GetFileSize(&fileSize);
+ NS_ENSURE_SUCCESS(rv, rv);
++
++ IncrementUsage(&usage, uint64_t(fileSize));
+ }
+
++ *aUsage = usage;
+ return NS_OK;
+ }
+diff --git dom/indexedDB/FileManager.h dom/indexedDB/FileManager.h
+index 2c72d0a..370d4a8 100644
+--- mozilla/dom/indexedDB/FileManager.h
++++ mozilla/dom/indexedDB/FileManager.h
+@@ -24,10 +24,10 @@ class FileManager
+ friend class FileInfo;
+
+ public:
+- FileManager(const nsACString& aOrigin,
++ FileManager(const nsACString& aOrigin, FactoryPrivilege aPrivilege,
+ const nsAString& aDatabaseName)
+- : mOrigin(aOrigin), mDatabaseName(aDatabaseName), mLastFileId(0),
+- mInvalidated(false)
++ : mOrigin(aOrigin), mPrivilege(aPrivilege), mDatabaseName(aDatabaseName),
++ mLastFileId(0), mInvalidated(false)
+ { }
+
+ ~FileManager()
+@@ -40,6 +40,11 @@ public:
+ return mOrigin;
+ }
+
++ const FactoryPrivilege& Privilege() const
++ {
++ return mPrivilege;
++ }
++
+ const nsAString& DatabaseName() const
+ {
+ return mDatabaseName;
+@@ -68,12 +73,15 @@ public:
+ static already_AddRefed<nsIFile> GetFileForId(nsIFile* aDirectory,
+ int64_t aId);
+
+- static nsresult InitDirectory(mozIStorageServiceQuotaManagement* aService,
+- nsIFile* aDirectory, nsIFile* aDatabaseFile,
+- FactoryPrivilege aPrivilege);
++ static nsresult InitDirectory(nsIFile* aDirectory,
++ nsIFile* aDatabaseFile,
++ const nsACString& aOrigin);
++
++ static nsresult GetUsage(nsIFile* aDirectory, uint64_t* aUsage);
+
+ private:
+ nsCString mOrigin;
++ FactoryPrivilege mPrivilege;
+ nsString mDatabaseName;
+
+ nsString mDirectoryPath;
+diff --git dom/indexedDB/FileStream.cpp dom/indexedDB/FileStream.cpp
+deleted file mode 100644
+index dddf5d5..0000000
+--- mozilla/dom/indexedDB/FileStream.cpp
++++ /dev/null
+@@ -1,321 +0,0 @@
+-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+-/* vim: set ts=2 et sw=2 tw=80: */
+-/* This Source Code Form is subject to the terms of the Mozilla Public
+- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+- * You can obtain one at http://mozilla.org/MPL/2.0/. */
+-
+-#include "FileStream.h"
+-
+-#include "nsIFile.h"
+-
+-#include "nsThreadUtils.h"
+-#include "test_quota.h"
+-
+-USING_INDEXEDDB_NAMESPACE
+-
+-NS_IMPL_THREADSAFE_ADDREF(FileStream)
+-NS_IMPL_THREADSAFE_RELEASE(FileStream)
+-
+-NS_INTERFACE_MAP_BEGIN(FileStream)
+- NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStandardFileStream)
+- NS_INTERFACE_MAP_ENTRY(nsISeekableStream)
+- NS_INTERFACE_MAP_ENTRY(nsIInputStream)
+- NS_INTERFACE_MAP_ENTRY(nsIOutputStream)
+- NS_INTERFACE_MAP_ENTRY(nsIStandardFileStream)
+- NS_INTERFACE_MAP_ENTRY(nsIFileMetadata)
+-NS_INTERFACE_MAP_END
+-
+-NS_IMETHODIMP
+-FileStream::Seek(int32_t aWhence, int64_t aOffset)
+-{
+- // TODO: Add support for 64 bit file sizes, bug 752431
+- NS_ENSURE_TRUE(aOffset <= INT32_MAX, NS_ERROR_INVALID_ARG);
+-
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- int whence;
+- switch (aWhence) {
+- case nsISeekableStream::NS_SEEK_SET:
+- whence = SEEK_SET;
+- break;
+- case nsISeekableStream::NS_SEEK_CUR:
+- whence = SEEK_CUR;
+- break;
+- case nsISeekableStream::NS_SEEK_END:
+- whence = SEEK_END;
+- break;
+- default:
+- return NS_ERROR_INVALID_ARG;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- int rc = sqlite3_quota_fseek(mQuotaFile, aOffset, whence);
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+-
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Tell(int64_t* aResult)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- long rc = sqlite3_quota_ftell(mQuotaFile);
+- NS_ENSURE_TRUE(rc >= 0, NS_BASE_STREAM_OSERROR);
+-
+- *aResult = rc;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::SetEOF()
+-{
+- int64_t pos;
+- nsresult rv = Tell(&pos);
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- int rc = sqlite3_quota_ftruncate(mQuotaFile, pos);
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+-
+- return NS_OK;
+-}
+-
+-
+-NS_IMETHODIMP
+-FileStream::Close()
+-{
+- CleanUpOpen();
+-
+- if (mQuotaFile) {
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- int rc = sqlite3_quota_fclose(mQuotaFile);
+- mQuotaFile = nullptr;
+-
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+- }
+-
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Available(uint64_t* aResult)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- long rc = sqlite3_quota_file_available(mQuotaFile);
+- NS_ENSURE_TRUE(rc >= 0, NS_BASE_STREAM_OSERROR);
+-
+- *aResult = rc;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Read(char* aBuf, uint32_t aCount, uint32_t* aResult)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- size_t bytesRead = sqlite3_quota_fread(aBuf, 1, aCount, mQuotaFile);
+- if (bytesRead < aCount && sqlite3_quota_ferror(mQuotaFile)) {
+- return NS_BASE_STREAM_OSERROR;
+- }
+-
+- *aResult = bytesRead;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::ReadSegments(nsWriteSegmentFun aWriter, void* aClosure,
+- uint32_t aCount, uint32_t* aResult)
+-{
+- NS_NOTREACHED("Don't call me!");
+- return NS_ERROR_NOT_IMPLEMENTED;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::IsNonBlocking(bool *aNonBlocking)
+-{
+- *aNonBlocking = false;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Write(const char* aBuf, uint32_t aCount, uint32_t *aResult)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- size_t bytesWritten = sqlite3_quota_fwrite(aBuf, 1, aCount, mQuotaFile);
+- if (bytesWritten < aCount) {
+- return NS_BASE_STREAM_OSERROR;
+- }
+-
+- *aResult = bytesWritten;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Flush()
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- int rc = sqlite3_quota_fflush(mQuotaFile, 1);
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+-
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::WriteFrom(nsIInputStream *inStr, uint32_t count, uint32_t *_retval)
+-{
+- return NS_ERROR_NOT_IMPLEMENTED;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::WriteSegments(nsReadSegmentFun reader, void * closure, uint32_t count, uint32_t *_retval)
+-{
+- NS_NOTREACHED("Don't call me!");
+- return NS_ERROR_NOT_IMPLEMENTED;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::Init(nsIFile* aFile, const nsAString& aMode, int32_t aFlags)
+-{
+- NS_ASSERTION(!mQuotaFile && !mDeferredOpen, "Already initialized!");
+-
+- nsresult rv = aFile->GetPath(mFilePath);
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- mMode = aMode;
+- mFlags = aFlags;
+-
+- if (mFlags & nsIStandardFileStream::FLAGS_DEFER_OPEN) {
+- mDeferredOpen = true;
+- return NS_OK;
+- }
+-
+- return DoOpen();
+-}
+-
+-NS_IMETHODIMP
+-FileStream::GetSize(int64_t* _retval)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- // TODO: Use sqlite3_quota_file_size() here, bug 760783
+- int64_t rc = sqlite3_quota_file_truesize(mQuotaFile);
+-
+- NS_ASSERTION(rc >= 0, "The file is not under quota management!");
+-
+- *_retval = rc;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::GetLastModified(int64_t* _retval)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- time_t mtime;
+- int rc = sqlite3_quota_file_mtime(mQuotaFile, &mtime);
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+-
+- *_retval = mtime * PR_MSEC_PER_SEC;
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-FileStream::FlushBuffers()
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mQuotaFile) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- int rc = sqlite3_quota_fflush(mQuotaFile, 0);
+- NS_ENSURE_TRUE(rc == 0, NS_BASE_STREAM_OSERROR);
+-
+- return NS_OK;
+-}
+-
+-nsresult
+-FileStream::DoOpen()
+-{
+- NS_ASSERTION(!mFilePath.IsEmpty(), "Must have a file path");
+-
+- NS_ASSERTION(!NS_IsMainThread(), "Performing sync IO on the main thread!");
+-
+- quota_FILE* quotaFile =
+- sqlite3_quota_fopen(NS_ConvertUTF16toUTF8(mFilePath).get(),
+- NS_ConvertUTF16toUTF8(mMode).get());
+-
+- CleanUpOpen();
+-
+- if (!quotaFile) {
+- return NS_BASE_STREAM_OSERROR;
+- }
+-
+- mQuotaFile = quotaFile;
+-
+- return NS_OK;
+-}
+diff --git dom/indexedDB/FileStream.h dom/indexedDB/FileStream.h
+deleted file mode 100644
+index 09648b1..0000000
+--- mozilla/dom/indexedDB/FileStream.h
++++ /dev/null
+@@ -1,140 +0,0 @@
+-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+-/* vim: set ts=2 et sw=2 tw=80: */
+-/* This Source Code Form is subject to the terms of the Mozilla Public
+- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+- * You can obtain one at http://mozilla.org/MPL/2.0/. */
+-
+-#ifndef mozilla_dom_indexeddb_filestream_h__
+-#define mozilla_dom_indexeddb_filestream_h__
+-
+-#include "IndexedDatabase.h"
+-
+-#include "nsIFileStreams.h"
+-#include "nsIInputStream.h"
+-#include "nsIOutputStream.h"
+-#include "nsISeekableStream.h"
+-#include "nsIStandardFileStream.h"
+-
+-class nsIFile;
+-struct quota_FILE;
+-
+-BEGIN_INDEXEDDB_NAMESPACE
+-
+-class FileStream : public nsISeekableStream,
+- public nsIInputStream,
+- public nsIOutputStream,
+- public nsIStandardFileStream,
+- public nsIFileMetadata
+-{
+-public:
+- FileStream()
+- : mFlags(0),
+- mDeferredOpen(false),
+- mQuotaFile(nullptr)
+- { }
+-
+- virtual ~FileStream()
+- {
+- Close();
+- }
+-
+- NS_DECL_ISUPPORTS
+- NS_DECL_NSISEEKABLESTREAM
+- NS_DECL_NSISTANDARDFILESTREAM
+- NS_DECL_NSIFILEMETADATA
+-
+- // nsIInputStream
+- NS_IMETHOD
+- Close();
+-
+- NS_IMETHOD
+- Available(uint64_t* _retval);
+-
+- NS_IMETHOD
+- Read(char* aBuf, uint32_t aCount, uint32_t* _retval);
+-
+- NS_IMETHOD
+- ReadSegments(nsWriteSegmentFun aWriter, void* aClosure, uint32_t aCount,
+- uint32_t* _retval);
+-
+- NS_IMETHOD
+- IsNonBlocking(bool* _retval);
+-
+- // nsIOutputStream
+-
+- // Close() already declared
+-
+- NS_IMETHOD
+- Flush();
+-
+- NS_IMETHOD
+- Write(const char* aBuf, uint32_t aCount, uint32_t* _retval);
+-
+- NS_IMETHOD
+- WriteFrom(nsIInputStream* aFromStream, uint32_t aCount, uint32_t* _retval);
+-
+- NS_IMETHOD
+- WriteSegments(nsReadSegmentFun aReader, void* aClosure, uint32_t aCount,
+- uint32_t* _retval);
+-
+- // IsNonBlocking() already declared
+-
+-protected:
+- /**
+- * Cleans up data prepared in Init.
+- */
+- void
+- CleanUpOpen()
+- {
+- mFilePath.Truncate();
+- mDeferredOpen = false;
+- }
+-
+- /**
+- * Open the file. This is called either from Init
+- * or from DoPendingOpen (if FLAGS_DEFER_OPEN is used when initializing this
+- * stream). The default behavior of DoOpen is to open the file and save the
+- * file descriptor.
+- */
+- virtual nsresult
+- DoOpen();
+-
+- /**
+- * If there is a pending open, do it now. It's important for this to be
+- * inlined since we do it in almost every stream API call.
+- */
+- nsresult
+- DoPendingOpen()
+- {
+- if (!mDeferredOpen) {
+- return NS_OK;
+- }
+-
+- return DoOpen();
+- }
+-
+- /**
+- * Data we need to do an open.
+- */
+- nsString mFilePath;
+- nsString mMode;
+-
+- /**
+- * Flags describing our behavior. See the IDL file for possible values.
+- */
+- int32_t mFlags;
+-
+- /**
+- * Whether we have a pending open (see FLAGS_DEFER_OPEN in the IDL file).
+- */
+- bool mDeferredOpen;
+-
+- /**
+- * File descriptor for opened file.
+- */
+- quota_FILE* mQuotaFile;
+-};
+-
+-END_INDEXEDDB_NAMESPACE
+-
+-#endif // mozilla_dom_indexeddb_filestream_h__
+diff --git dom/indexedDB/IDBDatabase.cpp dom/indexedDB/IDBDatabase.cpp
+index 63500b0..8842daf 100644
+--- mozilla/dom/indexedDB/IDBDatabase.cpp
++++ mozilla/dom/indexedDB/IDBDatabase.cpp
+@@ -779,6 +779,12 @@ IDBDatabase::Close()
+ return NS_OK;
+ }
+
++const nsACString&
++IDBDatabase::StorageOrigin()
++{
++ return Origin();
++}
++
+ nsISupports*
+ IDBDatabase::StorageId()
+ {
+diff --git dom/indexedDB/IDBFactory.cpp dom/indexedDB/IDBFactory.cpp
+index 1007df1..c1f573e 100644
+--- mozilla/dom/indexedDB/IDBFactory.cpp
++++ mozilla/dom/indexedDB/IDBFactory.cpp
+@@ -253,8 +253,26 @@ IDBFactory::Create(ContentParent* aContentParent,
+ }
+
+ // static
++already_AddRefed<nsIFileURL>
++IDBFactory::GetDatabaseFileURL(nsIFile* aDatabaseFile, const nsACString& aOrigin)
++{
++ nsCOMPtr<nsIURI> uri;
++ nsresult rv = NS_NewFileURI(getter_AddRefs(uri), aDatabaseFile);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ nsCOMPtr<nsIFileURL> fileUrl = do_QueryInterface(uri);
++ NS_ASSERTION(fileUrl, "This should always succeed!");
++
++ rv = fileUrl->SetQuery(NS_LITERAL_CSTRING("origin=") + aOrigin);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ return fileUrl.forget();
++}
++
++// static
+ already_AddRefed<mozIStorageConnection>
+-IDBFactory::GetConnection(const nsAString& aDatabaseFilePath)
++IDBFactory::GetConnection(const nsAString& aDatabaseFilePath,
++ const nsACString& aOrigin)
+ {
+ NS_ASSERTION(IndexedDatabaseManager::IsMainProcess(), "Wrong process!");
+ NS_ASSERTION(StringEndsWith(aDatabaseFilePath, NS_LITERAL_STRING(".sqlite")),
+@@ -271,13 +289,15 @@ IDBFactory::GetConnection(const nsAString& aDatabaseFilePath)
+ NS_ENSURE_SUCCESS(rv, nullptr);
+ NS_ENSURE_TRUE(exists, nullptr);
+
+- nsCOMPtr<mozIStorageServiceQuotaManagement> ss =
++ nsCOMPtr<nsIFileURL> dbFileUrl = GetDatabaseFileURL(dbFile, aOrigin);
++ NS_ENSURE_TRUE(dbFileUrl, nullptr);
++
++ nsCOMPtr<mozIStorageService> ss =
+ do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID);
+ NS_ENSURE_TRUE(ss, nullptr);
+
+ nsCOMPtr<mozIStorageConnection> connection;
+- rv = ss->OpenDatabaseWithVFS(dbFile, NS_LITERAL_CSTRING("quota"),
+- getter_AddRefs(connection));
++ rv = ss->OpenDatabaseWithFileURL(dbFileUrl, getter_AddRefs(connection));
+ NS_ENSURE_SUCCESS(rv, nullptr);
+
+ // Turn on foreign key constraints and recursive triggers.
+diff --git dom/indexedDB/IDBFactory.h dom/indexedDB/IDBFactory.h
+index d5461f7..49dad42 100644
+--- mozilla/dom/indexedDB/IDBFactory.h
++++ mozilla/dom/indexedDB/IDBFactory.h
+@@ -15,6 +15,8 @@
+ #include "nsCycleCollectionParticipant.h"
+
+ class nsIAtom;
++class nsIFile;
++class nsIFileURL;
+ class nsPIDOMWindow;
+
+ namespace mozilla {
+@@ -75,8 +77,12 @@ public:
+ static nsresult Create(ContentParent* aContentParent,
+ IDBFactory** aFactory);
+
++ static already_AddRefed<nsIFileURL>
++ GetDatabaseFileURL(nsIFile* aDatabaseFile, const nsACString& aOrigin);
++
+ static already_AddRefed<mozIStorageConnection>
+- GetConnection(const nsAString& aDatabaseFilePath);
++ GetConnection(const nsAString& aDatabaseFilePath,
++ const nsACString& aOrigin);
+
+ static nsresult
+ LoadDatabaseInformation(mozIStorageConnection* aConnection,
+diff --git dom/indexedDB/IDBFileHandle.cpp dom/indexedDB/IDBFileHandle.cpp
+index e0340ff..f71fd56 100644
+--- mozilla/dom/indexedDB/IDBFileHandle.cpp
++++ mozilla/dom/indexedDB/IDBFileHandle.cpp
+@@ -6,15 +6,14 @@
+
+ #include "IDBFileHandle.h"
+
+-#include "nsIStandardFileStream.h"
+-
+ #include "mozilla/dom/file/File.h"
++#include "mozilla/dom/quota/FileStreams.h"
+ #include "nsDOMClassInfoID.h"
+
+-#include "FileStream.h"
+ #include "IDBDatabase.h"
+
+ USING_INDEXEDDB_NAMESPACE
++USING_QUOTA_NAMESPACE
+
+ namespace {
+
+@@ -68,22 +67,22 @@ IDBFileHandle::Create(IDBDatabase* aDatabase,
+ already_AddRefed<nsISupports>
+ IDBFileHandle::CreateStream(nsIFile* aFile, bool aReadOnly)
+ {
+- nsRefPtr<FileStream> stream = new FileStream();
++ const nsACString& origin = mFileStorage->StorageOrigin();
++
++ nsCOMPtr<nsISupports> result;
+
+- nsString streamMode;
+ if (aReadOnly) {
+- streamMode.AssignLiteral("rb");
++ nsRefPtr<FileInputStream> stream = FileInputStream::Create(
++ origin, aFile, -1, -1, nsIFileInputStream::DEFER_OPEN);
++ result = NS_ISUPPORTS_CAST(nsIFileInputStream*, stream);
+ }
+ else {
+- streamMode.AssignLiteral("r+b");
++ nsRefPtr<FileStream> stream = FileStream::Create(
++ origin, aFile, -1, -1, nsIFileStream::DEFER_OPEN);
++ result = NS_ISUPPORTS_CAST(nsIFileStream*, stream);
+ }
++ NS_ENSURE_TRUE(result, nullptr);
+
+- nsresult rv = stream->Init(aFile, streamMode,
+- nsIStandardFileStream::FLAGS_DEFER_OPEN);
+- NS_ENSURE_SUCCESS(rv, nullptr);
+-
+- nsCOMPtr<nsISupports> result =
+- NS_ISUPPORTS_CAST(nsIStandardFileStream*, stream);
+ return result.forget();
+ }
+
+diff --git dom/indexedDB/IDBObjectStore.cpp dom/indexedDB/IDBObjectStore.cpp
+index 746d473..1f16d26 100644
+--- mozilla/dom/indexedDB/IDBObjectStore.cpp
++++ mozilla/dom/indexedDB/IDBObjectStore.cpp
+@@ -17,6 +17,7 @@
+ #include "mozilla/dom/ContentParent.h"
+ #include "mozilla/dom/StructuredCloneTags.h"
+ #include "mozilla/dom/ipc/Blob.h"
++#include "mozilla/dom/quota/FileStreams.h"
+ #include "mozilla/storage.h"
+ #include "nsContentUtils.h"
+ #include "nsDOMClassInfo.h"
+@@ -27,10 +28,8 @@
+ #include "nsServiceManagerUtils.h"
+ #include "nsThreadUtils.h"
+ #include "snappy/snappy.h"
+-#include "test_quota.h"
+
+ #include "AsyncConnectionHelper.h"
+-#include "FileStream.h"
+ #include "IDBCursor.h"
+ #include "IDBEvents.h"
+ #include "IDBFileHandle.h"
+@@ -51,6 +50,7 @@
+ USING_INDEXEDDB_NAMESPACE
+ using namespace mozilla::dom;
+ using namespace mozilla::dom::indexedDB::ipc;
++using mozilla::dom::quota::FileOutputStream;
+
+ namespace {
+
+@@ -2734,9 +2734,9 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
+ nativeFile = fileManager->GetFileForId(directory, id);
+ NS_ENSURE_TRUE(nativeFile, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- nsRefPtr<FileStream> outputStream = new FileStream();
+- rv = outputStream->Init(nativeFile, NS_LITERAL_STRING("wb"), 0);
+- NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
++ nsRefPtr<FileOutputStream> outputStream = FileOutputStream::Create(
++ mObjectStore->Transaction()->Database()->Origin(), nativeFile);
++ NS_ENSURE_TRUE(outputStream, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+ rv = CopyData(inputStream, outputStream);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+diff --git dom/indexedDB/IDBTransaction.cpp dom/indexedDB/IDBTransaction.cpp
+index fcef7cc..a5345e2 100644
+--- mozilla/dom/indexedDB/IDBTransaction.cpp
++++ mozilla/dom/indexedDB/IDBTransaction.cpp
+@@ -352,7 +352,8 @@ IDBTransaction::GetOrCreateConnection(mozIStorageConnection** aResult)
+
+ if (!mConnection) {
+ nsCOMPtr<mozIStorageConnection> connection =
+- IDBFactory::GetConnection(mDatabase->FilePath());
++ IDBFactory::GetConnection(mDatabase->FilePath(),
++ mDatabase->Origin());
+ NS_ENSURE_TRUE(connection, NS_ERROR_FAILURE);
+
+ nsresult rv;
+diff --git dom/indexedDB/IndexedDatabaseInlines.h dom/indexedDB/IndexedDatabaseInlines.h
+index 62e65d6..f27d60c 100644
+--- mozilla/dom/indexedDB/IndexedDatabaseInlines.h
++++ mozilla/dom/indexedDB/IndexedDatabaseInlines.h
+@@ -79,4 +79,17 @@ AppendConditionClause(const nsACString& aColumnName,
+ aResult += NS_LITERAL_CSTRING(" :") + aArgName;
+ }
+
++inline void
++IncrementUsage(uint64_t* aUsage, uint64_t aDelta)
++{
++ // Watch for overflow!
++ if ((UINT64_MAX - *aUsage) < aDelta) {
++ NS_WARNING("Usage exceeds the maximum!");
++ *aUsage = UINT64_MAX;
++ }
++ else {
++ *aUsage += aDelta;
++ }
++}
++
+ END_INDEXEDDB_NAMESPACE
+diff --git dom/indexedDB/IndexedDatabaseManager.cpp dom/indexedDB/IndexedDatabaseManager.cpp
+index e4ad647..88f09da 100644
+--- mozilla/dom/indexedDB/IndexedDatabaseManager.cpp
++++ mozilla/dom/indexedDB/IndexedDatabaseManager.cpp
+@@ -22,6 +22,7 @@
+ #include "nsITimer.h"
+
+ #include "mozilla/dom/file/FileService.h"
++#include "mozilla/dom/quota/QuotaManager.h"
+ #include "mozilla/dom/TabContext.h"
+ #include "mozilla/LazyIdleThread.h"
+ #include "mozilla/Preferences.h"
+@@ -36,7 +37,6 @@
+ #include "nsThreadUtils.h"
+ #include "nsXPCOM.h"
+ #include "nsXPCOMPrivate.h"
+-#include "test_quota.h"
+ #include "xpcpublic.h"
+
+ #include "AsyncConnectionHelper.h"
+@@ -48,6 +48,8 @@
+ #include "OpenDatabaseHelper.h"
+ #include "TransactionThreadPool.h"
+
++#include "IndexedDatabaseInlines.h"
++
+ // The amount of time, in milliseconds, that our IO thread will stay alive
+ // after the last event it processes.
+ #define DEFAULT_THREAD_TIMEOUT_MS 30000
+@@ -70,6 +72,7 @@ using namespace mozilla::services;
+ using namespace mozilla::dom;
+ using mozilla::Preferences;
+ using mozilla::dom::file::FileService;
++using mozilla::dom::quota::QuotaManager;
+
+ static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
+
+@@ -103,29 +106,6 @@ GetDatabaseBaseFilename(const nsAString& aFilename,
+ return true;
+ }
+
+-class QuotaCallback MOZ_FINAL : public mozIStorageQuotaCallback
+-{
+-public:
+- NS_DECL_ISUPPORTS
+-
+- NS_IMETHOD
+- QuotaExceeded(const nsACString& aFilename,
+- int64_t aCurrentSizeLimit,
+- int64_t aCurrentTotalSize,
+- nsISupports* aUserData,
+- int64_t* _retval)
+- {
+- if (IndexedDatabaseManager::QuotaIsLifted()) {
+- *_retval = 0;
+- return NS_OK;
+- }
+-
+- return NS_ERROR_FAILURE;
+- }
+-};
+-
+-NS_IMPL_THREADSAFE_ISUPPORTS1(QuotaCallback, mozIStorageQuotaCallback)
+-
+ // Adds all databases in the hash to the given array.
+ template <class T>
+ PLDHashOperator
+@@ -440,8 +420,8 @@ IndexedDatabaseManager::GetOrCreate()
+ NS_LITERAL_CSTRING("IndexedDB I/O"),
+ LazyIdleThread::ManualShutdown);
+
+- // We need one quota callback object to hand to SQLite.
+- instance->mQuotaCallbackSingleton = new QuotaCallback();
++ // Make sure that the quota manager is up.
++ NS_ENSURE_TRUE(QuotaManager::GetOrCreate(), nullptr);
+
+ // Make a timer here to avoid potential failures later. We don't actually
+ // initialize the timer until shutdown.
+@@ -996,37 +976,15 @@ IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
+ return NS_OK;
+ }
+
+- // First figure out the filename pattern we'll use.
+- nsCOMPtr<nsIFile> patternFile;
+- rv = directory->Clone(getter_AddRefs(patternFile));
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- rv = patternFile->Append(NS_LITERAL_STRING("*"));
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- nsString pattern;
+- rv = patternFile->GetPath(pattern);
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- // Now tell SQLite to start tracking this pattern for content.
+- nsCOMPtr<mozIStorageServiceQuotaManagement> ss =
+- do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID);
+- NS_ENSURE_TRUE(ss, NS_ERROR_FAILURE);
+-
+- if (aPrivilege != Chrome) {
+- rv = ss->SetQuotaForFilenamePattern(NS_ConvertUTF16toUTF8(pattern),
+- GetIndexedDBQuotaMB() * 1024 * 1024,
+- mQuotaCallbackSingleton, nullptr);
+- NS_ENSURE_SUCCESS(rv, rv);
+- }
+-
+ // We need to see if there are any files in the directory already. If they
+ // are database files then we need to cleanup stored files (if it's needed)
+- // and also tell SQLite about all of them.
++ // and also initialize the quota.
+
+ nsAutoTArray<nsString, 20> subdirsToProcess;
+ nsAutoTArray<nsCOMPtr<nsIFile> , 20> unknownFiles;
+
++ uint64_t usage = 0;
++
+ nsTHashtable<nsStringHashKey> validSubdirs;
+ validSubdirs.Init(20);
+
+@@ -1068,20 +1026,28 @@ IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
+ continue;
+ }
+
+- nsCOMPtr<nsIFile> fileManagerDirectory;
+- rv = directory->Clone(getter_AddRefs(fileManagerDirectory));
++ nsCOMPtr<nsIFile> fmDirectory;
++ rv = directory->Clone(getter_AddRefs(fmDirectory));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- rv = fileManagerDirectory->Append(dbBaseFilename);
++ rv = fmDirectory->Append(dbBaseFilename);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- rv = FileManager::InitDirectory(ss, fileManagerDirectory, file,
+- aPrivilege);
++ rv = FileManager::InitDirectory(fmDirectory, file, aOrigin);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (aPrivilege != Chrome) {
+- rv = ss->UpdateQuotaInformationForFile(file);
++ uint64_t fileUsage;
++ rv = FileManager::GetUsage(fmDirectory, &fileUsage);
+ NS_ENSURE_SUCCESS(rv, rv);
++
++ IncrementUsage(&usage, fileUsage);
++
++ int64_t fileSize;
++ rv = file->GetFileSize(&fileSize);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ IncrementUsage(&usage, uint64_t(fileSize));
+ }
+
+ validSubdirs.PutEntry(dbBaseFilename);
+@@ -1117,12 +1083,39 @@ IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
+ }
+ }
+
++ if (aPrivilege != Chrome) {
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->InitQuotaForOrigin(aOrigin, GetIndexedDBQuotaMB(), usage);
++ }
++
+ mInitializedOrigins.AppendElement(aOrigin);
+
+ NS_ADDREF(*aDirectory = directory);
+ return NS_OK;
+ }
+
++void
++IndexedDatabaseManager::UninitializeOriginsByPattern(
++ const nsACString& aPattern)
++{
++#ifdef DEBUG
++ {
++ bool correctThread;
++ NS_ASSERTION(NS_SUCCEEDED(mIOThread->IsOnCurrentThread(&correctThread)) &&
++ correctThread,
++ "Running on the wrong thread!");
++ }
++#endif
++
++ for (int32_t i = mInitializedOrigins.Length() - 1; i >= 0; i--) {
++ if (PatternMatchesOrigin(aPattern, mInitializedOrigins[i])) {
++ mInitializedOrigins.RemoveElementAt(i);
++ }
++ }
++}
++
+ bool
+ IndexedDatabaseManager::QuotaIsLiftedInternal()
+ {
+@@ -1250,16 +1243,14 @@ IndexedDatabaseManager::GetFileManager(const nsACString& aOrigin,
+ }
+
+ void
+-IndexedDatabaseManager::AddFileManager(const nsACString& aOrigin,
+- const nsAString& aDatabaseName,
+- FileManager* aFileManager)
++IndexedDatabaseManager::AddFileManager(FileManager* aFileManager)
+ {
+ NS_ASSERTION(aFileManager, "Null file manager!");
+
+ nsTArray<nsRefPtr<FileManager> >* array;
+- if (!mFileManagers.Get(aOrigin, &array)) {
++ if (!mFileManagers.Get(aFileManager->Origin(), &array)) {
+ array = new nsTArray<nsRefPtr<FileManager> >();
+- mFileManagers.Put(aOrigin, array);
++ mFileManagers.Put(aFileManager->Origin(), array);
+ }
+
+ array->AppendElement(aFileManager);
+@@ -1783,6 +1774,13 @@ OriginClearRunnable::DeleteFiles(IndexedDatabaseManager* aManager)
+ // correctly...
+ NS_ERROR("Failed to remove directory!");
+ }
++
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->RemoveQuotaForPattern(mOriginOrPattern);
++
++ aManager->UninitializeOriginsByPattern(mOriginOrPattern);
+ }
+ }
+
+@@ -1880,19 +1878,6 @@ IndexedDatabaseManager::AsyncUsageRunnable::Cancel()
+ }
+ }
+
+-inline void
+-IncrementUsage(uint64_t* aUsage, uint64_t aDelta)
+-{
+- // Watch for overflow!
+- if ((INT64_MAX - *aUsage) <= aDelta) {
+- NS_WARNING("Database sizes exceed max we can report!");
+- *aUsage = INT64_MAX;
+- }
+- else {
+- *aUsage += aDelta;
+- }
+-}
+-
+ nsresult
+ IndexedDatabaseManager::AsyncUsageRunnable::TakeShortcut()
+ {
+@@ -2295,25 +2280,22 @@ IndexedDatabaseManager::AsyncDeleteFileRunnable::Run()
+ nsCOMPtr<nsIFile> file = mFileManager->GetFileForId(directory, mFileId);
+ NS_ENSURE_TRUE(file, NS_ERROR_FAILURE);
+
+- nsString filePath;
+- nsresult rv = file->GetPath(filePath);
+- NS_ENSURE_SUCCESS(rv, rv);
++ nsresult rv;
++ int64_t fileSize;
+
+- int rc = sqlite3_quota_remove(NS_ConvertUTF16toUTF8(filePath).get());
+- if (rc != SQLITE_OK) {
+- NS_WARNING("Failed to delete stored file!");
+- return NS_ERROR_FAILURE;
++ if (mFileManager->Privilege() != Chrome) {
++ rv = file->GetFileSize(&fileSize);
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
+ }
+
+- // sqlite3_quota_remove won't actually remove anything if we're not tracking
+- // the quota here. Manually remove the file if it exists.
+- bool exists;
+- rv = file->Exists(&exists);
+- NS_ENSURE_SUCCESS(rv, rv);
++ rv = file->Remove(false);
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
+
+- if (exists) {
+- rv = file->Remove(false);
+- NS_ENSURE_SUCCESS(rv, rv);
++ if (mFileManager->Privilege() != Chrome) {
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->DecreaseUsageForOrigin(mFileManager->Origin(), fileSize);
+ }
+
+ directory = mFileManager->GetJournalDirectory();
+diff --git dom/indexedDB/IndexedDatabaseManager.h dom/indexedDB/IndexedDatabaseManager.h
+index f9fbbf2..1ea5425 100644
+--- mozilla/dom/indexedDB/IndexedDatabaseManager.h
++++ mozilla/dom/indexedDB/IndexedDatabaseManager.h
+@@ -23,7 +23,6 @@
+
+ #define INDEXEDDB_MANAGER_CONTRACTID "@mozilla.org/dom/indexeddb/manager;1"
+
+-class mozIStorageQuotaCallback;
+ class nsIAtom;
+ class nsIFile;
+ class nsITimer;
+@@ -134,6 +133,8 @@ public:
+ FactoryPrivilege aPrivilege,
+ nsIFile** aDirectory);
+
++ void UninitializeOriginsByPattern(const nsACString& aPattern);
++
+ // Determine if the quota is lifted for the Window the current thread is
+ // using.
+ static inline bool
+@@ -172,9 +173,7 @@ public:
+ const nsAString& aDatabaseName);
+
+ void
+- AddFileManager(const nsACString& aOrigin,
+- const nsAString& aDatabaseName,
+- FileManager* aFileManager);
++ AddFileManager(FileManager* aFileManager);
+
+ void InvalidateFileManagersForPattern(const nsACString& aPattern);
+
+@@ -502,10 +501,6 @@ private:
+ // A timer that gets activated at shutdown to ensure we close all databases.
+ nsCOMPtr<nsITimer> mShutdownTimer;
+
+- // A single threadsafe instance of our quota callback. Created on the main
+- // thread during GetOrCreate().
+- nsCOMPtr<mozIStorageQuotaCallback> mQuotaCallbackSingleton;
+-
+ // A list of all successfully initialized origins. This list isn't protected
+ // by any mutex but it is only ever touched on the IO thread.
+ nsTArray<nsCString> mInitializedOrigins;
+diff --git dom/indexedDB/Makefile.in dom/indexedDB/Makefile.in
+index fef0858..09d4853 100644
+--- mozilla/dom/indexedDB/Makefile.in
++++ mozilla/dom/indexedDB/Makefile.in
+@@ -25,7 +25,6 @@ CPPSRCS = \
+ DatabaseInfo.cpp \
+ FileInfo.cpp \
+ FileManager.cpp \
+- FileStream.cpp \
+ IDBCursor.cpp \
+ IDBDatabase.cpp \
+ IDBEvents.cpp \
+@@ -93,7 +92,6 @@ XPIDLSRCS = \
+ nsIIDBVersionChangeEvent.idl \
+ nsIIDBOpenDBRequest.idl \
+ nsIIndexedDatabaseManager.idl \
+- nsIStandardFileStream.idl \
+ $(NULL)
+
+ DIRS += ipc
+diff --git dom/indexedDB/OpenDatabaseHelper.cpp dom/indexedDB/OpenDatabaseHelper.cpp
+index e71cad4..4cd7f61 100644
+--- mozilla/dom/indexedDB/OpenDatabaseHelper.cpp
++++ mozilla/dom/indexedDB/OpenDatabaseHelper.cpp
+@@ -8,11 +8,12 @@
+
+ #include "nsIFile.h"
+
++#include "mozilla/dom/quota/QuotaManager.h"
+ #include "mozilla/storage.h"
+ #include "nsEscape.h"
++#include "nsNetUtil.h"
+ #include "nsThreadUtils.h"
+ #include "snappy/snappy.h"
+-#include "test_quota.h"
+
+ #include "nsIBFCacheEntry.h"
+ #include "IDBEvents.h"
+@@ -21,6 +22,7 @@
+
+ using namespace mozilla;
+ USING_INDEXEDDB_NAMESPACE
++USING_QUOTA_NAMESPACE
+
+ namespace {
+
+@@ -1632,15 +1634,15 @@ OpenDatabaseHelper::DoDatabaseWork()
+ rv = dbFile->GetPath(mDatabaseFilePath);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- nsCOMPtr<nsIFile> fileManagerDirectory;
+- rv = dbDirectory->Clone(getter_AddRefs(fileManagerDirectory));
++ nsCOMPtr<nsIFile> fmDirectory;
++ rv = dbDirectory->Clone(getter_AddRefs(fmDirectory));
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- rv = fileManagerDirectory->Append(filename);
++ rv = fmDirectory->Append(filename);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+ nsCOMPtr<mozIStorageConnection> connection;
+- rv = CreateDatabaseConnection(mName, dbFile, fileManagerDirectory,
++ rv = CreateDatabaseConnection(dbFile, fmDirectory, mName, mASCIIOrigin,
+ getter_AddRefs(connection));
+ if (NS_FAILED(rv) &&
+ NS_ERROR_GET_MODULE(rv) != NS_ERROR_MODULE_DOM_INDEXEDDB) {
+@@ -1691,12 +1693,12 @@ OpenDatabaseHelper::DoDatabaseWork()
+
+ nsRefPtr<FileManager> fileManager = mgr->GetFileManager(mASCIIOrigin, mName);
+ if (!fileManager) {
+- fileManager = new FileManager(mASCIIOrigin, mName);
++ fileManager = new FileManager(mASCIIOrigin, mPrivilege, mName);
+
+- rv = fileManager->Init(fileManagerDirectory, connection);
++ rv = fileManager->Init(fmDirectory, connection);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- mgr->AddFileManager(mASCIIOrigin, mName, fileManager);
++ mgr->AddFileManager(fileManager);
+ }
+
+ mFileManager = fileManager.forget();
+@@ -1707,23 +1709,26 @@ OpenDatabaseHelper::DoDatabaseWork()
+ // static
+ nsresult
+ OpenDatabaseHelper::CreateDatabaseConnection(
+- const nsAString& aName,
+ nsIFile* aDBFile,
+- nsIFile* aFileManagerDirectory,
++ nsIFile* aFMDirectory,
++ const nsAString& aName,
++ const nsACString& aOrigin,
+ mozIStorageConnection** aConnection)
+ {
+ NS_ASSERTION(IndexedDatabaseManager::IsMainProcess(), "Wrong process!");
+ NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
+
+- NS_NAMED_LITERAL_CSTRING(quotaVFSName, "quota");
++ nsCOMPtr<nsIFileURL> dbFileUrl =
++ IDBFactory::GetDatabaseFileURL(aDBFile, aOrigin);
++ NS_ENSURE_TRUE(dbFileUrl, NS_ERROR_FAILURE);
+
+- nsCOMPtr<mozIStorageServiceQuotaManagement> ss =
++ nsCOMPtr<mozIStorageService> ss =
+ do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID);
+ NS_ENSURE_TRUE(ss, NS_ERROR_FAILURE);
+
+ nsCOMPtr<mozIStorageConnection> connection;
+- nsresult rv = ss->OpenDatabaseWithVFS(aDBFile, quotaVFSName,
+- getter_AddRefs(connection));
++ nsresult rv =
++ ss->OpenDatabaseWithFileURL(dbFileUrl, getter_AddRefs(connection));
+ if (rv == NS_ERROR_FILE_CORRUPTED) {
+ // If we're just opening the database during origin initialization, then
+ // we don't want to erase any files. The failure here will fail origin
+@@ -1737,21 +1742,20 @@ OpenDatabaseHelper::CreateDatabaseConnection(
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ bool exists;
+- rv = aFileManagerDirectory->Exists(&exists);
++ rv = aFMDirectory->Exists(&exists);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (exists) {
+ bool isDirectory;
+- rv = aFileManagerDirectory->IsDirectory(&isDirectory);
++ rv = aFMDirectory->IsDirectory(&isDirectory);
+ NS_ENSURE_SUCCESS(rv, rv);
+ NS_ENSURE_TRUE(isDirectory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- rv = aFileManagerDirectory->Remove(true);
++ rv = aFMDirectory->Remove(true);
+ NS_ENSURE_SUCCESS(rv, rv);
+ }
+
+- rv = ss->OpenDatabaseWithVFS(aDBFile, quotaVFSName,
+- getter_AddRefs(connection));
++ rv = ss->OpenDatabaseWithFileURL(dbFileUrl, getter_AddRefs(connection));
+ }
+ NS_ENSURE_SUCCESS(rv, rv);
+
+@@ -2347,6 +2351,8 @@ DeleteDatabaseHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
+ {
+ NS_ASSERTION(!aConnection, "How did we get a connection here?");
+
++ const FactoryPrivilege& privilege = mOpenHelper->Privilege();
++
+ IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get();
+ NS_ASSERTION(mgr, "This should never fail!");
+
+@@ -2372,59 +2378,57 @@ DeleteDatabaseHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
+ rv = dbFile->Exists(&exists);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- int rc;
+-
+ if (exists) {
+- nsString dbFilePath;
+- rv = dbFile->GetPath(dbFilePath);
+- NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
++ int64_t fileSize;
+
+- rc = sqlite3_quota_remove(NS_ConvertUTF16toUTF8(dbFilePath).get());
+- if (rc != SQLITE_OK) {
+- NS_WARNING("Failed to delete db file!");
+- return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
++ if (privilege != Chrome) {
++ rv = dbFile->GetFileSize(&fileSize);
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+ }
+
+- // sqlite3_quota_remove won't actually remove anything if we're not tracking
+- // the quota here. Manually remove the file if it exists.
+- rv = dbFile->Exists(&exists);
++ rv = dbFile->Remove(false);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- if (exists) {
+- rv = dbFile->Remove(false);
+- NS_ENSURE_SUCCESS(rv, rv);
++ if (privilege != Chrome) {
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->DecreaseUsageForOrigin(mASCIIOrigin, fileSize);
+ }
+ }
+
+- nsCOMPtr<nsIFile> fileManagerDirectory;
+- rv = directory->Clone(getter_AddRefs(fileManagerDirectory));
+- NS_ENSURE_SUCCESS(rv, rv);
++ nsCOMPtr<nsIFile> fmDirectory;
++ rv = directory->Clone(getter_AddRefs(fmDirectory));
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- rv = fileManagerDirectory->Append(filename);
++ rv = fmDirectory->Append(filename);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- rv = fileManagerDirectory->Exists(&exists);
++ rv = fmDirectory->Exists(&exists);
+ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+ if (exists) {
+ bool isDirectory;
+- rv = fileManagerDirectory->IsDirectory(&isDirectory);
++ rv = fmDirectory->IsDirectory(&isDirectory);
+ NS_ENSURE_SUCCESS(rv, rv);
+ NS_ENSURE_TRUE(isDirectory, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+
+- nsString fileManagerDirectoryPath;
+- rv = fileManagerDirectory->GetPath(fileManagerDirectoryPath);
+- NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
++ uint64_t usage = 0;
+
+- rc = sqlite3_quota_remove(
+- NS_ConvertUTF16toUTF8(fileManagerDirectoryPath).get());
+- if (rc != SQLITE_OK) {
+- NS_WARNING("Failed to delete file directory!");
+- return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
++ if (privilege != Chrome) {
++ rv = FileManager::GetUsage(fmDirectory, &usage);
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
+ }
+
+- rv = fileManagerDirectory->Remove(true);
+- NS_ENSURE_SUCCESS(rv, rv);
++ rv = fmDirectory->Remove(true);
++ NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
++
++ if (privilege != Chrome) {
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->DecreaseUsageForOrigin(mASCIIOrigin, usage);
++ }
+ }
+
+ return NS_OK;
+diff --git dom/indexedDB/OpenDatabaseHelper.h dom/indexedDB/OpenDatabaseHelper.h
+index 587301b..5a3d987 100644
+--- mozilla/dom/indexedDB/OpenDatabaseHelper.h
++++ mozilla/dom/indexedDB/OpenDatabaseHelper.h
+@@ -77,10 +77,16 @@ public:
+ return mDatabase;
+ }
+
++ const FactoryPrivilege& Privilege() const
++ {
++ return mPrivilege;
++ }
++
+ static
+- nsresult CreateDatabaseConnection(const nsAString& aName,
+- nsIFile* aDBFile,
+- nsIFile* aFileManagerDirectory,
++ nsresult CreateDatabaseConnection(nsIFile* aDBFile,
++ nsIFile* aFMDirectory,
++ const nsAString& aName,
++ const nsACString& aOrigin,
+ mozIStorageConnection** aConnection);
+
+ protected:
+diff --git dom/indexedDB/nsIStandardFileStream.idl dom/indexedDB/nsIStandardFileStream.idl
+deleted file mode 100644
+index 265c3ed..0000000
+--- mozilla/dom/indexedDB/nsIStandardFileStream.idl
++++ /dev/null
+@@ -1,60 +0,0 @@
+-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+-/* vim: set ts=2 et sw=2 tw=80: */
+-/* This Source Code Form is subject to the terms of the Mozilla Public
+- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+- * You can obtain one at http://mozilla.org/MPL/2.0/. */
+-
+-#include "nsISupports.idl"
+-
+-interface nsIFile;
+-
+-/**
+- * A stream that allows you to read from a file or stream to a file
+- * using standard file APIs.
+- */
+-[scriptable, uuid(ebbbb779-92a3-4b2a-b7cf-6efbe904c453)]
+-interface nsIStandardFileStream : nsISupports
+-{
+- /**
+- * If this is set, the file will be opened (i.e., a call to
+- * fopen done) only when we do an actual operation on the stream,
+- * or more specifically, when one of the following is called:
+- * - Seek
+- * - Tell
+- * - SetEOF
+- * - Available
+- * - Read
+- * - Write
+- * - Flush
+- * - GetSize
+- * - GetLastModified
+- * - Sync
+- *
+- * FLAGS_DEFER_OPEN is useful if we use the stream on a background
+- * thread, so that the opening and possible |stat|ing of the file
+- * happens there as well.
+- *
+- * @note Using this flag results in the file not being opened
+- * during the call to Init. This means that any errors that might
+- * happen when this flag is not set would happen during the
+- * first read. Also, the file is not locked when Init is called,
+- * so it might be deleted before we try to read from it.
+- */
+- const long FLAGS_DEFER_OPEN = 1 << 0;
+-
+- /**
+- * @param file file to read from or stream to
+- * @param mode file open mode (see fopen documentation)
+- * @param flags flags specifying various behaviors of the class
+- * (see enumerations in the class)
+- */
+- void init(in nsIFile file,
+- in AString mode,
+- in long flags);
+-
+- /**
+- * Flush all written content held in memory buffers out to disk.
+- * This is the equivalent of fflush()
+- */
+- void flushBuffers();
+-};
+diff --git dom/indexedDB/test/Makefile.in dom/indexedDB/test/Makefile.in
+index 9c79b14..4c9a201 100644
+--- mozilla/dom/indexedDB/test/Makefile.in
++++ mozilla/dom/indexedDB/test/Makefile.in
+@@ -54,11 +54,13 @@ MOCHITEST_FILES = \
+ test_file_os_delete.html \
+ test_file_put_get_object.html \
+ test_file_put_get_values.html \
++ test_file_quota.html \
+ test_file_replace.html \
+ test_file_resurrection_delete.html \
+ test_file_resurrection_transaction_abort.html \
+ test_file_sharing.html \
+ test_file_transaction_abort.html \
++ test_filehandle_quota.html \
+ test_filehandle_serialization.html \
+ test_filehandle_store_snapshot.html \
+ test_getAll.html \
+diff --git dom/indexedDB/test/file.js dom/indexedDB/test/file.js
+index 07bd10a..3c6194a 100644
+--- mozilla/dom/indexedDB/test/file.js
++++ mozilla/dom/indexedDB/test/file.js
+@@ -3,6 +3,8 @@
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
++const DEFAULT_QUOTA = 50 * 1024 * 1024;
++
+ var bufferCache = [];
+ var utils = SpecialPowers.getDOMWindowUtils(window);
+
+@@ -184,25 +186,6 @@ function getUsage(usageHandler)
+ idbManager.getUsageForURI(uri, callback);
+ }
+
+-function getUsageSync()
+-{
+- let usage;
+-
+- getUsage(function(aUsage, aFileUsage) {
+- usage = aUsage;
+- });
+-
+- let comp = SpecialPowers.wrap(Components);
+- let thread = comp.classes["@mozilla.org/thread-manager;1"]
+- .getService(comp.interfaces.nsIThreadManager)
+- .currentThread;
+- while (!usage) {
+- thread.processNextEvent(true);
+- }
+-
+- return usage;
+-}
+-
+ function scheduleGC()
+ {
+ SpecialPowers.exactGC(window, continueToNextStep);
+diff --git dom/indexedDB/test/test_file_quota.html dom/indexedDB/test/test_file_quota.html
+index b07880d..9fbc0c0 100644
+--- mozilla/dom/indexedDB/test/test_file_quota.html
++++ mozilla/dom/indexedDB/test/test_file_quota.html
+@@ -13,14 +13,12 @@
+ function testSteps()
+ {
+ const READ_WRITE = IDBTransaction.READ_WRITE;
+- const DEFAULT_QUOTA_MB = 50;
+
+ const name = window.location.pathname;
+
+ const objectStoreName = "Blobs";
+
+- const testData = { key: 0, value: {} };
+- const fileData = { key: 1, file: null };
++ const fileData = { key: 1, file: getNullFile("random.bin", DEFAULT_QUOTA) };
+
+ let request = indexedDB.open(name, 1);
+ request.onerror = errorHandler;
+@@ -32,21 +30,17 @@
+
+ let db = event.target.result;
+
+- let objectStore = db.createObjectStore(objectStoreName, { });
+- objectStore.add(testData.value, testData.key);
+-
+- let size = (DEFAULT_QUOTA_MB + 1) * 1024 * 1024 - getUsageSync();
+- fileData.file = getNullFile("random.bin", size);
++ db.createObjectStore(objectStoreName, { });
+
+ event = yield;
+
+ is(event.type, "success", "Got correct event type");
+
+ trans = db.transaction([objectStoreName], READ_WRITE);
+- objectStore = trans.objectStore(objectStoreName);
++ let objectStore = trans.objectStore(objectStoreName);
+
+ request = objectStore.add(fileData.file, fileData.key);
+- request.addEventListener("error", new ExpectError("UnknownError"));
++ request.addEventListener("error", new ExpectError("UnknownError", true));
+ request.onsuccess = unexpectedSuccessHandler;
+ event = yield;
+
+diff --git dom/indexedDB/test/test_filehandle_quota.html dom/indexedDB/test/test_filehandle_quota.html
+index addaf01..0506279 100644
+--- mozilla/dom/indexedDB/test/test_filehandle_quota.html
++++ mozilla/dom/indexedDB/test/test_filehandle_quota.html
+@@ -13,7 +13,6 @@
+ function testSteps()
+ {
+ const READ_WRITE = IDBTransaction.READ_WRITE;
+- const DEFAULT_QUOTA_MB = 50;
+
+ const name = window.location.pathname;
+
+@@ -39,10 +38,10 @@
+
+ let lockedFile = fileHandle.open("readwrite");
+
+- let blob = getNullBlob((50 + 1) * 1024 * 1024 - getUsageSync());
++ let blob = getNullBlob(DEFAULT_QUOTA);
+
+ request = lockedFile.write(blob);
+- request.addEventListener("error", new ExpectError("UnknownError"));
++ request.addEventListener("error", new ExpectError("UnknownError", true));
+ request.onsuccess = unexpectedSuccessHandler;
+ event = yield;
+
+diff --git dom/quota/FileStreams.cpp dom/quota/FileStreams.cpp
+new file mode 100644
+index 0000000..9de244f
+--- /dev/null
++++ mozilla/dom/quota/FileStreams.cpp
+@@ -0,0 +1,123 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#include "FileStreams.h"
++
++USING_QUOTA_NAMESPACE
++
++template <class FileStreamBase>
++NS_IMETHODIMP
++FileQuotaStream<FileStreamBase>::SetEOF()
++{
++ nsresult rv = FileStreamBase::SetEOF();
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ if (mQuotaObject) {
++ int64_t offset;
++ nsresult rv = FileStreamBase::Tell(&offset);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ mQuotaObject->UpdateSize(offset);
++ }
++
++ return NS_OK;
++}
++
++template <class FileStreamBase>
++NS_IMETHODIMP
++FileQuotaStream<FileStreamBase>::Close()
++{
++ nsresult rv = FileStreamBase::Close();
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ mQuotaObject = nullptr;
++
++ return NS_OK;
++}
++
++template <class FileStreamBase>
++nsresult
++FileQuotaStream<FileStreamBase>::DoOpen()
++{
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ NS_ASSERTION(!mQuotaObject, "Creating quota object more than once?");
++ mQuotaObject = quotaManager->GetQuotaObject(mOrigin,
++ FileStreamBase::mOpenParams.localFile);
++
++ nsresult rv = FileStreamBase::DoOpen();
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ if (mQuotaObject && (FileStreamBase::mOpenParams.ioFlags & PR_TRUNCATE)) {
++ mQuotaObject->UpdateSize(0);
++ }
++
++ return NS_OK;
++}
++
++template <class FileStreamBase>
++NS_IMETHODIMP
++FileQuotaStreamWithWrite<FileStreamBase>::Write(const char* aBuf,
++ uint32_t aCount,
++ uint32_t* _retval)
++{
++ nsresult rv;
++
++ if (FileQuotaStreamWithWrite::mQuotaObject) {
++ int64_t offset;
++ rv = FileStreamBase::Tell(&offset);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ if (!FileQuotaStreamWithWrite::
++ mQuotaObject->MaybeAllocateMoreSpace(offset, aCount)) {
++ return NS_ERROR_FAILURE;
++ }
++ }
++
++ rv = FileStreamBase::Write(aBuf, aCount, _retval);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ return NS_OK;
++}
++
++NS_IMPL_ISUPPORTS_INHERITED0(FileInputStream, nsFileInputStream)
++
++already_AddRefed<FileInputStream>
++FileInputStream::Create(const nsACString& aOrigin, nsIFile* aFile,
++ int32_t aIOFlags, int32_t aPerm,
++ int32_t aBehaviorFlags)
++{
++ nsRefPtr<FileInputStream> stream = new FileInputStream(aOrigin);
++ nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++ return stream.forget();
++}
++
++NS_IMPL_ISUPPORTS_INHERITED0(FileOutputStream, nsFileOutputStream)
++
++already_AddRefed<FileOutputStream>
++FileOutputStream::Create(const nsACString& aOrigin, nsIFile* aFile,
++ int32_t aIOFlags, int32_t aPerm,
++ int32_t aBehaviorFlags)
++{
++ nsRefPtr<FileOutputStream> stream = new FileOutputStream(aOrigin);
++ nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++ return stream.forget();
++}
++
++NS_IMPL_ISUPPORTS_INHERITED0(FileStream, nsFileStream)
++
++already_AddRefed<FileStream>
++FileStream::Create(const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags,
++ int32_t aPerm, int32_t aBehaviorFlags)
++{
++ nsRefPtr<FileStream> stream = new FileStream(aOrigin);
++ nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++ return stream.forget();
++}
+diff --git dom/quota/FileStreams.h dom/quota/FileStreams.h
+new file mode 100644
+index 0000000..77bfad4
+--- /dev/null
++++ mozilla/dom/quota/FileStreams.h
+@@ -0,0 +1,115 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef mozilla_dom_quota_filestreams_h__
++#define mozilla_dom_quota_filestreams_h__
++
++#include "QuotaCommon.h"
++
++#include "nsFileStreams.h"
++
++#include "QuotaManager.h"
++
++BEGIN_QUOTA_NAMESPACE
++
++template <class FileStreamBase>
++class FileQuotaStream : public FileStreamBase
++{
++public:
++ // nsFileStreamBase override
++ NS_IMETHOD
++ SetEOF() MOZ_OVERRIDE;
++
++ NS_IMETHOD
++ Close() MOZ_OVERRIDE;
++
++protected:
++ FileQuotaStream(const nsACString& aOrigin)
++ : mOrigin(aOrigin)
++ { }
++
++ // nsFileStreamBase override
++ virtual nsresult
++ DoOpen() MOZ_OVERRIDE;
++
++ nsCString mOrigin;
++ nsRefPtr<QuotaObject> mQuotaObject;
++};
++
++template <class FileStreamBase>
++class FileQuotaStreamWithWrite : public FileQuotaStream<FileStreamBase>
++{
++public:
++ // nsFileStreamBase override
++ NS_IMETHOD
++ Write(const char* aBuf, uint32_t aCount, uint32_t* _retval) MOZ_OVERRIDE;
++
++protected:
++ FileQuotaStreamWithWrite(const nsACString& aOrigin)
++ : FileQuotaStream<FileStreamBase>(aOrigin)
++ { }
++};
++
++class FileInputStream : public FileQuotaStream<nsFileInputStream>
++{
++public:
++ NS_DECL_ISUPPORTS_INHERITED
++
++ static already_AddRefed<FileInputStream>
++ Create(const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
++ int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
++
++private:
++ FileInputStream(const nsACString& aOrigin)
++ : FileQuotaStream<nsFileInputStream>(aOrigin)
++ { }
++
++ virtual ~FileInputStream() {
++ Close();
++ }
++};
++
++class FileOutputStream : public FileQuotaStreamWithWrite<nsFileOutputStream>
++{
++public:
++ NS_DECL_ISUPPORTS_INHERITED
++
++ static already_AddRefed<FileOutputStream>
++ Create(const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
++ int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
++
++private:
++ FileOutputStream(const nsACString& aOrigin)
++ : FileQuotaStreamWithWrite<nsFileOutputStream>(aOrigin)
++ { }
++
++ virtual ~FileOutputStream() {
++ Close();
++ }
++};
++
++class FileStream : public FileQuotaStreamWithWrite<nsFileStream>
++{
++public:
++ NS_DECL_ISUPPORTS_INHERITED
++
++ static already_AddRefed<FileStream>
++ Create(const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
++ int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
++
++private:
++ FileStream(const nsACString& aOrigin)
++ : FileQuotaStreamWithWrite<nsFileStream>(aOrigin)
++ { }
++
++ virtual ~FileStream() {
++ Close();
++ }
++};
++
++END_QUOTA_NAMESPACE
++
++#endif /* mozilla_dom_quota_filestreams_h__ */
+diff --git dom/quota/Makefile.in dom/quota/Makefile.in
+new file mode 100644
+index 0000000..49be551
+--- /dev/null
++++ mozilla/dom/quota/Makefile.in
+@@ -0,0 +1,33 @@
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distributed with this file,
++# You can obtain one at http://mozilla.org/MPL/2.0/.
++
++DEPTH = ../..
++topsrcdir = @top_srcdir@
++srcdir = @srcdir@
++VPATH = @srcdir@
++
++include $(DEPTH)/config/autoconf.mk
++
++MODULE = dom
++LIBRARY_NAME = domquota_s
++XPIDL_MODULE = dom_quota
++LIBXUL_LIBRARY = 1
++FORCE_STATIC_LIB = 1
++
++include $(topsrcdir)/dom/dom-config.mk
++
++EXPORTS_NAMESPACES = mozilla/dom/quota
++
++CPPSRCS = \
++ FileStreams.cpp \
++ QuotaManager.cpp \
++ $(NULL)
++
++EXPORTS_mozilla/dom/quota = \
++ FileStreams.h \
++ QuotaCommon.h \
++ QuotaManager.h \
++ $(NULL)
++
++include $(topsrcdir)/config/rules.mk
+diff --git dom/quota/QuotaCommon.h dom/quota/QuotaCommon.h
+new file mode 100644
+index 0000000..a415d17
+--- /dev/null
++++ mozilla/dom/quota/QuotaCommon.h
+@@ -0,0 +1,23 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
++ * You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef mozilla_dom_quota_quotacommon_h__
++#define mozilla_dom_quota_quotacommon_h__
++
++#include "nsAutoPtr.h"
++#include "nsCOMPtr.h"
++#include "nsDebug.h"
++#include "nsStringGlue.h"
++#include "nsTArray.h"
++
++#define BEGIN_QUOTA_NAMESPACE \
++ namespace mozilla { namespace dom { namespace quota {
++#define END_QUOTA_NAMESPACE \
++ } /* namespace quota */ } /* namespace dom */ } /* namespace mozilla */
++#define USING_QUOTA_NAMESPACE \
++ using namespace mozilla::dom::quota;
++
++#endif // mozilla_dom_quota_quotacommon_h__
+diff --git dom/quota/QuotaManager.cpp dom/quota/QuotaManager.cpp
+new file mode 100644
+index 0000000..b251606
+--- /dev/null
++++ mozilla/dom/quota/QuotaManager.cpp
+@@ -0,0 +1,294 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
++ * You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#include "QuotaManager.h"
++
++#include "nsIFile.h"
++
++#include "mozilla/ClearOnShutdown.h"
++#include "nsComponentManagerUtils.h"
++
++#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
++
++USING_QUOTA_NAMESPACE
++
++namespace {
++
++nsAutoPtr<QuotaManager> gInstance;
++
++PLDHashOperator
++RemoveQuotaForPatternCallback(const nsACString& aKey,
++ nsRefPtr<OriginInfo>& aValue,
++ void* aUserArg)
++{
++ NS_ASSERTION(!aKey.IsEmpty(), "Empty key!");
++ NS_ASSERTION(aValue, "Null pointer!");
++ NS_ASSERTION(aUserArg, "Null pointer!");
++
++ const nsACString* pattern =
++ static_cast<const nsACString*>(aUserArg);
++
++ if (StringBeginsWith(aKey, *pattern)) {
++ return PL_DHASH_REMOVE;
++ }
++
++ return PL_DHASH_NEXT;
++}
++
++} // anonymous namespace
++
++void
++QuotaObject::AddRef()
++{
++ QuotaManager* quotaManager = QuotaManager::Get();
++ if (!quotaManager) {
++ NS_ERROR("Null quota manager, this shouldn't happen, possible leak!");
++
++ NS_AtomicIncrementRefcnt(mRefCnt);
++
++ return;
++ }
++
++ MutexAutoLock lock(quotaManager->mQuotaMutex);
++
++ ++mRefCnt;
++}
++
++void
++QuotaObject::Release()
++{
++ QuotaManager* quotaManager = QuotaManager::Get();
++ if (!quotaManager) {
++ NS_ERROR("Null quota manager, this shouldn't happen, possible leak!");
++
++ nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt);
++ if (count == 0) {
++ mRefCnt = 1;
++ delete this;
++ }
++
++ return;
++ }
++
++ {
++ MutexAutoLock lock(quotaManager->mQuotaMutex);
++
++ --mRefCnt;
++
++ if (mRefCnt > 0) {
++ return;
++ }
++
++ if (mOriginInfo) {
++ mOriginInfo->mQuotaObjects.Remove(mPath);
++ }
++ }
++
++ delete this;
++}
++
++void
++QuotaObject::UpdateSize(int64_t aSize)
++{
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ MutexAutoLock lock(quotaManager->mQuotaMutex);
++
++ if (mOriginInfo) {
++ mOriginInfo->mUsage -= mSize;
++ mSize = aSize;
++ mOriginInfo->mUsage += mSize;
++ }
++}
++
++bool
++QuotaObject::MaybeAllocateMoreSpace(int64_t aOffset, int32_t aCount)
++{
++ int64_t end = aOffset + aCount;
++
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ MutexAutoLock lock(quotaManager->mQuotaMutex);
++
++ if (mSize >= end || !mOriginInfo) {
++ return true;
++ }
++
++ int64_t newUsage = mOriginInfo->mUsage - mSize + end;
++ if (newUsage > mOriginInfo->mLimit) {
++ if (!indexedDB::IndexedDatabaseManager::QuotaIsLifted()) {
++ return false;
++ }
++
++ nsCString origin = mOriginInfo->mOrigin;
++
++ mOriginInfo->LockedClearOriginInfos();
++ NS_ASSERTION(!mOriginInfo,
++ "Should have cleared in LockedClearOriginInfos!");
++
++ quotaManager->mOriginInfos.Remove(origin);
++
++ mSize = end;
++
++ return true;
++ }
++
++ mOriginInfo->mUsage = newUsage;
++ mSize = end;
++
++ return true;
++}
++
++#ifdef DEBUG
++void
++OriginInfo::LockedClearOriginInfos()
++{
++ QuotaManager* quotaManager = QuotaManager::Get();
++ NS_ASSERTION(quotaManager, "Shouldn't be null!");
++
++ quotaManager->mQuotaMutex.AssertCurrentThreadOwns();
++
++ mQuotaObjects.EnumerateRead(ClearOriginInfoCallback, nullptr);
++}
++#endif
++
++// static
++PLDHashOperator
++OriginInfo::ClearOriginInfoCallback(const nsAString& aKey,
++ QuotaObject* aValue,
++ void* aUserArg)
++{
++ NS_ASSERTION(!aKey.IsEmpty(), "Empty key!");
++ NS_ASSERTION(aValue, "Null pointer!");
++
++ aValue->mOriginInfo = nullptr;
++
++ return PL_DHASH_NEXT;
++}
++
++// static
++QuotaManager*
++QuotaManager::GetOrCreate()
++{
++ if (!gInstance) {
++ NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
++
++ gInstance = new QuotaManager();
++
++ ClearOnShutdown(&gInstance);
++ }
++
++ return gInstance;
++}
++
++// static
++QuotaManager*
++QuotaManager::Get()
++{
++ // Does not return an owning reference.
++ return gInstance;
++}
++
++void
++QuotaManager::InitQuotaForOrigin(const nsACString& aOrigin,
++ int64_t aLimit,
++ int64_t aUsage)
++{
++ OriginInfo* info = new OriginInfo(aOrigin, aLimit * 1024 * 1024, aUsage);
++
++ MutexAutoLock lock(mQuotaMutex);
++
++ NS_ASSERTION(!mOriginInfos.GetWeak(aOrigin), "Replacing an existing entry!");
++ mOriginInfos.Put(aOrigin, info);
++}
++
++void
++QuotaManager::DecreaseUsageForOrigin(const nsACString& aOrigin,
++ int64_t aSize)
++{
++ MutexAutoLock lock(mQuotaMutex);
++
++ nsRefPtr<OriginInfo> originInfo;
++ mOriginInfos.Get(aOrigin, getter_AddRefs(originInfo));
++
++ if (originInfo) {
++ originInfo->mUsage -= aSize;
++ }
++}
++
++void
++QuotaManager::RemoveQuotaForPattern(const nsACString& aPattern)
++{
++ NS_ASSERTION(!aPattern.IsEmpty(), "Empty pattern!");
++
++ MutexAutoLock lock(mQuotaMutex);
++
++ mOriginInfos.Enumerate(RemoveQuotaForPatternCallback,
++ const_cast<nsACString*>(&aPattern));
++}
++
++already_AddRefed<QuotaObject>
++QuotaManager::GetQuotaObject(const nsACString& aOrigin,
++ nsIFile* aFile)
++{
++ NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
++
++ nsString path;
++ nsresult rv = aFile->GetPath(path);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ int64_t fileSize;
++
++ bool exists;
++ rv = aFile->Exists(&exists);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ if (exists) {
++ rv = aFile->GetFileSize(&fileSize);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++ }
++ else {
++ fileSize = 0;
++ }
++
++ QuotaObject* info = nullptr;
++ {
++ MutexAutoLock lock(mQuotaMutex);
++
++ nsRefPtr<OriginInfo> originInfo;
++ mOriginInfos.Get(aOrigin, getter_AddRefs(originInfo));
++
++ if (!originInfo) {
++ return nullptr;
++ }
++
++ originInfo->mQuotaObjects.Get(path, &info);
++
++ if (!info) {
++ info = new QuotaObject(originInfo, path, fileSize);
++ originInfo->mQuotaObjects.Put(path, info);
++ }
++ }
++
++ nsRefPtr<QuotaObject> result = info;
++ return result.forget();
++}
++
++already_AddRefed<QuotaObject>
++QuotaManager::GetQuotaObject(const nsACString& aOrigin,
++ const nsAString& aPath)
++{
++ nsresult rv;
++ nsCOMPtr<nsIFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ rv = file->InitWithPath(aPath);
++ NS_ENSURE_SUCCESS(rv, nullptr);
++
++ return GetQuotaObject(aOrigin, file);
++}
+diff --git dom/quota/QuotaManager.h dom/quota/QuotaManager.h
+new file mode 100644
+index 0000000..e19acdd
+--- /dev/null
++++ mozilla/dom/quota/QuotaManager.h
+@@ -0,0 +1,147 @@
++/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* vim: set ts=2 et sw=2 tw=80: */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
++ * You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef mozilla_dom_quota_quotamanager_h__
++#define mozilla_dom_quota_quotamanager_h__
++
++#include "QuotaCommon.h"
++
++#include "mozilla/Mutex.h"
++#include "nsDataHashtable.h"
++#include "nsRefPtrHashtable.h"
++#include "nsThreadUtils.h"
++
++BEGIN_QUOTA_NAMESPACE
++
++class OriginInfo;
++class QuotaManager;
++
++class QuotaObject
++{
++ friend class OriginInfo;
++ friend class QuotaManager;
++
++public:
++ void
++ AddRef();
++
++ void
++ Release();
++
++ void
++ UpdateSize(int64_t aSize);
++
++ bool
++ MaybeAllocateMoreSpace(int64_t aOffset, int32_t aCount);
++
++private:
++ QuotaObject(OriginInfo* aOriginInfo, const nsAString& aPath, int64_t aSize)
++ : mOriginInfo(aOriginInfo), mPath(aPath), mSize(aSize)
++ { }
++
++ virtual ~QuotaObject()
++ { }
++
++ nsAutoRefCnt mRefCnt;
++
++ OriginInfo* mOriginInfo;
++ nsString mPath;
++ int64_t mSize;
++};
++
++class OriginInfo
++{
++ friend class QuotaManager;
++ friend class QuotaObject;
++
++public:
++ OriginInfo(const nsACString& aOrigin, int64_t aLimit, int64_t aUsage)
++ : mOrigin(aOrigin), mLimit(aLimit), mUsage(aUsage)
++ {
++ mQuotaObjects.Init();
++ }
++
++ NS_INLINE_DECL_THREADSAFE_REFCOUNTING(OriginInfo)
++
++private:
++ void
++#ifdef DEBUG
++ LockedClearOriginInfos();
++#else
++ LockedClearOriginInfos()
++ {
++ mQuotaObjects.EnumerateRead(ClearOriginInfoCallback, nullptr);
++ }
++#endif
++
++ static PLDHashOperator
++ ClearOriginInfoCallback(const nsAString& aKey,
++ QuotaObject* aValue, void* aUserArg);
++
++ nsDataHashtable<nsStringHashKey, QuotaObject*> mQuotaObjects;
++
++ nsCString mOrigin;
++ int64_t mLimit;
++ int64_t mUsage;
++};
++
++class QuotaManager
++{
++ friend class nsAutoPtr<QuotaManager>;
++ friend class OriginInfo;
++ friend class QuotaObject;
++
++public:
++ // Returns a non-owning reference.
++ static QuotaManager*
++ GetOrCreate();
++
++ // Returns a non-owning reference.
++ static QuotaManager*
++ Get();
++
++ void
++ InitQuotaForOrigin(const nsACString& aOrigin,
++ int64_t aLimit,
++ int64_t aUsage);
++
++ void
++ DecreaseUsageForOrigin(const nsACString& aOrigin,
++ int64_t aSize);
++
++ void
++ RemoveQuotaForPattern(const nsACString& aPattern);
++
++ already_AddRefed<QuotaObject>
++ GetQuotaObject(const nsACString& aOrigin,
++ nsIFile* aFile);
++
++ already_AddRefed<QuotaObject>
++ GetQuotaObject(const nsACString& aOrigin,
++ const nsAString& aPath);
++
++private:
++ QuotaManager()
++ : mQuotaMutex("QuotaManager.mQuotaMutex")
++ {
++ NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
++
++ mOriginInfos.Init();
++ }
++
++ virtual ~QuotaManager()
++ {
++ NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
++ }
++
++ mozilla::Mutex mQuotaMutex;
++
++ nsRefPtrHashtable<nsCStringHashKey, OriginInfo> mOriginInfos;
++};
++
++END_QUOTA_NAMESPACE
++
++#endif /* mozilla_dom_quota_quotamanager_h__ */
+diff --git layout/build/Makefile.in layout/build/Makefile.in
+index e6b32da..496b55f 100644
+--- mozilla/layout/build/Makefile.in
++++ mozilla/layout/build/Makefile.in
+@@ -69,6 +69,7 @@ SHARED_LIBRARY_LIBS = \
+ $(DEPTH)/dom/encoding/$(LIB_PREFIX)domencoding_s.$(LIB_SUFFIX) \
+ $(DEPTH)/dom/file/$(LIB_PREFIX)domfile_s.$(LIB_SUFFIX) \
+ $(DEPTH)/dom/power/$(LIB_PREFIX)dom_power_s.$(LIB_SUFFIX) \
++ $(DEPTH)/dom/quota/$(LIB_PREFIX)domquota_s.$(LIB_SUFFIX) \
+ $(DEPTH)/dom/settings/$(LIB_PREFIX)jsdomsettings_s.$(LIB_SUFFIX) \
+ $(DEPTH)/dom/permission/$(LIB_PREFIX)jsdompermissionsettings_s.$(LIB_SUFFIX) \
+ $(DEPTH)/dom/network/src/$(LIB_PREFIX)dom_network_s.$(LIB_SUFFIX) \
+diff --git netwerk/base/src/Makefile.in netwerk/base/src/Makefile.in
+index 0c0d60e..e8cef48 100644
+--- mozilla/netwerk/base/src/Makefile.in
++++ mozilla/netwerk/base/src/Makefile.in
+@@ -19,6 +19,7 @@ LIBXUL_LIBRARY = 1
+ EXPORTS = \
+ nsMIMEInputStream.h \
+ nsURLHelper.h \
++ nsFileStreams.h \
+ $(NULL)
+
+ EXPORTS_NAMESPACES = mozilla/net
+diff --git netwerk/base/src/nsFileStreams.cpp netwerk/base/src/nsFileStreams.cpp
+index 2420ffc..ecc26aa 100644
+--- mozilla/netwerk/base/src/nsFileStreams.cpp
++++ mozilla/netwerk/base/src/nsFileStreams.cpp
+@@ -51,7 +51,9 @@ nsFileStreamBase::~nsFileStreamBase()
+ Close();
+ }
+
+-NS_IMPL_THREADSAFE_ISUPPORTS1(nsFileStreamBase, nsISeekableStream)
++NS_IMPL_THREADSAFE_ISUPPORTS2(nsFileStreamBase,
++ nsISeekableStream,
++ nsIFileMetadata)
+
+ NS_IMETHODIMP
+ nsFileStreamBase::Seek(int32_t whence, int64_t offset)
+@@ -124,6 +126,52 @@ nsFileStreamBase::SetEOF()
+ return NS_OK;
+ }
+
++NS_IMETHODIMP
++nsFileStreamBase::GetSize(int64_t* _retval)
++{
++ nsresult rv = DoPendingOpen();
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ if (!mFD) {
++ return NS_BASE_STREAM_CLOSED;
++ }
++
++ PRFileInfo64 info;
++ if (PR_GetOpenFileInfo64(mFD, &info) == PR_FAILURE) {
++ return NS_BASE_STREAM_OSERROR;
++ }
++
++ *_retval = int64_t(info.size);
++
++ return NS_OK;
++}
++
++NS_IMETHODIMP
++nsFileStreamBase::GetLastModified(int64_t* _retval)
++{
++ nsresult rv = DoPendingOpen();
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ if (!mFD) {
++ return NS_BASE_STREAM_CLOSED;
++ }
++
++ PRFileInfo64 info;
++ if (PR_GetOpenFileInfo64(mFD, &info) == PR_FAILURE) {
++ return NS_BASE_STREAM_OSERROR;
++ }
++
++ int64_t modTime = int64_t(info.modifyTime);
++ if (modTime == 0) {
++ *_retval = 0;
++ }
++ else {
++ *_retval = modTime / int64_t(PR_USEC_PER_MSEC);
++ }
++
++ return NS_OK;
++}
++
+ nsresult
+ nsFileStreamBase::Close()
+ {
+@@ -934,13 +982,12 @@ nsSafeFileOutputStream::Write(const char *buf, uint32_t count, uint32_t *result)
+ ////////////////////////////////////////////////////////////////////////////////
+ // nsFileStream
+
+-NS_IMPL_ISUPPORTS_INHERITED4(nsFileStream,
++NS_IMPL_ISUPPORTS_INHERITED3(nsFileStream,
+ nsFileStreamBase,
+ nsIInputStream,
+ nsIOutputStream,
+- nsIFileStream,
+- nsIFileMetadata)
+-
++ nsIFileStream)
++
+ NS_IMETHODIMP
+ nsFileStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm,
+ int32_t behaviorFlags)
+@@ -959,50 +1006,4 @@ nsFileStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm,
+ mBehaviorFlags & nsIFileStream::DEFER_OPEN);
+ }
+
+-NS_IMETHODIMP
+-nsFileStream::GetSize(int64_t* _retval)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mFD) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- PRFileInfo64 info;
+- if (PR_GetOpenFileInfo64(mFD, &info) == PR_FAILURE) {
+- return NS_BASE_STREAM_OSERROR;
+- }
+-
+- *_retval = int64_t(info.size);
+-
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-nsFileStream::GetLastModified(int64_t* _retval)
+-{
+- nsresult rv = DoPendingOpen();
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- if (!mFD) {
+- return NS_BASE_STREAM_CLOSED;
+- }
+-
+- PRFileInfo64 info;
+- if (PR_GetOpenFileInfo64(mFD, &info) == PR_FAILURE) {
+- return NS_BASE_STREAM_OSERROR;
+- }
+-
+- int64_t modTime = int64_t(info.modifyTime);
+- if (modTime == 0) {
+- *_retval = 0;
+- }
+- else {
+- *_retval = modTime / int64_t(PR_USEC_PER_MSEC);
+- }
+-
+- return NS_OK;
+-}
+-
+ ////////////////////////////////////////////////////////////////////////////////
+diff --git netwerk/base/src/nsFileStreams.h netwerk/base/src/nsFileStreams.h
+index 13e5b45..1aa6a82 100644
+--- mozilla/netwerk/base/src/nsFileStreams.h
++++ mozilla/netwerk/base/src/nsFileStreams.h
+@@ -24,11 +24,13 @@
+
+ ////////////////////////////////////////////////////////////////////////////////
+
+-class nsFileStreamBase : public nsISeekableStream
++class nsFileStreamBase : public nsISeekableStream,
++ public nsIFileMetadata
+ {
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSISEEKABLESTREAM
++ NS_DECL_NSIFILEMETADATA
+
+ nsFileStreamBase();
+ virtual ~nsFileStreamBase();
+@@ -124,8 +126,8 @@ public:
+ NS_IMETHOD IsNonBlocking(bool* _retval)
+ {
+ return nsFileStreamBase::IsNonBlocking(_retval);
+- }
+-
++ }
++
+ // Overrided from nsFileStreamBase
+ NS_IMETHOD Seek(int32_t aWhence, int64_t aOffset);
+
+@@ -260,13 +262,11 @@ protected:
+ class nsFileStream : public nsFileStreamBase,
+ public nsIInputStream,
+ public nsIOutputStream,
+- public nsIFileStream,
+- public nsIFileMetadata
++ public nsIFileStream
+ {
+ public:
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_NSIFILESTREAM
+- NS_DECL_NSIFILEMETADATA
+ NS_FORWARD_NSIINPUTSTREAM(nsFileStreamBase::)
+
+ // Can't use NS_FORWARD_NSIOUTPUTSTREAM due to overlapping methods
+diff --git storage/public/Makefile.in storage/public/Makefile.in
+index c485d4e..c05e6f3 100644
+--- mozilla/storage/public/Makefile.in
++++ mozilla/storage/public/Makefile.in
+@@ -36,7 +36,6 @@ XPIDLSRCS = \
+ mozIStorageCompletionCallback.idl \
+ mozIStorageBaseStatement.idl \
+ mozIStorageAsyncStatement.idl \
+- mozIStorageServiceQuotaManagement.idl \
+ mozIStorageVacuumParticipant.idl \
+ $(NULL)
+ # SEE ABOVE NOTE!
+diff --git storage/public/mozIStorageService.idl storage/public/mozIStorageService.idl
+index 3087a11..483649b 100644
+--- mozilla/storage/public/mozIStorageService.idl
++++ mozilla/storage/public/mozIStorageService.idl
+@@ -7,6 +7,7 @@
+
+ interface mozIStorageConnection;
+ interface nsIFile;
++interface nsIFileURL;
+
+ /**
+ * The mozIStorageService interface is intended to be implemented by
+@@ -15,7 +16,7 @@ interface nsIFile;
+ *
+ * This is the only way to open a database connection.
+ */
+-[scriptable, uuid(fe8e95cb-b377-4c8d-bccb-d9198c67542b)]
++[scriptable, uuid(12bfad34-cca3-40fb-8736-d8bf9db61a27)]
+ interface mozIStorageService : nsISupports {
+ /**
+ * Get a connection to a named special database storage.
+@@ -106,6 +107,16 @@ interface mozIStorageService : nsISupports {
+ */
+ mozIStorageConnection openUnsharedDatabase(in nsIFile aDatabaseFile);
+
++ /**
++ * See openDatabase(). Exactly the same only initialized with a file URL.
++ * Custom parameters can be passed to SQLite and VFS implementations through
++ * the query part of the URL.
++ *
++ * @param aURL
++ * A nsIFileURL that represents the database that is to be opened.
++ */
++ mozIStorageConnection openDatabaseWithFileURL(in nsIFileURL aFileURL);
++
+ /*
+ * Utilities
+ */
+diff --git storage/public/mozIStorageServiceQuotaManagement.idl storage/public/mozIStorageServiceQuotaManagement.idl
+deleted file mode 100644
+index ee5086b..0000000
+--- mozilla/storage/public/mozIStorageServiceQuotaManagement.idl
++++ /dev/null
+@@ -1,99 +0,0 @@
+-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+-/* vim: set ts=2 et sw=2 tw=80: */
+-/* This Source Code Form is subject to the terms of the Mozilla Public
+- * License, v. 2.0. If a copy of the MPL was not distributed with this
+- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+-
+-#include "nsISupports.idl"
+-
+-interface mozIStorageConnection;
+-interface nsIFile;
+-
+-[scriptable, function, uuid(ae94f0a5-ebdf-48f4-9959-085e13235d8d)]
+-interface mozIStorageQuotaCallback : nsISupports
+-{
+- /**
+- * Called when the file size quota for a group of databases is exceeded.
+- *
+- * @param aFilename
+- * The filename of the database that has exceeded the quota.
+- *
+- * @param aCurrentSizeLimit
+- * The current size (in bytes) of the quota.
+- *
+- * @param aCurrentTotalSize
+- * The current size of all databases in the quota group.
+- *
+- * @param aUserData
+- * Any additional data that was provided to the
+- * setQuotaForFilenamePattern function.
+- *
+- * @returns A new quota size. A new quota of 0 will disable the quota callback
+- * and any quota value less than aCurrentTotalSize will cause the
+- * database operation to fail with NS_ERROR_FILE_NO_DEVICE_SPACE.
+- */
+- long long quotaExceeded(in ACString aFilename,
+- in long long aCurrentSizeLimit,
+- in long long aCurrentTotalSize,
+- in nsISupports aUserData);
+-};
+-
+-/**
+- * This is a temporary interface that should eventually merge with
+- * mozIStorageService.
+- */
+-[scriptable, uuid(4d81faf5-fe01-428b-99b8-c94cba12fd72)]
+-interface mozIStorageServiceQuotaManagement : nsISupports
+-{
+- /**
+- * See mozIStorageService.openDatabase. Exactly the same only with a custom
+- * SQLite VFS.
+- */
+- mozIStorageConnection openDatabaseWithVFS(in nsIFile aDatabaseFile,
+- in ACString aVFSName);
+-
+- /**
+- * Set a file size quota for a group of databases matching the given filename
+- * pattern, optionally specifying a callback when the quota is exceeded.
+- *
+- * @param aPattern
+- * A pattern to match filenames for inclusion in the quota system. May
+- * contain the following special characters:
+- * '*' Matches any sequence of zero or more characters.
+- * '?' Matches exactly one character.
+- * [...] Matches one character from the enclosed list of characters.
+- * [^...] Matches one character not in the enclosed list.
+- *
+- * @param aSizeLimit
+- * The size limit (in bytes) for the quota group.
+- *
+- * @param aCallback
+- * A callback that will be used when the quota is exceeded.
+- *
+- * @param aUserData
+- * Additional information to be passed to the callback.
+- */
+- void setQuotaForFilenamePattern(in ACString aPattern,
+- in long long aSizeLimit,
+- in mozIStorageQuotaCallback aCallback,
+- in nsISupports aUserData);
+-
+- /**
+- * Adds, removes, or updates the file size information maintained by the quota
+- * system for files not opened through openDatabaseWithVFS().
+- *
+- * Use this function when you want files to be included in quota calculations
+- * that are either a) not SQLite databases, or b) SQLite databases that have
+- * not been opened.
+- *
+- * This function will have no effect on files that do not match an existing
+- * quota pattern (set previously by setQuotaForFilenamePattern()).
+- *
+- * @param aFile
+- * The file for which quota information should be updated. If the file
+- * exists then its size information will be added or refreshed. If the
+- * file does not exist then the file will be removed from tracking
+- * under the quota system.
+- */
+- void updateQuotaInformationForFile(in nsIFile aFile);
+-};
+diff --git storage/public/storage.h storage/public/storage.h
+index 8e571e2..08f39f3 100644
+--- mozilla/storage/public/storage.h
++++ mozilla/storage/public/storage.h
+@@ -24,7 +24,6 @@
+ #include "mozIStorageStatementCallback.h"
+ #include "mozIStorageBindingParamsArray.h"
+ #include "mozIStorageBindingParams.h"
+-#include "mozIStorageServiceQuotaManagement.h"
+ #include "mozIStorageVacuumParticipant.h"
+ #include "mozIStorageCompletionCallback.h"
+ #include "mozIStorageAsyncStatement.h"
+diff --git storage/src/TelemetryVFS.cpp storage/src/TelemetryVFS.cpp
+index 60de5c4..e4fce09 100644
+--- mozilla/storage/src/TelemetryVFS.cpp
++++ mozilla/storage/src/TelemetryVFS.cpp
+@@ -10,6 +10,7 @@
+ #include "sqlite3.h"
+ #include "nsThreadUtils.h"
+ #include "mozilla/Util.h"
++#include "mozilla/dom/quota/QuotaManager.h"
+
+ /**
+ * This preference is a workaround to allow users/sysadmins to identify
+@@ -24,6 +25,7 @@
+ namespace {
+
+ using namespace mozilla;
++using namespace mozilla::dom::quota;
+
+ struct Histograms {
+ const char *name;
+@@ -82,9 +84,17 @@ private:
+ };
+
+ struct telemetry_file {
+- sqlite3_file base; // Base class. Must be first
+- Histograms *histograms; // histograms pertaining to this file
+- sqlite3_file pReal[1]; // This contains the vfs that actually does work
++ // Base class. Must be first
++ sqlite3_file base;
++
++ // histograms pertaining to this file
++ Histograms *histograms;
++
++ // quota object for this file
++ nsRefPtr<QuotaObject> quotaObject;
++
++ // This contains the vfs that actually does work
++ sqlite3_file pReal[1];
+ };
+
+ /*
+@@ -99,6 +109,7 @@ xClose(sqlite3_file *pFile)
+ if( rc==SQLITE_OK ){
+ delete p->base.pMethods;
+ p->base.pMethods = NULL;
++ p->quotaObject = nullptr;
+ }
+ return rc;
+ }
+@@ -126,6 +137,9 @@ int
+ xWrite(sqlite3_file *pFile, const void *zBuf, int iAmt, sqlite_int64 iOfst)
+ {
+ telemetry_file *p = (telemetry_file *)pFile;
++ if (p->quotaObject && !p->quotaObject->MaybeAllocateMoreSpace(iOfst, iAmt)) {
++ return SQLITE_FULL;
++ }
+ IOThreadAutoTimer ioTimer(p->histograms->writeMS);
+ int rc;
+ rc = p->pReal->pMethods->xWrite(p->pReal, zBuf, iAmt, iOfst);
+@@ -144,6 +158,9 @@ xTruncate(sqlite3_file *pFile, sqlite_int64 size)
+ int rc;
+ Telemetry::AutoTimer<Telemetry::MOZ_SQLITE_TRUNCATE_MS> timer;
+ rc = p->pReal->pMethods->xTruncate(p->pReal, size);
++ if (rc == SQLITE_OK && p->quotaObject) {
++ p->quotaObject->UpdateSize(size);
++ }
+ return rc;
+ }
+
+@@ -300,6 +317,18 @@ xOpen(sqlite3_vfs* vfs, const char *zName, sqlite3_file* pFile,
+ break;
+ }
+ p->histograms = h;
++
++ const char* origin;
++ if ((flags & SQLITE_OPEN_URI) &&
++ (origin = sqlite3_uri_parameter(zName, "origin"))) {
++ QuotaManager* quotaManager = QuotaManager::Get();
++ MOZ_ASSERT(quotaManager);
++
++ p->quotaObject = quotaManager->GetQuotaObject(nsDependentCString(origin),
++ NS_ConvertUTF8toUTF16(zName));
++
++ }
++
+ rc = orig_vfs->xOpen(orig_vfs, zName, p->pReal, flags, pOutFlags);
+ if( rc != SQLITE_OK )
+ return rc;
+diff --git storage/src/mozStorageConnection.cpp storage/src/mozStorageConnection.cpp
+index 3afd3e1b..430824a 100644
+--- mozilla/storage/src/mozStorageConnection.cpp
++++ mozilla/storage/src/mozStorageConnection.cpp
+@@ -12,6 +12,7 @@
+ #include "nsIMemoryReporter.h"
+ #include "nsThreadUtils.h"
+ #include "nsIFile.h"
++#include "nsIFileURL.h"
+ #include "mozilla/Telemetry.h"
+ #include "mozilla/Mutex.h"
+ #include "mozilla/CondVar.h"
+@@ -471,34 +472,83 @@ Connection::getAsyncExecutionTarget()
+ }
+
+ nsresult
+-Connection::initialize(nsIFile *aDatabaseFile,
+- const char* aVFSName)
++Connection::initialize()
+ {
+ NS_ASSERTION (!mDBConn, "Initialize called on already opened database!");
+ SAMPLE_LABEL("storage", "Connection::initialize");
+
+- int srv;
+- nsresult rv;
++ // in memory database requested, sqlite uses a magic file name
++ int srv = ::sqlite3_open_v2(":memory:", &mDBConn, mFlags, NULL);
++ if (srv != SQLITE_OK) {
++ mDBConn = nullptr;
++ return convertResultCode(srv);
++ }
++
++ return initializeInternal(nullptr);
++}
++
++nsresult
++Connection::initialize(nsIFile *aDatabaseFile)
++{
++ NS_ASSERTION (aDatabaseFile, "Passed null file!");
++ NS_ASSERTION (!mDBConn, "Initialize called on already opened database!");
++ SAMPLE_LABEL("storage", "Connection::initialize");
+
+ mDatabaseFile = aDatabaseFile;
+
+- if (aDatabaseFile) {
+- nsAutoString path;
+- rv = aDatabaseFile->GetPath(path);
+- NS_ENSURE_SUCCESS(rv, rv);
++ nsAutoString path;
++ nsresult rv = aDatabaseFile->GetPath(path);
++ NS_ENSURE_SUCCESS(rv, rv);
+
+- srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn, mFlags,
+- aVFSName);
+- }
+- else {
+- // in memory database requested, sqlite uses a magic file name
+- srv = ::sqlite3_open_v2(":memory:", &mDBConn, mFlags, aVFSName);
++ int srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn,
++ mFlags, NULL);
++ if (srv != SQLITE_OK) {
++ mDBConn = nullptr;
++ return convertResultCode(srv);
+ }
++
++ rv = initializeInternal(aDatabaseFile);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ mDatabaseFile = aDatabaseFile;
++
++ return NS_OK;
++}
++
++nsresult
++Connection::initialize(nsIFileURL *aFileURL)
++{
++ NS_ASSERTION (aFileURL, "Passed null file URL!");
++ NS_ASSERTION (!mDBConn, "Initialize called on already opened database!");
++ SAMPLE_LABEL("storage", "Connection::initialize");
++
++ nsCOMPtr<nsIFile> databaseFile;
++ nsresult rv = aFileURL->GetFile(getter_AddRefs(databaseFile));
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ nsAutoCString spec;
++ rv = aFileURL->GetSpec(spec);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ int srv = ::sqlite3_open_v2(spec.get(), &mDBConn, mFlags, NULL);
+ if (srv != SQLITE_OK) {
+ mDBConn = nullptr;
+ return convertResultCode(srv);
+ }
+
++ rv = initializeInternal(databaseFile);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ mFileURL = aFileURL;
++ mDatabaseFile = databaseFile;
++
++ return NS_OK;
++}
++
++
++nsresult
++Connection::initializeInternal(nsIFile* aDatabaseFile)
++{
+ // Properly wrap the database handle's mutex.
+ sharedDBMutex.initWithMutex(sqlite3_db_mutex(mDBConn));
+
+@@ -522,14 +572,14 @@ Connection::initialize(nsIFile *aDatabaseFile,
+ nsAutoCString pageSizeQuery(MOZ_STORAGE_UNIQUIFY_QUERY_STR
+ "PRAGMA page_size = ");
+ pageSizeQuery.AppendInt(pageSize);
+- rv = ExecuteSimpleSQL(pageSizeQuery);
++ nsresult rv = ExecuteSimpleSQL(pageSizeQuery);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ // Get the current page_size, since it may differ from the specified value.
+ sqlite3_stmt *stmt;
+ NS_NAMED_LITERAL_CSTRING(pragma_page_size,
+ MOZ_STORAGE_UNIQUIFY_QUERY_STR "PRAGMA page_size");
+- srv = prepareStatement(pragma_page_size, &stmt);
++ int srv = prepareStatement(pragma_page_size, &stmt);
+ if (srv == SQLITE_OK) {
+ if (SQLITE_ROW == stepStatement(stmt)) {
+ pageSize = ::sqlite3_column_int64(stmt, 0);
+@@ -962,7 +1012,8 @@ Connection::Clone(bool aReadOnly,
+ nsRefPtr<Connection> clone = new Connection(mStorageService, flags);
+ NS_ENSURE_TRUE(clone, NS_ERROR_OUT_OF_MEMORY);
+
+- nsresult rv = clone->initialize(mDatabaseFile);
++ nsresult rv = mFileURL ? clone->initialize(mFileURL)
++ : clone->initialize(mDatabaseFile);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ // Copy over pragmas from the original connection.
+diff --git storage/src/mozStorageConnection.h storage/src/mozStorageConnection.h
+index b71f5db..97f5cf8 100644
+--- mozilla/storage/src/mozStorageConnection.h
++++ mozilla/storage/src/mozStorageConnection.h
+@@ -25,6 +25,7 @@
+
+ struct PRLock;
+ class nsIFile;
++class nsIFileURL;
+ class nsIEventTarget;
+ class nsIThread;
+
+@@ -63,18 +64,27 @@ public:
+ Connection(Service *aService, int aFlags);
+
+ /**
++ * Creates the connection to an in-memory database.
++ */
++ nsresult initialize();
++
++ /**
+ * Creates the connection to the database.
+ *
+ * @param aDatabaseFile
+ * The nsIFile of the location of the database to open, or create if it
+- * does not exist. Passing in nullptr here creates an in-memory
+- * database.
+- * @param aVFSName
+- * The VFS that SQLite will use when opening this database. NULL means
+- * "default".
++ * does not exist.
+ */
+- nsresult initialize(nsIFile *aDatabaseFile,
+- const char* aVFSName = NULL);
++ nsresult initialize(nsIFile *aDatabaseFile);
++
++ /**
++ * Creates the connection to the database.
++ *
++ * @param aFileURL
++ * The nsIFileURL of the location of the database to open, or create if it
++ * does not exist.
++ */
++ nsresult initialize(nsIFileURL *aFileURL);
+
+ // fetch the native handle
+ sqlite3 *GetNativeConnection() { return mDBConn; }
+@@ -155,6 +165,8 @@ public:
+ private:
+ ~Connection();
+
++ nsresult initializeInternal(nsIFile *aDatabaseFile);
++
+ /**
+ * Sets the database into a closed state so no further actions can be
+ * performed.
+@@ -206,6 +218,7 @@ private:
+ int progressHandler();
+
+ sqlite3 *mDBConn;
++ nsCOMPtr<nsIFileURL> mFileURL;
+ nsCOMPtr<nsIFile> mDatabaseFile;
+
+ /**
+diff --git storage/src/mozStorageService.cpp storage/src/mozStorageService.cpp
+index 00661d6..862a7da 100644
+--- mozilla/storage/src/mozStorageService.cpp
++++ mozilla/storage/src/mozStorageService.cpp
+@@ -24,8 +24,6 @@
+ #include "mozilla/Preferences.h"
+
+ #include "sqlite3.h"
+-#include "test_quota.h"
+-#include "test_quota.c"
+
+ #ifdef SQLITE_OS_WIN
+ // "windows.h" was included and it can #define lots of things we care about...
+@@ -35,61 +33,6 @@
+ #include "nsIPromptService.h"
+ #include "nsIMemoryReporter.h"
+
+-namespace {
+-
+-class QuotaCallbackData
+-{
+-public:
+- QuotaCallbackData(mozIStorageQuotaCallback *aCallback,
+- nsISupports *aUserData)
+- : callback(aCallback), userData(aUserData)
+- {
+- MOZ_COUNT_CTOR(QuotaCallbackData);
+- }
+-
+- ~QuotaCallbackData()
+- {
+- MOZ_COUNT_DTOR(QuotaCallbackData);
+- }
+-
+- static void Callback(const char *zFilename,
+- sqlite3_int64 *piLimit,
+- sqlite3_int64 iSize,
+- void *pArg)
+- {
+- NS_ASSERTION(zFilename && strlen(zFilename), "Null or empty filename!");
+- NS_ASSERTION(piLimit, "Null pointer!");
+-
+- QuotaCallbackData *data = static_cast<QuotaCallbackData*>(pArg);
+- if (!data) {
+- // No callback specified, return immediately.
+- return;
+- }
+-
+- NS_ASSERTION(data->callback, "Should never have a null callback!");
+-
+- nsDependentCString filename(zFilename);
+-
+- int64_t newLimit;
+- if (NS_SUCCEEDED(data->callback->QuotaExceeded(filename, *piLimit,
+- iSize, data->userData,
+- &newLimit))) {
+- *piLimit = newLimit;
+- }
+- }
+-
+- static void Destroy(void *aUserData)
+- {
+- delete static_cast<QuotaCallbackData*>(aUserData);
+- }
+-
+-private:
+- nsCOMPtr<mozIStorageQuotaCallback> callback;
+- nsCOMPtr<nsISupports> userData;
+-};
+-
+-} // anonymous namespace
+-
+ ////////////////////////////////////////////////////////////////////////////////
+ //// Defines
+
+@@ -345,11 +288,10 @@ private:
+ ////////////////////////////////////////////////////////////////////////////////
+ //// Service
+
+-NS_IMPL_THREADSAFE_ISUPPORTS3(
++NS_IMPL_THREADSAFE_ISUPPORTS2(
+ Service,
+ mozIStorageService,
+- nsIObserver,
+- mozIStorageServiceQuotaManagement
++ nsIObserver
+ )
+
+ Service *Service::gService = nullptr;
+@@ -438,10 +380,6 @@ Service::~Service()
+
+ // Shutdown the sqlite3 API. Warn if shutdown did not turn out okay, but
+ // there is nothing actionable we can do in that case.
+- rc = ::sqlite3_quota_shutdown();
+- if (rc != SQLITE_OK)
+- NS_WARNING("sqlite3 did not shutdown cleanly.");
+-
+ rc = ::sqlite3_shutdown();
+ if (rc != SQLITE_OK)
+ NS_WARNING("sqlite3 did not shutdown cleanly.");
+@@ -636,9 +574,6 @@ Service::initialize()
+ } else {
+ NS_WARNING("Failed to register telemetry VFS");
+ }
+- rc = ::sqlite3_quota_initialize("telemetry-vfs", 0);
+- if (rc != SQLITE_OK)
+- return convertResultCode(rc);
+
+ // Set the default value for the toolkit.storage.synchronous pref. It will be
+ // updated with the user preference on the main thread.
+@@ -739,28 +674,24 @@ Service::OpenSpecialDatabase(const char *aStorageKey,
+ // connection to use a memory DB.
+ }
+ else if (::strcmp(aStorageKey, "profile") == 0) {
+-
+ rv = NS_GetSpecialDirectory(NS_APP_STORAGE_50_FILE,
+ getter_AddRefs(storageFile));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- nsString filename;
+- storageFile->GetPath(filename);
+- nsCString filename8 = NS_ConvertUTF16toUTF8(filename.get());
+ // fall through to DB initialization
+ }
+ else {
+ return NS_ERROR_INVALID_ARG;
+ }
+
+- Connection *msc = new Connection(this, SQLITE_OPEN_READWRITE);
+- NS_ENSURE_TRUE(msc, NS_ERROR_OUT_OF_MEMORY);
++ nsRefPtr<Connection> msc = new Connection(this, SQLITE_OPEN_READWRITE);
+
+- rv = msc->initialize(storageFile);
++ rv = storageFile ? msc->initialize(storageFile) : msc->initialize();
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- NS_ADDREF(*_connection = msc);
++ msc.forget(_connection);
+ return NS_OK;
++
+ }
+
+ NS_IMETHODIMP
+@@ -774,12 +705,11 @@ Service::OpenDatabase(nsIFile *aDatabaseFile,
+ int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_SHAREDCACHE |
+ SQLITE_OPEN_CREATE;
+ nsRefPtr<Connection> msc = new Connection(this, flags);
+- NS_ENSURE_TRUE(msc, NS_ERROR_OUT_OF_MEMORY);
+
+ nsresult rv = msc->initialize(aDatabaseFile);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- NS_ADDREF(*_connection = msc);
++ msc.forget(_connection);
+ return NS_OK;
+ }
+
+@@ -794,12 +724,30 @@ Service::OpenUnsharedDatabase(nsIFile *aDatabaseFile,
+ int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_PRIVATECACHE |
+ SQLITE_OPEN_CREATE;
+ nsRefPtr<Connection> msc = new Connection(this, flags);
+- NS_ENSURE_TRUE(msc, NS_ERROR_OUT_OF_MEMORY);
+
+ nsresult rv = msc->initialize(aDatabaseFile);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+- NS_ADDREF(*_connection = msc);
++ msc.forget(_connection);
++ return NS_OK;
++}
++
++NS_IMETHODIMP
++Service::OpenDatabaseWithFileURL(nsIFileURL *aFileURL,
++ mozIStorageConnection **_connection)
++{
++ NS_ENSURE_ARG(aFileURL);
++
++ // Always ensure that SQLITE_OPEN_CREATE is passed in for compatibility
++ // reasons.
++ int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_SHAREDCACHE |
++ SQLITE_OPEN_CREATE | SQLITE_OPEN_URI;
++ nsRefPtr<Connection> msc = new Connection(this, flags);
++
++ nsresult rv = msc->initialize(aFileURL);
++ NS_ENSURE_SUCCESS(rv, rv);
++
++ msc.forget(_connection);
+ return NS_OK;
+ }
+
+@@ -885,67 +833,5 @@ Service::Observe(nsISupports *, const char *aTopic, const PRUnichar *)
+ return NS_OK;
+ }
+
+-////////////////////////////////////////////////////////////////////////////////
+-//// mozIStorageServiceQuotaManagement
+-
+-NS_IMETHODIMP
+-Service::OpenDatabaseWithVFS(nsIFile *aDatabaseFile,
+- const nsACString &aVFSName,
+- mozIStorageConnection **_connection)
+-{
+- NS_ENSURE_ARG(aDatabaseFile);
+-
+- // Always ensure that SQLITE_OPEN_CREATE is passed in for compatibility
+- // reasons.
+- int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_SHAREDCACHE |
+- SQLITE_OPEN_CREATE;
+- nsRefPtr<Connection> msc = new Connection(this, flags);
+- NS_ENSURE_TRUE(msc, NS_ERROR_OUT_OF_MEMORY);
+-
+- nsresult rv = msc->initialize(aDatabaseFile,
+- PromiseFlatCString(aVFSName).get());
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- NS_ADDREF(*_connection = msc);
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-Service::SetQuotaForFilenamePattern(const nsACString &aPattern,
+- int64_t aSizeLimit,
+- mozIStorageQuotaCallback *aCallback,
+- nsISupports *aUserData)
+-{
+- NS_ENSURE_FALSE(aPattern.IsEmpty(), NS_ERROR_INVALID_ARG);
+-
+- nsAutoPtr<QuotaCallbackData> data;
+- if (aSizeLimit && aCallback) {
+- data = new QuotaCallbackData(aCallback, aUserData);
+- }
+-
+- int rc = ::sqlite3_quota_set(PromiseFlatCString(aPattern).get(),
+- aSizeLimit, QuotaCallbackData::Callback,
+- data, QuotaCallbackData::Destroy);
+- NS_ENSURE_TRUE(rc == SQLITE_OK, convertResultCode(rc));
+-
+- data.forget();
+- return NS_OK;
+-}
+-
+-NS_IMETHODIMP
+-Service::UpdateQuotaInformationForFile(nsIFile *aFile)
+-{
+- NS_ENSURE_ARG_POINTER(aFile);
+-
+- nsString path;
+- nsresult rv = aFile->GetPath(path);
+- NS_ENSURE_SUCCESS(rv, rv);
+-
+- int rc = ::sqlite3_quota_file(NS_ConvertUTF16toUTF8(path).get());
+- NS_ENSURE_TRUE(rc == SQLITE_OK, convertResultCode(rc));
+-
+- return NS_OK;
+-}
+-
+ } // namespace storage
+ } // namespace mozilla
+diff --git storage/src/mozStorageService.h storage/src/mozStorageService.h
+index 21c1ff8..3f5a546 100644
+--- mozilla/storage/src/mozStorageService.h
++++ mozilla/storage/src/mozStorageService.h
+@@ -15,7 +15,6 @@
+ #include "mozilla/Mutex.h"
+
+ #include "mozIStorageService.h"
+-#include "mozIStorageServiceQuotaManagement.h"
+
+ class nsIMemoryReporter;
+ class nsIMemoryMultiReporter;
+@@ -28,7 +27,6 @@ namespace storage {
+ class Connection;
+ class Service : public mozIStorageService
+ , public nsIObserver
+- , public mozIStorageServiceQuotaManagement
+ {
+ public:
+ /**
+@@ -58,7 +56,6 @@ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_MOZISTORAGESERVICE
+ NS_DECL_NSIOBSERVER
+- NS_DECL_MOZISTORAGESERVICEQUOTAMANAGEMENT
+
+ /**
+ * Obtains an already AddRefed pointer to XPConnect. This is used by
+diff --git toolkit/toolkit-makefiles.sh toolkit/toolkit-makefiles.sh
+index 6a7d714..8f1bbe0 100644
+--- mozilla/toolkit/toolkit-makefiles.sh
++++ mozilla/toolkit/toolkit-makefiles.sh
+@@ -68,6 +68,7 @@ MAKEFILES_dom="
+ dom/plugins/base/Makefile
+ dom/plugins/ipc/Makefile
+ dom/power/Makefile
++ dom/quota/Makefile
+ dom/settings/Makefile
+ dom/sms/Makefile
+ dom/sms/interfaces/Makefile
diff --git a/www/seamonkey/files/patch-bug787904 b/www/seamonkey/files/patch-bug787904
deleted file mode 100644
index efd1a9154581..000000000000
--- a/www/seamonkey/files/patch-bug787904
+++ /dev/null
@@ -1,12 +0,0 @@
---- mozilla/js/src/gc/Heap.h
-+++ mozilla/js/src/gc/Heap.h
-@@ -108,7 +108,8 @@ struct Cell
- * Bug 692267: Move page size definition to gc/Memory.h and include it
- * directly once jsgc.h is no longer an installed header.
- */
--#if defined(SOLARIS) && (defined(__sparc) || defined(__sparcv9))
-+#if (defined(SOLARIS) || defined(__FreeBSD__)) && \
-+ (defined(__sparc) || defined(__sparcv9) || defined(__ia64))
- const size_t PageShift = 13;
- #else
- const size_t PageShift = 12;
diff --git a/www/seamonkey/files/patch-bug788039 b/www/seamonkey/files/patch-bug788039
deleted file mode 100644
index e449b5e5b1a2..000000000000
--- a/www/seamonkey/files/patch-bug788039
+++ /dev/null
@@ -1,48 +0,0 @@
-# Bug 788039 - With no prefix search libevent via pkg-config.
-
---- mozilla/configure.in~
-+++ mozilla/configure.in
-@@ -3854,7 +3854,7 @@ fi
- dnl system libevent Support
- dnl ========================================================
- MOZ_ARG_WITH_STRING(system-libevent,
--[ --with-system-libevent=[PFX]
-+[ --with-system-libevent[=PFX]
- Use system libevent [installed at prefix PFX]],
- LIBEVENT_DIR=$withval)
-
-@@ -3863,10 +3863,11 @@ _SAVE_LDFLAGS=$LDFLAGS
- _SAVE_LIBS=$LIBS
- if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
- MOZ_NATIVE_LIBEVENT=
-+elif test "$LIBEVENT_DIR" = yes; then
-+ PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
-+ MOZ_NATIVE_LIBEVENT=1,
-+ AC_MSG_ERROR([--with-system-libevent requested but libevent package not found]))
- else
-- if test "${LIBEVENT_DIR}" = "yes"; then
-- LIBEVENT_DIR=/usr
-- fi
- CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
- LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
- MOZ_CHECK_HEADER(event.h,
-@@ -3876,16 +3877,16 @@ else
- AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
- AC_CHECK_LIB(event, event_init,
- [MOZ_NATIVE_LIBEVENT=1
-- MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
-+ MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
- MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
-- [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
-+ [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
- fi
- CFLAGS=$_SAVE_CFLAGS
- LDFLAGS=$_SAVE_LDFLAGS
- LIBS=$_SAVE_LIBS
-
- AC_SUBST(MOZ_NATIVE_LIBEVENT)
--AC_SUBST(MOZ_LIBEVENT_INCLUDES)
-+AC_SUBST(MOZ_LIBEVENT_CFLAGS)
- AC_SUBST(MOZ_LIBEVENT_LIBS)
-
- dnl ========================================================
diff --git a/www/seamonkey/files/patch-bug788108 b/www/seamonkey/files/patch-bug788108
deleted file mode 100644
index 3e5eb72dad08..000000000000
--- a/www/seamonkey/files/patch-bug788108
+++ /dev/null
@@ -1,20 +0,0 @@
---- mozilla/content/base/public/nsContentUtils.h~
-+++ mozilla/content/base/public/nsContentUtils.h
-@@ -18,17 +18,6 @@
- #include <ieeefp.h>
- #endif
-
--//A trick to handle IEEE floating point exceptions on FreeBSD - E.D.
--#ifdef __FreeBSD__
--#include <ieeefp.h>
--#if !defined(__i386__) && !defined(__x86_64__)
--static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP;
--#else
--static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP|FP_X_DNML;
--#endif
--static fp_except_t oldmask = fpsetmask(~allmask);
--#endif
--
- #include "nsAString.h"
- #include "nsIStatefulFrame.h"
- #include "nsNodeInfoManager.h"
diff --git a/www/seamonkey/files/patch-bug789436 b/www/seamonkey/files/patch-bug789436
deleted file mode 100644
index 2479d8e69c78..000000000000
--- a/www/seamonkey/files/patch-bug789436
+++ /dev/null
@@ -1,27 +0,0 @@
---- mozilla/toolkit/xre/nsAppRunner.cpp~
-+++ mozilla/toolkit/xre/nsAppRunner.cpp
-@@ -1388,11 +1388,6 @@ static int MSCRTReportHook( int aReportType, char *aMessage, int *oReturnValue)
-
- #endif
-
--#if defined(FREEBSD)
--// pick up fpsetmask prototype.
--#include <ieeefp.h>
--#endif
--
- static inline void
- DumpVersion()
- {
-@@ -4136,12 +4131,5 @@ SetupErrorHandling(const char* progname)
-
- // Unbuffer stdout, needed for tinderbox tests.
- setbuf(stdout, 0);
--
--#if defined(FREEBSD)
-- // Disable all SIGFPE's on FreeBSD, as it has non-IEEE-conformant fp
-- // trap behavior that trips up on floating-point tests performed by
-- // the JS engine. See bugzilla bug 9967 details.
-- fpsetmask(0);
--#endif
- }
-
diff --git a/www/seamonkey/files/patch-bug789656 b/www/seamonkey/files/patch-bug789656
deleted file mode 100644
index 17f1419897cc..000000000000
--- a/www/seamonkey/files/patch-bug789656
+++ /dev/null
@@ -1,11 +0,0 @@
---- mozilla/media/libopus/Makefile.in~
-+++ mozilla/media/libopus/Makefile.in
-@@ -20,7 +20,7 @@ DEFINES += \
- -Drestrict= \
- $(NULL)
-
--ifneq ($(filter $(OS_ARCH),Linux Darwin),)
-+ifneq ($(filter $(OS_ARCH),Linux Darwin DragonFly FreeBSD NetBSD OpenBSD),)
- DEFINES += -DHAVE_LRINTF
- endif
- ifeq ($(OS_ARCH), WINNT)
diff --git a/www/seamonkey/files/patch-bug789693 b/www/seamonkey/files/patch-bug789693
deleted file mode 100644
index f88228f5498b..000000000000
--- a/www/seamonkey/files/patch-bug789693
+++ /dev/null
@@ -1,109 +0,0 @@
---- mozilla/toolkit/components/startup/nsAppStartup.cpp
-+++ mozilla/toolkit/components/startup/nsAppStartup.cpp
-@@ -50,18 +50,41 @@
- #include <sys/syscall.h>
- #endif
-
--#ifdef XP_MACOSX
-+#if defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \
-+ || defined(__NetBSD__) || defined(__OpenBSD__)
-+#include <sys/param.h>
- #include <sys/sysctl.h>
- #endif
-
--#ifdef __OpenBSD__
--#include <sys/param.h>
--#include <sys/sysctl.h>
-+#if defined(__DragonFly__) || defined(__FreeBSD__)
-+#include <sys/user.h>
- #endif
-
- #include "mozilla/Telemetry.h"
- #include "mozilla/StartupTimeline.h"
-
-+#if defined(__NetBSD__)
-+#undef KERN_PROC
-+#define KERN_PROC KERN_PROC2
-+#define KINFO_PROC struct kinfo_proc2
-+#else
-+#define KINFO_PROC struct kinfo_proc
-+#endif
-+
-+#if defined(XP_MACOSX)
-+#define KP_START_SEC kp_proc.p_un.__p_starttime.tv_sec
-+#define KP_START_USEC kp_proc.p_un.__p_starttime.tv_usec
-+#elif defined(__DragonFly__)
-+#define KP_START_SEC kp_start.tv_sec
-+#define KP_START_USEC kp_start.tv_usec
-+#elif defined(__FreeBSD__)
-+#define KP_START_SEC ki_start.tv_sec
-+#define KP_START_USEC ki_start.tv_usec
-+#else
-+#define KP_START_SEC p_ustart_sec
-+#define KP_START_USEC p_ustart_usec
-+#endif
-+
- static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
-
- #define kPrefLastSuccess "toolkit.startup.last_success"
-@@ -836,42 +859,30 @@ CalculateProcessCreationTimestamp()
- #endif
- return timestamp;
- }
--#elif defined(XP_MACOSX)
-+#elif defined(XP_MACOSX) || defined(__DragonFly__) || defined(__FreeBSD__) \
-+ || defined(__NetBSD__) || defined(__OpenBSD__)
- static PRTime
- CalculateProcessCreationTimestamp()
- {
-- int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() };
-- size_t buffer_size;
-- if (sysctl(mib, 4, NULL, &buffer_size, NULL, 0))
-- return 0;
-+ int mib[] = {
-+ CTL_KERN,
-+ KERN_PROC,
-+ KERN_PROC_PID,
-+ getpid(),
-+#if defined(__NetBSD__) || defined(__OpenBSD__)
-+ sizeof(KINFO_PROC),
-+ 1,
-+#endif
-+ };
-+ u_int miblen = sizeof(mib) / sizeof(mib[0]);
-
-- struct kinfo_proc *proc = (kinfo_proc*) malloc(buffer_size);
-- if (sysctl(mib, 4, proc, &buffer_size, NULL, 0)) {
-- free(proc);
-- return 0;
-- }
-- PRTime starttime = static_cast<PRTime>(proc->kp_proc.p_un.__p_starttime.tv_sec) * PR_USEC_PER_SEC;
-- starttime += proc->kp_proc.p_un.__p_starttime.tv_usec;
-- free(proc);
-- return starttime;
--}
--#elif defined(__OpenBSD__)
--static PRTime
--CalculateProcessCreationTimestamp()
--{
-- int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid(), sizeof(struct kinfo_proc), 1 };
-- size_t buffer_size;
-- if (sysctl(mib, 6, NULL, &buffer_size, NULL, 0))
-+ KINFO_PROC proc;
-+ size_t buffer_size = sizeof(proc);
-+ if (sysctl(mib, miblen, &proc, &buffer_size, NULL, 0))
- return 0;
-
-- struct kinfo_proc *proc = (struct kinfo_proc*) malloc(buffer_size);
-- if (sysctl(mib, 6, proc, &buffer_size, NULL, 0)) {
-- free(proc);
-- return 0;
-- }
-- PRTime starttime = static_cast<PRTime>(proc->p_ustart_sec) * PR_USEC_PER_SEC;
-- starttime += proc->p_ustart_usec;
-- free(proc);
-+ PRTime starttime = static_cast<PRTime>(proc.KP_START_SEC) * PR_USEC_PER_SEC;
-+ starttime += proc.KP_START_USEC;
- return starttime;
- }
- #else
diff --git a/www/seamonkey/files/patch-bug791305 b/www/seamonkey/files/patch-bug791305
index e4c44a405f57..633415128199 100644
--- a/www/seamonkey/files/patch-bug791305
+++ b/www/seamonkey/files/patch-bug791305
@@ -15,93 +15,383 @@ Date: Fri Sep 14 15:54:55 2012 -0400
image/decoders/nsJPEGDecoder.cpp | 311 ++-------------------------------------
2 files changed, 20 insertions(+), 297 deletions(-)
+diff --git configure.in configure.in
+index f0aeb5d..1c01010 100644
+--- mozilla/configure.in
++++ mozilla/configure.in
+@@ -4027,11 +4027,7 @@ if test "$MOZ_NATIVE_JPEG" = 1; then
+ #include <jpeglib.h> ],
+ [ #if JPEG_LIB_VERSION < $MOZJPEG
+ #error "Insufficient JPEG library version ($MOZJPEG required)."
+- #endif
+- #ifndef JCS_EXTENSIONS
+- #error "libjpeg-turbo JCS_EXTENSIONS required"
+- #endif
+- ],
++ #endif ],
+ MOZ_NATIVE_JPEG=1,
+ AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
+ fi
diff --git mozilla/image/decoders/nsJPEGDecoder.cpp mozilla/image/decoders/nsJPEGDecoder.cpp
-index c1fb515..1d2a259 100644
+index 8fa8200..1d2a259 100644
--- mozilla/image/decoders/nsJPEGDecoder.cpp
+++ mozilla/image/decoders/nsJPEGDecoder.cpp
-@@ -22,6 +22,13 @@
+@@ -21,13 +21,28 @@
+
extern "C" {
#include "iccjpeg.h"
+-}
+#ifdef JCS_EXTENSIONS
-+#if defined(IS_BIG_ENDIAN)
-+#define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_XRGB
-+#else
-+#define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_BGRX
-+#endif
+ #if defined(IS_BIG_ENDIAN)
+ #define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_XRGB
+ #else
+ #define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_BGRX
+ #endif
+#else
- /* Colorspace conversion (copied from jpegint.h) */
- struct jpeg_color_deconverter {
- JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
-@@ -34,6 +41,7 @@ METHODDEF(void)
- ycc_rgb_convert_argb (j_decompress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION input_row,
- JSAMPARRAY output_buf, int num_rows);
++/* Colorspace conversion (copied from jpegint.h) */
++struct jpeg_color_deconverter {
++ JMETHOD(void, start_pass, (j_decompress_ptr cinfo));
++ JMETHOD(void, color_convert, (j_decompress_ptr cinfo,
++ JSAMPIMAGE input_buf, JDIMENSION input_row,
++ JSAMPARRAY output_buf, int num_rows));
++};
++
++METHODDEF(void)
++ycc_rgb_convert_argb (j_decompress_ptr cinfo,
++ JSAMPIMAGE input_buf, JDIMENSION input_row,
++ JSAMPARRAY output_buf, int num_rows);
+#endif
- }
++}
static void cmyk_convert_rgb(JSAMPROW row, JDIMENSION width);
-@@ -329,7 +340,18 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
+
+@@ -324,6 +340,7 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, uint32_t aCount)
case JCS_GRAYSCALE:
case JCS_RGB:
case JCS_YCbCr:
+#ifdef JCS_EXTENSIONS
-+ // if we're not color managing we can decode directly to
-+ // MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB
-+ if (mCMSMode != eCMSMode_All) {
-+ mInfo.out_color_space = MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB;
-+ mInfo.out_color_components = 4;
-+ } else {
-+ mInfo.out_color_space = JCS_RGB;
-+ }
+ // if we're not color managing we can decode directly to
+ // MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB
+ if (mCMSMode != eCMSMode_All) {
+@@ -332,6 +349,9 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, uint32_t aCount)
+ } else {
+ mInfo.out_color_space = JCS_RGB;
+ }
+#else
- mInfo.out_color_space = JCS_RGB;
++ mInfo.out_color_space = JCS_RGB;
+#endif
break;
case JCS_CMYK:
case JCS_YCCK:
-@@ -397,6 +419,7 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
+@@ -399,6 +419,15 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, uint32_t aCount)
return; /* I/O suspension */
}
+#ifndef JCS_EXTENSIONS
- /* Force to use our YCbCr to Packed RGB converter when possible */
- if (!mTransform && (mCMSMode != eCMSMode_All) &&
- mInfo.jpeg_color_space == JCS_YCbCr && mInfo.out_color_space == JCS_RGB) {
-@@ -404,6 +427,7 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
- mInfo.out_color_components = 4; /* Packed ARGB pixels are always 4 bytes...*/
- mInfo.cconvert->color_convert = ycc_rgb_convert_argb;
- }
++ /* Force to use our YCbCr to Packed RGB converter when possible */
++ if (!mTransform && (mCMSMode != eCMSMode_All) &&
++ mInfo.jpeg_color_space == JCS_YCbCr && mInfo.out_color_space == JCS_RGB) {
++ /* Special case for the most common case: transform from YCbCr direct into packed ARGB */
++ mInfo.out_color_components = 4; /* Packed ARGB pixels are always 4 bytes...*/
++ mInfo.cconvert->color_convert = ycc_rgb_convert_argb;
++ }
+#endif
/* If this is a progressive JPEG ... */
mState = mInfo.buffered_image ? JPEG_DECOMPRESS_PROGRESSIVE : JPEG_DECOMPRESS_SEQUENTIAL;
-@@ -542,7 +566,11 @@ nsJPEGDecoder::OutputScanlines(bool* suspend)
- PRUint32 *imageRow = ((PRUint32*)mImageData) +
+@@ -544,7 +573,11 @@ nsJPEGDecoder::OutputScanlines(bool* suspend)
+ uint32_t *imageRow = ((uint32_t*)mImageData) +
(mInfo.output_scanline * mInfo.output_width);
+#ifdef JCS_EXTENSIONS
-+ if (mInfo.out_color_space == MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB) {
+ if (mInfo.out_color_space == MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB) {
+#else
- if (mInfo.cconvert->color_convert == ycc_rgb_convert_argb) {
++ if (mInfo.cconvert->color_convert == ycc_rgb_convert_argb) {
+#endif
/* Special case: scanline will be directly converted into packed ARGB */
if (jpeg_read_scanlines(&mInfo, (JSAMPARRAY)&imageRow, 1) != 1) {
*suspend = true; /* suspend */
-@@ -858,6 +887,7 @@ term_source (j_decompress_ptr jd)
+@@ -854,6 +887,282 @@ term_source (j_decompress_ptr jd)
} // namespace mozilla
+#ifndef JCS_EXTENSIONS
- /**************** YCbCr -> Cairo's RGB24/ARGB32 conversion: most common case **************/
-
- /*
-@@ -1130,7 +1160,8 @@ ycc_rgb_convert_argb (j_decompress_ptr cinfo,
- }
- }
- }
++/**************** YCbCr -> Cairo's RGB24/ARGB32 conversion: most common case **************/
++
++/*
++ * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
++ * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
++ * The conversion equations to be implemented are therefore
++ * R = Y + 1.40200 * Cr
++ * G = Y - 0.34414 * Cb - 0.71414 * Cr
++ * B = Y + 1.77200 * Cb
++ * where Cb and Cr represent the incoming values less CENTERJSAMPLE.
++ * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
++ *
++ * To avoid floating-point arithmetic, we represent the fractional constants
++ * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
++ * the products by 2^16, with appropriate rounding, to get the correct answer.
++ * Notice that Y, being an integral input, does not contribute any fraction
++ * so it need not participate in the rounding.
++ *
++ * For even more speed, we avoid doing any multiplications in the inner loop
++ * by precalculating the constants times Cb and Cr for all possible values.
++ * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
++ * for 12-bit samples it is still acceptable. It's not very reasonable for
++ * 16-bit samples, but if you want lossless storage you shouldn't be changing
++ * colorspace anyway.
++ * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
++ * values for the G calculation are left scaled up, since we must add them
++ * together before rounding.
++ */
++
++#define SCALEBITS 16 /* speediest right-shift on some machines */
++
++/* Use static tables for color processing. */
++/* Four tables, each 256 entries of 4 bytes totals 4K which is not bad... */
++
++const int Cr_r_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ -0xb3, -0xb2, -0xb1, -0xaf, -0xae, -0xac,
++ -0xab, -0xaa, -0xa8, -0xa7, -0xa5, -0xa4,
++ -0xa3, -0xa1, -0xa0, -0x9e, -0x9d, -0x9c,
++ -0x9a, -0x99, -0x97, -0x96, -0x95, -0x93,
++ -0x92, -0x90, -0x8f, -0x8e, -0x8c, -0x8b,
++ -0x89, -0x88, -0x87, -0x85, -0x84, -0x82,
++ -0x81, -0x80, -0x7e, -0x7d, -0x7b, -0x7a,
++ -0x79, -0x77, -0x76, -0x74, -0x73, -0x72,
++ -0x70, -0x6f, -0x6d, -0x6c, -0x6b, -0x69,
++ -0x68, -0x66, -0x65, -0x64, -0x62, -0x61,
++ -0x5f, -0x5e, -0x5d, -0x5b, -0x5a, -0x58,
++ -0x57, -0x56, -0x54, -0x53, -0x51, -0x50,
++ -0x4f, -0x4d, -0x4c, -0x4a, -0x49, -0x48,
++ -0x46, -0x45, -0x43, -0x42, -0x40, -0x3f,
++ -0x3e, -0x3c, -0x3b, -0x39, -0x38, -0x37,
++ -0x35, -0x34, -0x32, -0x31, -0x30, -0x2e,
++ -0x2d, -0x2b, -0x2a, -0x29, -0x27, -0x26,
++ -0x24, -0x23, -0x22, -0x20, -0x1f, -0x1d,
++ -0x1c, -0x1b, -0x19, -0x18, -0x16, -0x15,
++ -0x14, -0x12, -0x11, -0x0f, -0x0e, -0x0d,
++ -0x0b, -0x0a, -0x08, -0x07, -0x06, -0x04,
++ -0x03, -0x01, 0x00, 0x01, 0x03, 0x04,
++ 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0d,
++ 0x0e, 0x0f, 0x11, 0x12, 0x14, 0x15,
++ 0x16, 0x18, 0x19, 0x1b, 0x1c, 0x1d,
++ 0x1f, 0x20, 0x22, 0x23, 0x24, 0x26,
++ 0x27, 0x29, 0x2a, 0x2b, 0x2d, 0x2e,
++ 0x30, 0x31, 0x32, 0x34, 0x35, 0x37,
++ 0x38, 0x39, 0x3b, 0x3c, 0x3e, 0x3f,
++ 0x40, 0x42, 0x43, 0x45, 0x46, 0x48,
++ 0x49, 0x4a, 0x4c, 0x4d, 0x4f, 0x50,
++ 0x51, 0x53, 0x54, 0x56, 0x57, 0x58,
++ 0x5a, 0x5b, 0x5d, 0x5e, 0x5f, 0x61,
++ 0x62, 0x64, 0x65, 0x66, 0x68, 0x69,
++ 0x6b, 0x6c, 0x6d, 0x6f, 0x70, 0x72,
++ 0x73, 0x74, 0x76, 0x77, 0x79, 0x7a,
++ 0x7b, 0x7d, 0x7e, 0x80, 0x81, 0x82,
++ 0x84, 0x85, 0x87, 0x88, 0x89, 0x8b,
++ 0x8c, 0x8e, 0x8f, 0x90, 0x92, 0x93,
++ 0x95, 0x96, 0x97, 0x99, 0x9a, 0x9c,
++ 0x9d, 0x9e, 0xa0, 0xa1, 0xa3, 0xa4,
++ 0xa5, 0xa7, 0xa8, 0xaa, 0xab, 0xac,
++ 0xae, 0xaf, 0xb1, 0xb2,
++ };
++
++const int Cb_b_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ -0xe3, -0xe1, -0xdf, -0xde, -0xdc, -0xda,
++ -0xd8, -0xd6, -0xd5, -0xd3, -0xd1, -0xcf,
++ -0xce, -0xcc, -0xca, -0xc8, -0xc6, -0xc5,
++ -0xc3, -0xc1, -0xbf, -0xbe, -0xbc, -0xba,
++ -0xb8, -0xb7, -0xb5, -0xb3, -0xb1, -0xaf,
++ -0xae, -0xac, -0xaa, -0xa8, -0xa7, -0xa5,
++ -0xa3, -0xa1, -0x9f, -0x9e, -0x9c, -0x9a,
++ -0x98, -0x97, -0x95, -0x93, -0x91, -0x90,
++ -0x8e, -0x8c, -0x8a, -0x88, -0x87, -0x85,
++ -0x83, -0x81, -0x80, -0x7e, -0x7c, -0x7a,
++ -0x78, -0x77, -0x75, -0x73, -0x71, -0x70,
++ -0x6e, -0x6c, -0x6a, -0x69, -0x67, -0x65,
++ -0x63, -0x61, -0x60, -0x5e, -0x5c, -0x5a,
++ -0x59, -0x57, -0x55, -0x53, -0x52, -0x50,
++ -0x4e, -0x4c, -0x4a, -0x49, -0x47, -0x45,
++ -0x43, -0x42, -0x40, -0x3e, -0x3c, -0x3a,
++ -0x39, -0x37, -0x35, -0x33, -0x32, -0x30,
++ -0x2e, -0x2c, -0x2b, -0x29, -0x27, -0x25,
++ -0x23, -0x22, -0x20, -0x1e, -0x1c, -0x1b,
++ -0x19, -0x17, -0x15, -0x13, -0x12, -0x10,
++ -0x0e, -0x0c, -0x0b, -0x09, -0x07, -0x05,
++ -0x04, -0x02, 0x00, 0x02, 0x04, 0x05,
++ 0x07, 0x09, 0x0b, 0x0c, 0x0e, 0x10,
++ 0x12, 0x13, 0x15, 0x17, 0x19, 0x1b,
++ 0x1c, 0x1e, 0x20, 0x22, 0x23, 0x25,
++ 0x27, 0x29, 0x2b, 0x2c, 0x2e, 0x30,
++ 0x32, 0x33, 0x35, 0x37, 0x39, 0x3a,
++ 0x3c, 0x3e, 0x40, 0x42, 0x43, 0x45,
++ 0x47, 0x49, 0x4a, 0x4c, 0x4e, 0x50,
++ 0x52, 0x53, 0x55, 0x57, 0x59, 0x5a,
++ 0x5c, 0x5e, 0x60, 0x61, 0x63, 0x65,
++ 0x67, 0x69, 0x6a, 0x6c, 0x6e, 0x70,
++ 0x71, 0x73, 0x75, 0x77, 0x78, 0x7a,
++ 0x7c, 0x7e, 0x80, 0x81, 0x83, 0x85,
++ 0x87, 0x88, 0x8a, 0x8c, 0x8e, 0x90,
++ 0x91, 0x93, 0x95, 0x97, 0x98, 0x9a,
++ 0x9c, 0x9e, 0x9f, 0xa1, 0xa3, 0xa5,
++ 0xa7, 0xa8, 0xaa, 0xac, 0xae, 0xaf,
++ 0xb1, 0xb3, 0xb5, 0xb7, 0xb8, 0xba,
++ 0xbc, 0xbe, 0xbf, 0xc1, 0xc3, 0xc5,
++ 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xcf,
++ 0xd1, 0xd3, 0xd5, 0xd6, 0xd8, 0xda,
++ 0xdc, 0xde, 0xdf, 0xe1,
++ };
++
++const int Cr_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ 0x5b6900, 0x5ab22e, 0x59fb5c, 0x59448a, 0x588db8, 0x57d6e6,
++ 0x572014, 0x566942, 0x55b270, 0x54fb9e, 0x5444cc, 0x538dfa,
++ 0x52d728, 0x522056, 0x516984, 0x50b2b2, 0x4ffbe0, 0x4f450e,
++ 0x4e8e3c, 0x4dd76a, 0x4d2098, 0x4c69c6, 0x4bb2f4, 0x4afc22,
++ 0x4a4550, 0x498e7e, 0x48d7ac, 0x4820da, 0x476a08, 0x46b336,
++ 0x45fc64, 0x454592, 0x448ec0, 0x43d7ee, 0x43211c, 0x426a4a,
++ 0x41b378, 0x40fca6, 0x4045d4, 0x3f8f02, 0x3ed830, 0x3e215e,
++ 0x3d6a8c, 0x3cb3ba, 0x3bfce8, 0x3b4616, 0x3a8f44, 0x39d872,
++ 0x3921a0, 0x386ace, 0x37b3fc, 0x36fd2a, 0x364658, 0x358f86,
++ 0x34d8b4, 0x3421e2, 0x336b10, 0x32b43e, 0x31fd6c, 0x31469a,
++ 0x308fc8, 0x2fd8f6, 0x2f2224, 0x2e6b52, 0x2db480, 0x2cfdae,
++ 0x2c46dc, 0x2b900a, 0x2ad938, 0x2a2266, 0x296b94, 0x28b4c2,
++ 0x27fdf0, 0x27471e, 0x26904c, 0x25d97a, 0x2522a8, 0x246bd6,
++ 0x23b504, 0x22fe32, 0x224760, 0x21908e, 0x20d9bc, 0x2022ea,
++ 0x1f6c18, 0x1eb546, 0x1dfe74, 0x1d47a2, 0x1c90d0, 0x1bd9fe,
++ 0x1b232c, 0x1a6c5a, 0x19b588, 0x18feb6, 0x1847e4, 0x179112,
++ 0x16da40, 0x16236e, 0x156c9c, 0x14b5ca, 0x13fef8, 0x134826,
++ 0x129154, 0x11da82, 0x1123b0, 0x106cde, 0x0fb60c, 0x0eff3a,
++ 0x0e4868, 0x0d9196, 0x0cdac4, 0x0c23f2, 0x0b6d20, 0x0ab64e,
++ 0x09ff7c, 0x0948aa, 0x0891d8, 0x07db06, 0x072434, 0x066d62,
++ 0x05b690, 0x04ffbe, 0x0448ec, 0x03921a, 0x02db48, 0x022476,
++ 0x016da4, 0x00b6d2, 0x000000, -0x00b6d2, -0x016da4, -0x022476,
++ -0x02db48, -0x03921a, -0x0448ec, -0x04ffbe, -0x05b690, -0x066d62,
++ -0x072434, -0x07db06, -0x0891d8, -0x0948aa, -0x09ff7c, -0x0ab64e,
++ -0x0b6d20, -0x0c23f2, -0x0cdac4, -0x0d9196, -0x0e4868, -0x0eff3a,
++ -0x0fb60c, -0x106cde, -0x1123b0, -0x11da82, -0x129154, -0x134826,
++ -0x13fef8, -0x14b5ca, -0x156c9c, -0x16236e, -0x16da40, -0x179112,
++ -0x1847e4, -0x18feb6, -0x19b588, -0x1a6c5a, -0x1b232c, -0x1bd9fe,
++ -0x1c90d0, -0x1d47a2, -0x1dfe74, -0x1eb546, -0x1f6c18, -0x2022ea,
++ -0x20d9bc, -0x21908e, -0x224760, -0x22fe32, -0x23b504, -0x246bd6,
++ -0x2522a8, -0x25d97a, -0x26904c, -0x27471e, -0x27fdf0, -0x28b4c2,
++ -0x296b94, -0x2a2266, -0x2ad938, -0x2b900a, -0x2c46dc, -0x2cfdae,
++ -0x2db480, -0x2e6b52, -0x2f2224, -0x2fd8f6, -0x308fc8, -0x31469a,
++ -0x31fd6c, -0x32b43e, -0x336b10, -0x3421e2, -0x34d8b4, -0x358f86,
++ -0x364658, -0x36fd2a, -0x37b3fc, -0x386ace, -0x3921a0, -0x39d872,
++ -0x3a8f44, -0x3b4616, -0x3bfce8, -0x3cb3ba, -0x3d6a8c, -0x3e215e,
++ -0x3ed830, -0x3f8f02, -0x4045d4, -0x40fca6, -0x41b378, -0x426a4a,
++ -0x43211c, -0x43d7ee, -0x448ec0, -0x454592, -0x45fc64, -0x46b336,
++ -0x476a08, -0x4820da, -0x48d7ac, -0x498e7e, -0x4a4550, -0x4afc22,
++ -0x4bb2f4, -0x4c69c6, -0x4d2098, -0x4dd76a, -0x4e8e3c, -0x4f450e,
++ -0x4ffbe0, -0x50b2b2, -0x516984, -0x522056, -0x52d728, -0x538dfa,
++ -0x5444cc, -0x54fb9e, -0x55b270, -0x566942, -0x572014, -0x57d6e6,
++ -0x588db8, -0x59448a, -0x59fb5c, -0x5ab22e,
++ };
++
++const int Cb_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={
++ 0x2c8d00, 0x2c34e6, 0x2bdccc, 0x2b84b2, 0x2b2c98, 0x2ad47e,
++ 0x2a7c64, 0x2a244a, 0x29cc30, 0x297416, 0x291bfc, 0x28c3e2,
++ 0x286bc8, 0x2813ae, 0x27bb94, 0x27637a, 0x270b60, 0x26b346,
++ 0x265b2c, 0x260312, 0x25aaf8, 0x2552de, 0x24fac4, 0x24a2aa,
++ 0x244a90, 0x23f276, 0x239a5c, 0x234242, 0x22ea28, 0x22920e,
++ 0x2239f4, 0x21e1da, 0x2189c0, 0x2131a6, 0x20d98c, 0x208172,
++ 0x202958, 0x1fd13e, 0x1f7924, 0x1f210a, 0x1ec8f0, 0x1e70d6,
++ 0x1e18bc, 0x1dc0a2, 0x1d6888, 0x1d106e, 0x1cb854, 0x1c603a,
++ 0x1c0820, 0x1bb006, 0x1b57ec, 0x1affd2, 0x1aa7b8, 0x1a4f9e,
++ 0x19f784, 0x199f6a, 0x194750, 0x18ef36, 0x18971c, 0x183f02,
++ 0x17e6e8, 0x178ece, 0x1736b4, 0x16de9a, 0x168680, 0x162e66,
++ 0x15d64c, 0x157e32, 0x152618, 0x14cdfe, 0x1475e4, 0x141dca,
++ 0x13c5b0, 0x136d96, 0x13157c, 0x12bd62, 0x126548, 0x120d2e,
++ 0x11b514, 0x115cfa, 0x1104e0, 0x10acc6, 0x1054ac, 0x0ffc92,
++ 0x0fa478, 0x0f4c5e, 0x0ef444, 0x0e9c2a, 0x0e4410, 0x0debf6,
++ 0x0d93dc, 0x0d3bc2, 0x0ce3a8, 0x0c8b8e, 0x0c3374, 0x0bdb5a,
++ 0x0b8340, 0x0b2b26, 0x0ad30c, 0x0a7af2, 0x0a22d8, 0x09cabe,
++ 0x0972a4, 0x091a8a, 0x08c270, 0x086a56, 0x08123c, 0x07ba22,
++ 0x076208, 0x0709ee, 0x06b1d4, 0x0659ba, 0x0601a0, 0x05a986,
++ 0x05516c, 0x04f952, 0x04a138, 0x04491e, 0x03f104, 0x0398ea,
++ 0x0340d0, 0x02e8b6, 0x02909c, 0x023882, 0x01e068, 0x01884e,
++ 0x013034, 0x00d81a, 0x008000, 0x0027e6, -0x003034, -0x00884e,
++ -0x00e068, -0x013882, -0x01909c, -0x01e8b6, -0x0240d0, -0x0298ea,
++ -0x02f104, -0x03491e, -0x03a138, -0x03f952, -0x04516c, -0x04a986,
++ -0x0501a0, -0x0559ba, -0x05b1d4, -0x0609ee, -0x066208, -0x06ba22,
++ -0x07123c, -0x076a56, -0x07c270, -0x081a8a, -0x0872a4, -0x08cabe,
++ -0x0922d8, -0x097af2, -0x09d30c, -0x0a2b26, -0x0a8340, -0x0adb5a,
++ -0x0b3374, -0x0b8b8e, -0x0be3a8, -0x0c3bc2, -0x0c93dc, -0x0cebf6,
++ -0x0d4410, -0x0d9c2a, -0x0df444, -0x0e4c5e, -0x0ea478, -0x0efc92,
++ -0x0f54ac, -0x0facc6, -0x1004e0, -0x105cfa, -0x10b514, -0x110d2e,
++ -0x116548, -0x11bd62, -0x12157c, -0x126d96, -0x12c5b0, -0x131dca,
++ -0x1375e4, -0x13cdfe, -0x142618, -0x147e32, -0x14d64c, -0x152e66,
++ -0x158680, -0x15de9a, -0x1636b4, -0x168ece, -0x16e6e8, -0x173f02,
++ -0x17971c, -0x17ef36, -0x184750, -0x189f6a, -0x18f784, -0x194f9e,
++ -0x19a7b8, -0x19ffd2, -0x1a57ec, -0x1ab006, -0x1b0820, -0x1b603a,
++ -0x1bb854, -0x1c106e, -0x1c6888, -0x1cc0a2, -0x1d18bc, -0x1d70d6,
++ -0x1dc8f0, -0x1e210a, -0x1e7924, -0x1ed13e, -0x1f2958, -0x1f8172,
++ -0x1fd98c, -0x2031a6, -0x2089c0, -0x20e1da, -0x2139f4, -0x21920e,
++ -0x21ea28, -0x224242, -0x229a5c, -0x22f276, -0x234a90, -0x23a2aa,
++ -0x23fac4, -0x2452de, -0x24aaf8, -0x250312, -0x255b2c, -0x25b346,
++ -0x260b60, -0x26637a, -0x26bb94, -0x2713ae, -0x276bc8, -0x27c3e2,
++ -0x281bfc, -0x287416, -0x28cc30, -0x29244a, -0x297c64, -0x29d47e,
++ -0x2a2c98, -0x2a84b2, -0x2adccc, -0x2b34e6,
++ };
++
++
++/* We assume that right shift corresponds to signed division by 2 with
++ * rounding towards minus infinity. This is correct for typical "arithmetic
++ * shift" instructions that shift in copies of the sign bit. But some
++ * C compilers implement >> with an unsigned shift. For these machines you
++ * must define RIGHT_SHIFT_IS_UNSIGNED.
++ * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity.
++ * It is only applied with constant shift counts. SHIFT_TEMPS must be
++ * included in the variables of any routine using RIGHT_SHIFT.
++ */
++
++#ifdef RIGHT_SHIFT_IS_UNSIGNED
++#define SHIFT_TEMPS INT32 shift_temp;
++#define RIGHT_SHIFT(x,shft) \
++ ((shift_temp = (x)) < 0 ? \
++ (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \
++ (shift_temp >> (shft)))
++#else
++#define SHIFT_TEMPS
++#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
+#endif
-
-
++
++
++METHODDEF(void)
++ycc_rgb_convert_argb (j_decompress_ptr cinfo,
++ JSAMPIMAGE input_buf, JDIMENSION input_row,
++ JSAMPARRAY output_buf, int num_rows)
++{
++ JDIMENSION num_cols = cinfo->output_width;
++ JSAMPLE * range_limit = cinfo->sample_range_limit;
++
++ SHIFT_TEMPS
++
++ /* This is used if we don't have SSE2 */
++
++ while (--num_rows >= 0) {
++ JSAMPROW inptr0 = input_buf[0][input_row];
++ JSAMPROW inptr1 = input_buf[1][input_row];
++ JSAMPROW inptr2 = input_buf[2][input_row];
++ input_row++;
++ uint32_t *outptr = (uint32_t *) *output_buf++;
++ for (JDIMENSION col = 0; col < num_cols; col++) {
++ int y = GETJSAMPLE(inptr0[col]);
++ int cb = GETJSAMPLE(inptr1[col]);
++ int cr = GETJSAMPLE(inptr2[col]);
++ JSAMPLE * range_limit_y = range_limit + y;
++ /* Range-limiting is essential due to noise introduced by DCT losses. */
++ outptr[col] = 0xFF000000 |
++ ( range_limit_y[Cr_r_tab[cr]] << 16 ) |
++ ( range_limit_y[((int) RIGHT_SHIFT(Cb_g_tab[cb] + Cr_g_tab[cr], SCALEBITS))] << 8 ) |
++ ( range_limit_y[Cb_b_tab[cb]] );
++ }
++ }
++}
++#endif
++
++
/**************** Inverted CMYK -> RGB conversion **************/
/*
+ * Input is (Inverted) CMYK stored as 4 bytes per pixel.
diff --git a/www/seamonkey/files/patch-bug791366 b/www/seamonkey/files/patch-bug791366
deleted file mode 100644
index 90e9e523bbbe..000000000000
--- a/www/seamonkey/files/patch-bug791366
+++ /dev/null
@@ -1,95 +0,0 @@
-diff --git mozilla/xpcom/base/nsMemoryReporterManager.cpp mozilla/xpcom/base/nsMemoryReporterManager.cpp
-index a9aff58..674e757 100644
---- mozilla/xpcom/base/nsMemoryReporterManager.cpp
-+++ mozilla/xpcom/base/nsMemoryReporterManager.cpp
-@@ -32,7 +32,7 @@ using namespace mozilla;
- # include "jemalloc.h"
- #endif // MOZ_MEMORY
-
--#if defined(XP_LINUX) || defined(XP_MACOSX) || defined(SOLARIS)
-+#ifdef XP_UNIX
-
- #include <sys/time.h>
- #include <sys/resource.h>
-@@ -95,6 +95,81 @@ static nsresult GetResident(PRInt64 *n)
- return GetProcSelfStatmField(1, n);
- }
-
-+#elif defined(__DragonFly__) || defined(__FreeBSD__) \
-+ || defined(__NetBSD__) || defined(__OpenBSD__)
-+
-+#include <sys/param.h>
-+#include <sys/sysctl.h>
-+#if defined(__DragonFly__) || defined(__FreeBSD__)
-+#include <sys/user.h>
-+#endif
-+
-+#include <unistd.h>
-+
-+#if defined(__NetBSD__)
-+#undef KERN_PROC
-+#define KERN_PROC KERN_PROC2
-+#define KINFO_PROC struct kinfo_proc2
-+#else
-+#define KINFO_PROC struct kinfo_proc
-+#endif
-+
-+#if defined(__DragonFly__)
-+#define KP_SIZE(kp) (kp.kp_vm_map_size)
-+#define KP_RSS(kp) (kp.kp_vm_rssize * getpagesize())
-+#elif defined(__FreeBSD__)
-+#define KP_SIZE(kp) (kp.ki_size)
-+#define KP_RSS(kp) (kp.ki_rssize * getpagesize())
-+#elif defined(__NetBSD__)
-+#define KP_SIZE(kp) (kp.p_vm_msize * getpagesize())
-+#define KP_RSS(kp) (kp.p_vm_rssize * getpagesize())
-+#elif defined(__OpenBSD__)
-+#define KP_SIZE(kp) ((kp.p_vm_dsize + kp.p_vm_ssize \
-+ + kp.p_vm_tsize) * getpagesize())
-+#define KP_RSS(kp) (kp.p_vm_rssize * getpagesize())
-+#endif
-+
-+static nsresult GetKinfoProcSelf(KINFO_PROC *proc)
-+{
-+ int mib[] = {
-+ CTL_KERN,
-+ KERN_PROC,
-+ KERN_PROC_PID,
-+ getpid(),
-+#if defined(__NetBSD__) || defined(__OpenBSD__)
-+ sizeof(KINFO_PROC),
-+ 1,
-+#endif
-+ };
-+ u_int miblen = sizeof(mib) / sizeof(mib[0]);
-+ size_t size = sizeof(KINFO_PROC);
-+ if (sysctl(mib, miblen, proc, &size, NULL, 0))
-+ return NS_ERROR_FAILURE;
-+
-+ return NS_OK;
-+}
-+
-+#define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
-+static nsresult GetVsize(PRInt64 *n)
-+{
-+ KINFO_PROC proc;
-+ nsresult rv = GetKinfoProcSelf(&proc);
-+ if (NS_SUCCEEDED(rv))
-+ *n = KP_SIZE(proc);
-+
-+ return rv;
-+}
-+
-+static nsresult GetResident(PRInt64 *n)
-+{
-+ KINFO_PROC proc;
-+ nsresult rv = GetKinfoProcSelf(&proc);
-+ if (NS_SUCCEEDED(rv))
-+ *n = KP_RSS(proc);
-+
-+ return rv;
-+}
-+
- #elif defined(SOLARIS)
-
- #include <procfs.h>
diff --git a/www/seamonkey/files/patch-bug798354 b/www/seamonkey/files/patch-bug798354
new file mode 100644
index 000000000000..26ce712479ff
--- /dev/null
+++ b/www/seamonkey/files/patch-bug798354
@@ -0,0 +1,15 @@
+--- mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.cc~
++++ mozilla/ipc/chromium/src/chrome/common/ipc_channel_posix.cc
+@@ -133,7 +133,12 @@ int ChannelNameToClientFD(const std::string& channel_id) {
+ }
+
+ //------------------------------------------------------------------------------
++#if !defined(__clang__) && defined(__GNUC__) && __GNUC_MINOR__ <= 2
++sockaddr_un sizecheck;
++const size_t kMaxPipeNameLength = sizeof(sizecheck.sun_path);
++#else
+ const size_t kMaxPipeNameLength = sizeof(sockaddr_un::sun_path);
++#endif
+
+ // Creates a Fifo with the specified name ready to listen on.
+ bool CreateServerFifo(const std::string& pipe_name, int* server_listen_fd) {
diff --git a/www/seamonkey/files/patch-bug799441 b/www/seamonkey/files/patch-bug799441
deleted file mode 100644
index 35d43a9b4579..000000000000
--- a/www/seamonkey/files/patch-bug799441
+++ /dev/null
@@ -1,116 +0,0 @@
-commit b9accdd
-Author: Mike Hommey <mh+mozilla@glandium.org>
-Date: Thu Oct 18 14:47:10 2012 +0200
-
- Bug 799441 - Build GIO module in libxul. r=ted
----
- configure.in | 6 ++++++
- extensions/gio/Makefile.in | 14 +++-----------
- toolkit/library/Makefile.in | 5 +++++
- toolkit/library/nsStaticXULComponents.cpp | 7 +++++++
- toolkit/toolkit-tiers.mk | 4 ++++
- 5 files changed, 25 insertions(+), 11 deletions(-)
-
-diff --git configure.in configure.in
-index a9fb5f1..37e6db8 100644
---- mozilla/configure.in
-+++ mozilla/configure.in
-@@ -6086,6 +6086,12 @@ if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; th
- MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
- fi
-
-+if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
-+ MOZ_GIO_COMPONENT=1
-+ MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
-+fi
-+AC_SUBST(MOZ_GIO_COMPONENT)
-+
- if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
- AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
- MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
-diff --git extensions/gio/Makefile.in extensions/gio/Makefile.in
-index ccf2846..79112a8 100644
---- mozilla/extensions/gio/Makefile.in
-+++ mozilla/extensions/gio/Makefile.in
-@@ -14,6 +14,9 @@ MODULE = nkgio
- LIBRARY_NAME = nkgio
- SHORT_LIBNAME = nkgio
- IS_COMPONENT = 1
-+EXPORT_LIBRARY = 1
-+MODULE_NAME = nsGIOModule
-+LIBXUL_LIBRARY = 1
-
- CPPSRCS = \
- nsGIOProtocolHandler.cpp \
-@@ -21,15 +24,4 @@ CPPSRCS = \
-
- LOCAL_INCLUDES = $(MOZ_GIO_CFLAGS)
-
--EXTRA_DSO_LDOPTS = \
-- $(XPCOM_GLUE_LDOPTS) \
-- $(MOZ_COMPONENT_LIBS) \
-- $(MOZ_GIO_LIBS) \
-- $(NULL)
--
--# make sure this component is never statically linked into the main
--# application. this is necessary since we don't want to force users
--# to install gio in order to use the rest of mozilla ;-)
--FORCE_SHARED_LIB= 1
--
- include $(topsrcdir)/config/rules.mk
-diff --git toolkit/library/Makefile.in toolkit/library/Makefile.in
-index 7f9046e..6499758 100644
---- mozilla/toolkit/library/Makefile.in
-+++ mozilla/toolkit/library/Makefile.in
-@@ -333,6 +333,11 @@ COMPONENT_LIBS += gkdebug
- endif
- endif
-
-+ifdef MOZ_GIO_COMPONENT
-+DEFINES += -DMOZ_GIO_COMPONENT
-+COMPONENT_LIBS += nkgio
-+endif
-+
- ifdef MOZ_APP_COMPONENT_LIBS
- COMPONENT_LIBS += $(MOZ_APP_COMPONENT_LIBS)
- endif
-diff --git toolkit/library/nsStaticXULComponents.cpp toolkit/library/nsStaticXULComponents.cpp
-index e1d90f2..85b21a2 100644
---- mozilla/toolkit/library/nsStaticXULComponents.cpp
-+++ mozilla/toolkit/library/nsStaticXULComponents.cpp
-@@ -164,6 +164,12 @@
- #define PROFILER_MODULE
- #endif
-
-+#if defined(MOZ_GIO_COMPONENT)
-+#define GIO_MODULE MODULE(nsGIOModule)
-+#else
-+#define GIO_MODULE
-+#endif
-+
- #define XUL_MODULES \
- MODULE(nsUConvModule) \
- MODULE(nsI18nModule) \
-@@ -220,6 +226,7 @@
- MODULE(nsTelemetryModule) \
- MODULE(jsinspector) \
- MODULE(jsdebugger) \
-+ GIO_MODULE \
- /* end of list */
-
- #define MODULE(_name) \
-diff --git toolkit/toolkit-tiers.mk toolkit/toolkit-tiers.mk
-index e87d7af..4b16d23 100644
---- mozilla/toolkit/toolkit-tiers.mk
-+++ mozilla/toolkit/toolkit-tiers.mk
-@@ -252,6 +252,10 @@ tier_platform_dirs += js/ductwork/debugger
-
- tier_platform_dirs += other-licenses/snappy
-
-+ifdef MOZ_GIO_COMPONENT
-+tier_platform_dirs += extensions/gio
-+endif
-+
- ifdef APP_LIBXUL_STATICDIRS
- # Applications can cheat and ask for code to be
- # built before libxul so libxul can be linked against it.
diff --git a/www/seamonkey/files/patch-bug800401 b/www/seamonkey/files/patch-bug800401
new file mode 100644
index 000000000000..b0364c3eb231
--- /dev/null
+++ b/www/seamonkey/files/patch-bug800401
@@ -0,0 +1,91 @@
+commit a564d64
+Author: Ehsan Akhgari <ehsan@mozilla.com>
+Date: Thu Oct 11 13:42:12 2012 -0400
+
+ Bug 800401 - Make sure that the WebRTC build system does not impose the -Werror flag on all Linux/Mac builds; r=jesup
+
+ In the future, we need to hook these up to the FAIL_ON_WARNINGS machinery.
+---
+ media/mtransport/third_party/nICEr/nicer.gyp | 2 --
+ media/mtransport/third_party/nrappkit/nrappkit.gyp | 2 --
+ media/webrtc/signaling/signaling.gyp | 6 ------
+ 3 files changed, 10 deletions(-)
+
+diff --git media/mtransport/third_party/nICEr/nicer.gyp media/mtransport/third_party/nICEr/nicer.gyp
+index 26ec0c5..0e1f8b4 100644
+--- mozilla/media/mtransport/third_party/nICEr/nicer.gyp
++++ mozilla/media/mtransport/third_party/nICEr/nicer.gyp
+@@ -132,7 +132,6 @@
+ ## Mac
+ [ 'OS == "mac"', {
+ 'cflags_mozilla': [
+- '-Werror',
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+@@ -183,7 +182,6 @@
+ ## Linux
+ [ 'OS == "linux"', {
+ 'cflags': [
+- '-Werror',
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+diff --git media/mtransport/third_party/nrappkit/nrappkit.gyp media/mtransport/third_party/nrappkit/nrappkit.gyp
+index f9a5c19..3cc8e1c 100644
+--- mozilla/media/mtransport/third_party/nrappkit/nrappkit.gyp
++++ mozilla/media/mtransport/third_party/nrappkit/nrappkit.gyp
+@@ -150,7 +150,6 @@
+ ## Mac
+ [ 'OS == "mac"', {
+ 'cflags_mozilla': [
+- '-Werror',
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+@@ -200,7 +199,6 @@
+ ## Linux
+ [ 'OS == "linux"', {
+ 'cflags': [
+- '-Werror',
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+diff --git media/webrtc/signaling/signaling.gyp media/webrtc/signaling/signaling.gyp
+index 1ec0ee2..175996f 100644
+--- mozilla/media/webrtc/signaling/signaling.gyp
++++ mozilla/media/webrtc/signaling/signaling.gyp
+@@ -184,7 +184,6 @@
+ ],
+
+ 'cflags_mozilla': [
+- '-Werror',
+ ],
+ }],
+ ['OS=="win"', {
+@@ -212,8 +211,6 @@
+ ],
+
+ 'cflags_mozilla': [
+- '-Werror',
+- '-Wno-error=conversion'
+ ],
+ }],
+ ],
+@@ -633,7 +630,6 @@
+ ],
+
+ 'cflags_mozilla': [
+- '-Werror',
+ ],
+ }],
+ ['OS=="win"', {
+@@ -752,8 +748,6 @@
+ ],
+
+ 'cflags_mozilla': [
+- '-Werror',
+- '-Wno-error=conversion'
+ ],
+ }],
+ ],
diff --git a/www/seamonkey/files/patch-bug806139 b/www/seamonkey/files/patch-bug806139
index d3676869659b..0bdf975ce228 100644
--- a/www/seamonkey/files/patch-bug806139
+++ b/www/seamonkey/files/patch-bug806139
@@ -11,10 +11,10 @@
#ifdef MOZ_MEDIA_PLUGINS
--- mozilla/content/html/content/src/nsHTMLMediaElement.cpp~
+++ mozilla/content/html/content/src/nsHTMLMediaElement.cpp
-@@ -2114,12 +2114,14 @@ const char nsHTMLMediaElement::gH264Type
- "video/quicktime",
- };
+@@ -2135,12 +2135,14 @@ nsHTMLMediaElement::IsWebMType(const nsA
+ #endif
+ #if defined(MOZ_GSTREAMER) || defined(MOZ_WIDGET_GONK)
-char const *const nsHTMLMediaElement::gH264Codecs[7] = {
+char const *const nsHTMLMediaElement::gH264Codecs[9] = {
"avc1.42E01E",
diff --git a/www/seamonkey/files/patch-bug807492 b/www/seamonkey/files/patch-bug807492
new file mode 100644
index 000000000000..578e18ae5535
--- /dev/null
+++ b/www/seamonkey/files/patch-bug807492
@@ -0,0 +1,2188 @@
+diff --git config/system-headers config/system-headers
+index 9bd1efa..1095a01 100644
+--- mozilla/config/system-headers
++++ mozilla/config/system-headers
+@@ -1066,8 +1066,10 @@ gst/app/gstappsink.h
+ gst/app/gstappsrc.h
+ gst/video/video.h
+ sys/msg.h
+ sys/ipc.h
+ sys/thr.h
+ sys/user.h
+ kvm.h
+ spawn.h
++err.h
++xlocale.h
+diff --git configure.in configure.in
+index c167461..8346c11 100644
+--- mozilla/configure.in
++++ mozilla/configure.in
+@@ -1413,16 +1413,27 @@ if test "$GNU_CC"; then
+ _SAVE_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS -mssse3"
+ AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
+ [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
+ AC_MSG_RESULT([no]))
+ CFLAGS=$_SAVE_CFLAGS
+ AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
+
++ # Check for -msse4.1 on $CC
++ AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
++ HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
++ _SAVE_CFLAGS=$CFLAGS
++ CFLAGS="$CFLAGS -msse4.1"
++ AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
++ [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
++ AC_MSG_RESULT([no]))
++ CFLAGS=$_SAVE_CFLAGS
++ AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
++
+ # Turn on GNU-specific warnings:
+ # -Wall - turn on a lot of warnings
+ # -pedantic - this is turned on below
+ # -Wpointer-arith - enabled with -pedantic, but good to have even if not
+ # -Wdeclaration-after-statement - MSVC doesn't like these
+ # -Werror=return-type - catches missing returns, zero false positives
+ # -Wtype-limits - catches overflow bugs, few false positives
+ # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
+@@ -5232,17 +5243,17 @@ dnl Turn off webrtc for OS's we don't handle yet, but allow
+ dnl --enable-webrtc to override. Can disable for everything in
+ dnl the master list above.
+ if test -n "$MOZ_WEBRTC"; then
+ case "$target" in
+ *-android*|*-linuxandroid*)
+ dnl Make sure doesn't get matched by *-linux*
+ MOZ_WEBRTC=
+ ;;
+- *-linux*|*-mingw*|*-darwin*)
++ *-linux*|*-mingw*|*-darwin*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
+ dnl Leave enabled
+ ;;
+ *)
+ dnl default to disabled for all others
+ MOZ_WEBRTC=
+ ;;
+ esac
+ fi
+@@ -8909,16 +8920,21 @@ if test "${OS_TARGET}" = "WINNT"; then
+ if test "$HAVE_64BIT_OS"; then
+ OS_BITS=64
+ else
+ OS_BITS=32
+ fi
+ EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
+ fi
+
++# Don't try to compile sse4.1 code if toolchain doesn't support
++if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then
++ EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1"
++fi
++
+ if test -n "$MOZ_WEBRTC"; then
+ AC_MSG_RESULT("generating WebRTC Makefiles...")
+
+ WEBRTC_CONFIG="-D build_with_mozilla=1 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
+
+ GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
+
+ $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
+diff --git js/src/config/system-headers js/src/config/system-headers
+index 9bd1efa..1095a01 100644
+--- mozilla/js/src/config/system-headers
++++ mozilla/js/src/config/system-headers
+@@ -1066,8 +1066,10 @@ gst/app/gstappsink.h
+ gst/app/gstappsrc.h
+ gst/video/video.h
+ sys/msg.h
+ sys/ipc.h
+ sys/thr.h
+ sys/user.h
+ kvm.h
+ spawn.h
++err.h
++xlocale.h
+diff --git media/mtransport/objs.mk media/mtransport/objs.mk
+index f1fc85f..141e8ca 100644
+--- mozilla/media/mtransport/objs.mk
++++ mozilla/media/mtransport/objs.mk
+@@ -18,22 +18,26 @@ LOCAL_INCLUDES += \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/util/libekr \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/log \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/registry \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/stats \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/plugin \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/event \
+ $(NULL)
+
+-ifeq ($(OS_ARCH), Darwin)
++ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
+ LOCAL_INCLUDES += \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/generic/include \
+ $(NULL)
++ifeq ($(OS_ARCH), Darwin)
+ DEFINES += -DDARWIN
++else
++DEFINES += -DBSD
++endif
+ endif
+
+ ifeq ($(OS_ARCH), Linux)
+ LOCAL_INCLUDES += \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/linux/include \
+ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/generic/include \
+ $(NULL)
+ DEFINES += -DLINUX
+diff --git media/mtransport/test/Makefile.in media/mtransport/test/Makefile.in
+index c1d5bf4..2ecf2c7 100644
+--- mozilla/media/mtransport/test/Makefile.in
++++ mozilla/media/mtransport/test/Makefile.in
+@@ -67,22 +67,24 @@ DEFINES += -D__Userspace_os_FreeBSD=1
+ else
+ #default_fallback; probably doesn't work
+ DEFINES += -D__Userspace_os_$(OS_TARGET)=1
+ endif
+ endif
+ endif
+ endif
+
+-ifeq ($(OS_ARCH), Darwin)
++ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
+ LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include
++ifeq ($(OS_TARGET), Darwin)
+ DEFINES += \
+ -DGTEST_USE_OWN_TR1_TUPLE=1 \
+ $(NULL)
+ endif
++endif
+
+ ifeq ($(OS_ARCH), Linux)
+ LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/linux/include
+ endif
+
+ ifneq ($(OS_TARGET),WINNT)
+ CPP_UNIT_TESTS = \
+ ice_unittest.cpp \
+diff --git media/mtransport/third_party/nICEr/nicer.gyp media/mtransport/third_party/nICEr/nicer.gyp
+index 0e1f8b4..9a4b995 100644
+--- mozilla/media/mtransport/third_party/nICEr/nicer.gyp
++++ mozilla/media/mtransport/third_party/nICEr/nicer.gyp
+@@ -124,26 +124,36 @@
+ 'R_DEFINED_UINT2=uint16_t',
+ 'R_DEFINED_INT4=int32_t',
+ 'R_DEFINED_UINT4=uint32_t',
+ 'R_DEFINED_INT8=int64_t',
+ 'R_DEFINED_UINT8=uint64_t',
+ ],
+
+ 'conditions' : [
+- ## Mac
++ ## Mac and BSDs
+ [ 'OS == "mac"', {
++ 'defines' : [
++ 'DARWIN',
++ 'HAVE_XLOCALE',
++ ],
++ }],
++ [ 'os_bsd == 1', {
++ 'defines' : [
++ 'BSD',
++ ],
++ }],
++ [ 'OS == "mac" or os_bsd == 1', {
+ 'cflags_mozilla': [
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+ '-Wmissing-prototypes',
+ ],
+ 'defines' : [
+- 'DARWIN',
+ 'HAVE_LIBM=1',
+ 'HAVE_STRDUP=1',
+ 'HAVE_STRLCPY=1',
+ 'HAVE_SYS_TIME_H=1',
+ 'HAVE_VFPRINTF=1',
+ 'NEW_STDIO'
+ 'RETSIGTYPE=void',
+ 'TIME_WITH_SYS_TIME_H=1',
+diff --git media/mtransport/third_party/nICEr/src/stun/addrs.c media/mtransport/third_party/nICEr/src/stun/addrs.c
+index b0b66b2..04fea94 100644
+--- mozilla/media/mtransport/third_party/nICEr/src/stun/addrs.c
++++ mozilla/media/mtransport/third_party/nICEr/src/stun/addrs.c
+@@ -69,17 +69,17 @@ static char *RCSSTRING __UNUSED__="$Id: addrs.c,v 1.2 2008/04/28 18:21:30 ekr Ex
+ #include <netdb.h>
+ #endif /* UNIX */
+
+ #include "stun.h"
+ #include "addrs.h"
+
+
+
+-#ifdef DARWIN
++#if defined(BSD) || defined(DARWIN)
+ /*
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+@@ -675,17 +675,17 @@ nr_stun_remove_duplicate_addrs(nr_transport_addr addrs[], int remove_loopback, i
+ }
+
+ int
+ nr_stun_get_addrs(nr_transport_addr addrs[], int maxaddrs, int drop_loopback, int *count)
+ {
+ int _status=0;
+ int i;
+
+-#ifdef DARWIN
++#if defined(BSD) || defined(DARWIN)
+ _status = stun_get_mib_addrs(addrs, maxaddrs, count);
+ #elif defined(WIN32)
+ _status = stun_get_win32_addrs(addrs, maxaddrs, count);
+ #elif defined(__sparc__)
+ _status = stun_get_sparc_addrs(addrs, maxaddrs, count);
+ #else
+ _status = stun_get_siocgifconf_addrs(addrs, maxaddrs, count);
+ #endif
+diff --git media/mtransport/third_party/nICEr/src/stun/stun.h media/mtransport/third_party/nICEr/src/stun/stun.h
+index a3c51f9..eb65ac8 100644
+--- mozilla/media/mtransport/third_party/nICEr/src/stun/stun.h
++++ mozilla/media/mtransport/third_party/nICEr/src/stun/stun.h
+@@ -40,17 +40,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #include <sys/param.h>
+ #include <sys/socket.h>
+ #include <net/if.h>
+ #ifndef LINUX
+ #include <net/if_var.h>
+ #include <net/if_dl.h>
+ #include <net/if_types.h>
+ #endif
++#ifndef BSD
+ #include <net/route.h>
++#endif
+ #include <netinet/in.h>
+ #ifndef LINUX
+ #include <netinet/in_var.h>
+ #endif
+ #include <arpa/inet.h>
+ #include <netdb.h>
+ #endif
+ #include <time.h>
+diff --git media/mtransport/third_party/nICEr/src/util/mbslen.c media/mtransport/third_party/nICEr/src/util/mbslen.c
+index cc260b7..66af2d7 100644
+--- mozilla/media/mtransport/third_party/nICEr/src/util/mbslen.c
++++ mozilla/media/mtransport/third_party/nICEr/src/util/mbslen.c
+@@ -38,50 +38,58 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ #include <errno.h>
+ #include <csi_platform.h>
+
+ #include <assert.h>
+ #include <locale.h>
+ #include <stdlib.h>
+ #include <wchar.h>
+-#ifdef DARWIN
++
++#ifdef __FreeBSD__
++#include <osreldate.h>
++# if __FreeBSD_version > 900044
++# define HAVE_XLOCALE
++# endif
++#endif
++
++#ifdef HAVE_XLOCALE
+ #include <xlocale.h>
+-#endif /* DARWIN */
++#endif /* HAVE_XLOCALE */
+
+ #include "nr_api.h"
+ #include "mbslen.h"
+
+ /* get number of characters in a mult-byte character string */
+ int
+ mbslen(const char *s, size_t *ncharsp)
+ {
+-#ifdef DARWIN
++#ifdef HAVE_XLOCALE
+ static locale_t loc = 0;
+ static int initialized = 0;
+-#endif /* DARWIN */
++#endif /* HAVE_XLOCALE */
+ #ifdef WIN32
+ char *my_locale=0;
+ unsigned int i;
+ #endif /* WIN32 */
+ int _status;
+ size_t nbytes;
+ int nchars;
+ mbstate_t mbs;
+
+-#ifdef DARWIN
++#ifdef HAVE_XLOCALE
+ if (! initialized) {
+ initialized = 1;
+ loc = newlocale(LC_CTYPE_MASK, "UTF-8", LC_GLOBAL_LOCALE);
+ }
+
+ if (loc == 0) {
+ /* unable to create the UTF-8 locale */
+ assert(loc != 0); /* should never happen */
+-#endif /* DARWIN */
++#endif /* HAVE_XLOCALE */
+
+ #ifdef WIN32
+ if (!setlocale(LC_CTYPE, 0))
+ ABORT(R_INTERNAL);
+
+ if (!(my_locale = r_strdup(setlocale(LC_CTYPE, 0))))
+ ABORT(R_NO_MEMORY);
+
+@@ -91,28 +99,28 @@ mbslen(const char *s, size_t *ncharsp)
+ if (!strstr(my_locale, "UTF-8"))
+ ABORT(R_NOT_FOUND);
+ #else
+ /* can't count UTF-8 characters with mbrlen if the locale isn't UTF-8 */
+ if (! strcasestr(setlocale(LC_CTYPE, 0), "UTF-8"))
+ ABORT(R_NOT_FOUND);
+ #endif
+
+-#ifdef DARWIN
++#ifdef HAVE_XLOCALE
+ }
+-#endif /* DARWIN */
++#endif /* HAVE_XLOCALE */
+
+ memset(&mbs, 0, sizeof(mbs));
+ nchars = 0;
+
+-#ifdef DARWIN
++#ifdef HAVE_XLOCALE
+ while (*s != '\0' && (nbytes = mbrlen_l(s, strlen(s), &mbs, loc)) != 0)
+ #else
+ while (*s != '\0' && (nbytes = mbrlen(s, strlen(s), &mbs)) != 0)
+-#endif /* DARWIN */
++#endif /* HAVE_XLOCALE */
+ {
+ if (nbytes == (size_t)-1) /* should never happen */ {
+ assert(0);
+ ABORT(R_INTERNAL);
+ }
+ if (nbytes == (size_t)-2) /* encoding error */ {
+ assert(0);
+ ABORT(R_BAD_DATA);
+diff --git media/mtransport/third_party/nrappkit/nrappkit.gyp media/mtransport/third_party/nrappkit/nrappkit.gyp
+index 3cc8e1c..74016c6 100644
+--- mozilla/media/mtransport/third_party/nrappkit/nrappkit.gyp
++++ mozilla/media/mtransport/third_party/nrappkit/nrappkit.gyp
+@@ -142,26 +142,35 @@
+ 'R_DEFINED_UINT2=uint16_t',
+ 'R_DEFINED_INT4=int32_t',
+ 'R_DEFINED_UINT4=uint32_t',
+ 'R_DEFINED_INT8=int64_t',
+ 'R_DEFINED_UINT8=uint64_t',
+ ],
+
+ 'conditions' : [
+- ## Mac
++ ## Mac and BSDs
+ [ 'OS == "mac"', {
++ 'defines' : [
++ 'DARWIN',
++ ],
++ }],
++ [ 'os_bsd == 1', {
++ 'defines' : [
++ 'BSD',
++ ],
++ }],
++ [ 'OS == "mac" or os_bsd == 1', {
+ 'cflags_mozilla': [
+ '-Wall',
+ '-Wno-parentheses',
+ '-Wno-strict-prototypes',
+ '-Wmissing-prototypes',
+ ],
+ 'defines' : [
+- 'DARWIN',
+ 'HAVE_LIBM=1',
+ 'HAVE_STRDUP=1',
+ 'HAVE_STRLCPY=1',
+ 'HAVE_SYS_TIME_H=1',
+ 'HAVE_VFPRINTF=1',
+ 'NEW_STDIO'
+ 'RETSIGTYPE=void',
+ 'TIME_WITH_SYS_TIME_H=1',
+diff --git media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h
+index 15452e3..2c9651a 100644
+--- mozilla/media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h
++++ mozilla/media/mtransport/third_party/nrappkit/src/port/darwin/include/csi_platform.h
+@@ -37,16 +37,21 @@
+ */
+
+
+ #ifndef _platform_h
+ #define _platform_h
+
+ #include <unistd.h>
+
++#ifdef BSD
++/* Hack version of addr2ascii (in util/util.c) */
++char *addr2ascii(int af, const void *addrp, int len,char *buf);
++#endif
++
+ #define STDIO_BYTES_BUFFERED(fp) (fp->_r)
+
+ #ifdef NR_SOCKET_IS_VOID_PTR
+ typedef void* NR_SOCKET;
+ #else
+ typedef int NR_SOCKET;
+ #define NR_SOCKET_READ(sock,buf,count) read((sock),(buf),(count))
+ #define NR_SOCKET_WRITE(sock,buf,count) write((sock),(buf),(count))
+diff --git media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h
+index bcb1ec0..bb73591 100644
+--- mozilla/media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h
++++ mozilla/media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h
+@@ -28,17 +28,17 @@
+ *
+ * @(#)queue.h 8.5 (Berkeley) 8/20/94
+ * $FreeBSD$
+ */
+
+ #ifndef _SYS_QUEUE_H_
+ #define _SYS_QUEUE_H_
+
+-#ifndef DARWIN
++#if !defined(BSD) && !defined(DARWIN)
+ #include <stddef.h>
+ #define __offsetof offsetof
+ #endif
+
+ #define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
+ for ((var) = STAILQ_FIRST((head)); \
+ (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
+ (var) = (tvar))
+diff --git media/mtransport/third_party/nrappkit/src/util/util.c media/mtransport/third_party/nrappkit/src/util/util.c
+index 3aced8b..be020bb 100644
+--- mozilla/media/mtransport/third_party/nrappkit/src/util/util.c
++++ mozilla/media/mtransport/third_party/nrappkit/src/util/util.c
+@@ -36,16 +36,19 @@
+ ekr@rtfm.com Wed Dec 26 17:19:36 2001
+ */
+
+
+ static char *RCSSTRING __UNUSED__ ="$Id: util.c,v 1.5 2007/11/21 00:09:13 adamcain Exp $";
+
+ #ifndef WIN32
+ #include <sys/uio.h>
++#include <sys/socket.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
+ #include <pwd.h>
+ #include <dirent.h>
+ #endif
+ #include <string.h>
+ #include <ctype.h>
+ #include <sys/stat.h>
+ #ifdef OPENSSL
+ #include <openssl/evp.h>
+@@ -431,17 +434,17 @@ int nr_reg_uint8_fetch_and_check(NR_registry key, UINT8 min, UINT8 max, int log_
+ abort:
+ if(die && _status){
+ r_log(log_fac,LOG_CRIT,"Exiting due to invalid configuration (key '%s')",key);
+ exit(1);
+ }
+ return(_status);
+ }
+
+-#if defined(LINUX) || defined(WIN32)
++#if defined(LINUX) || defined(BSD) || defined(WIN32)
+ /* Hack version of addr2ascii */
+ char *addr2ascii(int af, const void *addrp, int len,char *buf)
+ {
+ static char buf2[256];
+ char *ret;
+ struct in_addr *addr=(struct in_addr *)addrp;
+
+ if (! buf)
+diff --git media/webrtc/signaling/signaling.gyp media/webrtc/signaling/signaling.gyp
+index f0cbf870..ba0f801 100644
+--- mozilla/media/webrtc/signaling/signaling.gyp
++++ mozilla/media/webrtc/signaling/signaling.gyp
+@@ -208,16 +208,29 @@
+ 'SIPCC_BUILD',
+ 'HAVE_WINSOCK2_H',
+ 'CPR_STDINT_INCLUDE=\\"mozilla/StandardInteger.h\\"'
+ ],
+
+ 'cflags_mozilla': [
+ ],
+ }],
++ ['os_bsd==1', {
++ 'include_dirs': [
++ ],
++ 'defines': [
++ # avoiding pointless ifdef churn
++ 'SIP_OS_OSX',
++ 'OSX',
++ 'SECLIB_OPENSSL',
++ ],
++
++ 'cflags_mozilla': [
++ ],
++ }],
+ ['OS=="mac"', {
+ 'include_dirs': [
+ ],
+ 'defines': [
+ 'SIP_OS_OSX',
+ 'OSX',
+ '_FORTIFY_SOURCE=2',
+ ],
+@@ -701,17 +714,17 @@
+ 'EXTERNAL_TICK_REQUIRED',
+ 'GIPS_VER=3480',
+ ],
+
+ 'cflags_mozilla': [
+ ],
+
+ }],
+- ['OS=="mac"', {
++ ['OS=="mac" or os_bsd==1', {
+
+ 'include_dirs': [
+ ],
+
+ 'sources': [
+ # SIPSTACK
+ './src/sipcc/core/sipstack/sip_platform_task.c',
+
+@@ -746,24 +759,23 @@
+ './src/sipcc/cpr/darwin/cpr_darwin_timers_using_select.c',
+ './src/sipcc/cpr/darwin/cpr_darwin_tst.h',
+ './src/sipcc/cpr/darwin/cpr_darwin_types.h',
+ ],
+
+
+ 'defines' : [
+ 'SIP_OS_OSX',
+- '_POSIX_SOURCE',
++ # using BSD extensions, leave _POSIX_SOURCE undefined
+ 'CPR_MEMORY_LITTLE_ENDIAN',
+ 'NO_SOCKET_POLLING',
+ 'USE_TIMER_SELECT_BASED',
+ 'FULL_BUILD',
+ 'STUBBED_OUT',
+ 'USE_PRINTF',
+- '_DARWIN_C_SOURCE',
+ 'NO_NSPR_10_SUPPORT',
+ ],
+
+ 'cflags_mozilla': [
+ ],
+ }],
+ ],
+
+diff --git media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c
+index a7c47e1..4f191de 100644
+--- mozilla/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c
++++ mozilla/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c
+@@ -352,21 +352,25 @@ cprGetMessage (cprMsgQueue_t msgQueue, b
+ {
+ static const char fname[] = "cprGetMessage";
+
+ void *buffer = 0;
+ cpr_msg_queue_t *msgq;
+ cpr_msgq_node_t *node;
+ struct timespec timeout;
+ struct timeval tv;
++#ifndef __APPLE__
++ struct timezone tz;
++#else
+ // On the iPhone, there is a DarwinAlias problem with "timezone"
+ struct _timezone {
+ int tz_minuteswest; /* of Greenwich */
+ int tz_dsttime; /* type of dst correction to apply */
+ } tz;
++#endif
+
+ /* Initialize ppUserData */
+ if (ppUserData) {
+ *ppUserData = NULL;
+ }
+
+ msgq = (cpr_msg_queue_t *) msgQueue;
+ if (msgq == NULL) {
+diff --git media/webrtc/signaling/test/Makefile.in media/webrtc/signaling/test/Makefile.in
+index a30e330..cfbd8a3 100644
+--- mozilla/media/webrtc/signaling/test/Makefile.in
++++ mozilla/media/webrtc/signaling/test/Makefile.in
+@@ -22,32 +22,32 @@ LIBS = \
+ $(DEPTH)/media/webrtc/signalingtest/signaling_ecc/$(LIB_PREFIX)ecc.$(LIB_SUFFIX) \
+ $(DEPTH)/media/webrtc/signalingtest/signaling_sipcc/$(LIB_PREFIX)sipcc.$(LIB_SUFFIX) \
+ $(DEPTH)/layout/media/$(LIB_PREFIX)gkmedias.$(LIB_SUFFIX) \
+ $(DEPTH)/media/webrtc/trunk/testing/gtest_gtest/$(LIB_PREFIX)gtest.$(LIB_SUFFIX) \
+ $(DEPTH)/netwerk/srtp/src/$(LIB_PREFIX)nksrtp_s.$(LIB_SUFFIX) \
+ $(NULL)
+
+ ifdef MOZ_SYDNEYAUDIO
+-ifeq ($(OS_ARCH),Linux)
++ifneq (,$(filter Linux DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
+ LIBS += \
+ $(MOZ_ALSA_LIBS) \
+ $(NULL)
+ endif
+ endif
+
+ ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
+ LIBS += \
+ $(XLIBS) \
+ $(MOZ_GTK2_LIBS) \
+ -lgthread-2.0 \
+ $(NULL)
+ endif
+
+-ifeq ($(OS_ARCH),Linux)
++ifneq (,$(filter Linux DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
+ LIBS += \
+ $(MOZ_CAIRO_OSLIBS) \
+ $(NULL)
+ endif
+
+ ifeq ($(OS_ARCH),Darwin)
+ LIBS += \
+ -framework AudioToolbox \
+diff --git media/webrtc/trunk/build/common.gypi media/webrtc/trunk/build/common.gypi
+index 6ca2f70..5d261cb 100644
+--- mozilla/media/webrtc/trunk/build/common.gypi
++++ mozilla/media/webrtc/trunk/build/common.gypi
+@@ -75,22 +75,31 @@
+ # ash. This rule should be removed for the future when Windows is
+ # using the aura windows without the ash interface.
+ ['use_aura==1 and OS=="win"', {
+ 'use_ash%': 1,
+ }],
+ ['use_ash==1', {
+ 'use_aura%': 1,
+ }],
++
++ # A flag for BSD platforms
++ ['OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or \
++ OS=="openbsd"', {
++ 'os_bsd%': 1,
++ }, {
++ 'os_bsd%': 0,
++ }],
+ ],
+ },
+ # Copy conditionally-set variables out one scope.
+ 'chromeos%': '<(chromeos)',
+ 'use_aura%': '<(use_aura)',
+ 'use_ash%': '<(use_ash)',
++ 'os_bsd%': '<(os_bsd)',
+ 'use_openssl%': '<(use_openssl)',
+ 'use_ibus%': '<(use_ibus)',
+ 'enable_viewport%': '<(enable_viewport)',
+ 'enable_hidpi%': '<(enable_hidpi)',
+ 'enable_touch_ui%': '<(enable_touch_ui)',
+ 'android_upstream_bringup%': '<(android_upstream_bringup)',
+ 'buildtype%': '<(buildtype)',
+
+@@ -114,17 +123,17 @@
+ # Set default value of toolkit_views based on OS.
+ ['OS=="win" or chromeos==1 or use_aura==1', {
+ 'toolkit_views%': 1,
+ }, {
+ 'toolkit_views%': 0,
+ }],
+
+ # Set toolkit_uses_gtk for the Chromium browser on Linux.
+- ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_aura==0', {
++ ['(OS=="linux" or OS=="solaris" or os_bsd==1) and use_aura==0', {
+ 'toolkit_uses_gtk%': 1,
+ }, {
+ 'toolkit_uses_gtk%': 0,
+ }],
+
+ # Enable HiDPI on Mac OS and Chrome OS.
+ ['OS=="mac" or chromeos==1', {
+ 'enable_hidpi%': 1,
+@@ -139,16 +148,17 @@
+
+ # Copy conditionally-set variables out one scope.
+ 'chromeos%': '<(chromeos)',
+ 'host_arch%': '<(host_arch)',
+ 'toolkit_views%': '<(toolkit_views)',
+ 'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
+ 'use_aura%': '<(use_aura)',
+ 'use_ash%': '<(use_ash)',
++ 'os_bsd%': '<(os_bsd)',
+ 'use_openssl%': '<(use_openssl)',
+ 'use_ibus%': '<(use_ibus)',
+ 'enable_viewport%': '<(enable_viewport)',
+ 'enable_hidpi%': '<(enable_hidpi)',
+ 'enable_touch_ui%': '<(enable_touch_ui)',
+ 'android_upstream_bringup%': '<(android_upstream_bringup)',
+ 'android_build_type%': '<(android_build_type)',
+
+@@ -397,25 +407,18 @@
+
+ # A flag for POSIX platforms
+ ['OS=="win"', {
+ 'os_posix%': 0,
+ }, {
+ 'os_posix%': 1,
+ }],
+
+- # A flag for BSD platforms
+- ['OS=="freebsd" or OS=="openbsd"', {
+- 'os_bsd%': 1,
+- }, {
+- 'os_bsd%': 0,
+- }],
+-
+ # NSS usage.
+- ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_openssl==0', {
++ ['(OS=="linux" or OS=="solaris" or os_bsd==1) and use_openssl==0', {
+ 'use_nss%': 1,
+ }, {
+ 'use_nss%': 0,
+ }],
+
+ # Flags to use X11 on non-Mac POSIX platforms
+ ['OS=="win" or OS=="mac" or OS=="ios" or OS=="android"', {
+ 'use_glib%': 0,
+diff --git media/webrtc/trunk/src/build/common.gypi media/webrtc/trunk/src/build/common.gypi
+index 9ca9f7c..d5c4ab9 100644
+--- mozilla/media/webrtc/trunk/src/build/common.gypi
++++ mozilla/media/webrtc/trunk/src/build/common.gypi
+@@ -101,16 +101,23 @@
+ 'enable_protobuf%': 1,
+ 'include_tests%': 1,
+
+ # TODO(andrew): For now, disable the Chrome plugins, which causes a
+ # flood of chromium-style warnings. Investigate enabling them:
+ # http://code.google.com/p/webrtc/issues/detail?id=163
+ 'clang_use_chrome_plugins%': 0,
+ }],
++ ['OS=="linux" or OS=="solaris" or os_bsd==1', {
++ 'include_alsa_audio%': 1,
++ 'include_v4l2_video_capture%': 1,
++ }, {
++ 'include_alsa_audio%': 0,
++ 'include_v4l2_video_capture%': 0,
++ }],
+ ], # conditions
+ },
+ 'target_defaults': {
+ 'include_dirs': [
+ # TODO(andrew): we should be able to just use <(webrtc_root) here.
+ '..','../..',
+ ],
+ 'defines': [
+@@ -174,16 +181,28 @@
+ 'defines': [
+ 'WEBRTC_LINUX',
+ 'WEBRTC_THREAD_RR',
+ # TODO(andrew): can we select this automatically?
+ # Define this if the Linux system does not support CLOCK_MONOTONIC.
+ #'WEBRTC_CLOCK_TYPE_REALTIME',
+ ],
+ }],
++ ['os_bsd==1', {
++ 'defines': [
++ 'WEBRTC_BSD',
++ 'WEBRTC_THREAD_RR',
++ ],
++ }],
++ ['OS=="dragonfly" or OS=="netbsd"', {
++ 'defines': [
++ # doesn't support pthread_condattr_setclock
++ 'WEBRTC_CLOCK_TYPE_REALTIME',
++ ],
++ }],
+ ['OS=="mac"', {
+ 'defines': [
+ 'WEBRTC_MAC',
+ 'WEBRTC_MAC_INTEL', # TODO(andrew): remove this.
+ 'WEBRTC_THREAD_RR',
+ 'WEBRTC_CLOCK_TYPE_REALTIME',
+ ],
+ }],
+diff --git media/webrtc/trunk/src/modules/audio_device/main/source/audio_device.gypi media/webrtc/trunk/src/modules/audio_device/main/source/audio_device.gypi
+index 8457737..4d0f322 100644
+--- mozilla/media/webrtc/trunk/src/modules/audio_device/main/source/audio_device.gypi
++++ mozilla/media/webrtc/trunk/src/modules/audio_device/main/source/audio_device.gypi
+@@ -41,21 +41,25 @@
+ 'audio_device_utility.h',
+ 'audio_device_impl.cc',
+ 'audio_device_impl.h',
+ 'audio_device_config.h',
+ 'dummy/audio_device_dummy.h',
+ 'dummy/audio_device_utility_dummy.h',
+ ],
+ 'conditions': [
+- ['OS=="linux"', {
++ ['include_alsa_audio==1', {
+ 'include_dirs': [
+ 'linux',
+ ],
+- }], # OS==linux
++ 'defines': [
++ # avoiding pointless ifdef churn
++ 'WEBRTC_LINUX',
++ ],
++ }], # include_alsa_audio==1
+ ['OS=="mac"', {
+ 'include_dirs': [
+ 'mac',
+ ],
+ }], # OS==mac
+ ['OS=="win"', {
+ 'include_dirs': [
+ 'win',
+@@ -111,24 +115,26 @@
+ 'link_settings': {
+ 'libraries': [
+ '-llog',
+ '-lOpenSLES',
+ ],
+ },
+ }],
+ ['OS=="linux"', {
+- 'defines': [
+- 'LINUX_ALSA',
+- ],
+ 'link_settings': {
+ 'libraries': [
+ '-ldl',
+ ],
+ },
++ }],
++ ['include_alsa_audio==1', {
++ 'defines': [
++ 'LINUX_ALSA',
++ ],
+ 'conditions': [
+ ['include_pulse_audio==1', {
+ 'defines': [
+ 'LINUX_PULSE',
+ ],
+ 'sources': [
+ 'linux/audio_device_pulse_linux.cc',
+ 'linux/audio_device_pulse_linux.h',
+diff --git media/webrtc/trunk/src/modules/audio_device/main/source/audio_device_utility.cc media/webrtc/trunk/src/modules/audio_device/main/source/audio_device_utility.cc
+index 203f09a..0b0b70e 100644
+--- mozilla/media/webrtc/trunk/src/modules/audio_device/main/source/audio_device_utility.cc
++++ mozilla/media/webrtc/trunk/src/modules/audio_device/main/source/audio_device_utility.cc
+@@ -41,17 +41,17 @@ bool AudioDeviceUtility::StringCompare(
+ const char* str1 , const char* str2,
+ const WebRtc_UWord32 length)
+ {
+ return ((_strnicmp(str1, str2, length) == 0) ? true : false);
+ }
+
+ } // namespace webrtc
+
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+ // ============================================================================
+ // Linux & Mac
+ // ============================================================================
+
+ #include <sys/time.h> // gettimeofday
+ #include <time.h> // gettimeofday
+ #include <string.h> // strncasecmp
+@@ -104,11 +104,11 @@ WebRtc_UWord32 AudioDeviceUtility::GetTimeInMS()
+ bool AudioDeviceUtility::StringCompare(
+ const char* str1 , const char* str2, const WebRtc_UWord32 length)
+ {
+ return (strncasecmp(str1, str2, length) == 0)?true: false;
+ }
+
+ } // namespace webrtc
+
+-#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+
+diff --git media/webrtc/trunk/src/modules/rtp_rtcp/source/forward_error_correction.cc media/webrtc/trunk/src/modules/rtp_rtcp/source/forward_error_correction.cc
+index bdad224..39e1132 100644
+--- mozilla/media/webrtc/trunk/src/modules/rtp_rtcp/source/forward_error_correction.cc
++++ mozilla/media/webrtc/trunk/src/modules/rtp_rtcp/source/forward_error_correction.cc
+@@ -7,16 +7,17 @@
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+ #include "modules/rtp_rtcp/source/forward_error_correction.h"
+
+ #include <algorithm>
+ #include <cassert>
++#include <cstdlib> // for abs()
+ #include <cstring>
+ #include <iterator>
+
+ #include "modules/rtp_rtcp/source/forward_error_correction_internal.h"
+ #include "modules/rtp_rtcp/source/rtp_utility.h"
+ #include "system_wrappers/interface/trace.h"
+
+ namespace webrtc {
+diff --git media/webrtc/trunk/src/modules/rtp_rtcp/source/rtp_utility.cc media/webrtc/trunk/src/modules/rtp_rtcp/source/rtp_utility.cc
+index 298d479..37b70c9 100644
+--- mozilla/media/webrtc/trunk/src/modules/rtp_rtcp/source/rtp_utility.cc
++++ mozilla/media/webrtc/trunk/src/modules/rtp_rtcp/source/rtp_utility.cc
+@@ -13,17 +13,17 @@
+ #include <cassert>
+ #include <cmath> // ceil
+ #include <cstring> // memcpy
+
+ #if defined(_WIN32)
+ #include <Windows.h> // FILETIME
+ #include <WinSock.h> // timeval
+ #include <MMSystem.h> // timeGetTime
+-#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC))
++#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC))
+ #include <sys/time.h> // gettimeofday
+ #include <time.h>
+ #endif
+ #if (defined(_DEBUG) && defined(_WIN32) && (_MSC_VER >= 1400))
+ #include <stdio.h>
+ #endif
+
+ #include "system_wrappers/interface/tick_util.h"
+@@ -151,17 +151,17 @@ void get_time(WindowsHelpTimer* help_timer, FILETIME& current_time) {
+ virtual WebRtc_Word64 GetTimeInMS();
+
+ virtual void CurrentNTP(WebRtc_UWord32& secs, WebRtc_UWord32& frac);
+
+ private:
+ WindowsHelpTimer* _helpTimer;
+ };
+
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+ // A clock reading times from the POSIX API.
+ class UnixSystemClock : public RtpRtcpClock {
+ public:
+ UnixSystemClock() {}
+ virtual ~UnixSystemClock() {}
+
+ virtual WebRtc_Word64 GetTimeInMS();
+@@ -209,17 +209,17 @@ void WindowsSystemClock::CurrentNTP(WebRtc_UWord32& secs,
+ } else if (dtemp < -1) {
+ dtemp += 1;
+ secs--;
+ }
+ dtemp *= NTP_FRAC;
+ frac = (WebRtc_UWord32)dtemp;
+ }
+
+-#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC))
++#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC))
+
+ WebRtc_Word64 UnixSystemClock::GetTimeInMS() {
+ return TickTime::MillisecondTimestamp();
+ }
+
+ // Use the system time.
+ void UnixSystemClock::CurrentNTP(WebRtc_UWord32& secs, WebRtc_UWord32& frac) {
+ double dtemp;
+@@ -248,17 +248,17 @@ void UnixSystemClock::CurrentNTP(WebRtc_UWord32& secs, WebRtc_UWord32& frac) {
+ // Note that this is a POD. Only PODs are allowed to have static storage
+ // duration according to the Google Style guide.
+ static WindowsHelpTimer global_help_timer = {0, 0, {{ 0, 0}, 0}, 0};
+ #endif
+
+ RtpRtcpClock* GetSystemClock() {
+ #if defined(_WIN32)
+ return new WindowsSystemClock(&global_help_timer);
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ return new UnixSystemClock();
+ #else
+ return NULL;
+ #endif
+ }
+
+ WebRtc_UWord32 GetCurrentRTP(RtpRtcpClock* clock, WebRtc_UWord32 freq) {
+ const bool use_global_clock = (clock == NULL);
+@@ -313,17 +313,17 @@ bool OldTimestamp(uint32_t newTimestamp,
+ * Misc utility routines
+ */
+
+ #if defined(_WIN32)
+ bool StringCompare(const char* str1, const char* str2,
+ const WebRtc_UWord32 length) {
+ return (_strnicmp(str1, str2, length) == 0) ? true : false;
+ }
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ bool StringCompare(const char* str1, const char* str2,
+ const WebRtc_UWord32 length) {
+ return (strncasecmp(str1, str2, length) == 0) ? true : false;
+ }
+ #endif
+
+ #if !defined(WEBRTC_LITTLE_ENDIAN) && !defined(WEBRTC_BIG_ENDIAN)
+ #error Either WEBRTC_LITTLE_ENDIAN or WEBRTC_BIG_ENDIAN must be defined
+diff --git media/webrtc/trunk/src/modules/udp_transport/source/udp_transport_impl.cc media/webrtc/trunk/src/modules/udp_transport/source/udp_transport_impl.cc
+index e50db5d..70ad8a8 100644
+--- mozilla/media/webrtc/trunk/src/modules/udp_transport/source/udp_transport_impl.cc
++++ mozilla/media/webrtc/trunk/src/modules/udp_transport/source/udp_transport_impl.cc
+@@ -13,60 +13,62 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <time.h>
+
+ #if defined(_WIN32)
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ #include <arpa/inet.h>
+ #include <ctype.h>
+ #include <fcntl.h>
+ #include <netdb.h>
++#include <sys/socket.h>
+ #include <net/if.h>
+ #include <netinet/in.h>
+ #include <stdlib.h>
+ #include <sys/ioctl.h>
+-#include <sys/socket.h>
+ #include <sys/time.h>
+ #include <unistd.h>
+ #ifndef MAC_IPHONE
+ #include <net/if_arp.h>
+ #endif
+ #endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
+
+ #if defined(WEBRTC_MAC)
+-#include <ifaddrs.h>
+ #include <machine/types.h>
+ #endif
++#if defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
++#include <ifaddrs.h>
++#endif
+ #if defined(WEBRTC_LINUX)
+ #include <linux/netlink.h>
+ #include <linux/rtnetlink.h>
+ #endif
+
+ #include "common_types.h"
+ #include "critical_section_wrapper.h"
+ #include "rw_lock_wrapper.h"
+ #include "trace.h"
+ #include "typedefs.h"
+ #include "udp_socket_manager_wrapper.h"
+
+-#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ #define GetLastError() errno
+
+ #define IFRSIZE ((int)(size * sizeof (struct ifreq)))
+
+ #define NLMSG_OK_NO_WARNING(nlh,len) \
+ ((len) >= (int)sizeof(struct nlmsghdr) && \
+ (int)(nlh)->nlmsg_len >= (int)sizeof(struct nlmsghdr) && \
+ (int)(nlh)->nlmsg_len <= (len))
+
+-#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+ namespace webrtc {
+
+ class SocketFactory : public UdpTransportImpl::SocketFactoryInterface {
+ public:
+ UdpSocketWrapper* CreateSocket(const WebRtc_Word32 id,
+ UdpSocketManager* mgr,
+ CallbackObj obj,
+@@ -2366,17 +2368,17 @@ WebRtc_UWord32 UdpTransport::InetAddrIPV4(const char* ip)
+ {
+ return ::inet_addr(ip);
+ }
+
+ WebRtc_Word32 UdpTransport::InetPresentationToNumeric(WebRtc_Word32 af,
+ const char* src,
+ void* dst)
+ {
+-#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ const WebRtc_Word32 result = inet_pton(af, src, dst);
+ return result > 0 ? 0 : -1;
+
+ #elif defined(_WIN32)
+ SocketAddress temp;
+ int length=sizeof(SocketAddress);
+
+ if(af == AF_INET)
+@@ -2488,17 +2490,17 @@ WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(char n_localIP[16])
+ break;
+ };
+ }
+ freeaddrinfo(result);
+ WEBRTC_TRACE(kTraceWarning, kTraceTransport, -1,
+ "getaddrinfo failed to find address");
+ return -1;
+
+-#elif defined(WEBRTC_MAC)
++#elif defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ struct ifaddrs* ptrIfAddrs = NULL;
+ struct ifaddrs* ptrIfAddrsStart = NULL;
+
+ getifaddrs(&ptrIfAddrsStart);
+ ptrIfAddrs = ptrIfAddrsStart;
+ while(ptrIfAddrs)
+ {
+ if(ptrIfAddrs->ifa_addr->sa_family == AF_INET6)
+@@ -2680,17 +2682,17 @@ WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP)
+ }
+ else
+ {
+ WebRtc_Word32 error = WSAGetLastError();
+ WEBRTC_TRACE(kTraceWarning, kTraceTransport, -1,
+ "gethostbyname failed, error:%d", error);
+ return -1;
+ }
+-#elif (defined(WEBRTC_MAC))
++#elif (defined(WEBRTC_BSD) || defined(WEBRTC_MAC))
+ char localname[255];
+ if (gethostname(localname, 255) != -1)
+ {
+ hostent* localHost;
+ localHost = gethostbyname(localname);
+ if(localHost)
+ {
+ if(localHost->h_addrtype != AF_INET)
+@@ -2819,17 +2821,17 @@ WebRtc_Word32 UdpTransport::IPAddress(const SocketAddress& address,
+ }
+
+ source_port = address._sockaddr_in6.sin6_port;
+ }
+ // Convert port number to network byte order.
+ sourcePort = htons(source_port);
+ return 0;
+
+- #elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++ #elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ WebRtc_Word32 ipFamily = address._sockaddr_storage.sin_family;
+ const void* ptrNumericIP = NULL;
+
+ if(ipFamily == AF_INET)
+ {
+ ptrNumericIP = &(address._sockaddr_in.sin_addr);
+ }
+ else if(ipFamily == AF_INET6)
+diff --git media/webrtc/trunk/src/modules/utility/source/rtp_dump_impl.cc media/webrtc/trunk/src/modules/utility/source/rtp_dump_impl.cc
+index 69a52ec..7ac226c 100644
+--- mozilla/media/webrtc/trunk/src/modules/utility/source/rtp_dump_impl.cc
++++ mozilla/media/webrtc/trunk/src/modules/utility/source/rtp_dump_impl.cc
+@@ -14,17 +14,17 @@
+ #include <stdio.h>
+
+ #include "critical_section_wrapper.h"
+ #include "trace.h"
+
+ #if defined(_WIN32)
+ #include <Windows.h>
+ #include <mmsystem.h>
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ #include <string.h>
+ #include <sys/time.h>
+ #include <time.h>
+ #endif
+
+ #if (defined(_DEBUG) && defined(_WIN32))
+ #define DEBUG_PRINT(expr) OutputDebugString(##expr)
+ #define DEBUG_PRINTP(expr, p) \
+@@ -233,17 +233,17 @@ bool RtpDumpImpl::RTCP(const WebRtc_UWord8* packet) const
+ return is_rtcp;
+ }
+
+ // TODO (hellner): why is TickUtil not used here?
+ inline WebRtc_UWord32 RtpDumpImpl::GetTimeInMS() const
+ {
+ #if defined(_WIN32)
+ return timeGetTime();
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ struct timeval tv;
+ struct timezone tz;
+ unsigned long val;
+
+ gettimeofday(&tv, &tz);
+ val = tv.tv_sec * 1000 + tv.tv_usec / 1000;
+ return val;
+ #else
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
+index 653ee16..8d6fd68 100644
+--- mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
++++ mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
+@@ -14,17 +14,23 @@
+ #include <unistd.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+
+ //v4l includes
++#if defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
++#include <sys/videoio.h>
++#elif defined(__sun)
++#include <sys/videodev2.h>
++#else
+ #include <linux/videodev2.h>
++#endif
+
+ #include "ref_count.h"
+ #include "trace.h"
+
+
+ namespace webrtc
+ {
+ namespace videocapturemodule
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
+index 12df1b3..424ea0a 100644
+--- mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
++++ mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
+@@ -7,22 +7,30 @@
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+ #include <sys/ioctl.h>
+ #include <unistd.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+-#include <linux/videodev2.h>
+ #include <errno.h>
+ #include <stdio.h>
+ #include <sys/mman.h>
+ #include <string.h>
+
++//v4l includes
++#if defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
++#include <sys/videoio.h>
++#elif defined(__sun)
++#include <sys/videodev2.h>
++#else
++#include <linux/videodev2.h>
++#endif
++
+ #include <iostream>
+ #include <new>
+
+ #include "ref_count.h"
+ #include "trace.h"
+ #include "thread_wrapper.h"
+ #include "critical_section_wrapper.h"
+ #include "video_capture_linux.h"
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/device_info_impl.cc media/webrtc/trunk/src/modules/video_capture/main/source/device_info_impl.cc
+index e3f7bb5..882cede 100644
+--- mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/device_info_impl.cc
++++ mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/device_info_impl.cc
+@@ -49,17 +49,17 @@ WebRtc_Word32 DeviceInfoImpl::NumberOfCapabilities(
+ if (!deviceUniqueIdUTF8)
+ return -1;
+
+ _apiLock.AcquireLockShared();
+
+ if (_lastUsedDeviceNameLength == strlen((char*) deviceUniqueIdUTF8))
+ {
+ // Is it the same device that is asked for again.
+-#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX)
++#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
+ if(strncasecmp((char*)_lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength)==0)
+ #else
+ if (_strnicmp((char*) _lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength) == 0)
+ #endif
+@@ -86,17 +86,17 @@ WebRtc_Word32 DeviceInfoImpl::GetCapability(const char* deviceUniqueIdUTF8,
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "deviceUniqueIdUTF8 parameter not set in call to GetCapability");
+ return -1;
+ }
+ ReadLockScoped cs(_apiLock);
+
+ if ((_lastUsedDeviceNameLength != strlen((char*) deviceUniqueIdUTF8))
+-#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX)
++#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
+ || (strncasecmp((char*)_lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength)!=0))
+ #else
+ || (_strnicmp((char*) _lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength) != 0))
+ #endif
+@@ -150,17 +150,17 @@ WebRtc_Word32 DeviceInfoImpl::GetBestMatchedCapability(
+ {
+
+
+ if (!deviceUniqueIdUTF8)
+ return -1;
+
+ ReadLockScoped cs(_apiLock);
+ if ((_lastUsedDeviceNameLength != strlen((char*) deviceUniqueIdUTF8))
+-#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX)
++#if defined(WEBRTC_MAC_INTEL) || defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
+ || (strncasecmp((char*)_lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength)!=0))
+ #else
+ || (_strnicmp((char*) _lastUsedDeviceName,
+ (char*) deviceUniqueIdUTF8,
+ _lastUsedDeviceNameLength) != 0))
+ #endif
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
+index 0a9765e..8d4bbf4 100644
+--- mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
++++ mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
+@@ -50,17 +50,17 @@
+ ['include_internal_video_capture==0', {
+ 'sources': [
+ 'External/device_info_external.cc',
+ 'External/video_capture_external.cc',
+ ],
+ },{ # include_internal_video_capture == 1
+ 'conditions': [
+ # DEFINE PLATFORM SPECIFIC SOURCE FILES
+- ['OS=="linux"', {
++ ['include_v4l2_video_capture==1', {
+ 'include_dirs': [
+ 'Linux',
+ ],
+ 'sources': [
+ 'Linux/device_info_linux.h',
+ 'Linux/video_capture_linux.h',
+ 'Linux/device_info_linux.cc',
+ 'Linux/video_capture_linux.cc',
+@@ -157,31 +157,35 @@
+ '../interface',
+ ],
+ 'sources': [
+ '../test/video_capture_unittest.cc',
+ '../test/video_capture_main_mac.mm',
+ ],
+ 'conditions': [
+ # DEFINE PLATFORM SPECIFIC INCLUDE AND CFLAGS
+- ['OS=="mac" or OS=="linux"', {
++ ['OS!="win" and OS!="android"', {
+ 'cflags': [
+ '-Wno-write-strings',
+ ],
+ 'ldflags': [
+ '-lpthread -lm',
+ ],
+ }],
+- ['OS=="linux"', {
++ ['include_v4l2_video_capture==1', {
+ 'libraries': [
+- '-lrt',
+ '-lXext',
+ '-lX11',
+ ],
+ }],
++ ['OS=="linux"', {
++ 'libraries': [
++ '-lrt',
++ ],
++ }],
+ ['OS=="mac"', {
+ 'dependencies': [
+ # Link with a special main for mac so we can use the webcam.
+ '<(webrtc_root)/test/test.gyp:test_support_main_threaded_mac',
+ ],
+ 'xcode_settings': {
+ # TODO(andrew): CoreAudio and AudioToolbox shouldn't be needed.
+ 'OTHER_LDFLAGS': [
+diff --git media/webrtc/trunk/src/system_wrappers/interface/tick_util.h media/webrtc/trunk/src/system_wrappers/interface/tick_util.h
+index 0cd85d0..45591be 100644
+--- mozilla/media/webrtc/trunk/src/system_wrappers/interface/tick_util.h
++++ mozilla/media/webrtc/trunk/src/system_wrappers/interface/tick_util.h
+@@ -161,17 +161,17 @@ inline TickTime TickTime::Now()
+ // so it must have been a wrap around.
+ if(old > 0xf0000000 && now < 0x0fffffff)
+ {
+ numWrapTimeGetTime++;
+ }
+ }
+ result._ticks = now + (numWrapTimeGetTime<<32);
+ #endif
+-#elif defined(WEBRTC_LINUX)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
+ struct timespec ts;
+ // TODO(wu): Remove CLOCK_REALTIME implementation.
+ #ifdef WEBRTC_CLOCK_TYPE_REALTIME
+ clock_gettime(CLOCK_REALTIME, &ts);
+ #else
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ #endif
+ result._ticks = 1000000000LL * static_cast<WebRtc_Word64>(ts.tv_sec) + static_cast<WebRtc_Word64>(ts.tv_nsec);
+@@ -203,17 +203,17 @@ inline WebRtc_Word64 TickTime::MillisecondTimestamp()
+ #if _WIN32
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (now._ticks * 1000) / qpfreq.QuadPart;
+ #else
+ return now._ticks;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ return now._ticks / 1000000LL;
+ #else
+ return now._ticks / 1000LL;
+ #endif
+ }
+
+ inline WebRtc_Word64 TickTime::MicrosecondTimestamp()
+ {
+@@ -222,17 +222,17 @@ inline WebRtc_Word64 TickTime::MicrosecondTimestamp()
+ #if _WIN32
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (now._ticks * 1000) / (qpfreq.QuadPart/1000);
+ #else
+ return now._ticks *1000LL;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ return now._ticks / 1000LL;
+ #else
+ return now._ticks;
+ #endif
+ }
+
+ inline WebRtc_Word64 TickTime::Ticks() const
+ {
+@@ -244,34 +244,34 @@ inline WebRtc_Word64 TickTime::MillisecondsToTicks(const WebRtc_Word64 ms)
+ #if _WIN32
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (qpfreq.QuadPart * ms) / 1000;
+ #else
+ return ms;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ return ms * 1000000LL;
+ #else
+ return ms * 1000LL;
+ #endif
+ }
+
+ inline WebRtc_Word64 TickTime::TicksToMilliseconds(const WebRtc_Word64 ticks)
+ {
+ #if _WIN32
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (ticks * 1000) / qpfreq.QuadPart;
+ #else
+ return ticks;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ return ticks / 1000000LL;
+ #else
+ return ticks / 1000LL;
+ #endif
+ }
+
+ inline TickTime& TickTime::operator+=(const WebRtc_Word64& ticks)
+ {
+@@ -294,17 +294,17 @@ inline WebRtc_Word64 TickInterval::Milliseconds() const
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (_interval * 1000) / qpfreq.QuadPart;
+ #else
+ // _interval is in ms
+ return _interval;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ // _interval is in ns
+ return _interval / 1000000;
+ #else
+ // _interval is usecs
+ return _interval / 1000;
+ #endif
+ }
+
+@@ -314,17 +314,17 @@ inline WebRtc_Word64 TickInterval::Microseconds() const
+ #ifdef USE_QUERY_PERFORMANCE_COUNTER
+ LARGE_INTEGER qpfreq;
+ QueryPerformanceFrequency(&qpfreq);
+ return (_interval * 1000000) / qpfreq.QuadPart;
+ #else
+ // _interval is in ms
+ return _interval *1000LL;
+ #endif
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ // _interval is in ns
+ return _interval / 1000;
+ #else
+ // _interval is usecs
+ return _interval;
+ #endif
+ }
+
+diff --git media/webrtc/trunk/src/system_wrappers/source/aligned_malloc.cc media/webrtc/trunk/src/system_wrappers/source/aligned_malloc.cc
+index bb10c6b..4878d71 100644
+--- mozilla/media/webrtc/trunk/src/system_wrappers/source/aligned_malloc.cc
++++ mozilla/media/webrtc/trunk/src/system_wrappers/source/aligned_malloc.cc
+@@ -7,24 +7,21 @@
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+ #include "aligned_malloc.h"
+
+ #include <assert.h>
+ #include <memory.h>
+-
+-#ifdef WEBRTC_ANDROID
+ #include <stdlib.h>
+-#endif
+
+ #if WEBRTC_MAC
+ #include <malloc/malloc.h>
+-#else
++#elif WEBRTC_WIN
+ #include <malloc.h>
+ #endif
+
+ #if _WIN32
+ #include <windows.h>
+ #else
+ #include <stdint.h>
+ #endif
+diff --git media/webrtc/trunk/src/system_wrappers/source/atomic32_posix.cc media/webrtc/trunk/src/system_wrappers/source/atomic32_posix.cc
+index 05b0e57..993456c 100644
+--- mozilla/media/webrtc/trunk/src/system_wrappers/source/atomic32_posix.cc
++++ mozilla/media/webrtc/trunk/src/system_wrappers/source/atomic32_posix.cc
+@@ -7,17 +7,16 @@
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+ #include "atomic32.h"
+
+ #include <assert.h>
+ #include <inttypes.h>
+-#include <malloc.h>
+
+ #include "common_types.h"
+
+ namespace webrtc {
+
+ Atomic32::Atomic32(WebRtc_Word32 initialValue) : _value(initialValue)
+ {
+ assert(Is32bitAligned());
+diff --git media/webrtc/trunk/src/system_wrappers/source/condition_variable.cc media/webrtc/trunk/src/system_wrappers/source/condition_variable.cc
+index b37d037..fcea221 100644
+--- mozilla/media/webrtc/trunk/src/system_wrappers/source/condition_variable.cc
++++ mozilla/media/webrtc/trunk/src/system_wrappers/source/condition_variable.cc
+@@ -3,35 +3,33 @@
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
++#include "condition_variable_wrapper.h"
++
+ #if defined(_WIN32)
+ #include <windows.h>
+- #include "condition_variable_wrapper.h"
+ #include "condition_variable_win.h"
+-#elif defined(WEBRTC_LINUX)
+- #include <pthread.h>
+- #include "condition_variable_wrapper.h"
+- #include "condition_variable_posix.h"
+-#elif defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL)
+ #include <pthread.h>
+- #include "condition_variable_wrapper.h"
+ #include "condition_variable_posix.h"
++#else
++ #include <stddef.h> // for NULL
+ #endif
+
+ namespace webrtc {
+ ConditionVariableWrapper*
+ ConditionVariableWrapper::CreateConditionVariable()
+ {
+ #if defined(_WIN32)
+ return new ConditionVariableWindows;
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL)
++#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL)
+ return ConditionVariablePosix::Create();
+ #else
+ return NULL;
+ #endif
+ }
+ } // namespace webrtc
+diff --git media/webrtc/trunk/src/system_wrappers/source/condition_variable_posix.cc media/webrtc/trunk/src/system_wrappers/source/condition_variable_posix.cc
+index 48835ab..16c6033 100644
+--- mozilla/media/webrtc/trunk/src/system_wrappers/source/condition_variable_posix.cc
++++ mozilla/media/webrtc/trunk/src/system_wrappers/source/condition_variable_posix.cc
+@@ -90,17 +90,17 @@ void ConditionVariablePosix::SleepCS(CriticalSectionWrapper& critSect)
+ bool
+ ConditionVariablePosix::SleepCS(
+ CriticalSectionWrapper& critSect,
+ unsigned long maxTimeInMS)
+ {
+ const unsigned long INFINITE = 0xFFFFFFFF;
+
+ const int MILLISECONDS_PER_SECOND = 1000;
+-#ifndef WEBRTC_LINUX
++#if !defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD)
+ const int MICROSECONDS_PER_MILLISECOND = 1000;
+ #endif
+ const int NANOSECONDS_PER_SECOND = 1000000000;
+ const int NANOSECONDS_PER_MILLISECOND = 1000000;
+
+ CriticalSectionPosix* cs = reinterpret_cast<CriticalSectionPosix*>(
+ &critSect);
+
+diff --git media/webrtc/trunk/src/system_wrappers/source/cpu.cc media/webrtc/trunk/src/system_wrappers/source/cpu.cc
+index 3df5d18..4cd3ddf 100644
+--- mozilla/media/webrtc/trunk/src/system_wrappers/source/cpu.cc
++++ mozilla/media/webrtc/trunk/src/system_wrappers/source/cpu.cc
+@@ -11,28 +11,28 @@
+ #include "cpu_wrapper.h"
+
+ #if defined(_WIN32)
+ #include "cpu_win.h"
+ #elif defined(WEBRTC_MAC)
+ #include "cpu_mac.h"
+ #elif defined(WEBRTC_MAC_INTEL)
+ #include "cpu_mac.h"
+-#elif defined(WEBRTC_ANDROID)
++#elif defined(WEBRTC_ANDROID) || defined(WEBRTC_BSD)
+ // Not implemented yet, might be possible to use Linux implementation
+ #else // defined(WEBRTC_LINUX)
+ #include "cpu_linux.h"
+ #endif
+
+ namespace webrtc {
+ CpuWrapper* CpuWrapper::CreateCpu()
+ {
+ #if defined(_WIN32)
+ return new CpuWindows();
+ #elif (defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL))
+ return new CpuWrapperMac();
+-#elif defined(WEBRTC_ANDROID)
++#elif defined(WEBRTC_ANDROID) || defined(WEBRTC_BSD)
+ return 0;
+ #else
+ return new CpuLinux();
+ #endif
+ }
+ } // namespace webrtc
+diff --git media/webrtc/trunk/src/system_wrappers/source/cpu_info.cc media/webrtc/trunk/src/system_wrappers/source/cpu_info.cc
+index e367abf..e14d7af 100644
+--- mozilla/media/webrtc/trunk/src/system_wrappers/source/cpu_info.cc
++++ mozilla/media/webrtc/trunk/src/system_wrappers/source/cpu_info.cc
+@@ -7,25 +7,27 @@
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+ #include "cpu_info.h"
+
+ #if defined(_WIN32)
+ #include <Windows.h>
+-#elif defined(WEBRTC_MAC)
++#elif defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+ #elif defined(WEBRTC_MAC_INTEL)
+ // Intentionally empty
+ #elif defined(WEBRTC_ANDROID)
+ // Not implemented yet, might be possible to use Linux implementation
+-#else // defined(WEBRTC_LINUX)
++#elif defined(WEBRTC_LINUX)
+ #include <sys/sysinfo.h>
++#else // defined(_SC_NPROCESSORS_ONLN)
++#include <unistd.h>
+ #endif
+
+ #include "trace.h"
+
+ namespace webrtc {
+
+ WebRtc_UWord32 CpuInfo::_numberOfCores = 0;
+
+@@ -40,31 +42,40 @@ WebRtc_UWord32 CpuInfo::DetectNumberOfCores()
+ WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
+ "Available number of cores:%d", _numberOfCores);
+
+ #elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
+ _numberOfCores = get_nprocs();
+ WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
+ "Available number of cores:%d", _numberOfCores);
+
+-#elif (defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL))
+- int name[] = {CTL_HW, HW_AVAILCPU};
++#elif (defined(WEBRTC_BSD) || defined(WEBRTC_MAC) || defined(WEBRTC_MAC_INTEL))
++ int name[] = {
++ CTL_HW,
++#ifdef HW_AVAILCPU
++ HW_AVAILCPU,
++#else
++ HW_NCPU,
++#endif
++ };
+ int ncpu;
+ size_t size = sizeof(ncpu);
+ if(0 == sysctl(name, 2, &ncpu, &size, NULL, 0))
+ {
+ _numberOfCores = static_cast<WebRtc_UWord32>(ncpu);
+ WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
+ "Available number of cores:%d", _numberOfCores);
+ } else
+ {
+ WEBRTC_TRACE(kTraceError, kTraceUtility, -1,
+ "Failed to get number of cores");
+ _numberOfCores = 1;
+ }
++#elif defined(_SC_NPROCESSORS_ONLN)
++ _numberOfCores = sysconf(_SC_NPROCESSORS_ONLN);
+ #else
+ WEBRTC_TRACE(kTraceWarning, kTraceUtility, -1,
+ "No function to get number of cores");
+ _numberOfCores = 1;
+ #endif
+ }
+ return _numberOfCores;
+ }
+diff --git media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc
+index 6334490..852ebaa 100644
+--- mozilla/media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc
++++ mozilla/media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc
+@@ -53,16 +53,25 @@
+ #include <sched.h>
+ #include <sys/syscall.h>
+ #include <linux/unistd.h>
+ #include <sys/prctl.h>
+ #endif
+
+ #if defined(WEBRTC_MAC)
+ #include <mach/mach.h>
++#elif defined(__NetBSD__)
++#include <lwp.h>
++#elif defined(__FreeBSD__)
++#include <sys/param.h>
++#include <sys/thr.h>
++#endif
++
++#if defined(WEBRTC_BSD) && !defined(__NetBSD__)
++#include <pthread_np.h>
+ #endif
+
+ #include "system_wrappers/interface/critical_section_wrapper.h"
+ #include "system_wrappers/interface/event_wrapper.h"
+ #include "system_wrappers/interface/trace.h"
+
+ namespace webrtc {
+ extern "C"
+@@ -116,16 +125,28 @@ ThreadPosix::ThreadPosix(ThreadRunFunction func, ThreadObj obj,
+ }
+ }
+
+ uint32_t ThreadWrapper::GetThreadId() {
+ #if defined(WEBRTC_ANDROID) || defined(WEBRTC_LINUX)
+ return static_cast<uint32_t>(syscall(__NR_gettid));
+ #elif defined(WEBRTC_MAC)
+ return static_cast<uint32_t>(mach_thread_self());
++#elif defined(__NetBSD__)
++ return _lwp_self();
++#elif defined(__DragonFly__)
++ return lwp_gettid();
++#elif defined(__FreeBSD__)
++# if __FreeBSD_version > 900030
++ return pthread_getthreadid_np();
++# else
++ long lwpid;
++ thr_self(&lwpid);
++ return lwpid;
++# endif
+ #else
+ return reinterpret_cast<uint32_t>(pthread_self());
+ #endif
+ }
+
+ int ThreadPosix::Construct()
+ {
+ int result = 0;
+@@ -154,16 +175,17 @@ ThreadPosix::~ThreadPosix()
+ {
+ pthread_attr_destroy(&_attr);
+ delete _event;
+ delete _crit_state;
+ }
+
+ #define HAS_THREAD_ID !defined(MAC_IPHONE) && !defined(MAC_IPHONE_SIM) && \
+ !defined(WEBRTC_MAC) && !defined(WEBRTC_MAC_INTEL) && \
++ !defined(WEBRTC_BSD) && \
+ !defined(MAC_DYLIB) && !defined(MAC_INTEL_DYLIB)
+ #if HAS_THREAD_ID
+ bool ThreadPosix::Start(unsigned int& threadID)
+ #else
+ bool ThreadPosix::Start(unsigned int& /*threadID*/)
+ #endif
+ {
+ if (!_runFunction)
+@@ -229,31 +251,39 @@ bool ThreadPosix::Start(unsigned int& /*threadID*/)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ // CPU_ZERO and CPU_SET are not available in NDK r7, so disable
+ // SetAffinity on Android for now.
+-#if (defined(WEBRTC_LINUX) && (!defined(WEBRTC_ANDROID)))
++#if defined(__FreeBSD__) || (defined(WEBRTC_LINUX) && (!defined(WEBRTC_ANDROID)))
+ bool ThreadPosix::SetAffinity(const int* processorNumbers,
+ const unsigned int amountOfProcessors) {
+ if (!processorNumbers || (amountOfProcessors == 0)) {
+ return false;
+ }
++#if defined(__FreeBSD__)
++ cpuset_t mask;
++#else
+ cpu_set_t mask;
++#endif
+ CPU_ZERO(&mask);
+
+ for (unsigned int processor = 0;
+ processor < amountOfProcessors;
+ processor++) {
+ CPU_SET(processorNumbers[processor], &mask);
+ }
+-#if defined(WEBRTC_ANDROID)
++#if defined(__FreeBSD__)
++ const int result = pthread_setaffinity_np(_thread,
++ sizeof(mask),
++ &mask);
++#elif defined(WEBRTC_ANDROID)
+ // Android.
+ const int result = syscall(__NR_sched_setaffinity,
+ _pid,
+ sizeof(mask),
+ &mask);
+ #else
+ // "Normal" Linux.
+ const int result = sched_setaffinity(_pid,
+@@ -340,16 +370,20 @@ void ThreadPosix::Run()
+ #endif
+ // The event the Start() is waiting for.
+ _event->Set();
+
+ if (_setThreadName)
+ {
+ #ifdef WEBRTC_LINUX
+ prctl(PR_SET_NAME, (unsigned long)_name, 0, 0, 0);
++#elif defined(__NetBSD__)
++ pthread_setname_np(pthread_self(), "%s", (void *)_name);
++#elif defined(WEBRTC_BSD)
++ pthread_set_name_np(pthread_self(), _name);
+ #endif
+ WEBRTC_TRACE(kTraceStateInfo, kTraceUtility,-1,
+ "Thread with name:%s started ", _name);
+ } else
+ {
+ WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1,
+ "Thread without name started");
+ }
+diff --git media/webrtc/trunk/src/video_engine/vie_defines.h media/webrtc/trunk/src/video_engine/vie_defines.h
+index 2cc18cc7..2c042a0 100644
+--- mozilla/media/webrtc/trunk/src/video_engine/vie_defines.h
++++ mozilla/media/webrtc/trunk/src/video_engine/vie_defines.h
+@@ -168,17 +168,17 @@ inline int ChannelId(const int moduleId) {
+
+ // Example: "Oct 10 2002 12:05:30 r".
+ #define BUILDINFO BUILDDATE TEXT(" ") BUILDTIME TEXT(" ") BUILDMODE
+ #define RENDER_MODULE_TYPE kRenderWindows
+ #endif
+
+ // Linux specific.
+ #ifndef WEBRTC_ANDROID
+-#ifdef WEBRTC_LINUX
++#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
+ // Build information macros.
+ #if defined(_DEBUG)
+ #define BUILDMODE "d"
+ #elif defined(DEBUG)
+ #define BUILDMODE "d"
+ #elif defined(NDEBUG)
+ #define BUILDMODE "r"
+ #else
+diff --git media/webrtc/trunk/src/voice_engine/voe_network_impl.cc media/webrtc/trunk/src/voice_engine/voe_network_impl.cc
+index 174abca..f8a2b2d 100644
+--- mozilla/media/webrtc/trunk/src/voice_engine/voe_network_impl.cc
++++ mozilla/media/webrtc/trunk/src/voice_engine/voe_network_impl.cc
+@@ -467,17 +467,17 @@ int VoENetworkImpl::SetSendTOS(int channel,
+ int DSCP,
+ int priority,
+ bool useSetSockopt)
+ {
+ WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
+ "SetSendTOS(channel=%d, DSCP=%d, useSetSockopt=%d)",
+ channel, DSCP, useSetSockopt);
+
+-#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_MAC)
++#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD) && !defined(WEBRTC_MAC)
+ _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceWarning,
+ "SetSendTOS() is not supported on this platform");
+ return -1;
+ #endif
+
+ #ifndef WEBRTC_EXTERNAL_TRANSPORT
+ if (!_shared->statistics().Initialized())
+ {
+@@ -523,17 +523,17 @@ int VoENetworkImpl::SetSendTOS(int channel,
+ return -1;
+ }
+ if (channelPtr->ExternalTransport())
+ {
+ _shared->SetLastError(VE_EXTERNAL_TRANSPORT_ENABLED, kTraceError,
+ "SetSendTOS() external transport is enabled");
+ return -1;
+ }
+-#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+ useSetSockopt = true;
+ WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1),
+ " force useSetSockopt=true since there is no alternative"
+ " implementation");
+ #endif
+
+ return channelPtr->SetSendTOS(DSCP, priority, useSetSockopt);
+ #else
+@@ -546,17 +546,17 @@ int VoENetworkImpl::SetSendTOS(int channel,
+ int VoENetworkImpl::GetSendTOS(int channel,
+ int& DSCP,
+ int& priority,
+ bool& useSetSockopt)
+ {
+ WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1),
+ "GetSendTOS(channel=%d)", channel);
+
+-#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_MAC)
++#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD) && !defined(WEBRTC_MAC)
+ _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceWarning,
+ "GetSendTOS() is not supported on this platform");
+ return -1;
+ #endif
+ #ifndef WEBRTC_EXTERNAL_TRANSPORT
+ if (!_shared->statistics().Initialized())
+ {
+ _shared->SetLastError(VE_NOT_INITED, kTraceError);
+diff --git media/webrtc/trunk/src/voice_engine/voice_engine_defines.h media/webrtc/trunk/src/voice_engine/voice_engine_defines.h
+index 7d4c729..4104719 100644
+--- mozilla/media/webrtc/trunk/src/voice_engine/voice_engine_defines.h
++++ mozilla/media/webrtc/trunk/src/voice_engine/voice_engine_defines.h
+@@ -434,41 +434,44 @@ namespace webrtc
+
+ #else
+ #define ANDROID_NOT_SUPPORTED(stat)
+ #endif // #ifdef WEBRTC_LINUX
+
+ // *** WEBRTC_MAC ***
+ // including iPhone
+
+-#ifdef WEBRTC_MAC
++#if defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+ #include <pthread.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
+ #include <errno.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <sched.h>
+ #include <sys/time.h>
+ #include <time.h>
++
++#ifdef WEBRTC_MAC
+ #include <AudioUnit/AudioUnit.h>
+ #if !defined(MAC_IPHONE) && !defined(MAC_IPHONE_SIM)
+ #include <CoreServices/CoreServices.h>
+ #include <CoreAudio/CoreAudio.h>
+ #include <AudioToolbox/DefaultAudioOutput.h>
+ #include <AudioToolbox/AudioConverter.h>
+ #include <CoreAudio/HostTime.h>
+ #endif
++#endif // WEBRTC_MAC
+
+ #define DWORD unsigned long int
+ #define WINAPI
+ #define LPVOID void *
+ #define FALSE 0
+ #define TRUE 1
+ #define SOCKADDR_IN struct sockaddr_in
+ #define UINT unsigned int
+@@ -576,13 +579,13 @@ namespace webrtc
+ // Defines
+ // ----------------------------------------------------------------------------
+
+ #define IPHONE_NOT_SUPPORTED()
+ #endif
+
+ #else
+ #define IPHONE_NOT_SUPPORTED()
+-#endif // #ifdef WEBRTC_MAC
++#endif // #if defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
+
+
+
+ #endif // WEBRTC_VOICE_ENGINE_VOICE_ENGINE_DEFINES_H
+diff --git media/webrtc/trunk/third_party/libyuv/libyuv.gyp media/webrtc/trunk/third_party/libyuv/libyuv.gyp
+index 6f4eb9e..5f044ad 100644
+--- mozilla/media/webrtc/trunk/third_party/libyuv/libyuv.gyp
++++ mozilla/media/webrtc/trunk/third_party/libyuv/libyuv.gyp
+@@ -4,16 +4,17 @@
+ # that can be found in the LICENSE file in the root of the source
+ # tree. An additional intellectual property rights grant can be found
+ # in the file PATENTS. All contributing project authors may
+ # be found in the AUTHORS file in the root of the source tree.
+
+ {
+ 'variables': {
+ 'use_system_libjpeg%': 0,
++ 'yuv_disable_asm%': 0,
+ },
+ 'targets': [
+ {
+ 'target_name': 'libyuv',
+ 'type': 'static_library',
+ 'conditions': [
+ ['use_system_libjpeg==0', {
+ 'dependencies': [
+@@ -43,16 +44,21 @@
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ 'include',
+ '.',
+ ],
+ },
+ 'conditions': [
++ ['yuv_disable_asm==1', {
++ 'defines': [
++ 'YUV_DISABLE_ASM',
++ ],
++ }],
+ ['build_with_mozilla==1', {
+ 'include_dirs': [
+ '$(DEPTH)/dist/include',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '$(DEPTH)/dist/include',
+ ],
+diff --git media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
+index 338d0b7..2241d41 100644
+--- mozilla/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
++++ mozilla/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
+@@ -4,16 +4,17 @@
+
+ # Python 2.5 needs this for the with statement.
+ from __future__ import with_statement
+
+ import collections
+ import gyp
+ import gyp.common
+ import sys
++import platform
+ import os
+ import re
+ import shlex
+
+ generator_wants_sorted_dependencies = True
+
+ generator_default_variables = {
+ }
+@@ -111,30 +112,44 @@ endif
+
+ def ensure_directory_exists(path):
+ dir = os.path.dirname(path)
+ if dir and not os.path.exists(dir):
+ os.makedirs(dir)
+
+ def GetFlavor(params):
+ """Returns |params.flavor| if it's set, the system's default flavor else."""
++ system = platform.system().lower()
+ flavors = {
+- 'win32': 'win',
+- 'darwin': 'mac',
+- 'sunos5': 'solaris',
+- 'freebsd7': 'freebsd',
+- 'freebsd8': 'freebsd',
++ 'microsoft': 'win',
++ 'windows' : 'win',
++ 'darwin' : 'mac',
++ 'sunos' : 'solaris',
++ 'dragonfly': 'bsd',
++ 'freebsd' : 'bsd',
++ 'netbsd' : 'bsd',
++ 'openbsd' : 'bsd',
+ }
+- flavor = flavors.get(sys.platform, 'linux')
+- return params.get('flavor', flavor)
++
++ if 'flavor' in params:
++ return params['flavor']
++ if system.startswith('cygwin'):
++ return 'win'
++ if system in flavors:
++ return flavors[system]
++
++ return 'linux'
+
+
+ def CalculateVariables(default_variables, params):
++ flavor = GetFlavor(params)
++ if flavor == 'bsd':
++ flavor = platform.system().lower()
+ generator_flags = params.get('generator_flags', {})
+- default_variables['OS'] = generator_flags.get('os', GetFlavor(params))
++ default_variables['OS'] = generator_flags.get('os', flavor)
+
+
+ def CalculateGeneratorInputInfo(params):
+ """Calculate the generator specific info that gets fed to input (called by
+ gyp)."""
+ generator_flags = params.get('generator_flags', {})
+ if generator_flags.get('adjust_static_libraries', False):
+ global generator_wants_static_library_dependencies_adjusted
diff --git a/www/seamonkey/files/patch-bug815025 b/www/seamonkey/files/patch-bug815025
new file mode 100644
index 000000000000..cc542e077de6
--- /dev/null
+++ b/www/seamonkey/files/patch-bug815025
@@ -0,0 +1,27 @@
+--- mozilla/mfbt/SHA1.h~
++++ mozilla/mfbt/SHA1.h
+@@ -27,6 +27,11 @@
+ #include "mozilla/StandardInteger.h"
+ #include "mozilla/Types.h"
+
++#if !defined(__clang__) && defined(__GNUC__) && __GNUC_MINOR__ <= 3
++/* c++/36107: mark SHA1Sum constructor as weak manually */
++__asm__(".weak _ZN7mozilla7SHA1SumC1Ev");
++#endif
++
+ namespace mozilla {
+ class SHA1Sum {
+ union {
+@@ -39,7 +43,12 @@ class SHA1Sum {
+
+ public:
+ static const unsigned int HashSize = 20;
++#if !defined(__clang__) && defined(__GNUC__) && __GNUC_MINOR__ <= 3
++ /* c++/36107: gcc42 fails to remove *INTERNAL* from produced asm */
++ MOZ_IMPORT_API() SHA1Sum();
++#else
+ MFBT_API() SHA1Sum();
++#endif
+ MFBT_API(void) update(const void* dataIn, uint32_t len);
+ MFBT_API(void) finish(uint8_t hashout[20]);
+ };
diff --git a/www/seamonkey/files/patch-bug817481 b/www/seamonkey/files/patch-bug817481
new file mode 100644
index 000000000000..691ae70e31aa
--- /dev/null
+++ b/www/seamonkey/files/patch-bug817481
@@ -0,0 +1,26 @@
+commit 93d56d2
+Author: Makoto Kato <m_kato@ga2.so-net.ne.jp>
+Date: Mon Dec 3 17:01:16 2012 +0900
+
+ Bug 817481 - Build failure on WebRTC unit test with --with-system-libvpx. r=jesup
+---
+ media/webrtc/signaling/test/Makefile.in | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git media/webrtc/signaling/test/Makefile.in media/webrtc/signaling/test/Makefile.in
+index 81a38ff..e10e869 100644
+--- mozilla/media/webrtc/signaling/test/Makefile.in
++++ mozilla/media/webrtc/signaling/test/Makefile.in
+@@ -34,6 +34,12 @@ LIBS += \
+ endif
+ endif
+
++ifdef MOZ_NATIVE_LIBVPX
++LIBS += \
++ $(MOZ_LIBVPX_LIBS) \
++ $(NULL)
++endif
++
+ ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
+ LIBS += \
+ $(XLIBS) \
diff --git a/www/seamonkey/files/patch-bug826985 b/www/seamonkey/files/patch-bug826985
new file mode 100644
index 000000000000..0a906f3be981
--- /dev/null
+++ b/www/seamonkey/files/patch-bug826985
@@ -0,0 +1,370 @@
+commit d18000b
+Author: Henrik Gulbrandsen <henrik@gulbra.net>
+Date: Fri Jan 4 13:49:22 2013 +0100
+
+ Bug 826985 - Support more video formats for WebRTC via libv4l2 on Linux.
+---
+ configure.in | 13 ++++++
+ .../main/source/Linux/device_info_linux.cc | 30 ++++++++------
+ .../main/source/Linux/video_capture_linux.cc | 47 ++++++++++++----------
+ .../video_capture/main/source/video_capture.gypi | 1 +
+ toolkit/library/Makefile.in | 3 ++
+ 5 files changed, 60 insertions(+), 34 deletions(-)
+
+diff --git configure.in configure.in
+index 6d05f9c..297615f 100644
+--- mozilla/configure.in
++++ mozilla/configure.in
+@@ -5270,6 +5270,17 @@ if test -n "$MOZ_WEBRTC"; then
+ MOZ_VP8=1
+ MOZ_VP8_ENCODER=1
+ MOZ_VP8_ERROR_CONCEALMENT=1
++ dnl use libv4l on Linux to support more cameras
++ case "$target" in
++ *-android*|*-linuxandroid*)
++ ;;
++ *-linux*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
++ MOZ_WEBRTC_LIBV4L=1
++ PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2, ,
++ [echo "$MOZ_LIBV4L2_PKG_ERRORS"
++ AC_MSG_ERROR([WebRTC on Linux needs libv4l2 for video format conversion.])])
++ ;;
++ esac
+ dnl enable once Signaling lands
+ MOZ_WEBRTC_SIGNALING=1
+ AC_DEFINE(MOZ_WEBRTC_SIGNALING)
+@@ -5288,6 +5299,7 @@ fi
+ AC_SUBST(MOZ_WEBRTC)
+ AC_SUBST(MOZ_WEBRTC_SIGNALING)
+ AC_SUBST(MOZ_PEERCONNECTION)
++AC_SUBST(MOZ_WEBRTC_LIBV4L)
+ AC_SUBST(MOZ_WEBRTC_IN_LIBXUL)
+ AC_SUBST(MOZ_SCTP)
+ AC_SUBST(MOZ_SRTP)
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
+index 653ee16..270f064 100644
+--- mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
++++ mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/Linux/device_info_linux.cc
+@@ -26,6 +26,7 @@
+ #else
+ #include <linux/videodev2.h>
+ #endif
++#include <libv4l2.h>
+
+ #include "ref_count.h"
+ #include "trace.h"
+@@ -68,9 +69,9 @@ WebRtc_UWord32 DeviceInfoLinux::NumberOfDevices()
+ for (int n = 0; n < 64; n++)
+ {
+ sprintf(device, "/dev/video%d", n);
+- if ((fd = open(device, O_RDONLY)) != -1)
++ if ((fd = v4l2_open(device, O_RDONLY)) != -1)
+ {
+- close(fd);
++ v4l2_close(fd);
+ count++;
+ }
+ }
+@@ -97,14 +98,14 @@ WebRtc_Word32 DeviceInfoLinux::GetDeviceName(
+ for (int n = 0; n < 64; n++)
+ {
+ sprintf(device, "/dev/video%d", n);
+- if ((fd = open(device, O_RDONLY)) != -1)
++ if ((fd = v4l2_open(device, O_RDONLY)) != -1)
+ {
+ if (count == deviceNumber) {
+ // Found the device
+ found = true;
+ break;
+ } else {
+- close(fd);
++ v4l2_close(fd);
+ count++;
+ }
+ }
+@@ -115,21 +116,26 @@ WebRtc_Word32 DeviceInfoLinux::GetDeviceName(
+
+ // query device capabilities
+ struct v4l2_capability cap;
+- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0)
++ if (v4l2_ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "error in querying the device capability for device %s. errno = %d",
+ device, errno);
+- close(fd);
++ v4l2_close(fd);
+ return -1;
+ }
+
+- close(fd);
++ v4l2_close(fd);
+
+ char cameraName[64];
+ memset(deviceNameUTF8, 0, deviceNameLength);
+ memcpy(cameraName, cap.card, sizeof(cap.card));
+
++ if (cameraName[0] == '\0')
++ {
++ sprintf(cameraName, "Camera at /dev/video%d", deviceNumber);
++ }
++
+ if (deviceNameLength >= strlen(cameraName))
+ {
+ memcpy(deviceNameUTF8, cameraName, strlen(cameraName));
+@@ -181,13 +187,13 @@ WebRtc_Word32 DeviceInfoLinux::CreateCapabilityMap(
+ for (int n = 0; n < 64; ++n)
+ {
+ sprintf(device, "/dev/video%d", n);
+- fd = open(device, O_RDONLY);
++ fd = v4l2_open(device, O_RDONLY);
+ if (fd == -1)
+ continue;
+
+ // query device capabilities
+ struct v4l2_capability cap;
+- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0)
++ if (v4l2_ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0)
+ {
+ if (cap.bus_info[0] != 0)
+ {
+@@ -209,7 +215,7 @@ WebRtc_Word32 DeviceInfoLinux::CreateCapabilityMap(
+ }
+ }
+ }
+- close(fd); // close since this is not the matching device
++ v4l2_close(fd); // close since this is not the matching device
+ }
+
+ if (!found)
+@@ -228,7 +234,7 @@ WebRtc_Word32 DeviceInfoLinux::CreateCapabilityMap(
+ }
+
+ int size = FillCapabilityMap(fd);
+- close(fd);
++ v4l2_close(fd);
+
+ // Store the new used device name
+ _lastUsedDeviceNameLength = deviceUniqueIdUTF8Length;
+@@ -282,7 +288,7 @@ WebRtc_Word32 DeviceInfoLinux::FillCapabilityMap(int fd)
+ video_fmt.fmt.pix.width = size[i][0];
+ video_fmt.fmt.pix.height = size[i][1];
+
+- if (ioctl(fd, VIDIOC_TRY_FMT, &video_fmt) >= 0)
++ if (v4l2_ioctl(fd, VIDIOC_TRY_FMT, &video_fmt) >= 0)
+ {
+ if ((video_fmt.fmt.pix.width == size[i][0])
+ && (video_fmt.fmt.pix.height == size[i][1]))
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
+index 12df1b3..4ddc9d4 100644
+--- mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
++++ mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/Linux/video_capture_linux.cc
+@@ -25,6 +25,7 @@
+ #else
+ #include <linux/videodev2.h>
+ #endif
++#include <libv4l2.h>
+
+ #include <new>
+
+@@ -79,11 +82,11 @@ WebRtc_Word32 VideoCaptureModuleV4L2::Init(const char* deviceUniqueIdUTF8)
+ for (n = 0; n < 64; n++)
+ {
+ sprintf(device, "/dev/video%d", n);
+- if ((fd = open(device, O_RDONLY)) != -1)
++ if ((fd = v4l2_open(device, O_RDONLY)) != -1)
+ {
+ // query device capabilities
+ struct v4l2_capability cap;
+- if (ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0)
++ if (v4l2_ioctl(fd, VIDIOC_QUERYCAP, &cap) == 0)
+ {
+ if (cap.bus_info[0] != 0)
+ {
+@@ -91,13 +94,13 @@ WebRtc_Word32 VideoCaptureModuleV4L2::Init(const char* deviceUniqueIdUTF8)
+ (const char*) deviceUniqueIdUTF8,
+ strlen((const char*) deviceUniqueIdUTF8)) == 0) //match with device id
+ {
+- close(fd);
++ v4l2_close(fd);
+ found = true;
+ break; // fd matches with device unique id supplied
+ }
+ }
+ }
+- close(fd); // close since this is not the matching device
++ v4l2_close(fd); // close since this is not the matching device
+ }
+ }
+ if (!found)
+@@ -117,7 +120,7 @@ VideoCaptureModuleV4L2::~VideoCaptureModuleV4L2()
+ delete _captureCritSect;
+ }
+ if (_deviceFd != -1)
+- close(_deviceFd);
++ v4l2_close(_deviceFd);
+ }
+
+ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+@@ -142,7 +145,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ char device[20];
+ sprintf(device, "/dev/video%d", (int) _deviceId);
+
+- if ((_deviceFd = open(device, O_RDWR | O_NONBLOCK, 0)) < 0)
++ if ((_deviceFd = v4l2_open(device, O_RDWR | O_NONBLOCK, 0)) < 0)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "error in opening %s errono = %d", device, errno);
+@@ -175,7 +178,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ for (int i = 0; i < nFormats; i++)
+ {
+ video_fmt.fmt.pix.pixelformat = fmts[i];
+- if (ioctl(_deviceFd, VIDIOC_TRY_FMT, &video_fmt) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_TRY_FMT, &video_fmt) < 0)
+ {
+ continue;
+ }
+@@ -200,7 +203,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ _captureVideoType = kVideoMJPEG;
+
+ //set format and frame size now
+- if (ioctl(_deviceFd, VIDIOC_S_FMT, &video_fmt) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_S_FMT, &video_fmt) < 0)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "error in VIDIOC_S_FMT, errno = %d", errno);
+@@ -217,7 +220,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ struct v4l2_streamparm streamparms;
+ memset(&streamparms, 0, sizeof(streamparms));
+ streamparms.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+- if (ioctl(_deviceFd, VIDIOC_G_PARM, &streamparms) < 0) {
++ if (v4l2_ioctl(_deviceFd, VIDIOC_G_PARM, &streamparms) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "error in VIDIOC_G_PARM errno = %d", errno);
+ driver_framerate_support = false;
+@@ -230,7 +233,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ streamparms.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ streamparms.parm.capture.timeperframe.numerator = 1;
+ streamparms.parm.capture.timeperframe.denominator = capability.maxFPS;
+- if (ioctl(_deviceFd, VIDIOC_S_PARM, &streamparms) < 0) {
++ if (v4l2_ioctl(_deviceFd, VIDIOC_S_PARM, &streamparms) < 0) {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "Failed to set the framerate. errno=%d", errno);
+ driver_framerate_support = false;
+@@ -268,7 +271,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StartCapture(
+ // Needed to start UVC camera - from the uvcview application
+ enum v4l2_buf_type type;
+ type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+- if (ioctl(_deviceFd, VIDIOC_STREAMON, &type) == -1)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_STREAMON, &type) == -1)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "Failed to turn on stream");
+@@ -303,7 +306,7 @@ WebRtc_Word32 VideoCaptureModuleV4L2::StopCapture()
+ _captureThread = NULL;
+
+ DeAllocateVideoBuffers();
+- close(_deviceFd);
++ v4l2_close(_deviceFd);
+ _deviceFd = -1;
+ }
+
+@@ -321,7 +324,7 @@ bool VideoCaptureModuleV4L2::AllocateVideoBuffers()
+ rbuffer.memory = V4L2_MEMORY_MMAP;
+ rbuffer.count = kNoOfV4L2Bufffers;
+
+- if (ioctl(_deviceFd, VIDIOC_REQBUFS, &rbuffer) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_REQBUFS, &rbuffer) < 0)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "Could not get buffers from device. errno = %d", errno);
+@@ -344,24 +347,24 @@ bool VideoCaptureModuleV4L2::AllocateVideoBuffers()
+ buffer.memory = V4L2_MEMORY_MMAP;
+ buffer.index = i;
+
+- if (ioctl(_deviceFd, VIDIOC_QUERYBUF, &buffer) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_QUERYBUF, &buffer) < 0)
+ {
+ return false;
+ }
+
+- _pool[i].start = mmap(NULL, buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED,
++ _pool[i].start = v4l2_mmap(NULL, buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED,
+ _deviceFd, buffer.m.offset);
+
+ if (MAP_FAILED == _pool[i].start)
+ {
+ for (unsigned int j = 0; j < i; j++)
+- munmap(_pool[j].start, _pool[j].length);
++ v4l2_munmap(_pool[j].start, _pool[j].length);
+ return false;
+ }
+
+ _pool[i].length = buffer.length;
+
+- if (ioctl(_deviceFd, VIDIOC_QBUF, &buffer) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_QBUF, &buffer) < 0)
+ {
+ return false;
+ }
+@@ -373,14 +376,14 @@ bool VideoCaptureModuleV4L2::DeAllocateVideoBuffers()
+ {
+ // unmap buffers
+ for (int i = 0; i < _buffersAllocatedByDevice; i++)
+- munmap(_pool[i].start, _pool[i].length);
++ v4l2_munmap(_pool[i].start, _pool[i].length);
+
+ delete[] _pool;
+
+ // turn off stream
+ enum v4l2_buf_type type;
+ type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+- if (ioctl(_deviceFd, VIDIOC_STREAMOFF, &type) < 0)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_STREAMOFF, &type) < 0)
+ {
+ WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideoCapture, _id,
+ "VIDIOC_STREAMOFF error. errno: %d", errno);
+@@ -438,7 +441,7 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
+ buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ buf.memory = V4L2_MEMORY_MMAP;
+ // dequeue a buffer - repeat until dequeued properly!
+- while (ioctl(_deviceFd, VIDIOC_DQBUF, &buf) < 0)
++ while (v4l2_ioctl(_deviceFd, VIDIOC_DQBUF, &buf) < 0)
+ {
+ if (errno != EINTR)
+ {
+@@ -457,7 +460,7 @@ bool VideoCaptureModuleV4L2::CaptureProcess()
+ IncomingFrame((unsigned char*) _pool[buf.index].start,
+ buf.bytesused, frameInfo);
+ // enqueue the buffer again
+- if (ioctl(_deviceFd, VIDIOC_QBUF, &buf) == -1)
++ if (v4l2_ioctl(_deviceFd, VIDIOC_QBUF, &buf) == -1)
+ {
+ WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCapture, _id,
+ "Failed to enqueue capture buffer");
+diff --git media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
+index 8d38102..3e8f76b 100644
+--- mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
++++ mozilla/media/webrtc/trunk/src/modules/video_capture/main/source/video_capture.gypi
+@@ -179,6 +179,7 @@
+ 'libraries': [
+ '-lXext',
+ '-lX11',
++ '-lv4l2',
+ ],
+ }],
+ ['OS=="linux"', {
+diff --git toolkit/library/Makefile.in toolkit/library/Makefile.in
+index 0440c26..8f6c735 100644
+--- mozilla/toolkit/library/Makefile.in
++++ mozilla/toolkit/library/Makefile.in
+@@ -411,6 +411,9 @@ EXTRA_DSO_LDOPTS += \
+ $(DEPTH)/media/webrtc/signaling/signaling_sipcc/$(LIB_PREFIX)sipcc.$(LIB_SUFFIX) \
+ $(NULL)
+ endif
++ifdef MOZ_WEBRTC_LIBV4L
++EXTRA_DSO_LDOPTS += $(MOZ_LIBV4L2_LIBS)
++endif
+ ifdef MOZ_WEBRTC_IN_LIBXUL
+ include $(topsrcdir)/media/webrtc/shared_libs.mk
+ EXTRA_DSO_LDOPTS += $(WEBRTC_LIBS)
diff --git a/www/seamonkey/files/patch-bug828003 b/www/seamonkey/files/patch-bug828003
new file mode 100644
index 000000000000..4a58815a5ab1
--- /dev/null
+++ b/www/seamonkey/files/patch-bug828003
@@ -0,0 +1,36 @@
+--- mozilla/gfx/qcms/qcmstypes.h
++++ mozilla/gfx/qcms/qcmstypes.h
+@@ -7,30 +7,12 @@
+ #include "mozilla/StandardInteger.h"
+
+ /* prtypes.h defines IS_LITTLE_ENDIAN and IS_BIG ENDIAN */
++/* stdint.h defines int*_t and uintptr_t */
+
+-#if defined (__SVR4) && defined (__sun)
+-/* int_types.h gets included somehow, so avoid redefining the types differently */
+-#include <sys/int_types.h>
+-#elif defined (_AIX)
++#if defined (_AIX)
+ #include <sys/types.h>
+-#elif defined(__OpenBSD__)
+-#include <inttypes.h>
+-#elif !defined(ANDROID)
+-typedef int8_t int8_t;
+-typedef uint8_t uint8_t;
+-typedef int16_t int16_t;
+-typedef uint16_t uint16_t;
+-typedef int32_t int32_t;
+-typedef uint32_t uint32_t;
+-typedef int64_t int64_t;
+-typedef uint64_t uint64_t;
+-
+-#ifdef __OS2__
+-/* OS/2's stdlib typdefs uintptr_t. So we'll just include that so we don't collide */
++#elif __OS2__
+ #include <stdlib.h>
+-#elif !defined(__intptr_t_defined) && !defined(_UINTPTR_T_DEFINED)
+-typedef unsigned long uintptr_t;
+-#endif
+ #endif
+
+ #else // MOZ_QCMS
diff --git a/www/seamonkey/files/patch-enigmail-ipc-src-Makefile b/www/seamonkey/files/patch-enigmail-ipc-src-Makefile
new file mode 100644
index 000000000000..d8b5128d02b4
--- /dev/null
+++ b/www/seamonkey/files/patch-enigmail-ipc-src-Makefile
@@ -0,0 +1,90 @@
+--- mailnews/extensions/enigmail/ipc/src/Makefile.enig~
++++ mailnews/extensions/enigmail/ipc/src/Makefile.enig
+@@ -19,26 +19,26 @@ endif
+
+ ifeq ($(OS_ARCH),NetBSD)
+ ifeq ($(DLL_SUFFIX),.so.1.0)
+-LDFLAGS += -Wl,-Bsymbolic
++LDFLAGS += -shared -Wl,-Bsymbolic
+ CFLAGS += -fPIC
+ endif
+ endif
+
+ ifeq ($(OS_ARCH),FreeBSD)
+-LDFLAGS += -Wl,-Bsymbolic
++LDFLAGS += -shared -Wl,-Bsymbolic
+ CFLAGS += -fPIC
+ endif
+
+ ifeq ($(OS_ARCH),HP-UX)
+ ifeq ($(GNU_CC)$(GNU_CXX),)
+-LDFLAGS += -Wl,-Bsymbolic
++LDFLAGS += -shared -Wl,-Bsymbolic
+ CFLAGS += -fPIC
+ endif
+ endif
+
+ ifeq ($(OS_ARCH),OSF1)
+ ifeq ($(GNU_CC)$(GNU_CXX),)
+-LDFLAGS += -B symbolic
++LDFLAGS += -shared -B symbolic
+ CFLAGS += -fPIC
+ endif
+ endif
+@@ -62,7 +62,11 @@ libs: source
+ $(CC) $(LDFLAGS) -o $(libname) $(objfiles)
+
+ source: $(source)
++ifneq (,$(filter 4.2.%, $(CC_VERSION)))
++ $(CC) $(CFLAGS) -c -o $(objfiles) $^
++else
+ $(CC) $(CFLAGS) -Wno-return-type-c-linkage -c -o $(objfiles) $^
++endif
+
+
+ clean:
+--- mailnews/extensions/enigmail/ipc/src/Makefile.in~
++++ mailnews/extensions/enigmail/ipc/src/Makefile.in
+@@ -19,26 +19,26 @@ endif
+
+ ifeq ($(OS_ARCH),NetBSD)
+ ifeq ($(DLL_SUFFIX),.so.1.0)
+-LDFLAGS += -Wl,-Bsymbolic
++LDFLAGS += -shared -Wl,-Bsymbolic
+ CFLAGS += -fPIC
+ endif
+ endif
+
+ ifeq ($(OS_ARCH),FreeBSD)
+-LDFLAGS += -Wl,-Bsymbolic
++LDFLAGS += -shared -Wl,-Bsymbolic
+ CFLAGS += -fPIC
+ endif
+
+ ifeq ($(OS_ARCH),HP-UX)
+ ifeq ($(GNU_CC)$(GNU_CXX),)
+-LDFLAGS += -Wl,-Bsymbolic
++LDFLAGS += -shared -Wl,-Bsymbolic
+ CFLAGS += -fPIC
+ endif
+ endif
+
+ ifeq ($(OS_ARCH),OSF1)
+ ifeq ($(GNU_CC)$(GNU_CXX),)
+-LDFLAGS += -B symbolic
++LDFLAGS += -shared -B symbolic
+ CFLAGS += -fPIC
+ endif
+ endif
+@@ -62,7 +62,11 @@ libs: source
+ $(CC) $(LDFLAGS) -o $(libname) $(objfiles)
+
+ source: $(source)
++ifneq (,$(filter 4.2.%, $(CC_VERSION)))
++ $(CC) $(CFLAGS) -c -o $(objfiles) $^
++else
+ $(CC) $(CFLAGS) -Wno-return-type-c-linkage -c -o $(objfiles) $^
++endif
+
+
+ clean:
diff --git a/www/seamonkey/files/patch-mozilla-content-base-src-nsTextFragmentImpl.h b/www/seamonkey/files/patch-mozilla-content-base-src-nsTextFragmentImpl.h
new file mode 100644
index 000000000000..b799ff5fb83f
--- /dev/null
+++ b/www/seamonkey/files/patch-mozilla-content-base-src-nsTextFragmentImpl.h
@@ -0,0 +1,14 @@
+--- mozilla/content/base/src/nsTextFragmentImpl.h.orig 2013-01-05 00:44:29.000000000 +0100
++++ mozilla/content/base/src/nsTextFragmentImpl.h 2013-01-10 13:02:12.291088273 +0100
+@@ -16,7 +16,11 @@
+ };
+
+ template<> struct Non8BitParameters<8> {
++#if !defined(__clang__) && defined(__GNUC__) && __GNUC_MINOR__ <= 2
++ static inline size_t mask() { return 0xff00ff00ff00ff00ULL; }
++#else
+ static inline size_t mask() { return 0xff00ff00ff00ff00; }
++#endif
+ static inline uint32_t alignMask() { return 0x7; }
+ static inline uint32_t numUnicharsPerWord() { return 4; }
+ };
diff --git a/www/seamonkey/files/patch-mozilla-content-media-nsAudioStream.cpp b/www/seamonkey/files/patch-mozilla-content-media-nsAudioStream.cpp
index f31ba356b0ab..346ff93c37fa 100644
--- a/www/seamonkey/files/patch-mozilla-content-media-nsAudioStream.cpp
+++ b/www/seamonkey/files/patch-mozilla-content-media-nsAudioStream.cpp
@@ -1,14 +1,11 @@
--- mozilla/content/media/nsAudioStream.cpp~
+++ mozilla/content/media/nsAudioStream.cpp
-@@ -298,7 +298,11 @@ static int PrefChanged(const char* aPref
- gVolumeScale = NS_MAX<double>(0, PR_strtod(utf8.get(), nsnull));
+@@ -298,7 +298,7 @@ static int PrefChanged(const char* aPref, void* aClosure)
+ gVolumeScale = NS_MAX<double>(0, PR_strtod(utf8.get(), nullptr));
}
} else if (strcmp(aPref, PREF_USE_CUBEB) == 0) {
-+#if defined(__FreeBSD__) && __FreeBSD_version < 800097
-+ bool value = Preferences::GetBool(aPref, false);
-+#else
+-#ifdef MOZ_WIDGET_GONK
++#if defined(MOZ_WIDGET_GONK) || defined(__FreeBSD__) && __FreeBSD_version < 800097
+ bool value = Preferences::GetBool(aPref, false);
+ #else
bool value = Preferences::GetBool(aPref, true);
-+#endif
- mozilla::MutexAutoLock lock(*gAudioPrefsLock);
- gUseCubeb = value;
- } else if (strcmp(aPref, PREF_CUBEB_LATENCY) == 0) {
diff --git a/www/seamonkey/files/patch-mozilla-gfx-qcms-qcmstypes.h b/www/seamonkey/files/patch-mozilla-gfx-qcms-qcmstypes.h
deleted file mode 100644
index 7a23c9dd3820..000000000000
--- a/www/seamonkey/files/patch-mozilla-gfx-qcms-qcmstypes.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- mozilla/gfx/qcms/qcmstypes.h.orig 2010-11-22 12:01:36.000000000 +0100
-+++ mozilla/gfx/qcms/qcmstypes.h 2010-11-22 12:02:42.000000000 +0100
-@@ -25,7 +25,7 @@
- #ifdef __OS2__
- /* OS/2's stdlib typdefs uintptr_t. So we'll just include that so we don't collide */
- #include <stdlib.h>
--#elif !defined(__intptr_t_defined) && !defined(_UINTPTR_T_DEFINED)
-+#elif !defined(__intptr_t_defined) && !defined(_INTPTR_T_DECLARED)
- typedef PRUptrdiff uintptr_t;
- #endif
- #endif
diff --git a/www/seamonkey/files/patch-mozilla-ipc-chromium-src-base-platform_thread_posix.cc b/www/seamonkey/files/patch-mozilla-ipc-chromium-src-base-platform_thread_posix.cc
new file mode 100644
index 000000000000..52c2d67db402
--- /dev/null
+++ b/www/seamonkey/files/patch-mozilla-ipc-chromium-src-base-platform_thread_posix.cc
@@ -0,0 +1,16 @@
+--- mozilla/ipc/chromium/src/base/platform_thread_posix.cc~
++++ mozilla/ipc/chromium/src/base/platform_thread_posix.cc
+@@ -16,7 +16,13 @@
+ #include <sys/prctl.h>
+ #elif defined(OS_FREEBSD)
+ #include <sys/param.h>
++#if __FreeBSD_version > 802500
+ #include <sys/thr.h>
++#else
++_Pragma("GCC visibility push(default)")
++extern "C" int thr_self(long *);
++_Pragma("GCC visibility pop")
++#endif
+ #endif
+
+ #if !defined(OS_MACOSX)
diff --git a/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-modules-audio_device-main-source-linux-latebindingsymboltable_linux.cc b/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-modules-audio_device-main-source-linux-latebindingsymboltable_linux.cc
new file mode 100644
index 000000000000..0cc297136b66
--- /dev/null
+++ b/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-modules-audio_device-main-source-linux-latebindingsymboltable_linux.cc
@@ -0,0 +1,37 @@
+--- mozilla/media/webrtc/trunk/src/modules/audio_device/main/source/linux/latebindingsymboltable_linux.cc~
++++ mozilla/media/webrtc/trunk/src/modules/audio_device/main/source/linux/latebindingsymboltable_linux.cc
+@@ -31,6 +31,10 @@
+ #include <dlfcn.h>
+ #endif
+
++#ifdef __FreeBSD__
++#include <osreldate.h>
++#endif
++
+ // TODO(grunell): Either put inside webrtc namespace or use webrtc:: instead.
+ using namespace webrtc;
+
+@@ -38,7 +42,11 @@ namespace webrtc_adm_linux {
+
+ inline static const char *GetDllError() {
+ #ifdef WEBRTC_LINUX
++#if __FreeBSD_version < 800505
++ const char *err = dlerror();
++#else
+ char *err = dlerror();
++#endif
+ if (err) {
+ return err;
+ } else {
+@@ -78,7 +86,11 @@ static bool LoadSymbol(DllHandle handle,
+ void **symbol) {
+ #ifdef WEBRTC_LINUX
+ *symbol = dlsym(handle, symbol_name);
++#if __FreeBSD_version < 800505
++ const char *err = dlerror();
++#else
+ char *err = dlerror();
++#endif
+ if (err) {
+ WEBRTC_TRACE(kTraceError, kTraceAudioDevice, -1,
+ "Error loading symbol %s : %d", symbol_name, err);
diff --git a/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-system_wrappers-source-spreadsortlib-spreadsort.hpp b/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-system_wrappers-source-spreadsortlib-spreadsort.hpp
new file mode 100644
index 000000000000..3492d13e36ff
--- /dev/null
+++ b/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-system_wrappers-source-spreadsortlib-spreadsort.hpp
@@ -0,0 +1,16 @@
+--- mozilla/media/webrtc/trunk/src/system_wrappers/source/spreadsortlib/spreadsort.hpp~
++++ mozilla/media/webrtc/trunk/src/system_wrappers/source/spreadsortlib/spreadsort.hpp
+@@ -21,6 +21,13 @@ Scott McMurray
+ #include "constants.hpp"
+ #include <cstring>
+
++#ifdef __FreeBSD__
++# include <osreldate.h>
++# if __FreeBSD_version < 900506
++# define getchar boost_getchar
++# endif
++#endif
++
+ namespace boost {
+ namespace detail {
+ //This only works on unsigned data types
diff --git a/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-system_wrappers-source-thread_posix.cc b/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-system_wrappers-source-thread_posix.cc
new file mode 100644
index 000000000000..d68cad2e5c6a
--- /dev/null
+++ b/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-src-system_wrappers-source-thread_posix.cc
@@ -0,0 +1,16 @@
+--- mozilla/media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc~
++++ mozilla/media/webrtc/trunk/src/system_wrappers/source/thread_posix.cc
+@@ -62,7 +62,13 @@
+ #include <lwp.h>
+ #elif defined(__FreeBSD__)
+ #include <sys/param.h>
++#if __FreeBSD_version > 802500
+ #include <sys/thr.h>
++#else
++_Pragma("GCC visibility push(default)")
++extern "C" int thr_self(long *);
++_Pragma("GCC visibility pop")
++#endif
+ #endif
+
+ #if defined(WEBRTC_BSD) && !defined(__NetBSD__)
diff --git a/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-testing-gtest-include-gtest-internal-gtest-port.h b/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-testing-gtest-include-gtest-internal-gtest-port.h
new file mode 100644
index 000000000000..8d16fc7fbf1d
--- /dev/null
+++ b/www/seamonkey/files/patch-mozilla-media-webrtc-trunk-testing-gtest-include-gtest-internal-gtest-port.h
@@ -0,0 +1,17 @@
+--- mozilla/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-port.h.orig 2012-12-09 16:28:45.641625374 +0100
++++ mozilla/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-port.h 2012-12-09 19:09:11.664625374 +0100
+@@ -490,10 +490,10 @@
+ # define GTEST_ENV_HAS_TR1_TUPLE_ 1
+ # endif
+
+-// C++11 specifies that <tuple> provides std::tuple. Users can't use
+-// gtest in C++11 mode until their standard library is at least that
+-// compliant.
+-# if GTEST_LANG_CXX11
++// C++11 specifies that <tuple> provides std::tuple. Use that if gtest is used
++// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6
++// can build with clang but need to use gcc4.2's libstdc++).
++# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325)
+ # define GTEST_ENV_HAS_STD_TUPLE_ 1
+ # endif
+
diff --git a/www/seamonkey/files/patch-mozilla-python-psutil-psutil-_psutil_bsd.c b/www/seamonkey/files/patch-mozilla-python-psutil-psutil-_psutil_bsd.c
new file mode 100644
index 000000000000..ae5b0b98ec84
--- /dev/null
+++ b/www/seamonkey/files/patch-mozilla-python-psutil-psutil-_psutil_bsd.c
@@ -0,0 +1,13 @@
+--- mozilla/python/psutil/psutil/_psutil_bsd.c.orig 2012-08-16 23:07:37.000000000 +0800
++++ mozilla/python/psutil/psutil/_psutil_bsd.c 2012-09-27 14:50:20.843763756 +0800
+@@ -1376,8 +1376,10 @@
+ strlcat(opts, ",noclusterr", sizeof(opts));
+ if (flags & MNT_NOCLUSTERW)
+ strlcat(opts, ",noclusterw", sizeof(opts));
++#if __FreeBSD_version >= 800000
+ if (flags & MNT_NFS4ACLS)
+ strlcat(opts, ",nfs4acls", sizeof(opts));
++#endif
+
+ py_tuple = Py_BuildValue("(ssss)", fs[i].f_mntfromname, // device
+ fs[i].f_mntonname, // mount point
diff --git a/www/seamonkey/files/patch-mozilla-xpcom-base-AvailableMemoryTracker.cpp b/www/seamonkey/files/patch-mozilla-xpcom-base-AvailableMemoryTracker.cpp
new file mode 100644
index 000000000000..e97731dbc67d
--- /dev/null
+++ b/www/seamonkey/files/patch-mozilla-xpcom-base-AvailableMemoryTracker.cpp
@@ -0,0 +1,10 @@
+--- mozilla/xpcom/base/AvailableMemoryTracker.cpp~
++++ mozilla/xpcom/base/AvailableMemoryTracker.cpp
+@@ -499,6 +499,6 @@ nsJemallocFreeDirtyPagesRunnable::Run()
+ MOZ_ASSERT(NS_IsMainThread());
+
+ #if defined(MOZ_JEMALLOC)
+- mallctl("arenas.purge", nullptr, 0, nullptr, 0);
++// mallctl("arenas.purge", nullptr, 0, nullptr, 0);
+ #elif defined(MOZ_MEMORY)
+ jemalloc_free_dirty_pages();
diff --git a/www/seamonkey/files/patch-z-bug815916 b/www/seamonkey/files/patch-z-bug815916
new file mode 100644
index 000000000000..2e3ecabbe6ab
--- /dev/null
+++ b/www/seamonkey/files/patch-z-bug815916
@@ -0,0 +1,27 @@
+--- mozilla/media/webrtc/signaling/test/Makefile.in~
++++ mozilla/media/webrtc/signaling/test/Makefile.in
+@@ -34,12 +34,24 @@ LIBS += \
+ endif
+ endif
+
++ifdef MOZ_NATIVE_JPEG
++LIBS += \
++ $(MOZ_JPEG_LIBS) \
++ $(NULL)
++endif
++
+ ifdef MOZ_NATIVE_LIBVPX
+ LIBS += \
+ $(MOZ_LIBVPX_LIBS) \
+ $(NULL)
+ endif
+
++ifndef MOZ_TREE_PIXMAN
++LIBS += \
++ $(MOZ_PIXMAN_LIBS) \
++ $(NULL)
++endif
++
+ ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
+ LIBS += \
+ $(XLIBS) \