Merge branch 'master' into f26

This commit is contained in:
Martin Stransky 2018-01-23 20:26:18 +01:00
commit 25470993af
8 changed files with 139 additions and 584 deletions

2
.gitignore vendored
View File

@ -274,3 +274,5 @@ firefox-3.6.4.source.tar.bz2
/firefox-langpacks-57.0.3-20180102.tar.xz /firefox-langpacks-57.0.3-20180102.tar.xz
/firefox-57.0.4.source.tar.xz /firefox-57.0.4.source.tar.xz
/firefox-langpacks-57.0.4-20180104.tar.xz /firefox-langpacks-57.0.4-20180104.tar.xz
/firefox-58.0.source.tar.xz
/firefox-langpacks-58.0-20180123.tar.xz

View File

@ -0,0 +1,14 @@
diff -up firefox-58.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium.old firefox-58.0/media/libyuv/libyuv/tools_libyuv/autoroller/unittests/testdata/DEPS.chromium
diff -up firefox-58.0/media/webrtc/trunk/Makefile.old firefox-58.0/media/webrtc/trunk/Makefile
diff -up firefox-58.0/old-configure.in.old firefox-58.0/old-configure.in
--- firefox-58.0/old-configure.in.old 2018-01-23 14:49:51.771309172 +0100
+++ firefox-58.0/old-configure.in 2018-01-23 14:50:04.091265876 +0100
@@ -1915,7 +1915,7 @@ MOZ_ARG_WITH_BOOL(system-nss,
_USE_SYSTEM_NSS=1 )
if test -n "$_USE_SYSTEM_NSS"; then
- AM_PATH_NSS(3.34.1, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
+ AM_PATH_NSS(3.34.0, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
fi
if test -n "$MOZ_SYSTEM_NSS"; then

View File

@ -0,0 +1,52 @@
diff --git a/security/certverifier/NSSCertDBTrustDomain.cpp b/security/certverifier/NSSCertDBTrustDomain.cpp
--- a/security/certverifier/NSSCertDBTrustDomain.cpp
+++ b/security/certverifier/NSSCertDBTrustDomain.cpp
@@ -1059,26 +1059,17 @@ InitializeNSS(const nsACString& dir, boo
// "/usr/lib/nss/libnssckbi.so".
uint32_t flags = NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE;
if (readOnly) {
flags |= NSS_INIT_READONLY;
}
if (!loadPKCS11Modules) {
flags |= NSS_INIT_NOMODDB;
}
- // At the moment, sqldb does not work with non-ASCII file paths on Windows.
- bool useSQLDB = Preferences::GetBool("security.use_sqldb", false) &&
- (NS_IsNativeUTF8() || NS_IsAscii(PromiseFlatCString(dir).get()));
nsAutoCString dbTypeAndDirectory;
- // Don't change any behavior if the user has specified an alternative database
- // location with MOZPSM_NSSDBDIR_OVERRIDE.
- const char* dbDirOverride = getenv("MOZPSM_NSSDBDIR_OVERRIDE");
- if (useSQLDB && (!dbDirOverride || strlen(dbDirOverride) == 0)) {
- dbTypeAndDirectory.Append("sql:");
- }
dbTypeAndDirectory.Append(dir);
MOZ_LOG(gCertVerifierLog, LogLevel::Debug,
("InitializeNSS(%s, %d, %d)", dbTypeAndDirectory.get(), readOnly,
loadPKCS11Modules));
SECStatus srv = NSS_Initialize(dbTypeAndDirectory.get(), "", "",
SECMOD_DB, flags);
if (srv != SECSuccess) {
return srv;
diff --git a/security/manager/ssl/security-prefs.js b/security/manager/ssl/security-prefs.js
--- a/security/manager/ssl/security-prefs.js
+++ b/security/manager/ssl/security-prefs.js
@@ -39,17 +39,17 @@ pref("security.ask_for_password",
pref("security.password_lifetime", 30);
// If true, use the modern sqlite-backed certificate and key databases in NSS.
// If false, use the default format. Currently the default in NSS is the old
// BerkeleyDB format, but this will change in bug 1377940.
// Changing this requires a restart to take effect.
// Note that the environment variable MOZPSM_NSSDBDIR_OVERRIDE can override both
// the behavior of this preference and the NSS default.
-pref("security.use_sqldb", true);
+pref("security.use_sqldb", false);
// The supported values of this pref are:
// 0: disable detecting Family Safety mode and importing the root
// 1: only attempt to detect Family Safety mode (don't import the root)
// 2: detect Family Safety mode and import the root
// (This is only relevant to Windows 8.1)
pref("security.family_safety.mode", 2);

View File

@ -94,13 +94,13 @@
Summary: Mozilla Firefox Web browser Summary: Mozilla Firefox Web browser
Name: firefox Name: firefox
Version: 57.0.4 Version: 58.0
Release: 2%{?pre_tag}%{?dist} Release: 1%{?pre_tag}%{?dist}
URL: https://www.mozilla.org/firefox/ URL: https://www.mozilla.org/firefox/
License: MPLv1.1 or GPLv2+ or LGPLv2+ License: MPLv1.1 or GPLv2+ or LGPLv2+
Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz
%if %{build_langpacks} %if %{build_langpacks}
Source1: firefox-langpacks-%{version}%{?pre_version}-20180104.tar.xz Source1: firefox-langpacks-%{version}%{?pre_version}-20180123.tar.xz
%endif %endif
Source10: firefox-mozconfig Source10: firefox-mozconfig
Source12: firefox-redhat-default-prefs.js Source12: firefox-redhat-default-prefs.js
@ -141,6 +141,8 @@ Patch225: mozilla-1005640-accept-lang.patch
#ARM run-time patch #ARM run-time patch
Patch226: rhbz-1354671.patch Patch226: rhbz-1354671.patch
Patch229: firefox-nss-version.patch Patch229: firefox-nss-version.patch
Patch230: firefox-fedora-rhbz-1537287-v2.patch
Patch231: build-with-nss-3.34.0.patch
# Upstream patches # Upstream patches
Patch402: mozilla-1196777.patch Patch402: mozilla-1196777.patch
@ -152,9 +154,6 @@ Patch412: mozilla-1337988.patch
Patch413: mozilla-1353817.patch Patch413: mozilla-1353817.patch
Patch416: mozilla-1399611.patch Patch416: mozilla-1399611.patch
# Better compatibility with NSS sql database format, rhbz#1496563
Patch481: sqlcompat-ff57-1-backport-730495
# Debian patches # Debian patches
Patch500: mozilla-440908.patch Patch500: mozilla-440908.patch
@ -300,10 +299,11 @@ This package contains results of tests executed during build.
%endif %endif
%patch29 -p1 -b .big-endian %patch29 -p1 -b .big-endian
%patch31 -p1 -b .ppc64-s390x-curl %patch31 -p1 -b .ppc64-s390x-curl
%patch32 -p1 -b .rust-ppc64le # Second arch patches - do we still need them?
%ifarch ppc ppc64 ppc64le #%patch32 -p1 -b .rust-ppc64le
%patch35 -p1 -b .ppc-jit #%ifarch ppc ppc64 ppc64le
%endif #%patch35 -p1 -b .ppc-jit
#%endif
%patch37 -p1 -b .jit-atomic-lucky %patch37 -p1 -b .jit-atomic-lucky
%patch3 -p1 -b .arm %patch3 -p1 -b .arm
@ -318,25 +318,29 @@ This package contains results of tests executed during build.
%ifarch aarch64 %ifarch aarch64
%patch226 -p1 -b .1354671 %patch226 -p1 -b .1354671
%endif %endif
%if 0%{?fedora} < 28
%patch230 -p1 -b .rhbz-1537287
%endif
%patch231 -p1
%patch402 -p1 -b .1196777 %patch402 -p1 -b .1196777
%patch406 -p1 -b .256180 %patch406 -p1 -b .256180
%ifarch %{arm} # Does not apply
%if 0%{?fedora} < 26 #%ifarch %{arm}
#%if 0%{?fedora} < 26
# Workaround for mozbz#1337988 # Workaround for mozbz#1337988
%patch412 -p1 -b .1337988 #%patch412 -p1 -b .1337988
%endif #%endif
%endif #%endif
%patch413 -p1 -b .1353817 %patch413 -p1 -b .1353817
%patch416 -p1 -b .1399611 # CSD - Disabled now
#%patch416 -p1 -b .1399611
%if 0%{?fedora} > 27
%patch481 -p1 -b .sqlcompat-1
%endif
# Debian extension patch # Debian extension patch
%patch500 -p1 -b .440908 # Disabled due to new pref module, see
# https://bugzilla.mozilla.org/show_bug.cgi?id=440908
#%patch500 -p1 -b .440908
# Patch for big endian platforms only # Patch for big endian platforms only
%if 0%{?big_endian} %if 0%{?big_endian}
@ -534,7 +538,11 @@ MOZ_SMP_FLAGS=-j1
[ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8 [ "$RPM_BUILD_NCPUS" -ge 8 ] && MOZ_SMP_FLAGS=-j8
%endif %endif
make -f client.mk build STRIP="/bin/true" MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" MOZ_SERVICES_SYNC="1" #make -f client.mk build STRIP="/bin/true" MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS" MOZ_SERVICES_SYNC="1"
export MOZ_MAKE_FLAGS="$MOZ_SMP_FLAGS"
export MOZ_SERVICES_SYNC="1"
export STRIP=/bin/true
./mach build
# create debuginfo for crash-stats.mozilla.com # create debuginfo for crash-stats.mozilla.com
%if %{enable_mozilla_crashreporter} %if %{enable_mozilla_crashreporter}
@ -816,7 +824,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{mozappdir}/browser/omni.ja %{mozappdir}/browser/omni.ja
%{mozappdir}/browser/icons %{mozappdir}/browser/icons
%{mozappdir}/chrome.manifest %{mozappdir}/chrome.manifest
%{mozappdir}/run-mozilla.sh #%{mozappdir}/run-mozilla.sh
%{mozappdir}/application.ini %{mozappdir}/application.ini
%{mozappdir}/pingsender %{mozappdir}/pingsender
%exclude %{mozappdir}/removed-files %exclude %{mozappdir}/removed-files
@ -857,6 +865,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#--------------------------------------------------------------------- #---------------------------------------------------------------------
%changelog %changelog
* Tue Jan 23 2018 Martin Stransky <stransky@redhat.com> - 58.0-1
- Update to 58.0
* Tue Jan 9 2018 Martin Stransky <stransky@redhat.com> - 57.0.4-2 * Tue Jan 9 2018 Martin Stransky <stransky@redhat.com> - 57.0.4-2
- Try to disable rust debuginfo on arm to have arm builds again (rhbz#1523912) - Try to disable rust debuginfo on arm to have arm builds again (rhbz#1523912)

View File

@ -1,7 +1,7 @@
diff -up firefox-56.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-56.0/extensions/pref/autoconfig/src/nsReadConfig.cpp diff -up firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp
--- firefox-56.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2017-09-25 10:28:35.413675532 +0200 --- firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 2018-01-11 21:17:03.000000000 +0100
+++ firefox-56.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2017-09-25 10:31:06.394196960 +0200 +++ firefox-58.0/extensions/pref/autoconfig/src/nsReadConfig.cpp 2018-01-23 13:59:45.446495820 +0100
@@ -243,9 +243,20 @@ nsresult nsReadConfig::openAndEvaluateJS @@ -239,9 +239,20 @@ nsresult nsReadConfig::openAndEvaluateJS
return rv; return rv;
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile); rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), jsFile);
@ -24,22 +24,22 @@ diff -up firefox-56.0/extensions/pref/autoconfig/src/nsReadConfig.cpp.1170092 fi
} else { } else {
nsAutoCString location("resource://gre/defaults/autoconfig/"); nsAutoCString location("resource://gre/defaults/autoconfig/");
location += aFileName; location += aFileName;
diff -up firefox-56.0/modules/libpref/Preferences.cpp.1170092 firefox-56.0/modules/libpref/Preferences.cpp diff -up firefox-58.0/modules/libpref/Preferences.cpp.1170092 firefox-58.0/modules/libpref/Preferences.cpp
--- firefox-56.0/modules/libpref/Preferences.cpp.1170092 2017-09-14 22:15:52.000000000 +0200 --- firefox-58.0/modules/libpref/Preferences.cpp.1170092 2018-01-23 13:59:45.447495817 +0100
+++ firefox-56.0/modules/libpref/Preferences.cpp 2017-09-25 10:28:35.413675532 +0200 +++ firefox-58.0/modules/libpref/Preferences.cpp 2018-01-23 14:02:51.456987774 +0100
@@ -1514,6 +1514,8 @@ pref_InitInitialObjects() @@ -4402,6 +4402,8 @@ pref_InitInitialObjects()
// - jar:$gre/omni.jar!/defaults/preferences/*.js //
// Thus, in omni.jar case, we always load app-specific default preferences // Thus, in the omni.jar case, we always load app-specific default
// from omni.jar, whether or not $app == $gre. // preferences from omni.jar, whether or not `$app == $gre`.
+ // At very end load configuration from system config location: + // At very end load configuration from system config location:
+ // - /etc/firefox/pref/*.js + // - /etc/firefox/pref/*.js
nsZipFind *findPtr; nsresult rv;
nsAutoPtr<nsZipFind> find; nsZipFind* findPtr;
diff -up firefox-56.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-56.0/toolkit/xre/nsXREDirProvider.cpp diff -up firefox-58.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-58.0/toolkit/xre/nsXREDirProvider.cpp
--- firefox-56.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2017-09-14 22:16:02.000000000 +0200 --- firefox-58.0/toolkit/xre/nsXREDirProvider.cpp.1170092 2018-01-11 21:17:06.000000000 +0100
+++ firefox-56.0/toolkit/xre/nsXREDirProvider.cpp 2017-09-25 10:28:35.414675529 +0200 +++ firefox-58.0/toolkit/xre/nsXREDirProvider.cpp 2018-01-23 13:59:45.447495817 +0100
@@ -58,6 +58,7 @@ @@ -59,6 +59,7 @@
#endif #endif
#ifdef XP_UNIX #ifdef XP_UNIX
#include <ctype.h> #include <ctype.h>
@ -47,7 +47,7 @@ diff -up firefox-56.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-56.0/tool
#endif #endif
#ifdef XP_IOS #ifdef XP_IOS
#include "UIKitDirProvider.h" #include "UIKitDirProvider.h"
@@ -570,6 +571,20 @@ nsXREDirProvider::GetFile(const char* aP @@ -554,6 +555,20 @@ nsXREDirProvider::GetFile(const char* aP
} }
} }
} }
@ -68,7 +68,7 @@ diff -up firefox-56.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-56.0/tool
if (NS_FAILED(rv) || !file) if (NS_FAILED(rv) || !file)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@@ -935,6 +950,14 @@ nsXREDirProvider::GetFilesInternal(const @@ -887,6 +902,14 @@ nsXREDirProvider::GetFilesInternal(const
LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories); LoadDirIntoArray(mXULAppDir, kAppendPrefDir, directories);
LoadDirsIntoArray(mAppBundleDirectories, LoadDirsIntoArray(mAppBundleDirectories,
kAppendPrefDir, directories); kAppendPrefDir, directories);
@ -83,12 +83,12 @@ diff -up firefox-56.0/toolkit/xre/nsXREDirProvider.cpp.1170092 firefox-56.0/tool
rv = NS_NewArrayEnumerator(aResult, directories); rv = NS_NewArrayEnumerator(aResult, directories);
} }
diff -up firefox-56.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-56.0/xpcom/io/nsAppDirectoryServiceDefs.h diff -up firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h
--- firefox-56.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2017-09-14 22:16:02.000000000 +0200 --- firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h.1170092 2018-01-23 13:59:45.447495817 +0100
+++ firefox-56.0/xpcom/io/nsAppDirectoryServiceDefs.h 2017-09-25 10:28:35.414675529 +0200 +++ firefox-58.0/xpcom/io/nsAppDirectoryServiceDefs.h 2018-01-23 14:02:02.871120476 +0100
@@ -62,6 +62,7 @@ @@ -59,6 +59,7 @@
#define NS_APP_PREFS_50_FILE "PrefF"
#define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL" #define NS_APP_PREFS_DEFAULTS_DIR_LIST "PrefDL"
#define NS_EXT_PREFS_DEFAULTS_DIR_LIST "ExtPrefDL"
#define NS_APP_PREFS_OVERRIDE_DIR "PrefDOverride" // Directory for per-profile defaults #define NS_APP_PREFS_OVERRIDE_DIR "PrefDOverride" // Directory for per-profile defaults
+#define NS_APP_PREFS_SYSTEM_CONFIG_DIR "PrefSysConf" // Directory with system-wide configuration +#define NS_APP_PREFS_SYSTEM_CONFIG_DIR "PrefSysConf" // Directory with system-wide configuration

