diff --git a/.firefox.metadata b/.firefox.metadata
index a77600d..8d4b963 100644
--- a/.firefox.metadata
+++ b/.firefox.metadata
@@ -1,2 +1,2 @@
-88b4c4de59e0c379e50ac28a8a9c289662e7a064 SOURCES/firefox-31.3.0esr.source.tar.bz2
-1ce18b2e2093b4c50ac28f02db7fed10809586f9 SOURCES/firefox-langpacks-31.3.0esr-20141126.tar.bz2
+32502debd0a207bb918ccf169757607ecb32b5e0 SOURCES/firefox-31.4.0esr.source.tar.bz2
+d43b72d4814d8a7e6805de24d048136af1a085d0 SOURCES/firefox-langpacks-31.4.0esr-20150106.tar.bz2
diff --git a/.gitignore b/.gitignore
index 352a348..5f37328 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-SOURCES/firefox-31.3.0esr.source.tar.bz2
-SOURCES/firefox-langpacks-31.3.0esr-20141126.tar.bz2
+SOURCES/firefox-31.4.0esr.source.tar.bz2
+SOURCES/firefox-langpacks-31.4.0esr-20150106.tar.bz2
diff --git a/SOURCES/firefox-centos-default-prefs.js b/SOURCES/firefox-centos-default-prefs.js
deleted file mode 100644
index 2b5da25..0000000
--- a/SOURCES/firefox-centos-default-prefs.js
+++ /dev/null
@@ -1,28 +0,0 @@
-pref("app.update.auto",                     false);
-pref("app.update.enabled",                  false);
-pref("app.update.autoInstallEnabled",       false);
-pref("browser.backspace_action",            2);
-pref("browser.display.use_system_colors",   true);
-pref("browser.download.folderList",         1);
-pref("browser.link.open_external",          3);
-pref("browser.shell.checkDefaultBrowser",   false);
-pref("general.smoothScroll",                true);
-pref("general.useragent.vendor",            "CentOS");
-pref("general.useragent.vendorSub",         "FIREFOX_RPM_VR");
-pref("intl.locale.matchOS",                 true);
-pref("storage.nfs_filesystem",              false);
-pref("dom.ipc.plugins.enabled.nswrapper*",  false);
-pref("network.manage-offline-status",       true);
-pref("toolkit.networkmanager.disable", false);
-pref("browser.startup.homepage",            "data:text/plain,browser.startup.homepage=file:///usr/share/doc/HTML/index.html");
-pref("toolkit.storage.synchronous",         0);
-pref("startup.homepage_override_url",       "http://www.centos.org");
-pref("startup.homepage_welcome_url",        "http://www.centos.org");
-/* Workaround for rhbz#1134876 */
-pref("javascript.options.baselinejit",      false);
-pref("extensions.shownSelectionUI",         true);
-/* Workaround for rhbz#1110291 */
-pref("network.negotiate-auth.allow-insecure-ntlm-v1", true);
-/* Workaround for mozbz#1063315 */
-pref("security.use_mozillapkix_verification", false);
-pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%");
diff --git a/SOURCES/firefox.sh.in b/SOURCES/firefox.sh.in
index 05a4af4..59f4a20 100644
--- a/SOURCES/firefox.sh.in
+++ b/SOURCES/firefox.sh.in
@@ -142,6 +142,11 @@ export FONTCONFIG_PATH
 GNOME_DISABLE_CRASH_DIALOG=1
 export GNOME_DISABLE_CRASH_DIALOG
 
+##
+## Disable the SLICE allocator (rhbz#1014858)
+##
+export G_SLICE=always-malloc
+
 # OK, here's where all the real work gets done
 
 
diff --git a/SOURCES/mozilla-1097550-dict-fix.patch b/SOURCES/mozilla-1097550-dict-fix.patch
new file mode 100644
index 0000000..f0001f1
--- /dev/null
+++ b/SOURCES/mozilla-1097550-dict-fix.patch
@@ -0,0 +1,59 @@
+diff -up comm-esr31/mozilla/editor/composer/src/nsEditorSpellCheck.cpp.dict-fix comm-esr31/mozilla/editor/composer/src/nsEditorSpellCheck.cpp
+--- comm-esr31/mozilla/editor/composer/src/nsEditorSpellCheck.cpp.dict-fix	2014-11-27 23:16:41.000000000 +0100
++++ comm-esr31/mozilla/editor/composer/src/nsEditorSpellCheck.cpp	2014-12-11 13:06:02.679106492 +0100
+@@ -102,6 +102,23 @@ GetLoadContext(nsIEditor* aEditor)
+ }
+ 
+ /**
++ * Helper function for converting underscore to dash in dictionary name,
++ * ie. en_CA to en-CA. This is required for some Linux distributions which
++ * use underscore as separator in system-wide installed dictionaries.
++ * We use it for nsStyleUtil::DashMatchCompare.
++ */
++static nsString
++GetDictNameWithDash(const nsAString& aDictName)
++{
++  nsString dictNameWithDash(aDictName);
++  int32_t underScore = dictNameWithDash.FindChar('_');
++  if (underScore != -1) {
++    dictNameWithDash.Replace(underScore, 1, '-');
++  }
++  return dictNameWithDash;
++}
++
++/**
+  * Fetches the dictionary stored in content prefs and maintains state during the
+  * fetch, which is asynchronous.
+  */
+@@ -603,8 +620,8 @@ nsEditorSpellCheck::SetCurrentDictionary
+     } else {
+       langCode.Assign(aDictionary);
+     }
+-
+-    if (mPreferredLang.IsEmpty() || !nsStyleUtil::DashMatchCompare(mPreferredLang, langCode, comparator)) {
++    if (mPreferredLang.IsEmpty() ||
++        !nsStyleUtil::DashMatchCompare(GetDictNameWithDash(mPreferredLang), langCode, comparator)) {
+       // When user sets dictionary manually, we store this value associated
+       // with editor url.
+       StoreCurrentDictionary(mEditor, aDictionary);
+@@ -790,8 +807,8 @@ nsEditorSpellCheck::DictionaryFetched(Di
+ 
+       // try dictionary.spellchecker preference if it starts with langCode (and
+       // if we haven't tried it already)
+-      if (!preferedDict.IsEmpty() && !dictName.Equals(preferedDict) && 
+-          nsStyleUtil::DashMatchCompare(preferedDict, langCode, comparator)) {
++      if (!preferedDict.IsEmpty() && !dictName.Equals(preferedDict) &&
++          nsStyleUtil::DashMatchCompare(GetDictNameWithDash(preferedDict), langCode, comparator)) {
+         rv = SetCurrentDictionary(preferedDict);
+       }
+ 
+@@ -819,8 +836,7 @@ nsEditorSpellCheck::DictionaryFetched(Di
+             // We have already tried it
+             continue;
+           }
+-
+-          if (nsStyleUtil::DashMatchCompare(dictStr, langCode, comparator) &&
++          if (nsStyleUtil::DashMatchCompare(GetDictNameWithDash(dictStr), langCode, comparator) &&
+               NS_SUCCEEDED(SetCurrentDictionary(dictStr))) {
+               break;
+           }
diff --git a/SOURCES/mozilla-ppc64le-js.patch b/SOURCES/mozilla-ppc64le-js.patch
new file mode 100644
index 0000000..cfc1301
--- /dev/null
+++ b/SOURCES/mozilla-ppc64le-js.patch
@@ -0,0 +1,49 @@
+diff -up mozilla-esr31/js/src/assembler/wtf/Platform.h.ppc64le mozilla-esr31/js/src/assembler/wtf/Platform.h
+--- mozilla-esr31/js/src/assembler/wtf/Platform.h.ppc64le	2014-11-25 12:23:26.000000000 +0100
++++ mozilla-esr31/js/src/assembler/wtf/Platform.h	2014-12-19 16:51:25.579571933 +0100
+@@ -179,6 +179,8 @@
+ #define WTF_CPU_PPC64 1
+ #if !defined(__LITTLE_ENDIAN__)
+ #define WTF_CPU_BIG_ENDIAN 1
++#else
++#define WTF_CPU_PPC64LE 1
+ #endif
+ #endif
+ 
+diff -up mozilla-esr31/js/src/gc/Memory.cpp.ppc64le mozilla-esr31/js/src/gc/Memory.cpp
+--- mozilla-esr31/js/src/gc/Memory.cpp.ppc64le	2014-11-25 12:23:26.000000000 +0100
++++ mozilla-esr31/js/src/gc/Memory.cpp	2014-12-19 16:51:25.579571933 +0100
+@@ -303,6 +303,9 @@ gc::MarkPagesUnused(JSRuntime *rt, void
+ bool
+ gc::MarkPagesInUse(JSRuntime *rt, void *p, size_t size)
+ {
++    if (!DecommitEnabled(rt))
++        return false;
++
+     JS_ASSERT(uintptr_t(p) % rt->gcSystemPageSize == 0);
+     return true;
+ }
+diff -up mozilla-esr31/js/src/yarr/BumpPointerAllocator.h.ppc64le mozilla-esr31/js/src/yarr/BumpPointerAllocator.h
+--- mozilla-esr31/js/src/yarr/BumpPointerAllocator.h.ppc64le	2014-11-25 12:23:30.000000000 +0100
++++ mozilla-esr31/js/src/yarr/BumpPointerAllocator.h	2014-12-19 16:51:25.579571933 +0100
+@@ -38,6 +38,8 @@ namespace WTF {
+ #define MINIMUM_BUMP_POOL_SIZE 0x2000
+ #elif WTF_CPU_IA64
+ #define MINIMUM_BUMP_POOL_SIZE 0x4000
++#elif WTF_CPU_PPC64LE
++#define MINIMUM_BUMP_POOL_SIZE 0x10000
+ #else
+ #define MINIMUM_BUMP_POOL_SIZE 0x1000
+ #endif
+diff -up mozilla-esr31/memory/mozjemalloc/jemalloc.c.ppc64le mozilla-esr31/memory/mozjemalloc/jemalloc.c
+--- mozilla-esr31/memory/mozjemalloc/jemalloc.c.ppc64le	2014-12-19 16:51:25.580571935 +0100
++++ mozilla-esr31/memory/mozjemalloc/jemalloc.c	2014-12-19 16:52:11.754626429 +0100
+@@ -596,7 +596,7 @@ static const bool isthreaded = true;
+ #define	RUN_MAX_OVRHD_RELAX	0x00001800U
+ 
+ /* Put a cap on small object run size.  This overrides RUN_MAX_OVRHD. */
+-#define	RUN_MAX_SMALL_2POW	15
++#define	RUN_MAX_SMALL_2POW	16
+ #define	RUN_MAX_SMALL		(1U << RUN_MAX_SMALL_2POW)
+ 
+ /*
diff --git a/SOURCES/rhbz-1014858.patch b/SOURCES/rhbz-1014858.patch
new file mode 100644
index 0000000..c953b33
--- /dev/null
+++ b/SOURCES/rhbz-1014858.patch
@@ -0,0 +1,16 @@
+diff -up mozilla-release/toolkit/xre/nsAppRunner.cpp.old mozilla-release/toolkit/xre/nsAppRunner.cpp
+--- mozilla-release/toolkit/xre/nsAppRunner.cpp.old	2014-11-26 03:17:40.000000000 +0100
++++ mozilla-release/toolkit/xre/nsAppRunner.cpp	2015-01-05 14:23:05.977933308 +0100
+@@ -4168,10 +4168,8 @@ XREMain::XRE_main(int argc, char* argv[]
+ 
+ #if defined(MOZ_WIDGET_GTK)
+ #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.
+-  g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, 1);
++  // rhbz#1014858 - enable slice allocator for child processes
++  unsetenv("G_SLICE");
+ #endif
+   g_thread_init(nullptr);
+ #endif
diff --git a/SPECS/firefox.spec b/SPECS/firefox.spec
index 49aaa0b..df293fe 100644
--- a/SPECS/firefox.spec
+++ b/SPECS/firefox.spec
@@ -55,19 +55,19 @@
 
 Summary:        Mozilla Firefox Web browser
 Name:           firefox
-Version:        31.3.0
-Release:        3%{?prever}%{?dist}
+Version:        31.4.0
+Release:        1%{?prever}%{?dist}
 URL:            http://www.mozilla.org/projects/firefox/
 License:        MPLv1.1 or GPLv2+ or LGPLv2+
 Group:          Applications/Internet
 # From ftp://ftp.mozilla.org/pub/firefox/releases/%{version}%{?pretag}/source
 Source0:        firefox-%{version}%{?prever}%{?ext_version}.source.tar.bz2
 %if %{build_langpacks}
-Source1:        firefox-langpacks-%{version}%{?ext_version}-20141126.tar.bz2
+Source1:        firefox-langpacks-%{version}%{?ext_version}-20150106.tar.bz2
 %endif
 Source10:       firefox-mozconfig
 Source11:       firefox-mozconfig-branded
-Source12:       firefox-centos-default-prefs.js
+Source12:       firefox-redhat-default-prefs.js
 Source20:       firefox.desktop
 Source21:       firefox.sh.in
 Source23:       firefox.1
@@ -86,9 +86,12 @@ Patch13:        rhbz-966424.patch
 Patch14:        remove-ogg.patch
 Patch15:        disable-webm.patch
 Patch16:        firefox-enable-plugins.patch
+Patch17:        mozilla-ppc64le-js.patch
+Patch18:        rhbz-1014858.patch
 
 # Upstream patches
 Patch200:       firefox-duckduckgo.patch
+Patch201:       mozilla-1097550-dict-fix.patch
 
 %if %{official_branding}
 # Required by Mozilla Corporation
@@ -199,9 +202,14 @@ cd %{tarballdir}
 %patch15 -p1 -b .webm
 %endif
 %patch16 -p2 -b .plugins
+%ifarch ppc64 ppc64le
+%patch17 -p1 -b .ppc64le
+%endif
+%patch18 -p1 -b .rhbz-1014858
 
 # For branding specific patches.
 %patch200 -p1 -b .duckduckgo
+%patch201 -p2 -b .dict-fix
 
 # Upstream patches
 
@@ -281,7 +289,6 @@ echo "ac_add_options --enable-jemalloc" >> .mozconfig
 %if %{?debug_build}
 echo "ac_add_options --enable-debug" >> .mozconfig
 echo "ac_add_options --disable-optimize" >> .mozconfig
-echo "ac_add_options --enable-dtrace" >> .mozconfig
 %else
 echo "ac_add_options --disable-debug" >> .mozconfig
 echo "ac_add_options --enable-optimize" >> .mozconfig
@@ -516,8 +523,16 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 #---------------------------------------------------------------------
 
 %changelog
-* Tue Dec 02 2014 CentOS Sources <bugs@centos.org> - 31.3.0-3.el7.centos
-- CentOS default prefs
+* Tue Jan  6 2015 Jan Horak <jhorak@redhat.com> - 31.4.0-1
+- Update to 31.4.0 ESR
+
+* Mon Jan 5 2015 Martin Stransky <stransky@redhat.com> - 31.3.0-6
+- Fixed Bug 1140385 - [HP HPS 7.1 bug] assertion
+  "sys_page_size == 0" when starting firefox
+
+* Fri Dec 19 2014 Martin Stransky <stransky@redhat.com> - 31.3.0-5
+- Fixed problems with dictionary (mozbz#1097550)
+- JS JIT fixes for ppc64le
 
 * Sat Nov 29 2014 Martin Stransky <stransky@redhat.com> - 31.3.0-3
 - Fixed geolocation key location