View File

@ -1,2 +1,2 @@
SHA512 (firefox-57.0.4.source.tar.xz) = 58846037aebbf14b85e6b3a46dbe617c780c6916e437ea4ee32a2502a6b55e3689921a0be28b920dedf2f966195df04ac8e45411caeb2601a168ec08b4827cf0 SHA512 (firefox-58.0.source.tar.xz) = 17a2c520973c68c5dd130bcb27407b1c20b03f74c97aeb486e86d422ab5c012e549787ae53275d6840b9d324f261ae282b98f61764ee5e0a6df1cc3e3c9e2632
SHA512 (firefox-langpacks-57.0.4-20180104.tar.xz) = 361b652a0089c4437e8e135f6499b93b875e6c4b6d24118e07e3a8c287f1f045855fb8de36af57baf8ff84f319a0eeba285f50a3ced27bf6c20093ed95f303d0 SHA512 (firefox-langpacks-58.0-20180123.tar.xz) = 6781bf0a5d68bdaa513f85404b8d9111bef8d2aa6d12e1b5fa8db2e4f44fce2d2642b9b5a70a6fc92f0cb96167f6895e17505bdc212aea987240cfb018f340f5

View File

@ -1,524 +0,0 @@
# HG changeset patch
# Parent 5de7eafc3ceca2196d84d5b6106e01046efda034
diff --git a/security/manager/ssl/nsNSSComponent.cpp b/security/manager/ssl/nsNSSComponent.cpp
--- a/security/manager/ssl/nsNSSComponent.cpp
+++ b/security/manager/ssl/nsNSSComponent.cpp
@@ -13,7 +13,6 @@
#include "SharedSSLState.h"
#include "cert.h"
#include "certdb.h"
-#include "mozStorageCID.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/Casting.h"
@@ -2038,14 +2037,6 @@ nsNSSComponent::Init()
return NS_ERROR_NOT_AVAILABLE;
}
- // To avoid a sqlite3_config race in NSS init, as a workaround for
- // bug 730495, we require the storage service to get initialized first.
- nsCOMPtr<nsISupports> storageService =
- do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID);
- if (!storageService) {
- return NS_ERROR_NOT_AVAILABLE;
- }
-
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Beginning NSS initialization\n"));
nsresult rv = InitializePIPNSSBundle();
diff --git a/storage/TelemetryVFS.cpp b/storage/TelemetryVFS.cpp
--- a/storage/TelemetryVFS.cpp
+++ b/storage/TelemetryVFS.cpp
@@ -834,6 +834,11 @@ xNextSystemCall(sqlite3_vfs *vfs, const
namespace mozilla {
namespace storage {
+const char *GetVFSName()
+{
+ return "telemetry-vfs";
+}
+
sqlite3_vfs* ConstructTelemetryVFS()
{
#if defined(XP_WIN)
@@ -867,7 +872,7 @@ sqlite3_vfs* ConstructTelemetryVFS()
MOZ_ASSERT(vfs->iVersion <= LAST_KNOWN_VFS_VERSION);
tvfs->szOsFile = sizeof(telemetry_file) - sizeof(sqlite3_file) + vfs->szOsFile;
tvfs->mxPathname = vfs->mxPathname;
- tvfs->zName = "telemetry-vfs";
+ tvfs->zName = GetVFSName();
tvfs->pAppData = vfs;
tvfs->xOpen = xOpen;
tvfs->xDelete = xDelete;
diff --git a/storage/mozStorageConnection.cpp b/storage/mozStorageConnection.cpp
--- a/storage/mozStorageConnection.cpp
+++ b/storage/mozStorageConnection.cpp
@@ -73,6 +73,8 @@ namespace storage {
using mozilla::dom::quota::QuotaObject;
+const char *GetVFSName();
+
namespace {
int
@@ -627,7 +629,7 @@ Connection::initialize()
AUTO_PROFILER_LABEL("Connection::initialize", STORAGE);
// in memory database requested, sqlite uses a magic file name
- int srv = ::sqlite3_open_v2(":memory:", &mDBConn, mFlags, nullptr);
+ int srv = ::sqlite3_open_v2(":memory:", &mDBConn, mFlags, GetVFSName());
if (srv != SQLITE_OK) {
mDBConn = nullptr;
return convertResultCode(srv);
@@ -660,7 +662,7 @@ Connection::initialize(nsIFile *aDatabas
#else
static const char* sIgnoreLockingVFS = "unix-none";
#endif
- const char* vfs = mIgnoreLockingMode ? sIgnoreLockingVFS : nullptr;
+ const char* vfs = mIgnoreLockingMode ? sIgnoreLockingVFS : GetVFSName();
int srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn,
mFlags, vfs);
@@ -694,7 +696,7 @@ Connection::initialize(nsIFileURL *aFile
rv = aFileURL->GetSpec(spec);
NS_ENSURE_SUCCESS(rv, rv);
- int srv = ::sqlite3_open_v2(spec.get(), &mDBConn, mFlags, nullptr);
+ int srv = ::sqlite3_open_v2(spec.get(), &mDBConn, mFlags, GetVFSName());
if (srv != SQLITE_OK) {
mDBConn = nullptr;
return convertResultCode(srv);
diff --git a/storage/mozStorageService.cpp b/storage/mozStorageService.cpp
--- a/storage/mozStorageService.cpp
+++ b/storage/mozStorageService.cpp
@@ -24,6 +24,7 @@
#include "mozIStoragePendingStatement.h"
#include "sqlite3.h"
+#include "mozilla/AutoSQLiteLifetime.h"
#ifdef SQLITE_OS_WIN
// "windows.h" was included and it can #define lots of things we care about...
@@ -32,13 +33,6 @@
#include "nsIPromptService.h"
-#ifdef MOZ_STORAGE_MEMORY
-# include "mozmemory.h"
-# ifdef MOZ_DMD
-# include "DMD.h"
-# endif
-#endif
-
////////////////////////////////////////////////////////////////////////////////
//// Defines
@@ -282,12 +276,6 @@ Service::~Service()
if (rc != SQLITE_OK)
NS_WARNING("Failed to unregister sqlite vfs wrapper.");
- // 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_shutdown();
- if (rc != SQLITE_OK)
- NS_WARNING("sqlite3 did not shutdown cleanly.");
-
shutdown(); // To release sXPConnect.
gService = nullptr;
@@ -400,121 +388,7 @@ Service::shutdown()
}
sqlite3_vfs *ConstructTelemetryVFS();
-
-#ifdef MOZ_STORAGE_MEMORY
-
-namespace {
-
-// By default, SQLite tracks the size of all its heap blocks by adding an extra
-// 8 bytes at the start of the block to hold the size. Unfortunately, this
-// causes a lot of 2^N-sized allocations to be rounded up by jemalloc
-// allocator, wasting memory. For example, a request for 1024 bytes has 8
-// bytes added, becoming a request for 1032 bytes, and jemalloc rounds this up
-// to 2048 bytes, wasting 1012 bytes. (See bug 676189 for more details.)
-//
-// So we register jemalloc as the malloc implementation, which avoids this
-// 8-byte overhead, and thus a lot of waste. This requires us to provide a
-// function, sqliteMemRoundup(), which computes the actual size that will be
-// allocated for a given request. SQLite uses this function before all
-// allocations, and may be able to use any excess bytes caused by the rounding.
-//
-// Note: the wrappers for malloc, realloc and moz_malloc_usable_size are
-// necessary because the sqlite_mem_methods type signatures differ slightly
-// from the standard ones -- they use int instead of size_t. But we don't need
-// a wrapper for free.
-
-#ifdef MOZ_DMD
-
-// sqlite does its own memory accounting, and we use its numbers in our memory
-// reporters. But we don't want sqlite's heap blocks to show up in DMD's
-// output as unreported, so we mark them as reported when they're allocated and
-// mark them as unreported when they are freed.
-//
-// In other words, we are marking all sqlite heap blocks as reported even
-// though we're not reporting them ourselves. Instead we're trusting that
-// sqlite is fully and correctly accounting for all of its heap blocks via its
-// own memory accounting. Well, we don't have to trust it entirely, because
-// it's easy to keep track (while doing this DMD-specific marking) of exactly
-// how much memory SQLite is using. And we can compare that against what
-// SQLite reports it is using.
-
-MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(SqliteMallocSizeOfOnAlloc)
-MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(SqliteMallocSizeOfOnFree)
-
-#endif
-
-static void *sqliteMemMalloc(int n)
-{
- void* p = ::malloc(n);
-#ifdef MOZ_DMD
- gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(p);
-#endif
- return p;
-}
-
-static void sqliteMemFree(void *p)
-{
-#ifdef MOZ_DMD
- gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p);
-#endif
- ::free(p);
-}
-
-static void *sqliteMemRealloc(void *p, int n)
-{
-#ifdef MOZ_DMD
- gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p);
- void *pnew = ::realloc(p, n);
- if (pnew) {
- gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(pnew);
- } else {
- // realloc failed; undo the SqliteMallocSizeOfOnFree from above
- gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(p);
- }
- return pnew;
-#else
- return ::realloc(p, n);
-#endif
-}
-
-static int sqliteMemSize(void *p)
-{
- return ::moz_malloc_usable_size(p);
-}
-
-static int sqliteMemRoundup(int n)
-{
- n = malloc_good_size(n);
-
- // jemalloc can return blocks of size 2 and 4, but SQLite requires that all
- // allocations be 8-aligned. So we round up sub-8 requests to 8. This
- // wastes a small amount of memory but is obviously safe.
- return n <= 8 ? 8 : n;
-}
-
-static int sqliteMemInit(void *p)
-{
- return 0;
-}
-
-static void sqliteMemShutdown(void *p)
-{
-}
-
-const sqlite3_mem_methods memMethods = {
- &sqliteMemMalloc,
- &sqliteMemFree,
- &sqliteMemRealloc,
- &sqliteMemSize,
- &sqliteMemRoundup,
- &sqliteMemInit,
- &sqliteMemShutdown,
- nullptr
-};
-
-} // namespace
-
-#endif // MOZ_STORAGE_MEMORY
+const char *GetVFSName();
static const char* sObserverTopics[] = {
"memory-pressure",
@@ -527,28 +401,13 @@ Service::initialize()
{
MOZ_ASSERT(NS_IsMainThread(), "Must be initialized on the main thread");
- int rc;
-
-#ifdef MOZ_STORAGE_MEMORY
- rc = ::sqlite3_config(SQLITE_CONFIG_MALLOC, &memMethods);
- if (rc != SQLITE_OK)
- return convertResultCode(rc);
-#endif
-
- // TODO (bug 1191405): do not preallocate the connections caches until we
- // have figured the impact on our consumers and memory.
- sqlite3_config(SQLITE_CONFIG_PAGECACHE, NULL, 0, 0);
-
- // Explicitly initialize sqlite3. Although this is implicitly called by
- // various sqlite3 functions (and the sqlite3_open calls in our case),
- // the documentation suggests calling this directly. So we do.
- rc = ::sqlite3_initialize();
+ int rc = AutoSQLiteLifetime::getInitResult();
if (rc != SQLITE_OK)
return convertResultCode(rc);
mSqliteVFS = ConstructTelemetryVFS();
if (mSqliteVFS) {
- rc = sqlite3_vfs_register(mSqliteVFS, 1);
+ rc = sqlite3_vfs_register(mSqliteVFS, 0);
if (rc != SQLITE_OK)
return convertResultCode(rc);
} else {
diff --git a/toolkit/xre/Bootstrap.cpp b/toolkit/xre/Bootstrap.cpp
--- a/toolkit/xre/Bootstrap.cpp
+++ b/toolkit/xre/Bootstrap.cpp
@@ -6,11 +6,15 @@
#include "mozilla/Bootstrap.h"
#include "nsXPCOM.h"
+#include "AutoSQLiteLifetime.h"
+
namespace mozilla {
class BootstrapImpl final : public Bootstrap
{
protected:
+ AutoSQLiteLifetime mSQLLT;
+
virtual void Dispose() override
{
delete this;
diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build
--- a/toolkit/xre/moz.build
+++ b/toolkit/xre/moz.build
@@ -30,7 +30,7 @@ EXPORTS += [
'nsIAppStartupNotifier.h',
]
-EXPORTS.mozilla += ['Bootstrap.h']
+EXPORTS.mozilla += ['AutoSQLiteLifetime.h', 'Bootstrap.h']
if CONFIG['MOZ_INSTRUMENT_EVENT_LOOP']:
EXPORTS += ['EventTracer.h']
@@ -91,6 +91,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'andr
]
UNIFIED_SOURCES += [
+ 'AutoSQLiteLifetime.cpp',
'Bootstrap.cpp',
'CreateAppData.cpp',
'nsAppStartupNotifier.cpp',
diff --git a/toolkit/xre/AutoSQLiteLifetime.cpp b/toolkit/xre/AutoSQLiteLifetime.cpp
new file mode 100644
--- /dev/null
+++ b/toolkit/xre/AutoSQLiteLifetime.cpp
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsDebug.h"
+#include "AutoSQLiteLifetime.h"
+#include "sqlite3.h"
+
+#ifdef MOZ_STORAGE_MEMORY
+# include "mozmemory.h"
+# ifdef MOZ_DMD
+# include "DMD.h"
+# endif
+
+namespace {
+
+// By default, SQLite tracks the size of all its heap blocks by adding an extra
+// 8 bytes at the start of the block to hold the size. Unfortunately, this
+// causes a lot of 2^N-sized allocations to be rounded up by jemalloc
+// allocator, wasting memory. For example, a request for 1024 bytes has 8
+// bytes added, becoming a request for 1032 bytes, and jemalloc rounds this up
+// to 2048 bytes, wasting 1012 bytes. (See bug 676189 for more details.)
+//
+// So we register jemalloc as the malloc implementation, which avoids this
+// 8-byte overhead, and thus a lot of waste. This requires us to provide a
+// function, sqliteMemRoundup(), which computes the actual size that will be
+// allocated for a given request. SQLite uses this function before all
+// allocations, and may be able to use any excess bytes caused by the rounding.
+//
+// Note: the wrappers for malloc, realloc and moz_malloc_usable_size are
+// necessary because the sqlite_mem_methods type signatures differ slightly
+// from the standard ones -- they use int instead of size_t. But we don't need
+// a wrapper for free.
+
+#ifdef MOZ_DMD
+
+// sqlite does its own memory accounting, and we use its numbers in our memory
+// reporters. But we don't want sqlite's heap blocks to show up in DMD's
+// output as unreported, so we mark them as reported when they're allocated and
+// mark them as unreported when they are freed.
+//
+// In other words, we are marking all sqlite heap blocks as reported even
+// though we're not reporting them ourselves. Instead we're trusting that
+// sqlite is fully and correctly accounting for all of its heap blocks via its
+// own memory accounting. Well, we don't have to trust it entirely, because
+// it's easy to keep track (while doing this DMD-specific marking) of exactly
+// how much memory SQLite is using. And we can compare that against what
+// SQLite reports it is using.
+
+MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(SqliteMallocSizeOfOnAlloc)
+MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(SqliteMallocSizeOfOnFree)
+
+#endif
+
+static void *sqliteMemMalloc(int n)
+{
+ void* p = ::malloc(n);
+#ifdef MOZ_DMD
+ gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(p);
+#endif
+ return p;
+}
+
+static void sqliteMemFree(void *p)
+{
+#ifdef MOZ_DMD
+ gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p);
+#endif
+ ::free(p);
+}
+
+static void *sqliteMemRealloc(void *p, int n)
+{
+#ifdef MOZ_DMD
+ gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p);
+ void *pnew = ::realloc(p, n);
+ if (pnew) {
+ gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(pnew);
+ } else {
+ // realloc failed; undo the SqliteMallocSizeOfOnFree from above
+ gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(p);
+ }
+ return pnew;
+#else
+ return ::realloc(p, n);
+#endif
+}
+
+static int sqliteMemSize(void *p)
+{
+ return ::moz_malloc_usable_size(p);
+}
+
+static int sqliteMemRoundup(int n)
+{
+ n = malloc_good_size(n);
+
+ // jemalloc can return blocks of size 2 and 4, but SQLite requires that all
+ // allocations be 8-aligned. So we round up sub-8 requests to 8. This
+ // wastes a small amount of memory but is obviously safe.
+ return n <= 8 ? 8 : n;
+}
+
+static int sqliteMemInit(void *p)
+{
+ return 0;
+}
+
+static void sqliteMemShutdown(void *p)
+{
+}
+
+const sqlite3_mem_methods memMethods = {
+ &sqliteMemMalloc,
+ &sqliteMemFree,
+ &sqliteMemRealloc,
+ &sqliteMemSize,
+ &sqliteMemRoundup,
+ &sqliteMemInit,
+ &sqliteMemShutdown,
+ nullptr
+};
+
+} // namespace
+
+#endif // MOZ_STORAGE_MEMORY
+
+namespace mozilla {
+
+AutoSQLiteLifetime::AutoSQLiteLifetime()
+{
+ if (++AutoSQLiteLifetime::sSingletonEnforcer != 1) {
+ NS_RUNTIMEABORT("multiple instances of AutoSQLiteLifetime constructed!");
+ }
+
+#ifdef MOZ_STORAGE_MEMORY
+ sResult = ::sqlite3_config(SQLITE_CONFIG_MALLOC, &memMethods);
+#else
+ sResult = SQLITE_OK;
+#endif
+
+ if (sResult == SQLITE_OK) {
+ // TODO (bug 1191405): do not preallocate the connections caches until we
+ // have figured the impact on our consumers and memory.
+ sqlite3_config(SQLITE_CONFIG_PAGECACHE, NULL, 0, 0);
+
+ // Explicitly initialize sqlite3. Although this is implicitly called by
+ // various sqlite3 functions (and the sqlite3_open calls in our case),
+ // the documentation suggests calling this directly. So we do.
+ sResult = ::sqlite3_initialize();
+ }
+}
+
+AutoSQLiteLifetime::~AutoSQLiteLifetime()
+{
+ // Shutdown the sqlite3 API. Warn if shutdown did not turn out okay, but
+ // there is nothing actionable we can do in that case.
+ sResult = ::sqlite3_shutdown();
+ NS_WARNING_ASSERTION(sResult == SQLITE_OK,
+ "sqlite3 did not shutdown cleanly.");
+}
+
+int AutoSQLiteLifetime::sSingletonEnforcer = 0;
+int AutoSQLiteLifetime::sResult = SQLITE_MISUSE;
+
+} // namespace mozilla
diff --git a/toolkit/xre/AutoSQLiteLifetime.h b/toolkit/xre/AutoSQLiteLifetime.h
new file mode 100644
--- /dev/null
+++ b/toolkit/xre/AutoSQLiteLifetime.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_AutoSQLiteLifetime_h
+#define mozilla_AutoSQLiteLifetime_h
+
+namespace mozilla {
+
+class AutoSQLiteLifetime final
+{
+private:
+ static int sSingletonEnforcer;
+ static int sResult;
+public:
+ AutoSQLiteLifetime();
+ ~AutoSQLiteLifetime();
+ static int getInitResult() { return AutoSQLiteLifetime::sResult; }
+};
+
+} // namespace mozilla
+
+#endif

View File

@ -1,12 +1,12 @@
diff -up firefox-57.0b5/memory/build/mozjemalloc.cpp.old firefox-57.0b5/memory/build/mozjemalloc.cpp diff -up firefox-58.0/memory/build/mozjemalloc.cpp.jemalloc-ppc firefox-58.0/memory/build/mozjemalloc.cpp
--- firefox-57.0b5/memory/build/mozjemalloc.cpp.old 2017-10-06 12:00:27.938687498 +0200 --- firefox-58.0/memory/build/mozjemalloc.cpp.jemalloc-ppc 2018-01-23 13:12:28.618164403 +0100
+++ firefox-57.0b5/memory/build/mozjemalloc.cpp 2017-10-06 12:02:45.232151309 +0200 +++ firefox-58.0/memory/build/mozjemalloc.cpp 2018-01-23 13:18:26.638212523 +0100
@@ -780,7 +780,7 @@ struct arena_t { @@ -180,7 +180,7 @@ using namespace mozilla;
* controlling the malloc behavior are defined as compile-time constants // Debug builds are opted out too, for test coverage.
* for best performance and cannot be altered at runtime. #ifndef MOZ_DEBUG
*/ #if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__) && \
-#if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__) && !defined(__aarch64__) - !defined(__aarch64__)
+#if !defined(__ia64__) && !defined(__sparc__) && !defined(__mips__) && !defined(__aarch64__) && !(defined(__powerpc__)) + !defined(__aarch64__) && !defined(__powerpc__)
#define MALLOC_STATIC_SIZES 1 #define MALLOC_STATIC_PAGESIZE 1
#endif
#endif #endif