summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwin7-7 <win7-7@users.noreply.github.com>2022-04-18 13:15:28 +0300
committerwin7-7 <win7-7@users.noreply.github.com>2022-04-18 13:15:28 +0300
commit5b84c3e982140280c00ab697d7fcad519a7a71a1 (patch)
tree85d184a9cd3747af702d75ec60c23f1d19b459da
parentd347a1e0c6f921f88ddb596379aea26bf1bf5144 (diff)
parent3abcec5d8bc1e4b420ef4b8a2e4b96433d67e2c7 (diff)
downloaduxp-5b84c3e982140280c00ab697d7fcad519a7a71a1.tar.gz
Merge branch 'master' into pr-1860
-rw-r--r--build/autoconf/compiler-opts.m49
-rw-r--r--build/moz.configure/old.configure1
-rw-r--r--build/moz.configure/toolchain.configure4
-rwxr-xr-xbuild/unix/build-gcc/build-gcc.sh2
-rw-r--r--config/external/moz.build2
-rw-r--r--dom/media/GraphDriver.cpp5
-rw-r--r--dom/media/MediaManager.cpp31
-rw-r--r--dom/media/MediaManager.h1
-rw-r--r--dom/plugins/base/npfunctions.h4
-rw-r--r--dom/plugins/base/nptypes.h19
-rw-r--r--gfx/2d/BaseRect.h1
-rw-r--r--js/src/builtin/String.js2
-rw-r--r--js/src/gc/Heap.h4
-rw-r--r--js/src/jit/IonBuilder.cpp6
-rw-r--r--js/src/jit/Safepoints.cpp6
-rw-r--r--js/src/jit/arm/Architecture-arm.h3
-rw-r--r--js/src/jit/arm/AtomicOperations-arm.h76
-rw-r--r--js/src/jit/arm/Simulator-arm.cpp2
-rw-r--r--js/src/jit/arm64/vixl/Assembler-vixl.h4
-rw-r--r--js/src/jit/arm64/vixl/MozAssembler-vixl.cpp2
-rw-r--r--js/src/jit/mips-shared/AtomicOperations-mips-shared.h76
-rw-r--r--js/src/jit/none/AtomicOperations-ppc.h76
-rw-r--r--js/src/jit/none/AtomicOperations-sparc.h76
-rw-r--r--js/src/jit/x86-shared/AtomicOperations-x86-shared.h108
-rw-r--r--js/src/old-configure.in13
-rw-r--r--js/src/wasm/WasmBaselineCompile.cpp4
-rw-r--r--layout/base/nsGenConList.cpp11
-rw-r--r--layout/base/nsGenConList.h6
-rw-r--r--layout/generic/nsFrame.cpp9
-rw-r--r--layout/reftests/flexbox/flexbox-table-flex-items-2-ref.html64
-rw-r--r--layout/reftests/flexbox/flexbox-table-flex-items-2.html73
-rw-r--r--layout/reftests/flexbox/flexbox-table-flex-items-3-ref.html66
-rw-r--r--layout/reftests/flexbox/flexbox-table-flex-items-3.html75
-rw-r--r--layout/reftests/flexbox/reftest.list2
-rw-r--r--layout/style/Declaration.cpp12
-rw-r--r--layout/style/nsCSSParser.cpp46
-rw-r--r--modules/libmar/src/mar.h2
-rw-r--r--modules/libmar/src/mar_extract.c2
-rw-r--r--modules/libmar/src/mar_read.c2
-rw-r--r--modules/xz-embedded/README.mozilla8
-rw-r--r--modules/xz-embedded/moz.build3
-rw-r--r--modules/xz-embedded/src/xz.h154
-rw-r--r--modules/xz-embedded/src/xz_config.h3
-rw-r--r--modules/xz-embedded/src/xz_crc32.c2
-rw-r--r--modules/xz-embedded/src/xz_crc64.c8
-rw-r--r--modules/xz-embedded/src/xz_dec_bcj.c4
-rw-r--r--modules/xz-embedded/src/xz_dec_lzma2.c193
-rw-r--r--modules/xz-embedded/src/xz_dec_stream.c102
-rw-r--r--modules/xz-embedded/src/xz_lzma2.h2
-rw-r--r--modules/xz-embedded/src/xz_private.h3
-rw-r--r--modules/xz-embedded/src/xz_stream.h2
-rwxr-xr-xmodules/xz-embedded/update.sh6
-rw-r--r--netwerk/base/nsURLParsers.cpp1
-rw-r--r--old-configure.in13
-rw-r--r--python/mozbuild/mozbuild/mach_commands.py19
-rw-r--r--python/pyyaml/ext/_yaml.c10
-rw-r--r--toolkit/components/downloads/moz.build2
-rw-r--r--toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd3
-rw-r--r--toolkit/modules/ResetProfile.jsm2
-rw-r--r--toolkit/mozapps/extensions/content/extensions.css17
-rw-r--r--toolkit/mozapps/extensions/content/extensions.xml8
-rw-r--r--toolkit/mozapps/extensions/internal/AddonRepository.jsm8
-rw-r--r--toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm31
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProvider.jsm36
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProviderUtils.js3
-rw-r--r--toolkit/mozapps/extensions/internal/moz.build6
-rw-r--r--toolkit/mozapps/installer/package-name.mk1
-rw-r--r--toolkit/mozapps/update/common/errors.h2
-rw-r--r--toolkit/mozapps/update/updater/archivereader.cpp92
-rw-r--r--toolkit/mozapps/update/updater/updater-common.build1
-rw-r--r--toolkit/themes/linux/mozapps/extensions/extensions.css7
-rw-r--r--toolkit/themes/linux/mozapps/extensions/stripes-compatibility.pngbin1041 -> 0 bytes
-rw-r--r--toolkit/themes/linux/mozapps/extensions/stripes-error.pngbin1979 -> 0 bytes
-rw-r--r--toolkit/themes/linux/mozapps/extensions/stripes-info-negative.pngbin2027 -> 0 bytes
-rw-r--r--toolkit/themes/linux/mozapps/extensions/stripes-info-positive.pngbin1852 -> 0 bytes
-rw-r--r--toolkit/themes/linux/mozapps/extensions/stripes-warning.pngbin2177 -> 0 bytes
-rw-r--r--toolkit/themes/linux/mozapps/jar.mn5
-rw-r--r--toolkit/themes/windows/mozapps/extensions/extensions.css7
-rw-r--r--toolkit/themes/windows/mozapps/extensions/stripes-compatibility.pngbin1041 -> 0 bytes
-rw-r--r--toolkit/themes/windows/mozapps/jar.mn1
-rw-r--r--tools/update-packaging/Makefile.in22
-rwxr-xr-xtools/update-packaging/common.sh9
-rwxr-xr-xtools/update-packaging/make_full_update.sh15
-rwxr-xr-xtools/update-packaging/make_incremental_update.sh68
-rwxr-xr-xtools/update-packaging/make_incremental_updates.py83
-rwxr-xr-xtools/update-packaging/test/catmanifest.sh4
-rwxr-xr-xtools/update-packaging/test/common.sh4
-rwxr-xr-xtools/update-packaging/test/diffmar.sh16
-rwxr-xr-xtools/update-packaging/test/make_full_update.sh6
-rwxr-xr-xtools/update-packaging/unwrap_full_update.pl51
-rw-r--r--uriloader/exthandler/nsExternalHelperAppService.cpp3
-rw-r--r--xpcom/base/nscore.h8
-rw-r--r--xpcom/glue/nsCOMPtr.h6
-rw-r--r--xpcom/string/nsTSubstring.h1
94 files changed, 1228 insertions, 740 deletions
diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4
index 077a3e6f19..2bf303eb0c 100644
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -16,7 +16,7 @@ dnl set DEVELOPER_OPTIONS early; MOZ_DEFAULT_COMPILER is usually the first non-s
DEVELOPER_OPTIONS=,
DEVELOPER_OPTIONS=1)
-dnl Default to MSVC for win32 and gcc-4.2 for darwin
+dnl Default to MSVC for win32
dnl ==============================================================
if test -z "$CROSS_COMPILE"; then
case "$target" in
@@ -176,8 +176,8 @@ if test "$GNU_CC"; then
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
fi
- CFLAGS="$CFLAGS -fno-math-errno"
- CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno"
+ CFLAGS="$CFLAGS -fno-math-errno -pipe"
+ CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-math-errno -pipe"
if test "$CPU_ARCH" = "x86" -o "$CPU_ARCH" = "x86_64"; then
CFLAGS="$CFLAGS -msse2 -mfpmath=sse"
@@ -186,7 +186,8 @@ if test "$GNU_CC"; then
if test -z "$CLANG_CC"; then
case "$CC_VERSION" in
- 4.* | 5.*)
+ 4.* | 5.* | 6.*)
+ AC_MSG_ERROR([Unsupported GCC version.])
;;
*)
# Lifetime Dead Store Elimination level 2 (default in GCC6+) breaks Gecko.
diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
index d2c03d712e..5806dcbb8b 100644
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -306,6 +306,7 @@ def old_configure_options(*options):
'--disable-browser-statusbar',
'--disable-sync',
'--disable-personas',
+ '--enable-phoenix-extensions',
# Below are configure flags used by Basilisk
'--disable-webextensions',
diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
index 056c6a9328..1f2b5ecf07 100644
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -675,9 +675,9 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
# Check the compiler version here instead of in `compiler_version` so
# that the `checking` message doesn't pretend the compiler can be used
# to then bail out one line later.
- if info.type == 'gcc' and info.version < '4.9.0':
+ if info.type == 'gcc' and info.version < '7.1.0':
raise FatalCheckError(
- 'Only GCC 4.9 or newer is supported (found version %s).'
+ 'Only GCC 7.1 or newer is supported (found version %s).'
% info.version)
# If you want to bump the version check here search for
diff --git a/build/unix/build-gcc/build-gcc.sh b/build/unix/build-gcc/build-gcc.sh
index df3bc5dfd3..2c4d7b323d 100755
--- a/build/unix/build-gcc/build-gcc.sh
+++ b/build/unix/build-gcc/build-gcc.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-gcc_version=4.8.5
+gcc_version=7.1.0
binutils_version=2.25.1
this_path=$(readlink -f $(dirname $0))
make_flags='-j12'
diff --git a/config/external/moz.build b/config/external/moz.build
index dc094b6af1..47db9e1526 100644
--- a/config/external/moz.build
+++ b/config/external/moz.build
@@ -54,7 +54,7 @@ external_dirs += [
'media/psshparser'
]
-if CONFIG['MOZ_LINKER']:
+if CONFIG['MOZ_UPDATER']:
external_dirs += ['modules/xz-embedded']
DIRS += ['../../' + i for i in external_dirs]
diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp
index 90680d8c69..daf1ccc989 100644
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -32,11 +32,6 @@ StaticRefPtr<nsIThreadPool> AsyncCubebTask::sThreadPool;
struct AutoProfilerUnregisterThread
{
- // The empty ctor is used to silence a pre-4.8.0 GCC unused variable warning.
- AutoProfilerUnregisterThread()
- {
- }
-
~AutoProfilerUnregisterThread()
{
profiler_unregister_thread();
diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp
index 54b09e6447..7fd11f1715 100644
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -1277,13 +1277,6 @@ GetSources(MediaEngine *engine, MediaSourceEnum aSrcType,
}
}
-// TODO: Remove once upgraded to GCC 4.8+ on linux. Bogus error on static func:
-// error: 'this' was not captured for this lambda function
-
-static auto& MediaManager_GetInstance = MediaManager::GetInstance;
-static auto& MediaManager_ToJSArray = MediaManager::ToJSArray;
-static auto& MediaManager_AnonymizeDevices = MediaManager::AnonymizeDevices;
-
already_AddRefed<MediaManager::PledgeChar>
MediaManager::SelectSettings(
MediaStreamConstraints& aConstraints,
@@ -1343,7 +1336,7 @@ MediaManager::SelectSettings(
}
}
NS_DispatchToMainThread(NewRunnableFrom([id, badConstraint]() mutable {
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
RefPtr<PledgeChar> p = mgr->mOutstandingCharPledges.Remove(id);
if (p) {
p->Resolve(badConstraint);
@@ -1608,7 +1601,7 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
fakeBackend = new MediaEngineDefault();
}
if ((!fakeCams && hasVideo) || (!fakeMics && hasAudio)) {
- RefPtr<MediaManager> manager = MediaManager_GetInstance();
+ RefPtr<MediaManager> manager = MediaManager::GetInstance();
realBackend = manager->GetBackend(aWindowId);
}
@@ -1633,7 +1626,7 @@ MediaManager::EnumerateRawDevices(uint64_t aWindowId,
SourceSet* handoff = result.release();
NS_DispatchToMainThread(NewRunnableFrom([id, handoff]() mutable {
UniquePtr<SourceSet> result(handoff); // grab result
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
if (!mgr) {
return NS_OK;
}
@@ -1922,7 +1915,7 @@ int MediaManager::AddDeviceChangeCallback(DeviceChangeCallback* aCallback)
{
bool fakeDeviceChangeEventOn = mPrefs.mFakeDeviceChangeEventOn;
MediaManager::PostTask(NewTaskFrom([fakeDeviceChangeEventOn]() {
- RefPtr<MediaManager> manager = MediaManager_GetInstance();
+ RefPtr<MediaManager> manager = MediaManager::GetInstance();
manager->GetBackend(0)->AddDeviceChangeCallback(manager);
if (fakeDeviceChangeEventOn)
manager->GetBackend(0)->SetFakeDeviceChangeEvents();
@@ -2445,7 +2438,7 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId,
p->Then([id, aWindowId, aVideoType, aAudioType,
aFake](const nsCString& aOriginKey) mutable {
MOZ_ASSERT(NS_IsMainThread());
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
RefPtr<PledgeSourceSet> p = mgr->EnumerateRawDevices(aWindowId, aVideoType,
aAudioType, aFake);
@@ -2453,7 +2446,7 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId,
UniquePtr<SourceSet> devices(aDevices); // secondary result
// Only run if window is still on our active list.
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
if (!mgr) {
return NS_OK;
}
@@ -2461,7 +2454,7 @@ MediaManager::EnumerateDevicesImpl(uint64_t aWindowId,
if (!p || !mgr->IsWindowStillActive(aWindowId)) {
return NS_OK;
}
- MediaManager_AnonymizeDevices(*devices, aOriginKey);
+ MediaManager::AnonymizeDevices(*devices, aOriginKey);
p->Resolve(devices.release());
return NS_OK;
});
@@ -2500,12 +2493,12 @@ MediaManager::EnumerateDevices(nsPIDOMWindowInner* aWindow,
fake);
p->Then([onSuccess, windowId, listener](SourceSet*& aDevices) mutable {
UniquePtr<SourceSet> devices(aDevices); // grab result
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
mgr->RemoveFromWindowList(windowId, listener);
- nsCOMPtr<nsIWritableVariant> array = MediaManager_ToJSArray(*devices);
+ nsCOMPtr<nsIWritableVariant> array = MediaManager::ToJSArray(*devices);
onSuccess->OnSuccess(array);
}, [onFailure, windowId, listener](MediaStreamError*& reason) mutable {
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
mgr->RemoveFromWindowList(windowId, listener);
onFailure->OnError(reason);
});
@@ -2542,7 +2535,7 @@ MediaManager::GetUserMediaDevices(nsPIDOMWindowInner* aWindow,
RefPtr<GetUserMediaTask> task;
if (!aCallID.Length() || aCallID == callID) {
if (mActiveCallbacks.Get(callID, getter_AddRefs(task))) {
- nsCOMPtr<nsIWritableVariant> array = MediaManager_ToJSArray(*task->mSourceSet);
+ nsCOMPtr<nsIWritableVariant> array = MediaManager::ToJSArray(*task->mSourceSet);
onSuccess->OnSuccess(array);
return NS_OK;
}
@@ -3356,7 +3349,7 @@ GetUserMediaCallbackMediaStreamListener::ApplyConstraintsToTrack(
NS_DispatchToMainThread(NewRunnableFrom([id, windowId, rv,
badConstraint]() mutable {
MOZ_ASSERT(NS_IsMainThread());
- RefPtr<MediaManager> mgr = MediaManager_GetInstance();
+ RefPtr<MediaManager> mgr = MediaManager::GetInstance();
if (!mgr) {
return NS_OK;
}
diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h
index 1255f6c90b..1ee61f1196 100644
--- a/dom/media/MediaManager.h
+++ b/dom/media/MediaManager.h
@@ -268,7 +268,6 @@ private:
static nsresult GenerateUUID(nsAString& aResult);
static nsresult AnonymizeId(nsAString& aId, const nsACString& aOriginKey);
-public: // TODO: make private once we upgrade to GCC 4.8+ on linux.
static void AnonymizeDevices(SourceSet& aDevices, const nsACString& aOriginKey);
static already_AddRefed<nsIWritableVariant> ToJSArray(SourceSet& aDevices);
private:
diff --git a/dom/plugins/base/npfunctions.h b/dom/plugins/base/npfunctions.h
index 7638a64882..83c8a9762c 100644
--- a/dom/plugins/base/npfunctions.h
+++ b/dom/plugins/base/npfunctions.h
@@ -189,8 +189,8 @@ typedef struct _NPNetscapeFuncs {
#endif
#if defined(XP_UNIX)
-/* GCC 3.3 and later support the visibility attribute. */
-#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
+/* GCC supports the visibility attribute. */
+#if defined(__GNUC__)
#define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
#define NP_VISIBILITY_DEFAULT __global
diff --git a/dom/plugins/base/nptypes.h b/dom/plugins/base/nptypes.h
index d0cef65406..1f8eba3c53 100644
--- a/dom/plugins/base/nptypes.h
+++ b/dom/plugins/base/nptypes.h
@@ -13,7 +13,7 @@
#if defined(WIN32)
/*
- * Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool
+ * Win32 doesn't know C99, so define [u]int_16/32/64 here. The bool
* is predefined tho, both in C and C++.
*/
typedef short int16_t;
@@ -61,28 +61,15 @@
#include <inttypes.h>
#include <stdbool.h>
#endif
-#elif defined(BEOS)
- #include <inttypes.h>
#else
/*
* For those that ship a standard C99 stdint.h header file, include
- * it. Can't do the same for stdbool.h tho, since some systems ship
- * with a stdbool.h file that doesn't compile!
+ * it.
*/
#include <stdint.h>
#ifndef __cplusplus
- #if !defined(__GNUC__) || (__GNUC__ > 2 || __GNUC_MINOR__ > 95)
- #include <stdbool.h>
- #else
- /*
- * GCC 2.91 can't deal with a typedef for bool, but a #define
- * works.
- */
- #define bool int
- #define true 1
- #define false 0
- #endif
+ #include <stdbool.h>
#endif
#endif
diff --git a/gfx/2d/BaseRect.h b/gfx/2d/BaseRect.h
index 57d01ba09b..b1eed9ddb9 100644
--- a/gfx/2d/BaseRect.h
+++ b/gfx/2d/BaseRect.h
@@ -9,6 +9,7 @@
#include <algorithm>
#include <cmath>
#include <ostream>
+#include <limits>
#include "mozilla/Assertions.h"
#include "mozilla/FloatingPoint.h"
diff --git a/js/src/builtin/String.js b/js/src/builtin/String.js
index c70f8558be..233a7323b2 100644
--- a/js/src/builtin/String.js
+++ b/js/src/builtin/String.js
@@ -969,12 +969,14 @@ function String_static_trimStart(string) {
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'String.trimStart');
return callFunction(std_String_trimStart, string);
}
+_SetCanonicalName(String_static_trimStart, "trimStart");
function String_static_trimEnd(string) {
if (arguments.length < 1)
ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'String.trimEnd');
return callFunction(std_String_trimEnd, string);
}
+_SetCanonicalName(String_static_trimEnd, "trimEnd");
function String_static_toLocaleLowerCase(string) {
if (arguments.length < 1)
diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h
index 2f27702601..2a10420943 100644
--- a/js/src/gc/Heap.h
+++ b/js/src/gc/Heap.h
@@ -80,9 +80,7 @@ enum InitialHeap {
};
/* The GC allocation kinds. */
-// FIXME: uint8_t would make more sense for the underlying type, but causes
-// miscompilations in GCC (fixed in 4.8.5 and 4.9.3). See also bug 1143966.
-enum class AllocKind {
+enum class AllocKind : uint8_t {
FIRST,
OBJECT_FIRST = FIRST,
FUNCTION = FIRST,
diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp
index 2b7ac6b9ce..dae86fd92a 100644
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -8181,12 +8181,14 @@ IonBuilder::maybeMarkEmpty(MDefinition* ins)
// as having no possible types too. This is to avoid degrading
// subsequent analysis.
for (size_t i = 0; i < ins->numOperands(); i++) {
- if (!ins->emptyResultTypeSet())
+ if (!ins->getOperand(i)->emptyResultTypeSet())
continue;
TemporaryTypeSet* types = alloc().lifoAlloc()->new_<TemporaryTypeSet>();
- if (types)
+ if (types) {
ins->setResultTypeSet(types);
+ return;
+ }
}
}
diff --git a/js/src/jit/Safepoints.cpp b/js/src/jit/Safepoints.cpp
index 9446861a0b..27cb642542 100644
--- a/js/src/jit/Safepoints.cpp
+++ b/js/src/jit/Safepoints.cpp
@@ -264,11 +264,7 @@ AllocationToPartKind(const LAllocation& a)
return Part_Arg;
}
-// gcc 4.5 doesn't actually inline CanEncodeInfoInHeader when only
-// using the "inline" keyword, and miscompiles the function as well
-// when doing block reordering with branch prediction information.
-// See bug 799295 comment 71.
-static MOZ_ALWAYS_INLINE bool
+static inline bool
CanEncodeInfoInHeader(const LAllocation& a, uint32_t* out)
{
if (a.isGeneralReg()) {
diff --git a/js/src/jit/arm/Architecture-arm.h b/js/src/jit/arm/Architecture-arm.h
index d2c634798b..5dbc68a599 100644
--- a/js/src/jit/arm/Architecture-arm.h
+++ b/js/src/jit/arm/Architecture-arm.h
@@ -13,8 +13,7 @@
#include "js/Utility.h"
-// GCC versions 4.6 and above define __ARM_PCS_VFP to denote a hard-float
-// ABI target.
+// GCC defines __ARM_PCS_VFP to denote a hard-float ABI target.
#if defined(__ARM_PCS_VFP)
#define JS_CODEGEN_ARM_HARDFP
#endif
diff --git a/js/src/jit/arm/AtomicOperations-arm.h b/js/src/jit/arm/AtomicOperations-arm.h
index e10b348c0a..f9ca690c07 100644
--- a/js/src/jit/arm/AtomicOperations-arm.h
+++ b/js/src/jit/arm/AtomicOperations-arm.h
@@ -12,18 +12,6 @@
#if defined(__clang__) || defined(__GNUC__)
-// The default implementation tactic for gcc/clang is to use the newer
-// __atomic intrinsics added for use in C++11 <atomic>. Where that
-// isn't available, we use GCC's older __sync functions instead.
-//
-// ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS is kept as a backward
-// compatible option for older compilers: enable this to use GCC's old
-// __sync functions instead of the newer __atomic functions. This
-// will be required for GCC 4.6.x and earlier, and probably for Clang
-// 3.1, should we need to use those versions.
-
-//#define ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
-
inline bool
js::jit::AtomicOperations::isLockfree8()
{
@@ -37,24 +25,16 @@ js::jit::AtomicOperations::isLockfree8()
//
// For now, make the JIT defer to the C++ compiler when we know what
// the C++ compiler will do, otherwise assume a lock is needed.
-# ifndef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int8_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int16_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int32_t), 0));
return HasLDSTREXBHD() && __atomic_always_lock_free(sizeof(int64_t), 0);
-# else
- return false;
-# endif
}
inline void
js::jit::AtomicOperations::fenceSeqCst()
{
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
-# else
__atomic_thread_fence(__ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -62,14 +42,8 @@ inline T
js::jit::AtomicOperations::loadSeqCst(T* addr)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
- T v = *addr;
- __sync_synchronize();
-# else
T v;
__atomic_load(addr, &v, __ATOMIC_SEQ_CST);
-# endif
return v;
}
@@ -78,13 +52,7 @@ inline void
js::jit::AtomicOperations::storeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
- *addr = val;
- __sync_synchronize();
-# else
__atomic_store(addr, &val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -92,18 +60,9 @@ inline T
js::jit::AtomicOperations::exchangeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- T v;
- __sync_synchronize();
- do {
- v = *addr;
- } while (__sync_val_compare_and_swap(addr, v, val) != v);
- return v;
-# else
T v;
__atomic_exchange(addr, &val, &v, __ATOMIC_SEQ_CST);
return v;
-# endif
}
template<typename T>
@@ -111,12 +70,8 @@ inline T
js::jit::AtomicOperations::compareExchangeSeqCst(T* addr, T oldval, T newval)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_val_compare_and_swap(addr, oldval, newval);
-# else
__atomic_compare_exchange(addr, &oldval, &newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
return oldval;
-# endif
}
template<typename T>
@@ -124,11 +79,7 @@ inline T
js::jit::AtomicOperations::fetchAddSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_add(addr, val);
-# else
return __atomic_fetch_add(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -136,11 +87,7 @@ inline T
js::jit::AtomicOperations::fetchSubSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_sub(addr, val);
-# else
return __atomic_fetch_sub(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -148,11 +95,7 @@ inline T
js::jit::AtomicOperations::fetchAndSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_and(addr, val);
-# else
return __atomic_fetch_and(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -160,11 +103,7 @@ inline T
js::jit::AtomicOperations::fetchOrSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_or(addr, val);
-# else
return __atomic_fetch_or(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -172,11 +111,7 @@ inline T
js::jit::AtomicOperations::fetchXorSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_xor(addr, val);
-# else
return __atomic_fetch_xor(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -209,17 +144,12 @@ template<size_t nbytes>
inline void
js::jit::RegionLock::acquire(void* addr)
{
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- while (!__sync_bool_compare_and_swap(&spinlock, 0, 1))
- ;
-# else
uint32_t zero = 0;
uint32_t one = 1;
while (!__atomic_compare_exchange(&spinlock, &zero, &one, false, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE)) {
zero = 0;
continue;
}
-# endif
}
template<size_t nbytes>
@@ -227,16 +157,10 @@ inline void
js::jit::RegionLock::release(void* addr)
{
MOZ_ASSERT(AtomicOperations::loadSeqCst(&spinlock) == 1, "releasing unlocked region lock");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_sub_and_fetch(&spinlock, 1);
-# else
uint32_t zero = 0;
__atomic_store(&spinlock, &zero, __ATOMIC_SEQ_CST);
-# endif
}
-# undef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
-
#elif defined(ENABLE_SHARED_ARRAY_BUFFER)
# error "Either disable JS shared memory at compile time, use GCC or Clang, or add code here"
diff --git a/js/src/jit/arm/Simulator-arm.cpp b/js/src/jit/arm/Simulator-arm.cpp
index 2b295212a5..5dfdb939a0 100644
--- a/js/src/jit/arm/Simulator-arm.cpp
+++ b/js/src/jit/arm/Simulator-arm.cpp
@@ -1289,8 +1289,6 @@ int32_t
Simulator::get_register(int reg) const
{
MOZ_ASSERT(reg >= 0 && reg < num_registers);
- // Work around GCC bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43949
- if (reg >= num_registers) return 0;
return registers_[reg] + ((reg == pc) ? SimInstruction::kPCReadOffset : 0);
}
diff --git a/js/src/jit/arm64/vixl/Assembler-vixl.h b/js/src/jit/arm64/vixl/Assembler-vixl.h
index d209f8b570..175349bf56 100644
--- a/js/src/jit/arm64/vixl/Assembler-vixl.h
+++ b/js/src/jit/arm64/vixl/Assembler-vixl.h
@@ -4016,11 +4016,9 @@ class Assembler : public MozBaseAssembler {
const MemOperand& addr,
LoadStoreScalingOption option = PreferScaledOffset);
- // TODO(all): The third parameter should be passed by reference but gcc 4.8.2
- // reports a bogus uninitialised warning then.
BufferOffset Logical(const Register& rd,
const Register& rn,
- const Operand operand,
+ const Operand& operand,
LogicalOp op);
BufferOffset LogicalImmediate(const Register& rd,
const Register& rn,
diff --git a/js/src/jit/arm64/vixl/MozAssembler-vixl.cpp b/js/src/jit/arm64/vixl/MozAssembler-vixl.cpp
index 3b2e0a8bc6..a9bb8a18d9 100644
--- a/js/src/jit/arm64/vixl/MozAssembler-vixl.cpp
+++ b/js/src/jit/arm64/vixl/MozAssembler-vixl.cpp
@@ -400,7 +400,7 @@ void Assembler::nop(Instruction* at) {
BufferOffset Assembler::Logical(const Register& rd, const Register& rn,
- const Operand operand, LogicalOp op)
+ const Operand& operand, LogicalOp op)
{
VIXL_ASSERT(rd.size() == rn.size());
if (operand.IsImmediate()) {
diff --git a/js/src/jit/mips-shared/AtomicOperations-mips-shared.h b/js/src/jit/mips-shared/AtomicOperations-mips-shared.h
index dee9302300..7441a27e87 100644
--- a/js/src/jit/mips-shared/AtomicOperations-mips-shared.h
+++ b/js/src/jit/mips-shared/AtomicOperations-mips-shared.h
@@ -13,22 +13,9 @@
#if defined(__clang__) || defined(__GNUC__)
-// The default implementation tactic for gcc/clang is to use the newer
-// __atomic intrinsics added for use in C++11 <atomic>. Where that
-// isn't available, we use GCC's older __sync functions instead.
-//
-// ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS is kept as a backward
-// compatible option for older compilers: enable this to use GCC's old
-// __sync functions instead of the newer __atomic functions. This
-// will be required for GCC 4.6.x and earlier, and probably for Clang
-// 3.1, should we need to use those versions.
-
-//#define ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
-
inline bool
js::jit::AtomicOperations::isLockfree8()
{
-# ifndef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int8_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int16_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int32_t), 0));
@@ -36,19 +23,12 @@ js::jit::AtomicOperations::isLockfree8()
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int64_t), 0));
# endif
return true;
-# else
- return false;
-# endif
}
inline void
js::jit::AtomicOperations::fenceSeqCst()
{
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
-# else
__atomic_thread_fence(__ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -56,14 +36,8 @@ inline T
js::jit::AtomicOperations::loadSeqCst(T* addr)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
- T v = *addr;
- __sync_synchronize();
-# else
T v;
__atomic_load(addr, &v, __ATOMIC_SEQ_CST);
-# endif
return v;
}
@@ -72,13 +46,7 @@ inline void
js::jit::AtomicOperations::storeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
- *addr = val;
- __sync_synchronize();
-# else
__atomic_store(addr, &val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -86,12 +54,8 @@ inline T
js::jit::AtomicOperations::compareExchangeSeqCst(T* addr, T oldval, T newval)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_val_compare_and_swap(addr, oldval, newval);
-# else
__atomic_compare_exchange(addr, &oldval, &newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
return oldval;
-# endif
}
template<typename T>
@@ -99,11 +63,7 @@ inline T
js::jit::AtomicOperations::fetchAddSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_add(addr, val);
-# else
return __atomic_fetch_add(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -111,11 +71,7 @@ inline T
js::jit::AtomicOperations::fetchSubSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_sub(addr, val);
-# else
return __atomic_fetch_sub(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -123,11 +79,7 @@ inline T
js::jit::AtomicOperations::fetchAndSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_and(addr, val);
-# else
return __atomic_fetch_and(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -135,11 +87,7 @@ inline T
js::jit::AtomicOperations::fetchOrSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_or(addr, val);
-# else
return __atomic_fetch_or(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -147,11 +95,7 @@ inline T
js::jit::AtomicOperations::fetchXorSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_xor(addr, val);
-# else
return __atomic_fetch_xor(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -185,35 +129,21 @@ inline T
js::jit::AtomicOperations::exchangeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- T v;
- __sync_synchronize();
- do {
- v = *addr;
- } while (__sync_val_compare_and_swap(addr, v, val) != v);
- return v;
-# else
T v;
__atomic_exchange(addr, &val, &v, __ATOMIC_SEQ_CST);
return v;
-# endif
}
template<size_t nbytes>
inline void
js::jit::RegionLock::acquire(void* addr)
{
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- while (!__sync_bool_compare_and_swap(&spinlock, 0, 1))
- ;
-# else
uint32_t zero = 0;
uint32_t one = 1;
while (!__atomic_compare_exchange(&spinlock, &zero, &one, false, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE)) {
zero = 0;
continue;
}
-# endif
}
template<size_t nbytes>
@@ -221,16 +151,10 @@ inline void
js::jit::RegionLock::release(void* addr)
{
MOZ_ASSERT(AtomicOperations::loadSeqCst(&spinlock) == 1, "releasing unlocked region lock");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_sub_and_fetch(&spinlock, 1);
-# else
uint32_t zero = 0;
__atomic_store(&spinlock, &zero, __ATOMIC_SEQ_CST);
-# endif
}
-# undef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
-
#elif defined(ENABLE_SHARED_ARRAY_BUFFER)
# error "Either disable JS shared memory at compile time, use GCC or Clang, or add code here"
diff --git a/js/src/jit/none/AtomicOperations-ppc.h b/js/src/jit/none/AtomicOperations-ppc.h
index 182de9f8ac..465c0cf41b 100644
--- a/js/src/jit/none/AtomicOperations-ppc.h
+++ b/js/src/jit/none/AtomicOperations-ppc.h
@@ -13,22 +13,9 @@
#if defined(__clang__) || defined(__GNUC__)
-// The default implementation tactic for gcc/clang is to use the newer
-// __atomic intrinsics added for use in C++11 <atomic>. Where that
-// isn't available, we use GCC's older __sync functions instead.
-//
-// ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS is kept as a backward
-// compatible option for older compilers: enable this to use GCC's old
-// __sync functions instead of the newer __atomic functions. This
-// will be required for GCC 4.6.x and earlier, and probably for Clang
-// 3.1, should we need to use those versions.
-
-//#define ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
-
inline bool
js::jit::AtomicOperations::isLockfree8()
{
-# ifndef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int8_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int16_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int32_t), 0));
@@ -37,19 +24,12 @@ js::jit::AtomicOperations::isLockfree8()
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int64_t), 0));
# endif
return true;
-# else
- return false;
-# endif
}
inline void
js::jit::AtomicOperations::fenceSeqCst()
{
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
-# else
__atomic_thread_fence(__ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -57,14 +37,8 @@ inline T
js::jit::AtomicOperations::loadSeqCst(T* addr)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
- T v = *addr;
- __sync_synchronize();
-# else
T v;
__atomic_load(addr, &v, __ATOMIC_SEQ_CST);
-# endif
return v;
}
@@ -73,13 +47,7 @@ inline void
js::jit::AtomicOperations::storeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
- *addr = val;
- __sync_synchronize();
-# else
__atomic_store(addr, &val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -87,12 +55,8 @@ inline T
js::jit::AtomicOperations::compareExchangeSeqCst(T* addr, T oldval, T newval)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_val_compare_and_swap(addr, oldval, newval);
-# else
__atomic_compare_exchange(addr, &oldval, &newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
return oldval;
-# endif
}
template<typename T>
@@ -100,11 +64,7 @@ inline T
js::jit::AtomicOperations::fetchAddSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_add(addr, val);
-# else
return __atomic_fetch_add(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -112,11 +72,7 @@ inline T
js::jit::AtomicOperations::fetchSubSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_sub(addr, val);
-# else
return __atomic_fetch_sub(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -124,11 +80,7 @@ inline T
js::jit::AtomicOperations::fetchAndSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_and(addr, val);
-# else
return __atomic_fetch_and(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -136,11 +88,7 @@ inline T
js::jit::AtomicOperations::fetchOrSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_or(addr, val);
-# else
return __atomic_fetch_or(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -148,11 +96,7 @@ inline T
js::jit::AtomicOperations::fetchXorSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_xor(addr, val);
-# else
return __atomic_fetch_xor(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -186,35 +130,21 @@ inline T
js::jit::AtomicOperations::exchangeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- T v;
- __sync_synchronize();
- do {
- v = *addr;
- } while (__sync_val_compare_and_swap(addr, v, val) != v);
- return v;
-# else
T v;
__atomic_exchange(addr, &val, &v, __ATOMIC_SEQ_CST);
return v;
-# endif
}
template<size_t nbytes>
inline void
js::jit::RegionLock::acquire(void* addr)
{
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- while (!__sync_bool_compare_and_swap(&spinlock, 0, 1))
- ;
-# else
uint32_t zero = 0;
uint32_t one = 1;
while (!__atomic_compare_exchange(&spinlock, &zero, &one, false, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE)) {
zero = 0;
continue;
}
-# endif
}
template<size_t nbytes>
@@ -222,16 +152,10 @@ inline void
js::jit::RegionLock::release(void* addr)
{
MOZ_ASSERT(AtomicOperations::loadSeqCst(&spinlock) == 1, "releasing unlocked region lock");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_sub_and_fetch(&spinlock, 1);
-# else
uint32_t zero = 0;
__atomic_store(&spinlock, &zero, __ATOMIC_SEQ_CST);
-# endif
}
-# undef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
-
#elif defined(ENABLE_SHARED_ARRAY_BUFFER)
# error "Either disable JS shared memory, use GCC or Clang, or add code here"
diff --git a/js/src/jit/none/AtomicOperations-sparc.h b/js/src/jit/none/AtomicOperations-sparc.h
index ca689da7e2..c962a524e7 100644
--- a/js/src/jit/none/AtomicOperations-sparc.h
+++ b/js/src/jit/none/AtomicOperations-sparc.h
@@ -13,22 +13,9 @@
#if defined(__clang__) || defined(__GNUC__)
-// The default implementation tactic for gcc/clang is to use the newer
-// __atomic intrinsics added for use in C++11 <atomic>. Where that
-// isn't available, we use GCC's older __sync functions instead.
-//
-// ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS is kept as a backward
-// compatible option for older compilers: enable this to use GCC's old
-// __sync functions instead of the newer __atomic functions. This
-// will be required for GCC 4.6.x and earlier, and probably for Clang
-// 3.1, should we need to use those versions.
-
-//#define ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
-
inline bool
js::jit::AtomicOperations::isLockfree8()
{
-# ifndef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int8_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int16_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int32_t), 0));
@@ -36,19 +23,12 @@ js::jit::AtomicOperations::isLockfree8()
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int64_t), 0));
# endif
return true;
-# else
- return false;
-# endif
}
inline void
js::jit::AtomicOperations::fenceSeqCst()
{
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
-# else
__atomic_thread_fence(__ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -56,14 +36,8 @@ inline T
js::jit::AtomicOperations::loadSeqCst(T* addr)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
- T v = *addr;
- __sync_synchronize();
-# else
T v;
__atomic_load(addr, &v, __ATOMIC_SEQ_CST);
-# endif
return v;
}
@@ -72,13 +46,7 @@ inline void
js::jit::AtomicOperations::storeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
- *addr = val;
- __sync_synchronize();
-# else
__atomic_store(addr, &val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -86,12 +54,8 @@ inline T
js::jit::AtomicOperations::compareExchangeSeqCst(T* addr, T oldval, T newval)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_val_compare_and_swap(addr, oldval, newval);
-# else
__atomic_compare_exchange(addr, &oldval, &newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
return oldval;
-# endif
}
template<typename T>
@@ -101,11 +65,7 @@ js::jit::AtomicOperations::fetchAddSeqCst(T* addr, T val)
#if !defined( __LP64__)
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
#endif
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_add(addr, val);
-# else
return __atomic_fetch_add(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -115,11 +75,7 @@ js::jit::AtomicOperations::fetchSubSeqCst(T* addr, T val)
#if !defined( __LP64__)
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
#endif
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_sub(addr, val);
-# else
return __atomic_fetch_sub(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -129,11 +85,7 @@ js::jit::AtomicOperations::fetchAndSeqCst(T* addr, T val)
#if !defined( __LP64__)
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
#endif
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_and(addr, val);
-# else
return __atomic_fetch_and(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -143,11 +95,7 @@ js::jit::AtomicOperations::fetchOrSeqCst(T* addr, T val)
#if !defined( __LP64__)
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
#endif
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_or(addr, val);
-# else
return __atomic_fetch_or(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -157,11 +105,7 @@ js::jit::AtomicOperations::fetchXorSeqCst(T* addr, T val)
#if !defined( __LP64__)
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
#endif
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_xor(addr, val);
-# else
return __atomic_fetch_xor(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -195,35 +139,21 @@ inline T
js::jit::AtomicOperations::exchangeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- T v;
- __sync_synchronize();
- do {
- v = *addr;
- } while (__sync_val_compare_and_swap(addr, v, val) != v);
- return v;
-# else
T v;
__atomic_exchange(addr, &val, &v, __ATOMIC_SEQ_CST);
return v;
-# endif
}
template<size_t nbytes>
inline void
js::jit::RegionLock::acquire(void* addr)
{
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- while (!__sync_bool_compare_and_swap(&spinlock, 0, 1))
- ;
-# else
uint32_t zero = 0;
uint32_t one = 1;
while (!__atomic_compare_exchange(&spinlock, &zero, &one, false, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE)) {
zero = 0;
continue;
}
-# endif
}
template<size_t nbytes>
@@ -231,16 +161,10 @@ inline void
js::jit::RegionLock::release(void* addr)
{
MOZ_ASSERT(AtomicOperations::loadSeqCst(&spinlock) == 1, "releasing unlocked region lock");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_sub_and_fetch(&spinlock, 1);
-# else
uint32_t zero = 0;
__atomic_store(&spinlock, &zero, __ATOMIC_SEQ_CST);
-# endif
}
-# undef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
-
#elif defined(ENABLE_SHARED_ARRAY_BUFFER)
# error "Either disable JS shared memory, use GCC or Clang, or add code here"
diff --git a/js/src/jit/x86-shared/AtomicOperations-x86-shared.h b/js/src/jit/x86-shared/AtomicOperations-x86-shared.h
index 1230c7febd..4eee00a3de 100644
--- a/js/src/jit/x86-shared/AtomicOperations-x86-shared.h
+++ b/js/src/jit/x86-shared/AtomicOperations-x86-shared.h
@@ -45,18 +45,6 @@
#if defined(__clang__) || defined(__GNUC__)
-// The default implementation tactic for gcc/clang is to use the newer
-// __atomic intrinsics added for use in C++11 <atomic>. Where that
-// isn't available, we use GCC's older __sync functions instead.
-//
-// ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS is kept as a backward
-// compatible option for older compilers: enable this to use GCC's old
-// __sync functions instead of the newer __atomic functions. This
-// will be required for GCC 4.6.x and earlier, and probably for Clang
-// 3.1, should we need to use those versions.
-
-// #define ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
-
// Lock-free 8-byte atomics are assumed on x86 but must be disabled in
// corner cases, see comments below and in isLockfree8().
@@ -77,15 +65,11 @@
inline bool
js::jit::AtomicOperations::isLockfree8()
{
-# ifndef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int8_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int16_t), 0));
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int32_t), 0));
-# endif
# ifdef LOCKFREE8
-# ifndef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
MOZ_ASSERT(__atomic_always_lock_free(sizeof(int64_t), 0));
-# endif
return true;
# else
return false;
@@ -95,11 +79,7 @@ js::jit::AtomicOperations::isLockfree8()
inline void
js::jit::AtomicOperations::fenceSeqCst()
{
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_synchronize();
-# else
__atomic_thread_fence(__ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -107,16 +87,8 @@ inline T
js::jit::AtomicOperations::loadSeqCst(T* addr)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- // Inhibit compiler reordering with a volatile load. The x86 does
- // not reorder loads with respect to subsequent loads or stores
- // and no ordering barrier is required here. See more elaborate
- // comments in storeSeqCst.
- T v = *static_cast<T volatile*>(addr);
-# else
T v;
__atomic_load(addr, &v, __ATOMIC_SEQ_CST);
-# endif
return v;
}
@@ -141,43 +113,7 @@ inline void
js::jit::AtomicOperations::storeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- // Inhibit compiler reordering with a volatile store. The x86 may
- // reorder a store with respect to a subsequent load from a
- // different location, hence there is an ordering barrier here to
- // prevent that.
- //
- // By way of background, look to eg
- // http://bartoszmilewski.com/2008/11/05/who-ordered-memory-fences-on-an-x86/
- //
- // Consider:
- //
- // uint8_t x = 0, y = 0; // to start
- //
- // thread1:
- // sx: AtomicOperations::store(&x, 1);
- // gy: uint8_t obs1 = AtomicOperations::loadSeqCst(&y);
- //
- // thread2:
- // sy: AtomicOperations::store(&y, 1);
- // gx: uint8_t obs2 = AtomicOperations::loadSeqCst(&x);
- //
- // Sequential consistency requires a total global ordering of
- // operations: sx-gy-sy-gx, sx-sy-gx-gy, sx-sy-gy-gx, sy-gx-sx-gy,
- // sy-sx-gy-gx, or sy-sx-gx-gy. In every ordering at least one of
- // sx-before-gx or sy-before-gy happens, so *at least one* of
- // obs1/obs2 is 1.
- //
- // If AtomicOperations::{load,store}SeqCst were just volatile
- // {load,store}, x86 could reorder gx/gy before each thread's
- // prior load. That would permit gx-gy-sx-sy: both loads would be
- // 0! Thus after a volatile store we must synchronize to ensure
- // the store happens before the load.
- *static_cast<T volatile*>(addr) = val;
- __sync_synchronize();
-# else
__atomic_store(addr, &val, __ATOMIC_SEQ_CST);
-# endif
}
# ifndef LOCKFREE8
@@ -201,19 +137,9 @@ inline T
js::jit::AtomicOperations::exchangeSeqCst(T* addr, T val)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- T v;
- do {
- // Here I assume the compiler will not hoist the load. It
- // shouldn't, because the CAS could affect* addr.
- v = *addr;
- } while (!__sync_bool_compare_and_swap(addr, v, val));
- return v;
-# else
T v;
__atomic_exchange(addr, &val, &v, __ATOMIC_SEQ_CST);
return v;
-# endif
}
# ifndef LOCKFREE8
@@ -237,12 +163,8 @@ inline T
js::jit::AtomicOperations::compareExchangeSeqCst(T* addr, T oldval, T newval)
{
MOZ_ASSERT(sizeof(T) < 8 || isLockfree8());
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_val_compare_and_swap(addr, oldval, newval);
-# else
__atomic_compare_exchange(addr, &oldval, &newval, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
return oldval;
-# endif
}
# ifndef LOCKFREE8
@@ -266,11 +188,7 @@ inline T
js::jit::AtomicOperations::fetchAddSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_add(addr, val);
-# else
return __atomic_fetch_add(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -278,11 +196,7 @@ inline T
js::jit::AtomicOperations::fetchSubSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_sub(addr, val);
-# else
return __atomic_fetch_sub(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -290,11 +204,7 @@ inline T
js::jit::AtomicOperations::fetchAndSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_and(addr, val);
-# else
return __atomic_fetch_and(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -302,11 +212,7 @@ inline T
js::jit::AtomicOperations::fetchOrSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_or(addr, val);
-# else
return __atomic_fetch_or(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -314,11 +220,7 @@ inline T
js::jit::AtomicOperations::fetchXorSeqCst(T* addr, T val)
{
static_assert(sizeof(T) <= 4, "not available for 8-byte values yet");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- return __sync_fetch_and_xor(addr, val);
-# else
return __atomic_fetch_xor(addr, val, __ATOMIC_SEQ_CST);
-# endif
}
template<typename T>
@@ -351,17 +253,12 @@ template<size_t nbytes>
inline void
js::jit::RegionLock::acquire(void* addr)
{
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- while (!__sync_bool_compare_and_swap(&spinlock, 0, 1))
- continue;
-# else
uint32_t zero = 0;
uint32_t one = 1;
while (!__atomic_compare_exchange(&spinlock, &zero, &one, false, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE)) {
zero = 0;
continue;
}
-# endif
}
template<size_t nbytes>
@@ -369,15 +266,10 @@ inline void
js::jit::RegionLock::release(void* addr)
{
MOZ_ASSERT(AtomicOperations::loadSeqCst(&spinlock) == 1, "releasing unlocked region lock");
-# ifdef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
- __sync_sub_and_fetch(&spinlock, 1); // Should turn into LOCK XADD
-# else
uint32_t zero = 0;
__atomic_store(&spinlock, &zero, __ATOMIC_SEQ_CST);
-# endif
}
-# undef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
# undef LOCKFREE8
#elif defined(_MSC_VER)
diff --git a/js/src/old-configure.in b/js/src/old-configure.in
index 355409352c..ec599b676d 100644
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -1903,19 +1903,6 @@ dnl ========================================================
MOZ_ARG_HEADER(Compiler Options)
dnl ========================================================
-dnl Check for gcc -pipe support
-dnl ========================================================
-AC_MSG_CHECKING([for -pipe support])
-if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
- dnl Any gcc that supports firefox supports -pipe.
- CFLAGS="$CFLAGS -pipe"
- CXXFLAGS="$CXXFLAGS -pipe"
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
-fi
-
-dnl ========================================================
dnl Profile guided optimization (gcc checks)
dnl ========================================================
dnl Test for profiling options
diff --git a/js/src/wasm/WasmBaselineCompile.cpp b/js/src/wasm/WasmBaselineCompile.cpp
index d4849f3d1d..7a905ecbea 100644
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -387,9 +387,9 @@ class BaseCompiler
#endif
case NONE:
MOZ_CRASH("AnyReg::any() on NONE");
+ default:
+ return AnyRegister();
}
- // Work around GCC 5 analysis/warning bug.
- MOZ_CRASH("AnyReg::any(): impossible case");
}
union {
diff --git a/layout/base/nsGenConList.cpp b/layout/base/nsGenConList.cpp
index bdb47e1838..fb0733f2e7 100644
--- a/layout/base/nsGenConList.cpp
+++ b/layout/base/nsGenConList.cpp
@@ -19,6 +19,7 @@ nsGenConList::Clear()
delete node;
}
mSize = 0;
+ mLastInserted = nullptr;
}
bool
@@ -41,6 +42,9 @@ nsGenConList::DestroyNodesFor(nsIFrame* aFrame)
node = nextNode;
}
+ // Modification of the list invalidates the cached pointer.
+ mLastInserted = nullptr;
+
return true;
}
@@ -108,6 +112,11 @@ nsGenConList::Insert(nsGenConNode* aNode)
// Check for append.
if (mList.isEmpty() || NodeAfter(aNode, mList.getLast())) {
mList.insertBack(aNode);
+ } else if (mLastInserted && mLastInserted != mList.getLast() &&
+ NodeAfter(aNode, mLastInserted) &&
+ NodeAfter(Next(mLastInserted), aNode)) {
+ // Fast path for inserting many consecutive nodes in one place
+ mLastInserted->setNext(aNode);
} else {
// Binary search.
@@ -142,6 +151,8 @@ nsGenConList::Insert(nsGenConNode* aNode)
}
++mSize;
+ mLastInserted = aNode;
+
// Set the mapping only if it is the first node of the frame.
// The DEBUG blocks below are for ensuring the invariant required by
// nsGenConList::DestroyNodesFor. See comment there.
diff --git a/layout/base/nsGenConList.h b/layout/base/nsGenConList.h
index 55bf6bc32e..58421d4301 100644
--- a/layout/base/nsGenConList.h
+++ b/layout/base/nsGenConList.h
@@ -86,7 +86,7 @@ protected:
uint32_t mSize;
public:
- nsGenConList() : mSize(0) {}
+ nsGenConList() : mSize(0), mLastInserted(nullptr) {}
~nsGenConList() { Clear(); }
void Clear();
static nsGenConNode* Next(nsGenConNode* aNode) {
@@ -127,6 +127,10 @@ private:
// Map from frame to the first nsGenConNode of it in the list.
nsDataHashtable<nsPtrHashKey<nsIFrame>, nsGenConNode*> mNodes;
+
+ // A weak pointer to the node most recently inserted, used to avoid repeated
+ // list traversals in Insert().
+ nsGenConNode* mLastInserted;
};
#endif /* nsGenConList_h___ */
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp
index 458b18abd9..af3d2f9457 100644
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -4645,6 +4645,13 @@ nsFrame::SetCoordToFlexBasis(bool aIsInlineFlexItem,
auto mainAxisCoord = aIsInlineFlexItem ?
aInlineStyle :
aBlockStyle;
+ // NOTE: If we're a table-wrapper frame, we skip this clause and just stick
+ // with 'main-size:auto' behavior (which -- unlike 'content'
+ // i.e. 'max-content' -- will give us the ability to honor percent sizes on
+ // our table-box child when resolving the flex base size). The flexbox spec
+ // doesn't call for this special case, but webcompat & regression-avoidance
+ // seems to require it, for the time being... Tables sure are special.
+ bool isTableWrapperFrame = GetType() == nsGkAtoms::tableWrapperFrame;
// We have a used flex-basis of 'content' if flex-basis explicitly has that
// value, OR if flex-basis is 'auto' (deferring to the main-size property)
// and the main-size property is also 'auto'.
@@ -4665,7 +4672,7 @@ nsFrame::SetCoordToFlexBasis(bool aIsInlineFlexItem,
// which substep we fall into) by using the 'auto' keyword for our
// main-axis coordinate here. (This makes sense, because the spec is
// effectively trying to produce the 'auto' sizing behavior).
- if (aIntrinsic) {
+ if (aIntrinsic || MOZ_LIKELY(isTableWrapperFrame)) {
static const nsStyleCoord autoStyleCoord(eStyleUnit_Auto);
*mainAxisCoord = &autoStyleCoord;
} else {
diff --git a/layout/reftests/flexbox/flexbox-table-flex-items-2-ref.html b/layout/reftests/flexbox/flexbox-table-flex-items-2-ref.html
new file mode 100644
index 0000000000..98a93716a5
--- /dev/null
+++ b/layout/reftests/flexbox/flexbox-table-flex-items-2-ref.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
+ <link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#flex-base-size">
+ <style>
+ .container {
+ display: flex;
+ width: 100px;
+ border: 1px solid black;
+ }
+
+ /* Two types of flex items: */
+ .table {
+ border: 2px solid teal;
+ }
+ .block {
+ border: 2px solid brown;
+ }
+
+ /* Each flex item gets one of these as its contents,
+ to have a nonzero content size: */
+ ib {
+ display: inline-block;
+ background: blue;
+ border: 1px solid gray;
+ width: 15px;
+ height: 10px;
+ }
+ </style>
+</head>
+<body>
+<!-- auto size: -->
+<div class="container">
+ <div class="table"><ib></ib></div>
+ <div class="block"><ib></ib></div>
+</div>
+
+<!-- px size: -->
+<div class="container">
+ <div class="table" style="width: 30px"><ib></ib></div>
+ <div class="block" style="width: 30px"><ib></ib></div>
+</div>
+
+<!-- % size: -->
+<div class="container">
+ <div class="table" style="width: 30%"><ib></ib></div>
+ <div class="block" style="width: 30%"><ib></ib></div>
+</div>
+
+<!-- calc() size: -->
+<div class="container">
+ <div class="table" style="width: calc(10px + 20%)"><ib></ib></div>
+ <div class="block" style="width: calc(10px + 20%)"><ib></ib></div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/flexbox/flexbox-table-flex-items-2.html b/layout/reftests/flexbox/flexbox-table-flex-items-2.html
new file mode 100644
index 0000000000..c11ce70802
--- /dev/null
+++ b/layout/reftests/flexbox/flexbox-table-flex-items-2.html
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>
+ CSS Test: Testing that implicit "flex-basis: content" on table wrapper box
+ doesn't prevent explicit table size from influencing flex base size.
+ </title>
+ <!-- XXXdholbert NOTE: This probably eventually should move to our
+ upstreamed reftest directory. But for now, this is just asserting
+ backwards-compatible/interoperable (but not necessary spec-compliant)
+ behavior, per https://github.com/w3c/csswg-drafts/issues/2604 -->
+ <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
+ <link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#flex-base-size">
+ <link rel="match" href="flexbox-table-flex-items-2.html">
+ <style>
+ .container {
+ display: flex;
+ width: 100px;
+ border: 1px solid black;
+ }
+
+ /* Two types of flex items: */
+ .table {
+ display: table;
+ border: 2px solid teal;
+ }
+ .block {
+ border: 2px solid brown;
+ }
+
+ /* Each flex item gets one of these as its contents,
+ to have a nonzero content size: */
+ ib {
+ display: inline-block;
+ background: blue;
+ border: 1px solid gray;
+ width: 15px;
+ height: 10px;
+ }
+ </style>
+</head>
+<body>
+<!-- auto size: -->
+<div class="container">
+ <div class="table"><ib></ib></div>
+ <div class="block"><ib></ib></div>
+</div>
+
+<!-- px size: -->
+<div class="container">
+ <div class="table" style="width: 30px"><ib></ib></div>
+ <div class="block" style="width: 30px"><ib></ib></div>
+</div>
+
+<!-- % size: -->
+<div class="container">
+ <div class="table" style="width: 30%"><ib></ib></div>
+ <div class="block" style="width: 30%"><ib></ib></div>
+</div>
+
+<!-- calc() size: -->
+<div class="container">
+ <div class="table" style="width: calc(10px + 20%)"><ib></ib></div>
+ <div class="block" style="width: calc(10px + 20%)"><ib></ib></div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/flexbox/flexbox-table-flex-items-3-ref.html b/layout/reftests/flexbox/flexbox-table-flex-items-3-ref.html
new file mode 100644
index 0000000000..568495f341
--- /dev/null
+++ b/layout/reftests/flexbox/flexbox-table-flex-items-3-ref.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>CSS Reftest Reference</title>
+ <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
+ <link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#flex-base-size">
+ <style>
+ .container {
+ display: flex;
+ flex-direction: column;
+ height: 100px;
+ float: left;
+ border: 1px solid black;
+ }
+
+ /* Two types of flex items: */
+ .table {
+ border: 2px solid teal;
+ }
+ .block {
+ border: 2px solid brown;
+ }
+
+ /* Each flex item gets one of these as its contents,
+ to have a nonzero content size: */
+ ib {
+ display: inline-block;
+ background: blue;
+ border: 1px solid gray;
+ width: 15px;
+ height: 10px;
+ }
+ </style>
+</head>
+<body>
+<!-- auto size: -->
+<div class="container">
+ <div class="table"><ib></ib></div>
+ <div class="block"><ib></ib></div>
+</div>
+
+<!-- px size: -->
+<div class="container">
+ <div class="table" style="height: 30px"><ib></ib></div>
+ <div class="block" style="height: 30px"><ib></ib></div>
+</div>
+
+<!-- % size: -->
+<div class="container">
+ <div class="table" style="height: 30%"><ib></ib></div>
+ <div class="block" style="height: 30%"><ib></ib></div>
+</div>
+
+<!-- calc() size: -->
+<div class="container">
+ <div class="table" style="height: calc(10px + 20%)"><ib></ib></div>
+ <div class="block" style="height: calc(10px + 20%)"><ib></ib></div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/flexbox/flexbox-table-flex-items-3.html b/layout/reftests/flexbox/flexbox-table-flex-items-3.html
new file mode 100644
index 0000000000..c68152856f
--- /dev/null
+++ b/layout/reftests/flexbox/flexbox-table-flex-items-3.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>
+ CSS Test: Testing that implicit "flex-basis: content" on table wrapper box
+ doesn't prevent explicit table size from influencing flex base size.
+ </title>
+ <!-- XXXdholbert NOTE: This probably eventually should move to our
+ upstreamed reftest directory. But for now, this is just asserting
+ backwards-compatible/interoperable (but not necessary spec-compliant)
+ behavior, per https://github.com/w3c/csswg-drafts/issues/2604 -->
+ <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
+ <link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#flex-base-size">
+ <link rel="match" href="flexbox-table-flex-items-3.html">
+ <style>
+ .container {
+ display: flex;
+ flex-direction: column;
+ height: 100px;
+ float: left;
+ border: 1px solid black;
+ }
+
+ /* Two types of flex items: */
+ .table {
+ display: table;
+ border: 2px solid teal;
+ }
+ .block {
+ border: 2px solid brown;
+ }
+
+ /* Each flex item gets one of these as its contents,
+ to have a nonzero content size: */
+ ib {
+ display: inline-block;
+ background: blue;
+ border: 1px solid gray;
+ width: 15px;
+ height: 10px;
+ }
+ </style>
+</head>
+<body>
+<!-- auto size: -->
+<div class="container">
+ <div class="table"><ib></ib></div>
+ <div class="block"><ib></ib></div>
+</div>
+
+<!-- px size: -->
+<div class="container">
+ <div class="table" style="height: 30px"><ib></ib></div>
+ <div class="block" style="height: 30px"><ib></ib></div>
+</div>
+
+<!-- % size: -->
+<div class="container">
+ <div class="table" style="height: 30%"><ib></ib></div>
+ <div class="block" style="height: 30%"><ib></ib></div>
+</div>
+
+<!-- calc() size: -->
+<div class="container">
+ <div class="table" style="height: calc(10px + 20%)"><ib></ib></div>
+ <div class="block" style="height: calc(10px + 20%)"><ib></ib></div>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/flexbox/reftest.list b/layout/reftests/flexbox/reftest.list
index be156100e8..075b789026 100644
--- a/layout/reftests/flexbox/reftest.list
+++ b/layout/reftests/flexbox/reftest.list
@@ -116,3 +116,5 @@ fuzzy-if(gtkWidget,1,31) == flexbox-widget-flex-items-4.html flexbox-widget-flex
# Tests for table flex items
== flexbox-table-flex-items-1-ref.html flexbox-table-flex-items-1-ref.html
+== flexbox-table-flex-items-2.html flexbox-table-flex-items-2-ref.html
+== flexbox-table-flex-items-3.html flexbox-table-flex-items-3-ref.html
diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp
index 9e7a01aff5..29cae7a3b6 100644
--- a/layout/style/Declaration.cpp
+++ b/layout/style/Declaration.cpp
@@ -1248,18 +1248,6 @@ Declaration::GetPropertyValueInternal(
// #2 <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>?
// #3 [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>
case eCSSProperty_grid: {
- const nsCSSValue& columnGapValue =
- *data->ValueFor(eCSSProperty_column_gap);
- if (columnGapValue.GetUnit() != eCSSUnit_Pixel ||
- columnGapValue.GetFloatValue() != 0.0f) {
- return; // Not serializable, bail.
- }
- const nsCSSValue& rowGapValue =
- *data->ValueFor(eCSSProperty_row_gap);
- if (rowGapValue.GetUnit() != eCSSUnit_Pixel ||
- rowGapValue.GetFloatValue() != 0.0f) {
- return; // Not serializable, bail.
- }
const nsCSSValue& areasValue =
*data->ValueFor(eCSSProperty_grid_template_areas);
const nsCSSValue& columnsValue =
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp
index b409bfed7e..2ba1e9b7f3 100644
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -9710,13 +9710,6 @@ CSSParserImpl::ParseGrid()
return true;
}
- // https://drafts.csswg.org/css-grid/#grid-shorthand
- // "Also, the gutter properties are reset by this shorthand,
- // even though they can't be set by it."
- value.SetFloatValue(0.0f, eCSSUnit_Pixel);
- AppendValue(eCSSProperty_row_gap, value);
- AppendValue(eCSSProperty_column_gap, value);
-
// [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'>
auto res = ParseGridShorthandAutoProps(NS_STYLE_GRID_AUTO_FLOW_ROW);
if (res == CSSParseResult::Error) {
@@ -9843,7 +9836,22 @@ CSSParserImpl::ParseGridLine(nsCSSValue& aValue)
// Make the contained value be defined even though we really want a
// Nothing here. This works around an otherwise difficult to avoid
// Memcheck false positive when this is compiled by gcc-5.3 -O2.
- // See bug 1301856.
+ // The problem is that gcc 5.4 and later, when using high
+ // optimization, inline Maybe::{isSome,ref} here
+ //
+ // if (integer.isSome() && integer.ref() < 0) {
+ //
+ // and then proceed to evaluate the expression right-to-left, as if it
+ // had been written
+ //
+ // integer.ref() < 0 && integer.isSome()
+ //
+ // This is a legitimate transformation because gcc presumably can prove
+ // via dataflow analysis that integer.isSome() is false whenever integer.ref()
+ // is undefined, so the overall expression result is still defined.
+ // Valgrind/Memcheck assumes that all conditional branches in the program
+ // are important, and that assumption is deeply wired in, so there is no
+ // easy way to avoid the warning apart from to force-initialise |integer|.
integer.emplace(0);
integer.reset();
#endif
@@ -15314,17 +15322,17 @@ CSSParserImpl::ParseFontFeatureSettings(nsCSSValue& aValue)
return true;
}
-bool
-CSSParserImpl::ParseFontVariationSettings(nsCSSValue& aValue)
-{
- // TODO: Actually implement this.
-
- // This stub is here because websites insist on considering this
- // very hardware-dependent and O.S.-variable low-level font-control
- // as a "critical feature" which it isn't as there is 0 guarantee
- // that font variation settings are supported or honored by any
- // operating system used by the client.
- return true;
+bool
+CSSParserImpl::ParseFontVariationSettings(nsCSSValue& aValue)
+{
+ // TODO: Actually implement this.
+
+ // This stub is here because websites insist on considering this
+ // very hardware-dependent and O.S.-variable low-level font-control
+ // as a "critical feature" which it isn't as there is 0 guarantee
+ // that font variation settings are supported or honored by any
+ // operating system used by the client.
+ return true;
}
bool
diff --git a/modules/libmar/src/mar.h b/modules/libmar/src/mar.h
index 776daf648d..e9c8d555e4 100644
--- a/modules/libmar/src/mar.h
+++ b/modules/libmar/src/mar.h
@@ -109,7 +109,7 @@ int mar_enum_items(MarFile *mar, MarItemCallback callback, void *data);
* @return The number of bytes written or a negative value if an
* error occurs.
*/
-int mar_read(MarFile *mar, const MarItem *item, int offset, char *buf,
+int mar_read(MarFile *mar, const MarItem *item, int offset, uint8_t *buf,
int bufsize);
/**
diff --git a/modules/libmar/src/mar_extract.c b/modules/libmar/src/mar_extract.c
index ec1cd6c534..969697ee29 100644
--- a/modules/libmar/src/mar_extract.c
+++ b/modules/libmar/src/mar_extract.c
@@ -37,7 +37,7 @@ static int mar_ensure_parent_dir(const char *path)
static int mar_test_callback(MarFile *mar, const MarItem *item, void *unused) {
FILE *fp;
- char buf[BLOCKSIZE];
+ uint8_t buf[BLOCKSIZE];
int fd, len, offset = 0;
if (mar_ensure_parent_dir(item->name))
diff --git a/modules/libmar/src/mar_read.c b/modules/libmar/src/mar_read.c
index 241d0c08e4..89b9da27d6 100644
--- a/modules/libmar/src/mar_read.c
+++ b/modules/libmar/src/mar_read.c
@@ -530,7 +530,7 @@ int mar_enum_items(MarFile *mar, MarItemCallback callback, void *closure) {
return 0;
}
-int mar_read(MarFile *mar, const MarItem *item, int offset, char *buf,
+int mar_read(MarFile *mar, const MarItem *item, int offset, uint8_t *buf,
int bufsize) {
int nr;
diff --git a/modules/xz-embedded/README.mozilla b/modules/xz-embedded/README.mozilla
index d0532e1e91..17dd755ee4 100644
--- a/modules/xz-embedded/README.mozilla
+++ b/modules/xz-embedded/README.mozilla
@@ -1,14 +1,14 @@
This is the XZ Embedded decompression library from
-http://tukaani.org/xz/embedded.html.
+https://tukaani.org/xz/embedded.html.
Upstream code can be viewed at
- http://git.tukaani.org/xz-embedded.git
+ https://git.tukaani.org/xz-embedded.git
and cloned by
- git clone http://git.tukaani.org/xz-embedded.git
+ git clone https://git.tukaani.org/xz-embedded.git
The in-tree copy is updated by running
sh update.sh
from within the modules/xz-embedded directory.
-Current version: [e75f4eb79165213a02d567940d344f5c2ff1be03].
+Current version: [3f438e15109229bb14ab45f285f4bff5412a9542].
diff --git a/modules/xz-embedded/moz.build b/modules/xz-embedded/moz.build
index fa1e5fc468..9806dca1ea 100644
--- a/modules/xz-embedded/moz.build
+++ b/modules/xz-embedded/moz.build
@@ -29,4 +29,7 @@ elif '86' in CONFIG['TARGET_CPU']:
DEFINES['XZ_USE_CRC64'] = 1
+if CONFIG['OS_ARCH'] == 'WINNT':
+ USE_STATIC_LIBS = True
+
Library('xz-embedded')
diff --git a/modules/xz-embedded/src/xz.h b/modules/xz-embedded/src/xz.h
index 0a4b38d33c..f3801eb6f5 100644
--- a/modules/xz-embedded/src/xz.h
+++ b/modules/xz-embedded/src/xz.h
@@ -2,7 +2,7 @@
* XZ decompressor
*
* Authors: Lasse Collin <lasse.collin@tukaani.org>
- * Igor Pavlov <http://7-zip.org/>
+ * Igor Pavlov <https://7-zip.org/>
*
* This file has been put into the public domain.
* You can do whatever you want with this file.
@@ -32,7 +32,7 @@ extern "C" {
* enum xz_mode - Operation mode
*
* @XZ_SINGLE: Single-call mode. This uses less RAM than
- * than multi-call modes, because the LZMA2
+ * multi-call modes, because the LZMA2
* dictionary doesn't need to be allocated as
* part of the decoder state. All required data
* structures are allocated at initialization,
@@ -198,7 +198,7 @@ struct xz_dec;
XZ_EXTERN struct xz_dec *xz_dec_init(enum xz_mode mode, uint32_t dict_max);
/**
- * xz_dec_run() - Run the XZ decoder
+ * xz_dec_run() - Run the XZ decoder for a single XZ stream
* @s: Decoder state allocated using xz_dec_init()
* @b: Input and output buffers
*
@@ -214,10 +214,52 @@ XZ_EXTERN struct xz_dec *xz_dec_init(enum xz_mode mode, uint32_t dict_max);
* cannot give the single-call decoder a too small buffer and then expect to
* get that amount valid data from the beginning of the stream. You must use
* the multi-call decoder if you don't want to uncompress the whole stream.
+ *
+ * Use xz_dec_run() when XZ data is stored inside some other file format.
+ * The decoding will stop after one XZ stream has been decompresed. To
+ * decompress regular .xz files which might have multiple concatenated
+ * streams, use xz_dec_catrun() instead.
*/
XZ_EXTERN enum xz_ret xz_dec_run(struct xz_dec *s, struct xz_buf *b);
/**
+ * xz_dec_catrun() - Run the XZ decoder with support for concatenated streams
+ * @s: Decoder state allocated using xz_dec_init()
+ * @b: Input and output buffers
+ * @finish: This is an int instead of bool to avoid requiring stdbool.h.
+ * As long as more input might be coming, finish must be false.
+ * When the caller knows that it has provided all the input to
+ * the decoder (some possibly still in b->in), it must set finish
+ * to true. Only when finish is true can this function return
+ * XZ_STREAM_END to indicate successful decompression of the
+ * file. In single-call mode (XZ_SINGLE) finish is assumed to
+ * always be true; the caller-provided value is ignored.
+ *
+ * This is like xz_dec_run() except that this makes it easy to decode .xz
+ * files with multiple streams (multiple .xz files concatenated as is).
+ * The rarely-used Stream Padding feature is supported too, that is, there
+ * can be null bytes after or between the streams. The number of null bytes
+ * must be a multiple of four.
+ *
+ * When finish is false and b->in_pos == b->in_size, it is possible that
+ * XZ_BUF_ERROR isn't returned even when no progress is possible (XZ_OK is
+ * returned instead). This shouldn't matter because in this situation a
+ * reasonable caller will attempt to provide more input or set finish to
+ * true for the next xz_dec_catrun() call anyway.
+ *
+ * For any struct xz_dec that has been initialized for multi-call mode:
+ * Once decoding has been started with xz_dec_run() or xz_dec_catrun(),
+ * the same function must be used until xz_dec_reset() or xz_dec_end().
+ * Switching between the two decoding functions without resetting results
+ * in undefined behavior.
+ *
+ * xz_dec_catrun() is only available if XZ_DEC_CONCATENATED was defined
+ * at compile time.
+ */
+XZ_EXTERN enum xz_ret xz_dec_catrun(struct xz_dec *s, struct xz_buf *b,
+ int finish);
+
+/**
* xz_dec_reset() - Reset an already allocated decoder state
* @s: Decoder state allocated using xz_dec_init()
*
@@ -238,6 +280,112 @@ XZ_EXTERN void xz_dec_reset(struct xz_dec *s);
XZ_EXTERN void xz_dec_end(struct xz_dec *s);
/*
+ * Decompressor for MicroLZMA, an LZMA variant with a very minimal header.
+ * See xz_dec_microlzma_alloc() below for details.
+ *
+ * These functions aren't used or available in preboot code and thus aren't
+ * marked with XZ_EXTERN. This avoids warnings about static functions that
+ * are never defined.
+ */
+/**
+ * struct xz_dec_microlzma - Opaque type to hold the MicroLZMA decoder state
+ */
+struct xz_dec_microlzma;
+
+/**
+ * xz_dec_microlzma_alloc() - Allocate memory for the MicroLZMA decoder
+ * @mode XZ_SINGLE or XZ_PREALLOC
+ * @dict_size LZMA dictionary size. This must be at least 4 KiB and
+ * at most 3 GiB.
+ *
+ * In contrast to xz_dec_init(), this function only allocates the memory
+ * and remembers the dictionary size. xz_dec_microlzma_reset() must be used
+ * before calling xz_dec_microlzma_run().
+ *
+ * The amount of allocated memory is a little less than 30 KiB with XZ_SINGLE.
+ * With XZ_PREALLOC also a dictionary buffer of dict_size bytes is allocated.
+ *
+ * On success, xz_dec_microlzma_alloc() returns a pointer to
+ * struct xz_dec_microlzma. If memory allocation fails or
+ * dict_size is invalid, NULL is returned.
+ *
+ * The compressed format supported by this decoder is a raw LZMA stream
+ * whose first byte (always 0x00) has been replaced with bitwise-negation
+ * of the LZMA properties (lc/lp/pb) byte. For example, if lc/lp/pb is
+ * 3/0/2, the first byte is 0xA2. This way the first byte can never be 0x00.
+ * Just like with LZMA2, lc + lp <= 4 must be true. The LZMA end-of-stream
+ * marker must not be used. The unused values are reserved for future use.
+ * This MicroLZMA header format was created for use in EROFS but may be used
+ * by others too.
+ */
+extern struct xz_dec_microlzma *xz_dec_microlzma_alloc(enum xz_mode mode,
+ uint32_t dict_size);
+
+/**
+ * xz_dec_microlzma_reset() - Reset the MicroLZMA decoder state
+ * @s Decoder state allocated using xz_dec_microlzma_alloc()
+ * @comp_size Compressed size of the input stream
+ * @uncomp_size Uncompressed size of the input stream. A value smaller
+ * than the real uncompressed size of the input stream can
+ * be specified if uncomp_size_is_exact is set to false.
+ * uncomp_size can never be set to a value larger than the
+ * expected real uncompressed size because it would eventually
+ * result in XZ_DATA_ERROR.
+ * @uncomp_size_is_exact This is an int instead of bool to avoid
+ * requiring stdbool.h. This should normally be set to true.
+ * When this is set to false, error detection is weaker.
+ */
+extern void xz_dec_microlzma_reset(struct xz_dec_microlzma *s,
+ uint32_t comp_size, uint32_t uncomp_size,
+ int uncomp_size_is_exact);
+
+/**
+ * xz_dec_microlzma_run() - Run the MicroLZMA decoder
+ * @s Decoder state initialized using xz_dec_microlzma_reset()
+ * @b: Input and output buffers
+ *
+ * This works similarly to xz_dec_run() with a few important differences.
+ * Only the differences are documented here.
+ *
+ * The only possible return values are XZ_OK, XZ_STREAM_END, and
+ * XZ_DATA_ERROR. This function cannot return XZ_BUF_ERROR: if no progress
+ * is possible due to lack of input data or output space, this function will
+ * keep returning XZ_OK. Thus, the calling code must be written so that it
+ * will eventually provide input and output space matching (or exceeding)
+ * comp_size and uncomp_size arguments given to xz_dec_microlzma_reset().
+ * If the caller cannot do this (for example, if the input file is truncated
+ * or otherwise corrupt), the caller must detect this error by itself to
+ * avoid an infinite loop.
+ *
+ * If the compressed data seems to be corrupt, XZ_DATA_ERROR is returned.
+ * This can happen also when incorrect dictionary, uncompressed, or
+ * compressed sizes have been specified.
+ *
+ * With XZ_PREALLOC only: As an extra feature, b->out may be NULL to skip over
+ * uncompressed data. This way the caller doesn't need to provide a temporary
+ * output buffer for the bytes that will be ignored.
+ *
+ * With XZ_SINGLE only: In contrast to xz_dec_run(), the return value XZ_OK
+ * is also possible and thus XZ_SINGLE is actually a limited multi-call mode.
+ * After XZ_OK the bytes decoded so far may be read from the output buffer.
+ * It is possible to continue decoding but the variables b->out and b->out_pos
+ * MUST NOT be changed by the caller. Increasing the value of b->out_size is
+ * allowed to make more output space available; one doesn't need to provide
+ * space for the whole uncompressed data on the first call. The input buffer
+ * may be changed normally like with XZ_PREALLOC. This way input data can be
+ * provided from non-contiguous memory.
+ */
+extern enum xz_ret xz_dec_microlzma_run(struct xz_dec_microlzma *s,
+ struct xz_buf *b);
+
+/**
+ * xz_dec_microlzma_end() - Free the memory allocated for the decoder state
+ * @s: Decoder state allocated using xz_dec_microlzma_alloc().
+ * If s is NULL, this function does nothing.
+ */
+extern void xz_dec_microlzma_end(struct xz_dec_microlzma *s);
+
+/*
* Standalone build (userspace build or in-kernel build for boot time use)
* needs a CRC32 implementation. For normal in-kernel use, kernel's own
* CRC32 module is used instead, and users of this module don't need to
diff --git a/modules/xz-embedded/src/xz_config.h b/modules/xz-embedded/src/xz_config.h
index eb9dac1a4b..ee590d7ea6 100644
--- a/modules/xz-embedded/src/xz_config.h
+++ b/modules/xz-embedded/src/xz_config.h
@@ -10,6 +10,9 @@
#ifndef XZ_CONFIG_H
#define XZ_CONFIG_H
+/* Uncomment to enable building of xz_dec_catrun(). */
+/* #define XZ_DEC_CONCATENATED */
+
/* Uncomment to enable CRC64 support. */
/* #define XZ_USE_CRC64 */
diff --git a/modules/xz-embedded/src/xz_crc32.c b/modules/xz-embedded/src/xz_crc32.c
index 34532d14fd..5627b00fca 100644
--- a/modules/xz-embedded/src/xz_crc32.c
+++ b/modules/xz-embedded/src/xz_crc32.c
@@ -2,7 +2,7 @@
* CRC32 using the polynomial from IEEE-802.3
*
* Authors: Lasse Collin <lasse.collin@tukaani.org>
- * Igor Pavlov <http://7-zip.org/>
+ * Igor Pavlov <https://7-zip.org/>
*
* This file has been put into the public domain.
* You can do whatever you want with this file.
diff --git a/modules/xz-embedded/src/xz_crc64.c b/modules/xz-embedded/src/xz_crc64.c
index ca1caee899..60c40f67e7 100644
--- a/modules/xz-embedded/src/xz_crc64.c
+++ b/modules/xz-embedded/src/xz_crc64.c
@@ -4,7 +4,7 @@
* This file is similar to xz_crc32.c. See the comments there.
*
* Authors: Lasse Collin <lasse.collin@tukaani.org>
- * Igor Pavlov <http://7-zip.org/>
+ * Igor Pavlov <https://7-zip.org/>
*
* This file has been put into the public domain.
* You can do whatever you want with this file.
@@ -20,7 +20,11 @@ STATIC_RW_DATA uint64_t xz_crc64_table[256];
XZ_EXTERN void xz_crc64_init(void)
{
- const uint64_t poly = 0xC96C5795D7870F42;
+ /*
+ * The ULL suffix is needed for -std=gnu89 compatibility
+ * on 32-bit platforms.
+ */
+ const uint64_t poly = 0xC96C5795D7870F42ULL;
uint32_t i;
uint32_t j;
diff --git a/modules/xz-embedded/src/xz_dec_bcj.c b/modules/xz-embedded/src/xz_dec_bcj.c
index a768e6d28b..ef449e97d1 100644
--- a/modules/xz-embedded/src/xz_dec_bcj.c
+++ b/modules/xz-embedded/src/xz_dec_bcj.c
@@ -2,7 +2,7 @@
* Branch/Call/Jump (BCJ) filter decoders
*
* Authors: Lasse Collin <lasse.collin@tukaani.org>
- * Igor Pavlov <http://7-zip.org/>
+ * Igor Pavlov <https://7-zip.org/>
*
* This file has been put into the public domain.
* You can do whatever you want with this file.
@@ -422,7 +422,7 @@ XZ_EXTERN enum xz_ret xz_dec_bcj_run(struct xz_dec_bcj *s,
/*
* Flush pending already filtered data to the output buffer. Return
- * immediatelly if we couldn't flush everything, or if the next
+ * immediately if we couldn't flush everything, or if the next
* filter in the chain had already returned XZ_STREAM_END.
*/
if (s->temp.filtered > 0) {
diff --git a/modules/xz-embedded/src/xz_dec_lzma2.c b/modules/xz-embedded/src/xz_dec_lzma2.c
index 08c3c80499..c929f1c82b 100644
--- a/modules/xz-embedded/src/xz_dec_lzma2.c
+++ b/modules/xz-embedded/src/xz_dec_lzma2.c
@@ -2,7 +2,7 @@
* LZMA2 decoder
*
* Authors: Lasse Collin <lasse.collin@tukaani.org>
- * Igor Pavlov <http://7-zip.org/>
+ * Igor Pavlov <https://7-zip.org/>
*
* This file has been put into the public domain.
* You can do whatever you want with this file.
@@ -147,8 +147,8 @@ struct lzma_dec {
/*
* LZMA properties or related bit masks (number of literal
- * context bits, a mask dervied from the number of literal
- * position bits, and a mask dervied from the number
+ * context bits, a mask derived from the number of literal
+ * position bits, and a mask derived from the number
* position bits)
*/
uint32_t lc;
@@ -248,6 +248,10 @@ struct lzma2_dec {
* before the first LZMA chunk.
*/
bool need_props;
+
+#ifdef XZ_DEC_MICROLZMA
+ bool pedantic_microlzma;
+#endif
};
struct xz_dec_lzma2 {
@@ -387,7 +391,14 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
*left -= copy_size;
- memcpy(dict->buf + dict->pos, b->in + b->in_pos, copy_size);
+ /*
+ * If doing in-place decompression in single-call mode and the
+ * uncompressed size of the file is larger than the caller
+ * thought (i.e. it is invalid input!), the buffers below may
+ * overlap and cause undefined behavior with memcpy().
+ * With valid inputs memcpy() would be fine here.
+ */
+ memmove(dict->buf + dict->pos, b->in + b->in_pos, copy_size);
dict->pos += copy_size;
if (dict->full < dict->pos)
@@ -397,7 +408,11 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
if (dict->pos == dict->end)
dict->pos = 0;
- memcpy(b->out + b->out_pos, b->in + b->in_pos,
+ /*
+ * Like above but for multi-call mode: use memmove()
+ * to avoid undefined behavior with invalid input.
+ */
+ memmove(b->out + b->out_pos, b->in + b->in_pos,
copy_size);
}
@@ -408,6 +423,12 @@ static void dict_uncompressed(struct dictionary *dict, struct xz_buf *b,
}
}
+#ifdef XZ_DEC_MICROLZMA
+# define DICT_FLUSH_SUPPORTS_SKIPPING true
+#else
+# define DICT_FLUSH_SUPPORTS_SKIPPING false
+#endif
+
/*
* Flush pending data from dictionary to b->out. It is assumed that there is
* enough space in b->out. This is guaranteed because caller uses dict_limit()
@@ -421,8 +442,19 @@ static uint32_t dict_flush(struct dictionary *dict, struct xz_buf *b)
if (dict->pos == dict->end)
dict->pos = 0;
- memcpy(b->out + b->out_pos, dict->buf + dict->start,
- copy_size);
+ /*
+ * These buffers cannot overlap even if doing in-place
+ * decompression because in multi-call mode dict->buf
+ * has been allocated by us in this file; it's not
+ * provided by the caller like in single-call mode.
+ *
+ * With MicroLZMA, b->out can be NULL to skip bytes that
+ * the caller doesn't need. This cannot be done with XZ
+ * because it would break BCJ filters.
+ */
+ if (!DICT_FLUSH_SUPPORTS_SKIPPING || b->out != NULL)
+ memcpy(b->out + b->out_pos, dict->buf + dict->start,
+ copy_size);
}
dict->start = dict->pos;
@@ -484,11 +516,11 @@ static __always_inline void rc_normalize(struct rc_dec *rc)
}
/*
- * Decode one bit. In some versions, this function has been splitted in three
+ * Decode one bit. In some versions, this function has been split in three
* functions so that the compiler is supposed to be able to more easily avoid
* an extra branch. In this particular version of the LZMA decoder, this
* doesn't seem to be a good idea (tested with GCC 3.3.6, 3.4.6, and 4.3.3
- * on x86). Using a non-splitted version results in nicer looking code too.
+ * on x86). Using a non-split version results in nicer looking code too.
*
* NOTE: This must return an int. Do not make it return a bool or the speed
* of the code generated by GCC 3.x decreases 10-15 %. (GCC 4.3 doesn't care,
@@ -761,7 +793,7 @@ static bool lzma_main(struct xz_dec_lzma2 *s)
}
/*
- * Reset the LZMA decoder and range decoder state. Dictionary is nore reset
+ * Reset the LZMA decoder and range decoder state. Dictionary is not reset
* here, because LZMA state may be reset without resetting the dictionary.
*/
static void lzma_reset(struct xz_dec_lzma2 *s)
@@ -774,6 +806,7 @@ static void lzma_reset(struct xz_dec_lzma2 *s)
s->lzma.rep1 = 0;
s->lzma.rep2 = 0;
s->lzma.rep3 = 0;
+ s->lzma.len = 0;
/*
* All probabilities are initialized to the same value. This hack
@@ -1146,6 +1179,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)
if (DEC_IS_DYNALLOC(s->dict.mode)) {
if (s->dict.allocated < s->dict.size) {
+ s->dict.allocated = s->dict.size;
vfree(s->dict.buf);
s->dict.buf = vmalloc(s->dict.size);
if (s->dict.buf == NULL) {
@@ -1156,8 +1190,6 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, uint8_t props)
}
}
- s->lzma.len = 0;
-
s->lzma2.sequence = SEQ_CONTROL;
s->lzma2.need_dict_reset = true;
@@ -1173,3 +1205,140 @@ XZ_EXTERN void xz_dec_lzma2_end(struct xz_dec_lzma2 *s)
kfree(s);
}
+
+#ifdef XZ_DEC_MICROLZMA
+/* This is a wrapper struct to have a nice struct name in the public API. */
+struct xz_dec_microlzma {
+ struct xz_dec_lzma2 s;
+};
+
+enum xz_ret xz_dec_microlzma_run(struct xz_dec_microlzma *s_ptr,
+ struct xz_buf *b)
+{
+ struct xz_dec_lzma2 *s = &s_ptr->s;
+
+ /*
+ * sequence is SEQ_PROPERTIES before the first input byte,
+ * SEQ_LZMA_PREPARE until a total of five bytes have been read,
+ * and SEQ_LZMA_RUN for the rest of the input stream.
+ */
+ if (s->lzma2.sequence != SEQ_LZMA_RUN) {
+ if (s->lzma2.sequence == SEQ_PROPERTIES) {
+ /* One byte is needed for the props. */
+ if (b->in_pos >= b->in_size)
+ return XZ_OK;
+
+ /*
+ * Don't increment b->in_pos here. The same byte is
+ * also passed to rc_read_init() which will ignore it.
+ */
+ if (!lzma_props(s, ~b->in[b->in_pos]))
+ return XZ_DATA_ERROR;
+
+ s->lzma2.sequence = SEQ_LZMA_PREPARE;
+ }
+
+ /*
+ * xz_dec_microlzma_reset() doesn't validate the compressed
+ * size so we do it here. We have to limit the maximum size
+ * to avoid integer overflows in lzma2_lzma(). 3 GiB is a nice
+ * round number and much more than users of this code should
+ * ever need.
+ */
+ if (s->lzma2.compressed < RC_INIT_BYTES
+ || s->lzma2.compressed > (3U << 30))
+ return XZ_DATA_ERROR;
+
+ if (!rc_read_init(&s->rc, b))
+ return XZ_OK;
+
+ s->lzma2.compressed -= RC_INIT_BYTES;
+ s->lzma2.sequence = SEQ_LZMA_RUN;
+
+ dict_reset(&s->dict, b);
+ }
+
+ /* This is to allow increasing b->out_size between calls. */
+ if (DEC_IS_SINGLE(s->dict.mode))
+ s->dict.end = b->out_size - b->out_pos;
+
+ while (true) {
+ dict_limit(&s->dict, min_t(size_t, b->out_size - b->out_pos,
+ s->lzma2.uncompressed));
+
+ if (!lzma2_lzma(s, b))
+ return XZ_DATA_ERROR;
+
+ s->lzma2.uncompressed -= dict_flush(&s->dict, b);
+
+ if (s->lzma2.uncompressed == 0) {
+ if (s->lzma2.pedantic_microlzma) {
+ if (s->lzma2.compressed > 0 || s->lzma.len > 0
+ || !rc_is_finished(&s->rc))
+ return XZ_DATA_ERROR;
+ }
+
+ return XZ_STREAM_END;
+ }
+
+ if (b->out_pos == b->out_size)
+ return XZ_OK;
+
+ if (b->in_pos == b->in_size
+ && s->temp.size < s->lzma2.compressed)
+ return XZ_OK;
+ }
+}
+
+struct xz_dec_microlzma *xz_dec_microlzma_alloc(enum xz_mode mode,
+ uint32_t dict_size)
+{
+ struct xz_dec_microlzma *s;
+
+ /* Restrict dict_size to the same range as in the LZMA2 code. */
+ if (dict_size < 4096 || dict_size > (3U << 30))
+ return NULL;
+
+ s = kmalloc(sizeof(*s), GFP_KERNEL);
+ if (s == NULL)
+ return NULL;
+
+ s->s.dict.mode = mode;
+ s->s.dict.size = dict_size;
+
+ if (DEC_IS_MULTI(mode)) {
+ s->s.dict.end = dict_size;
+
+ s->s.dict.buf = vmalloc(dict_size);
+ if (s->s.dict.buf == NULL) {
+ kfree(s);
+ return NULL;
+ }
+ }
+
+ return s;
+}
+
+void xz_dec_microlzma_reset(struct xz_dec_microlzma *s, uint32_t comp_size,
+ uint32_t uncomp_size, int uncomp_size_is_exact)
+{
+ /*
+ * comp_size is validated in xz_dec_microlzma_run().
+ * uncomp_size can safely be anything.
+ */
+ s->s.lzma2.compressed = comp_size;
+ s->s.lzma2.uncompressed = uncomp_size;
+ s->s.lzma2.pedantic_microlzma = uncomp_size_is_exact;
+
+ s->s.lzma2.sequence = SEQ_PROPERTIES;
+ s->s.temp.size = 0;
+}
+
+void xz_dec_microlzma_end(struct xz_dec_microlzma *s)
+{
+ if (DEC_IS_MULTI(s->s.dict.mode))
+ vfree(s->s.dict.buf);
+
+ kfree(s);
+}
+#endif
diff --git a/modules/xz-embedded/src/xz_dec_stream.c b/modules/xz-embedded/src/xz_dec_stream.c
index d6525506a1..2c41f5f1b0 100644
--- a/modules/xz-embedded/src/xz_dec_stream.c
+++ b/modules/xz-embedded/src/xz_dec_stream.c
@@ -35,7 +35,8 @@ struct xz_dec {
SEQ_INDEX,
SEQ_INDEX_PADDING,
SEQ_INDEX_CRC32,
- SEQ_STREAM_FOOTER
+ SEQ_STREAM_FOOTER,
+ SEQ_STREAM_PADDING
} sequence;
/* Position in variable-length integers and Check fields */
@@ -423,12 +424,12 @@ static enum xz_ret dec_stream_header(struct xz_dec *s)
* check types too, but then the check won't be verified and
* a warning (XZ_UNSUPPORTED_CHECK) will be given.
*/
+ if (s->temp.buf[HEADER_MAGIC_SIZE + 1] > XZ_CHECK_MAX)
+ return XZ_OPTIONS_ERROR;
+
s->check_type = s->temp.buf[HEADER_MAGIC_SIZE + 1];
#ifdef XZ_DEC_ANY_CHECK
- if (s->check_type > XZ_CHECK_MAX)
- return XZ_OPTIONS_ERROR;
-
if (s->check_type > XZ_CHECK_CRC32 && !IS_CRC64(s->check_type))
return XZ_UNSUPPORTED_CHECK;
#else
@@ -604,6 +605,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
if (ret != XZ_OK)
return ret;
+ /* Fall through */
+
case SEQ_BLOCK_START:
/* We need one byte of input to continue. */
if (b->in_pos == b->in_size)
@@ -627,6 +630,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
s->temp.pos = 0;
s->sequence = SEQ_BLOCK_HEADER;
+ /* Fall through */
+
case SEQ_BLOCK_HEADER:
if (!fill_temp(s, b))
return XZ_OK;
@@ -637,6 +642,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
s->sequence = SEQ_BLOCK_UNCOMPRESS;
+ /* Fall through */
+
case SEQ_BLOCK_UNCOMPRESS:
ret = dec_block(s, b);
if (ret != XZ_STREAM_END)
@@ -644,6 +651,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
s->sequence = SEQ_BLOCK_PADDING;
+ /* Fall through */
+
case SEQ_BLOCK_PADDING:
/*
* Size of Compressed Data + Block Padding
@@ -664,6 +673,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
s->sequence = SEQ_BLOCK_CHECK;
+ /* Fall through */
+
case SEQ_BLOCK_CHECK:
if (s->check_type == XZ_CHECK_CRC32) {
ret = crc_validate(s, b, 32);
@@ -691,6 +702,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
s->sequence = SEQ_INDEX_PADDING;
+ /* Fall through */
+
case SEQ_INDEX_PADDING:
while ((s->index.size + (b->in_pos - s->in_start))
& 3) {
@@ -713,6 +726,8 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
s->sequence = SEQ_INDEX_CRC32;
+ /* Fall through */
+
case SEQ_INDEX_CRC32:
ret = crc_validate(s, b, 32);
if (ret != XZ_STREAM_END)
@@ -721,11 +736,17 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
s->temp.size = STREAM_HEADER_SIZE;
s->sequence = SEQ_STREAM_FOOTER;
+ /* Fall through */
+
case SEQ_STREAM_FOOTER:
if (!fill_temp(s, b))
return XZ_OK;
return dec_stream_footer(s);
+
+ case SEQ_STREAM_PADDING:
+ /* Never reached, only silencing a warning */
+ break;
}
}
@@ -793,6 +814,79 @@ XZ_EXTERN enum xz_ret xz_dec_run(struct xz_dec *s, struct xz_buf *b)
return ret;
}
+#ifdef XZ_DEC_CONCATENATED
+XZ_EXTERN enum xz_ret xz_dec_catrun(struct xz_dec *s, struct xz_buf *b,
+ int finish)
+{
+ enum xz_ret ret;
+
+ if (DEC_IS_SINGLE(s->mode)) {
+ xz_dec_reset(s);
+ finish = true;
+ }
+
+ while (true) {
+ if (s->sequence == SEQ_STREAM_PADDING) {
+ /*
+ * Skip Stream Padding. Its size must be a multiple
+ * of four bytes which is tracked with s->pos.
+ */
+ while (true) {
+ if (b->in_pos == b->in_size) {
+ /*
+ * Note that if we are repeatedly
+ * given no input and finish is false,
+ * we will keep returning XZ_OK even
+ * though no progress is being made.
+ * The lack of XZ_BUF_ERROR support
+ * isn't a problem here because a
+ * reasonable caller will eventually
+ * provide more input or set finish
+ * to true.
+ */
+ if (!finish)
+ return XZ_OK;
+
+ if (s->pos != 0)
+ return XZ_DATA_ERROR;
+
+ return XZ_STREAM_END;
+ }
+
+ if (b->in[b->in_pos] != 0x00) {
+ if (s->pos != 0)
+ return XZ_DATA_ERROR;
+
+ break;
+ }
+
+ ++b->in_pos;
+ s->pos = (s->pos + 1) & 3;
+ }
+
+ /*
+ * More input remains. It should be a new Stream.
+ *
+ * In single-call mode xz_dec_run() will always call
+ * xz_dec_reset(). Thus, we need to do it here only
+ * in multi-call mode.
+ */
+ if (DEC_IS_MULTI(s->mode))
+ xz_dec_reset(s);
+ }
+
+ ret = xz_dec_run(s, b);
+
+ if (ret != XZ_STREAM_END)
+ break;
+
+ s->sequence = SEQ_STREAM_PADDING;
+ }
+
+ return ret;
+}
+#endif
+
XZ_EXTERN struct xz_dec *xz_dec_init(enum xz_mode mode, uint32_t dict_max)
{
struct xz_dec *s = kmalloc(sizeof(*s), GFP_KERNEL);
diff --git a/modules/xz-embedded/src/xz_lzma2.h b/modules/xz-embedded/src/xz_lzma2.h
index 071d67bee9..92d852d4f8 100644
--- a/modules/xz-embedded/src/xz_lzma2.h
+++ b/modules/xz-embedded/src/xz_lzma2.h
@@ -2,7 +2,7 @@
* LZMA2 definitions
*
* Authors: Lasse Collin <lasse.collin@tukaani.org>
- * Igor Pavlov <http://7-zip.org/>
+ * Igor Pavlov <https://7-zip.org/>
*
* This file has been put into the public domain.
* You can do whatever you want with this file.
diff --git a/modules/xz-embedded/src/xz_private.h b/modules/xz-embedded/src/xz_private.h
index 482b90f363..d9fd49b45f 100644
--- a/modules/xz-embedded/src/xz_private.h
+++ b/modules/xz-embedded/src/xz_private.h
@@ -37,6 +37,9 @@
# ifdef CONFIG_XZ_DEC_SPARC
# define XZ_DEC_SPARC
# endif
+# ifdef CONFIG_XZ_DEC_MICROLZMA
+# define XZ_DEC_MICROLZMA
+# endif
# define memeq(a, b, size) (memcmp(a, b, size) == 0)
# define memzero(buf, size) memset(buf, 0, size)
# endif
diff --git a/modules/xz-embedded/src/xz_stream.h b/modules/xz-embedded/src/xz_stream.h
index 66cb5a7055..430bb3a0d1 100644
--- a/modules/xz-embedded/src/xz_stream.h
+++ b/modules/xz-embedded/src/xz_stream.h
@@ -19,7 +19,7 @@
/*
* See the .xz file format specification at
- * http://tukaani.org/xz/xz-file-format.txt
+ * https://tukaani.org/xz/xz-file-format.txt
* to understand the container format.
*/
diff --git a/modules/xz-embedded/update.sh b/modules/xz-embedded/update.sh
index ecc1e3610e..37280bba12 100755
--- a/modules/xz-embedded/update.sh
+++ b/modules/xz-embedded/update.sh
@@ -4,11 +4,12 @@
MY_TEMP_DIR=$(mktemp -d -t xz-embedded_update.XXXXXX) || exit 1
-git clone http://git.tukaani.org/xz-embedded.git ${MY_TEMP_DIR}/xz-embedded
+git clone https://git.tukaani.org/xz-embedded.git ${MY_TEMP_DIR}/xz-embedded
COMMIT=$(git -C ${MY_TEMP_DIR}/xz-embedded rev-parse HEAD)
cd $(dirname $0)
-perl -p -i -e "s/\[commit [0-9a-f]{40}\]/[${COMMIT}]/" README.mozilla;
+perl -p -i -e "s/\[[0-9a-f]{40}\]/[${COMMIT}]/" README.mozilla;
+rm -f README.mozilla.bak;
rm -rf src
mkdir src
@@ -23,7 +24,6 @@ mv ${MY_TEMP_DIR}/xz-embedded/linux/lib/xz/xz_dec_bcj.c src/
mv ${MY_TEMP_DIR}/xz-embedded/linux/lib/xz/xz_dec_stream.c src/
mv ${MY_TEMP_DIR}/xz-embedded/linux/lib/xz/xz_dec_lzma2.c src/
rm -rf ${MY_TEMP_DIR}
-hg addremove src
echo "###"
echo "### Updated xz-embedded/src to $COMMIT."
diff --git a/netwerk/base/nsURLParsers.cpp b/netwerk/base/nsURLParsers.cpp
index b75ee0c4d4..ed4a216a88 100644
--- a/netwerk/base/nsURLParsers.cpp
+++ b/netwerk/base/nsURLParsers.cpp
@@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include <string.h>
+#include <limits>
#include "mozilla/RangedPtr.h"
diff --git a/old-configure.in b/old-configure.in
index a626a63ed9..a50baade18 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -4170,19 +4170,6 @@ dnl ========================================================
MOZ_ARG_HEADER(Compiler Options)
dnl ========================================================
-dnl Check for gcc -pipe support
-dnl ========================================================
-AC_MSG_CHECKING([for -pipe support])
-if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
- dnl Any gcc that supports firefox supports -pipe.
- CFLAGS="$CFLAGS -pipe"
- CXXFLAGS="$CXXFLAGS -pipe"
- AC_MSG_RESULT([yes])
-else
- AC_MSG_RESULT([no])
-fi
-
-dnl ========================================================
dnl Profile guided optimization (gcc checks)
dnl ========================================================
dnl Test for profiling options
diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py
index e299fca18a..4f58a2a33d 100644
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -1086,8 +1086,14 @@ class L10n_Package(MachCommandBase):
@Command('langpack', category='post-build',
description='Build and package l10n as a language pack.')
- def l10n_package(self):
- return self._run_make(directory=".", target='l10n-package', ensure_exit_code=False)
+ @CommandArgument('-v', '--verbose', action='store_true',
+ help='Verbose output for what commands the packaging process is running.')
+ def l10n_package(self, verbose=False):
+ ret = self._run_make(directory=".", target='l10n-package',
+ silent=not verbose, ensure_exit_code=False)
+ if ret == 0:
+ self.notify('Packaging complete')
+ return ret
@CommandProvider
class Package(MachCommandBase):
@@ -1134,8 +1140,13 @@ class Mar(MachCommandBase):
@Command('mar', category='post-build',
description='Create the mar file for the built product for distribution.')
- def mar(self):
- return self._run_make(directory="./tools/update-packaging/", target='', ensure_exit_code=False)
+ @CommandArgument('--bz2', action='store_true',
+ help='Compress the mar package with old-style bz2 instead of xz')
+ def mar(self, bz2):
+ if bz2:
+ return self._run_make(directory="./tools/update-packaging/", target='mar-package-bz2', ensure_exit_code=False)
+ else:
+ return self._run_make(directory="./tools/update-packaging/", target='mar-package', ensure_exit_code=False)
@CommandProvider
class Install(MachCommandBase):
diff --git a/python/pyyaml/ext/_yaml.c b/python/pyyaml/ext/_yaml.c
index f4a5bc5242..8a66c0fd3e 100644
--- a/python/pyyaml/ext/_yaml.c
+++ b/python/pyyaml/ext/_yaml.c
@@ -501,14 +501,8 @@ bad:
#ifdef __GNUC__
- /* Test for GCC > 2.95 */
- #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
- #define likely(x) __builtin_expect(!!(x), 1)
- #define unlikely(x) __builtin_expect(!!(x), 0)
- #else /* __GNUC__ > 2 ... */
- #define likely(x) (x)
- #define unlikely(x) (x)
- #endif /* __GNUC__ > 2 ... */
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build
index e4ed6bcedb..ea9dcbfb74 100644
--- a/toolkit/components/downloads/moz.build
+++ b/toolkit/components/downloads/moz.build
@@ -25,7 +25,7 @@ if CONFIG['OS_ARCH'] == 'WINNT':
# The Communicator Downloads Manager uses its own DownloadManagerUI
# component and it can't be guaranteed that its implimentation will override
# toolkit's so don't include toolkit's
-if not CONFIG['MOZ_SUITE'] and not CONFIG['BINOC_COMM_DLMGR']:
+if not CONFIG['MOZ_SUITE']:
EXTRA_COMPONENTS += [
'nsDownloadManagerUI.js',
'nsDownloadManagerUI.manifest',
diff --git a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd
index 098896d99e..9ec6eaa12d 100644
--- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd
+++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.dtd
@@ -207,6 +207,9 @@
<!ENTITY addon.loadingReleaseNotes.label "Loading…">
<!ENTITY addon.errorLoadingReleaseNotes.label "Sorry, but there was an error loading the release notes.">
+<!ENTITY addon.nativeAddon "This add-on directly targets &brandFullName;">
+<!ENTITY addon.compatAddon "This add-on targets Mozilla Firefox and runs in compatibility mode">
+
<!ENTITY addon.createdBy.label "By ">
<!ENTITY eula.title "End-User License Agreement">
diff --git a/toolkit/modules/ResetProfile.jsm b/toolkit/modules/ResetProfile.jsm
index 25ab8b9661..bc489e22c4 100644
--- a/toolkit/modules/ResetProfile.jsm
+++ b/toolkit/modules/ResetProfile.jsm
@@ -17,7 +17,7 @@ const MOZ_BUILD_APP = "browser";
#elifdef MOZ_THUNDERBIRD
const MOZ_APP_NAME = "thunderbird";
const MOZ_BUILD_APP = "mail";
-#elif defined(MOZ_SUITE) && !defined(BINOC_BOREALIS)
+#elif defined(MOZ_SUITE)
const MOZ_APP_NAME = "seamonkey";
const MOZ_BUILD_APP = "suite";
#else
diff --git a/toolkit/mozapps/extensions/content/extensions.css b/toolkit/mozapps/extensions/content/extensions.css
index 51828d544c..41c1405657 100644
--- a/toolkit/mozapps/extensions/content/extensions.css
+++ b/toolkit/mozapps/extensions/content/extensions.css
@@ -152,6 +152,8 @@ setting[type="menulist"] {
.addon:not([notification="info"]) .info,
.addon:not([pending]) .pending,
.addon:not([upgrade="true"]) .update-postfix,
+.addon:not([native="true"]) .nativeAddon,
+.addon:not([native="false"]) .compatAddon,
.addon[active="true"] .disabled-postfix,
.addon[pending="install"] .update-postfix,
.addon[pending="install"] .disabled-postfix,
@@ -264,6 +266,21 @@ richlistitem:not([selected]) * {
display: none;
}
+/* Indicator style for extension target application */
+.addon[native] .nativeIndicator {
+ margin-left: 5pt;
+ padding-bottom: 1pt;
+}
+.addon[native][active="false"] .nativeIndicator {
+ opacity: 0.4;
+}
+.addon[native] .nativeAddon {
+ color: #3366FF;
+}
+.addon[native] .compatAddon {
+ color: #FF6600;
+}
+
/* Translators for Language Pack details */
.translators > label {
-moz-margin-start: 0px;
diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml
index a3246e2206..28feb19698 100644
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -857,6 +857,10 @@
<xul:label anonid="name" class="name" crop="end" flex="1"
xbl:inherits="value=name,tooltiptext=name"/>
<xul:label anonid="version" class="version"/>
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ <xul:label class="nativeIndicator nativeAddon" value="●" tooltiptext="&addon.nativeAddon;"/>
+ <xul:label class="nativeIndicator compatAddon" value="●" tooltiptext="&addon.compatAddon;"/>
+#endif
<xul:label class="disabled-postfix" value="&addon.disabled.postfix;"/>
<xul:label class="update-postfix" value="&addon.update.postfix;"/>
<xul:spacer flex="5000"/> <!-- Necessary to make the name crop -->
@@ -1352,6 +1356,10 @@
[this.mAddon.name], 1);
} else {
this.removeAttribute("notification");
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ if (this.mAddon.type == "extension")
+ this.setAttribute("native", this.mAddon.native);
+#endif
}
}
diff --git a/toolkit/mozapps/extensions/internal/AddonRepository.jsm b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
index 41fb5c06d0..9750e99445 100644
--- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
@@ -64,6 +64,9 @@ const BLANK_DB = function() {
}
const TOOLKIT_ID = "toolkit@mozilla.org";
+#ifdef MOZ_PHOENIX_EXTENSIONS
+const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
+#endif
Cu.import("resource://gre/modules/Log.jsm");
const LOGGER_ID = "addons.repository";
@@ -1251,7 +1254,12 @@ this.AddonRepository = {
let results = [];
function isSameApplication(aAppNode) {
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ if (self._getTextContent(aAppNode) == Services.appinfo.ID ||
+ self._getTextContent(aAppNode) == FIREFOX_ID) {
+#else
if (self._getTextContent(aAppNode) == Services.appinfo.ID) {
+#endif
return true;
}
return false;
diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
index 4fce84095c..0dfb7cd109 100644
--- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
@@ -25,6 +25,7 @@ const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/pa
const TOOLKIT_ID = "toolkit@mozilla.org";
const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
+const FIREFOX_APPCOMPATVERSION = "56.9"
const PREF_UPDATE_REQUIREBUILTINCERTS = "extensions.update.requireBuiltInCerts";
const PREF_EM_MIN_COMPAT_APP_VERSION = "extensions.minCompatibleAppVersion";
@@ -522,6 +523,18 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) {
maxVersion: getRequiredProperty(app, "max_version", "string"),
}
}
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ else if (FIREFOX_ID in applications) {
+ logger.debug("update.json: Dual-GUID targetApplication");
+ app = getProperty(applications, FIREFOX_ID, "object");
+
+ appEntry = {
+ id: FIREFOX_ID,
+ minVersion: getRequiredProperty(app, "min_version", "string"),
+ maxVersion: getRequiredProperty(app, "max_version", "string"),
+ }
+ }
+#endif
else if (TOOLKIT_ID in applications) {
logger.debug("update.json: Toolkit targetApplication");
app = getProperty(applications, TOOLKIT_ID, "object");
@@ -545,7 +558,11 @@ function parseJSONManifest(aId, aUpdateKey, aRequest, aManifestData) {
id: TOOLKIT_ID,
minVersion: platformVersion,
#endif
+#if defined(MOZ_PHOENIX) && defined(MOZ_PHOENIX_EXTENSIONS)
+ maxVersion: FIREFOX_APPCOMPATVERSION,
+#else
maxVersion: '*',
+#endif
};
}
else {
@@ -808,6 +825,12 @@ function matchesVersions(aUpdate, aAppVersion, aPlatformVersion,
return (Services.vc.compare(aAppVersion, app.minVersion) >= 0) &&
(aIgnoreMaxVersion || (Services.vc.compare(aAppVersion, app.maxVersion) <= 0));
}
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ if (app.id == FIREFOX_ID) {
+ return (Services.vc.compare(aAppVersion, app.minVersion) >= 0) &&
+ (aIgnoreMaxVersion || (Services.vc.compare(aAppVersion, app.maxVersion) <= 0));
+ }
+#endif
if (app.id == TOOLKIT_ID) {
result = (Services.vc.compare(aPlatformVersion, app.minVersion) >= 0) &&
(aIgnoreMaxVersion || (Services.vc.compare(aPlatformVersion, app.maxVersion) <= 0));
@@ -865,7 +888,12 @@ this.AddonUpdateChecker = {
if (aIgnoreCompatibility) {
for (let targetApp of update.targetApplications) {
let id = targetApp.id;
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ if (id == Services.appinfo.ID || id == FIREFOX_ID ||
+ id == TOOLKIT_ID)
+#else
if (id == Services.appinfo.ID || id == TOOLKIT_ID)
+#endif
return update;
}
}
@@ -941,8 +969,7 @@ this.AddonUpdateChecker = {
// Define an array of internally used IDs to NOT send to AUS.
let internalIDS = [
'{972ce4c6-7e08-4474-a285-3208198ce6fd}', // Global Default Theme
- 'modern@themes.mozilla.org', // Modern Theme for Borealis/Suite-based Applications
- 'xplatform@interlink.projects.binaryoutcast.com', // Pref-set default theme for Interlink
+ 'modern@themes.mozilla.org', // Modern Theme for Suite-based Applications
'{e2fda1a4-762b-4020-b5ad-a41df1933103}', // Lightning/Calendar Extension
'{a62ef8ec-5fdc-40c2-873c-223b8a6925cc}' // Provider for Google Calendar (gdata) Extension
];
diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
index eb4e54720a..3bcb4275eb 100644
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -134,6 +134,10 @@ const RDFURI_INSTALL_MANIFEST_ROOT = "urn:mozilla:install-manifest";
const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#";
const TOOLKIT_ID = "toolkit@mozilla.org";
+#ifdef MOZ_PHOENIX_EXTENSIONS
+const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
+const FIREFOX_APPCOMPATVERSION = "56.9"
+#endif
// The value for this is in Makefile.in
#expand const DB_SCHEMA = __MOZ_EXTENSIONS_DB_SCHEMA__;
@@ -6402,11 +6406,27 @@ AddonInternal.prototype = {
if (!aPlatformVersion)
aPlatformVersion = Services.appinfo.platformVersion;
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ this.native = false;
+#endif
+
let version;
if (app.id == Services.appinfo.ID) {
version = aAppVersion;
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ this.native = true;
+ }
+ else if (app.id == FIREFOX_ID) {
+ version = FIREFOX_APPCOMPATVERSION;
+ if (this.type != "extension")
+ //Only allow extensions in Firefox compatibility mode
+ return false;
+#endif
}
else if (app.id == TOOLKIT_ID) {
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ this.native = true;
+#endif
version = aPlatformVersion;
}
@@ -6429,7 +6449,11 @@ AddonInternal.prototype = {
// Extremely old extensions should not be compatible by default.
let minCompatVersion;
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ if (app.id == Services.appinfo.ID || app.id == FIREFOX_ID)
+#else
if (app.id == Services.appinfo.ID)
+#endif
minCompatVersion = XPIProvider.minCompatibleAppVersion;
else if (app.id == TOOLKIT_ID)
minCompatVersion = XPIProvider.minCompatiblePlatformVersion;
@@ -6453,6 +6477,18 @@ AddonInternal.prototype = {
if (targetApp.id == TOOLKIT_ID)
app = targetApp;
}
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ // Special case: check for Firefox TargetApps. this has to be done AFTER
+ // the initial check to make sure appinfo.ID is preferred, even if
+ // Firefox is listed before it in the install manifest.
+ // Only do this for extensions. Other types should not be allowed.
+ if (this.type == "extension") {
+ for (let targetApp of this.targetApplications) {
+ if (targetApp.id == FIREFOX_ID) //Firefox GUID
+ return targetApp;
+ }
+ }
+#endif
// Return toolkit ID if toolkit.
return app;
},
diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
index 9f3273b1a5..512479d762 100644
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -71,6 +71,9 @@ const PROP_JSON_FIELDS = ["id", "syncGUID", "location", "version", "type",
"softDisabled", "foreignInstall", "hasBinaryComponents",
"strictCompatibility", "locales", "targetApplications",
"targetPlatforms", "multiprocessCompatible",
+#ifdef MOZ_PHOENIX_EXTENSIONS
+ "native"
+#endif
];
// Time to wait before async save of XPI JSON database, in milliseconds
diff --git a/toolkit/mozapps/extensions/internal/moz.build b/toolkit/mozapps/extensions/internal/moz.build
index 86cbbe82c5..3b967e0c6f 100644
--- a/toolkit/mozapps/extensions/internal/moz.build
+++ b/toolkit/mozapps/extensions/internal/moz.build
@@ -5,7 +5,6 @@
EXTRA_JS_MODULES.addons += [
'AddonLogging.jsm',
- 'AddonRepository.jsm',
'AddonRepository_SQLiteMigrator.jsm',
'Content.js',
'GMPProvider.jsm',
@@ -16,6 +15,7 @@ EXTRA_JS_MODULES.addons += [
]
EXTRA_PP_JS_MODULES.addons += [
+ 'AddonRepository.jsm',
'AddonUpdateChecker.jsm',
'XPIProvider.jsm',
'XPIProviderUtils.js',
@@ -28,3 +28,7 @@ DEFINES['MOZ_EXTENSIONS_DB_SCHEMA'] = 16
# Additional debugging info is exposed in debug builds
if CONFIG['MOZ_EM_DEBUG']:
DEFINES['MOZ_EM_DEBUG'] = 1
+
+# Apperently this needs to be defined because it isn't picked up automagically any more
+if CONFIG['MOZ_PHOENIX_EXTENSIONS']:
+ DEFINES['MOZ_PHOENIX_EXTENSIONS'] = 1 \ No newline at end of file
diff --git a/toolkit/mozapps/installer/package-name.mk b/toolkit/mozapps/installer/package-name.mk
index 680590b3c5..548a93b47f 100644
--- a/toolkit/mozapps/installer/package-name.mk
+++ b/toolkit/mozapps/installer/package-name.mk
@@ -80,6 +80,7 @@ PKG_UPDATE_BASENAME = $(PKG_BASENAME)
CHECKSUMS_FILE_BASENAME = $(PKG_BASENAME)
MOZ_INFO_BASENAME = $(PKG_BASENAME)
PKG_UPDATE_PATH = $(PKG_PATH)
+BARE_MAR = $(PKG_UPDATE_PATH)$(PKG_UPDATE_BASENAME).mar
COMPLETE_MAR = $(PKG_UPDATE_PATH)$(PKG_UPDATE_BASENAME).complete.mar
# PARTIAL_MAR needs to be processed by $(wildcard) before you use it.
PARTIAL_MAR = $(PKG_UPDATE_PATH)$(PKG_UPDATE_BASENAME).partial.*.mar
diff --git a/toolkit/mozapps/update/common/errors.h b/toolkit/mozapps/update/common/errors.h
index 846118d55d..de1782b8e5 100644
--- a/toolkit/mozapps/update/common/errors.h
+++ b/toolkit/mozapps/update/common/errors.h
@@ -46,7 +46,7 @@
#define WRITE_ERROR_ACCESS_DENIED 35
// #define WRITE_ERROR_SHARING_VIOLATION 36 // Replaced with errors 46-48
#define WRITE_ERROR_CALLBACK_APP 37
-#define UNEXPECTED_BZIP_ERROR 39
+#define UNEXPECTED_XZ_ERROR 39
#define UNEXPECTED_MAR_ERROR 40
#define UNEXPECTED_BSPATCH_ERROR 41
#define UNEXPECTED_FILE_OPERATION_ERROR 42
diff --git a/toolkit/mozapps/update/updater/archivereader.cpp b/toolkit/mozapps/update/updater/archivereader.cpp
index 90cf45c3db..72debbe82e 100644
--- a/toolkit/mozapps/update/updater/archivereader.cpp
+++ b/toolkit/mozapps/update/updater/archivereader.cpp
@@ -1,5 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* 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/. */
@@ -15,6 +14,9 @@
#include "updatehelper.h"
#endif
+#define XZ_USE_CRC64
+#include "xz.h"
+
// These are generated at compile time based on the DER file for the channel
// being used
#ifdef MOZ_VERIFY_MAR_SIGNATURE
@@ -36,10 +38,10 @@
# include <io.h>
#endif
-static int inbuf_size = 262144;
-static int outbuf_size = 262144;
-static char *inbuf = nullptr;
-static char *outbuf = nullptr;
+static size_t inbuf_size = 262144;
+static size_t outbuf_size = 262144;
+static uint8_t *inbuf = nullptr;
+static uint8_t *outbuf = nullptr;
/**
* Performs a verification on the opened MAR file with the passed in
@@ -182,22 +184,22 @@ ArchiveReader::Open(const NS_tchar *path)
Close();
if (!inbuf) {
- inbuf = (char *)malloc(inbuf_size);
+ inbuf = (uint8_t *)malloc(inbuf_size);
if (!inbuf) {
// Try again with a smaller buffer.
inbuf_size = 1024;
- inbuf = (char *)malloc(inbuf_size);
+ inbuf = (uint8_t *)malloc(inbuf_size);
if (!inbuf)
return ARCHIVE_READER_MEM_ERROR;
}
}
if (!outbuf) {
- outbuf = (char *)malloc(outbuf_size);
+ outbuf = (uint8_t *)malloc(outbuf_size);
if (!outbuf) {
// Try again with a smaller buffer.
outbuf_size = 1024;
- outbuf = (char *)malloc(outbuf_size);
+ outbuf = (uint8_t *)malloc(outbuf_size);
if (!outbuf)
return ARCHIVE_READER_MEM_ERROR;
}
@@ -211,6 +213,9 @@ ArchiveReader::Open(const NS_tchar *path)
if (!mArchive)
return READ_ERROR;
+ xz_crc32_init();
+ xz_crc64_init();
+
return OK;
}
@@ -273,12 +278,21 @@ ArchiveReader::ExtractItemToStream(const MarItem *item, FILE *fp)
{
/* decompress the data chunk by chunk */
- bz_stream strm;
- int offset, inlen, outlen, ret = OK;
+ int offset, inlen, ret = OK;
+ struct xz_buf strm = { 0 };
+ enum xz_ret xz_rv = XZ_OK;
+
+ struct xz_dec * dec = xz_dec_init(XZ_DYNALLOC, 64 * 1024 * 1024);
+ if (!dec) {
+ return UNEXPECTED_XZ_ERROR;
+ }
- memset(&strm, 0, sizeof(strm));
- if (BZ2_bzDecompressInit(&strm, 0, 0) != BZ_OK)
- return UNEXPECTED_BZIP_ERROR;
+ strm.in = inbuf;
+ strm.in_pos = 0;
+ strm.in_size = 0;
+ strm.out = outbuf;
+ strm.out_pos = 0;
+ strm.out_size = outbuf_size;
offset = 0;
for (;;) {
@@ -287,38 +301,50 @@ ArchiveReader::ExtractItemToStream(const MarItem *item, FILE *fp)
break;
}
- if (offset < (int) item->length && strm.avail_in == 0) {
+ if (offset < (int) item->length && strm.in_pos == strm.in_size) {
inlen = mar_read(mArchive, item, offset, inbuf, inbuf_size);
- if (inlen <= 0)
- return READ_ERROR;
+ if (inlen <= 0) {
+ ret = READ_ERROR;
+ break;
+ }
offset += inlen;
- strm.next_in = inbuf;
- strm.avail_in = inlen;
+ strm.in_size = inlen;
+ strm.in_pos = 0;
}
- strm.next_out = outbuf;
- strm.avail_out = outbuf_size;
+ xz_rv = xz_dec_run(dec, &strm);
- ret = BZ2_bzDecompress(&strm);
- if (ret != BZ_OK && ret != BZ_STREAM_END) {
- ret = UNEXPECTED_BZIP_ERROR;
- break;
- }
-
- outlen = outbuf_size - strm.avail_out;
- if (outlen) {
- if (fwrite(outbuf, outlen, 1, fp) != 1) {
+ if (strm.out_pos == outbuf_size) {
+ if (fwrite(outbuf, 1, strm.out_pos, fp) != strm.out_pos) {
ret = WRITE_ERROR_EXTRACT;
break;
}
+
+ strm.out_pos = 0;
+ }
+
+ if (xz_rv == XZ_OK) {
+ // There is still more data to decompress.
+ continue;
}
- if (ret == BZ_STREAM_END) {
- ret = OK;
+ // The return value of xz_dec_run is not XZ_OK and if it isn't XZ_STREAM_END
+ // an error has occured.
+ if (xz_rv != XZ_STREAM_END) {
+ ret = UNEXPECTED_XZ_ERROR;
break;
}
+
+ // Write out the remainder of the decompressed data. In the case of
+ // strm.out_pos == 0 this is needed to create empty files included in the
+ // mar file.
+ if (fwrite(outbuf, 1, strm.out_pos, fp) != strm.out_pos) {
+ ret = WRITE_ERROR_EXTRACT;
+ }
+
+ break;
}
- BZ2_bzDecompressEnd(&strm);
+ xz_dec_end(dec);
return ret;
}
diff --git a/toolkit/mozapps/update/updater/updater-common.build b/toolkit/mozapps/update/updater/updater-common.build
index a46c1388cc..1ace8fcc71 100644
--- a/toolkit/mozapps/update/updater/updater-common.build
+++ b/toolkit/mozapps/update/updater/updater-common.build
@@ -57,6 +57,7 @@ else:
USE_LIBS += [
'mar',
+ 'xz-embedded',
]
if CONFIG['MOZ_SYSTEM_BZ2']:
diff --git a/toolkit/themes/linux/mozapps/extensions/extensions.css b/toolkit/themes/linux/mozapps/extensions/extensions.css
index b21a655203..5c642fbbf1 100644
--- a/toolkit/themes/linux/mozapps/extensions/extensions.css
+++ b/toolkit/themes/linux/mozapps/extensions/extensions.css
@@ -517,13 +517,6 @@
background-repeat: repeat-x;
}
-.addon-view[notification="warning"][native="false"] {
- background-image: url("chrome://mozapps/skin/extensions/stripes-compatibility.png"),
- linear-gradient(rgba(255, 128, 0, 0.04),
- rgba(255, 128, 0, 0));
- background-repeat: repeat-x;
-}
-
.addon-view[notification="error"] {
background-image: url("chrome://mozapps/skin/extensions/stripes-error.png"),
linear-gradient(rgba(255, 0, 0, 0.04),
diff --git a/toolkit/themes/linux/mozapps/extensions/stripes-compatibility.png b/toolkit/themes/linux/mozapps/extensions/stripes-compatibility.png
deleted file mode 100644
index dee75516b7..0000000000
--- a/toolkit/themes/linux/mozapps/extensions/stripes-compatibility.png
+++ /dev/null
Binary files differ
diff --git a/toolkit/themes/linux/mozapps/extensions/stripes-error.png b/toolkit/themes/linux/mozapps/extensions/stripes-error.png
deleted file mode 100644
index 1dc2d8504c..0000000000
--- a/toolkit/themes/linux/mozapps/extensions/stripes-error.png
+++ /dev/null
Binary files differ
diff --git a/toolkit/themes/linux/mozapps/extensions/stripes-info-negative.png b/toolkit/themes/linux/mozapps/extensions/stripes-info-negative.png
deleted file mode 100644
index 901ab1ec29..0000000000
--- a/toolkit/themes/linux/mozapps/extensions/stripes-info-negative.png
+++ /dev/null
Binary files differ
diff --git a/toolkit/themes/linux/mozapps/extensions/stripes-info-positive.png b/toolkit/themes/linux/mozapps/extensions/stripes-info-positive.png
deleted file mode 100644
index 370ceec0f2..0000000000
--- a/toolkit/themes/linux/mozapps/extensions/stripes-info-positive.png
+++ /dev/null
Binary files differ
diff --git a/toolkit/themes/linux/mozapps/extensions/stripes-warning.png b/toolkit/themes/linux/mozapps/extensions/stripes-warning.png
deleted file mode 100644
index 69463fb1af..0000000000
--- a/toolkit/themes/linux/mozapps/extensions/stripes-warning.png
+++ /dev/null
Binary files differ
diff --git a/toolkit/themes/linux/mozapps/jar.mn b/toolkit/themes/linux/mozapps/jar.mn
index 27b6473084..0931d1823d 100644
--- a/toolkit/themes/linux/mozapps/jar.mn
+++ b/toolkit/themes/linux/mozapps/jar.mn
@@ -26,11 +26,6 @@ toolkit.jar:
skin/classic/mozapps/extensions/themeGeneric.png (extensions/themeGeneric.png)
skin/classic/mozapps/extensions/themeGeneric-16.png (extensions/themeGeneric-16.png)
skin/classic/mozapps/extensions/localeGeneric.png (extensions/localeGeneric.png)
- skin/classic/mozapps/extensions/stripes-warning.png (extensions/stripes-warning.png)
- skin/classic/mozapps/extensions/stripes-compatibility.png (extensions/stripes-compatibility.png)
- skin/classic/mozapps/extensions/stripes-error.png (extensions/stripes-error.png)
- skin/classic/mozapps/extensions/stripes-info-positive.png (extensions/stripes-info-positive.png)
- skin/classic/mozapps/extensions/stripes-info-negative.png (extensions/stripes-info-negative.png)
skin/classic/mozapps/extensions/newaddon.css (extensions/newaddon.css)
skin/classic/mozapps/extensions/selectAddons.css (extensions/selectAddons.css)
skin/classic/mozapps/xpinstall/xpinstallItemGeneric.png (extensions/extensionGeneric.png)
diff --git a/toolkit/themes/windows/mozapps/extensions/extensions.css b/toolkit/themes/windows/mozapps/extensions/extensions.css
index 96ea1b46ce..f350f7ca64 100644
--- a/toolkit/themes/windows/mozapps/extensions/extensions.css
+++ b/toolkit/themes/windows/mozapps/extensions/extensions.css
@@ -648,13 +648,6 @@
background-repeat: repeat-x;
}
-.addon-view[notification="warning"][native="false"] {
- background-image: url("chrome://mozapps/skin/extensions/stripes-compatibility.png"),
- linear-gradient(rgba(255, 128, 0, 0.04),
- rgba(255, 128, 0, 0));
- background-repeat: repeat-x;
-}
-
.addon-view[notification="error"] {
background-image: url("chrome://mozapps/skin/extensions/stripes-error.png"),
linear-gradient(rgba(255, 0, 0, 0.04),
diff --git a/toolkit/themes/windows/mozapps/extensions/stripes-compatibility.png b/toolkit/themes/windows/mozapps/extensions/stripes-compatibility.png
deleted file mode 100644
index dee75516b7..0000000000
--- a/toolkit/themes/windows/mozapps/extensions/stripes-compatibility.png
+++ /dev/null
Binary files differ
diff --git a/toolkit/themes/windows/mozapps/jar.mn b/toolkit/themes/windows/mozapps/jar.mn
index 5ca886051c..9f7562995f 100644
--- a/toolkit/themes/windows/mozapps/jar.mn
+++ b/toolkit/themes/windows/mozapps/jar.mn
@@ -39,7 +39,6 @@ toolkit.jar:
skin/classic/mozapps/extensions/heart.png (extensions/heart.png)
skin/classic/mozapps/extensions/navigation.png (extensions/navigation.png)
skin/classic/mozapps/extensions/stripes-warning.png (extensions/stripes-warning.png)
- skin/classic/mozapps/extensions/stripes-compatibility.png (extensions/stripes-compatibility.png)
skin/classic/mozapps/extensions/stripes-error.png (extensions/stripes-error.png)
skin/classic/mozapps/extensions/stripes-info-positive.png (extensions/stripes-info-positive.png)
skin/classic/mozapps/extensions/stripes-info-negative.png (extensions/stripes-info-negative.png)
diff --git a/tools/update-packaging/Makefile.in b/tools/update-packaging/Makefile.in
index 4788a55752..a751ae3ce5 100644
--- a/tools/update-packaging/Makefile.in
+++ b/tools/update-packaging/Makefile.in
@@ -31,7 +31,7 @@ MAR_BIN = $(DIST)/host/bin/mar$(HOST_BIN_SUFFIX)
MBSDIFF_BIN = $(DIST)/host/bin/mbsdiff$(HOST_BIN_SUFFIX)
OVERRIDE_DEFAULT_GOAL := full-update
-full-update:: complete-patch
+full-update:: mar-package
ifeq ($(OS_TARGET), WINNT)
ifdef AB_CD
@@ -70,3 +70,23 @@ partial-patch:: $(dir-stage)
ifdef MOZ_SIGN_CMD
$(MOZ_SIGN_CMD) -f mar '$(STAGE_DIR)/$(PKG_UPDATE_BASENAME).partial.$(SRC_BUILD_ID)-$(DST_BUILD_ID).mar'
endif
+
+mar-package: $(call mkdir_deps,$(ABS_DIST)/$(PKG_STAGE_DIR))
+ @echo 'Creating update mar (xz compressed)...'
+ MAR=$(MAR_BIN) \
+ $(srcdir)/make_full_update.sh \
+ '$(DIST)/$(BARE_MAR)' \
+ '$(PACKAGE_DIR)'
+ifdef MOZ_SIGN_CMD
+ $(MOZ_SIGN_CMD) -f mar '$(DIST)/$(BARE_MAR)'
+endif
+
+mar-package-bz2: $(call mkdir_deps,$(ABS_DIST)/$(PKG_STAGE_DIR))
+ @echo 'Creating update mar (bz2 compressed)...'
+ MAR_OLD_FORMAT=1 MAR=$(MAR_BIN) \
+ $(srcdir)/make_full_update.sh \
+ '$(DIST)/$(COMPLETE_MAR)' \
+ '$(PACKAGE_DIR)'
+ifdef MOZ_SIGN_CMD
+ $(MOZ_SIGN_CMD) -f mar '$(DIST)/$(COMPLETE_MAR)'
+endif \ No newline at end of file
diff --git a/tools/update-packaging/common.sh b/tools/update-packaging/common.sh
index 24f1ca6eb4..3df2cc4768 100755
--- a/tools/update-packaging/common.sh
+++ b/tools/update-packaging/common.sh
@@ -9,10 +9,15 @@
#
# -----------------------------------------------------------------------------
-# By default just assume that these tools exist on our path
+# By default just assume that these tools exist in our path
MAR=${MAR:-mar}
-BZIP2=${BZIP2:-bzip2}
MBSDIFF=${MBSDIFF:-mbsdiff}
+if [[ -z "${MAR_OLD_FORMAT}" ]]; then
+ XZ=${XZ:-xz}
+else
+ MAR_OLD_FORMAT=1
+ BZIP2=${BZIP2:-bzip2}
+fi
# -----------------------------------------------------------------------------
# Helper routines
diff --git a/tools/update-packaging/make_full_update.sh b/tools/update-packaging/make_full_update.sh
index ba1404474f..c480f8ee66 100755
--- a/tools/update-packaging/make_full_update.sh
+++ b/tools/update-packaging/make_full_update.sh
@@ -93,7 +93,11 @@ for ((i=0; $i<$num_files; i=$i+1)); do
dir=$(dirname "$f")
mkdir -p "$workdir/$dir"
- $BZIP2 -cz9 "$targetdir/$f" > "$workdir/$f"
+ if [[ -n $MAR_OLD_FORMAT ]]; then
+ $BZIP2 -cz9 "$targetdir/$f" > "$workdir/$f"
+ else
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force --stdout "$targetdir/$f" > "$workdir/$f"
+ fi
copy_perm "$targetdir/$f" "$workdir/$f"
targetfiles="$targetfiles \"$f\""
@@ -104,8 +108,13 @@ notice ""
notice "Adding file and directory remove instructions from file 'removed-files'"
append_remove_instructions "$targetdir" "$updatemanifestv2" "$updatemanifestv3"
-$BZIP2 -z9 "$updatemanifestv2" && mv -f "$updatemanifestv2.bz2" "$updatemanifestv2"
-$BZIP2 -z9 "$updatemanifestv3" && mv -f "$updatemanifestv3.bz2" "$updatemanifestv3"
+if [[ -n $MAR_OLD_FORMAT ]]; then
+ $BZIP2 -z9 "$updatemanifestv2" && mv -f "$updatemanifestv2.bz2" "$updatemanifestv2"
+ $BZIP2 -z9 "$updatemanifestv3" && mv -f "$updatemanifestv3.bz2" "$updatemanifestv3"
+else
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$updatemanifestv2" && mv -f "$updatemanifestv2.xz" "$updatemanifestv2"
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$updatemanifestv3" && mv -f "$updatemanifestv3.xz" "$updatemanifestv3"
+fi
eval "$MAR -C \"$workdir\" -c output.mar $targetfiles"
mv -f "$workdir/output.mar" "$archive"
diff --git a/tools/update-packaging/make_incremental_update.sh b/tools/update-packaging/make_incremental_update.sh
index 90372c017e..af3af854fd 100755
--- a/tools/update-packaging/make_incremental_update.sh
+++ b/tools/update-packaging/make_incremental_update.sh
@@ -169,7 +169,11 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do
if check_for_add_if_not_update "$f"; then
# The full workdir may not exist yet, so create it if necessary.
mkdir -p `dirname "$workdir/$f"`
- $BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
+ if [[ -n $MAR_OLD_FORMAT ]]; then
+ $BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
+ else
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
+ fi
copy_perm "$newdir/$f" "$workdir/$f"
make_add_if_not_instruction "$f" "$updatemanifestv3"
archivefiles="$archivefiles \"$f\""
@@ -179,7 +183,11 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do
if check_for_forced_update "$requested_forced_updates" "$f"; then
# The full workdir may not exist yet, so create it if necessary.
mkdir -p `dirname "$workdir/$f"`
- $BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
+ if [[ -n $MAR_OLD_FORMAT ]]; then
+ $BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
+ else
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
+ fi
copy_perm "$newdir/$f" "$workdir/$f"
make_add_instruction "$f" "$updatemanifestv2" "$updatemanifestv3" 1
archivefiles="$archivefiles \"$f\""
@@ -207,21 +215,44 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do
# if service is not enabled then default to old behavior
if [ -z "$MBSDIFF_HOOK" ]; then
$MBSDIFF "$olddir/$f" "$newdir/$f" "$workdir/$f.patch"
- $BZIP2 -z9 "$workdir/$f.patch"
+ if [[ -n $MAR_OLD_FORMAT ]]; then
+ $BZIP2 -z9 "$workdir/$f.patch"
+ else
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$workdir/$f.patch"
+ fi
else
# if service enabled then check patch existence for retrieval
- if $MBSDIFF_HOOK -g "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.bz2"; then
- notice "file \"$f\" found in funsize, diffing skipped"
+ if [[ -n $MAR_OLD_FORMAT ]]; then
+ if $MBSDIFF_HOOK -g "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.bz2"; then
+ notice "file \"$f\" found in funsize, diffing skipped"
+ else
+ # if not found already - compute it and cache it for future use
+ $MBSDIFF "$olddir/$f" "$newdir/$f" "$workdir/$f.patch"
+ $BZIP2 -z9 "$workdir/$f.patch"
+ $MBSDIFF_HOOK -u "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.bz2"
+ fi
else
- # if not found already - compute it and cache it for future use
- $MBSDIFF "$olddir/$f" "$newdir/$f" "$workdir/$f.patch"
- $BZIP2 -z9 "$workdir/$f.patch"
- $MBSDIFF_HOOK -u "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.bz2"
+ if $MBSDIFF_HOOK -g "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.xz"; then
+ notice "file \"$f\" found in funsize, diffing skipped"
+ else
+ # if not found already - compute it and cache it for future use
+ $MBSDIFF "$olddir/$f" "$newdir/$f" "$workdir/$f.patch"
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$workdir/$f.patch"
+ $MBSDIFF_HOOK -u "$olddir/$f" "$newdir/$f" "$workdir/$f.patch.xz"
+ fi
fi
fi
- $BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
+ if [[ -n $MAR_OLD_FORMAT ]]; then
+ $BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
+ else
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
+ fi
copy_perm "$newdir/$f" "$workdir/$f"
- patchfile="$workdir/$f.patch.bz2"
+ if [[ -n $MAR_OLD_FORMAT ]]; then
+ patchfile="$workdir/$f.patch.bz2"
+ else
+ patchfile="$workdir/$f.patch.xz"
+ fi
patchsize=$(get_file_size "$patchfile")
fullsize=$(get_file_size "$workdir/$f")
@@ -262,7 +293,11 @@ for ((i=0; $i<$num_newfiles; i=$i+1)); do
dir=$(dirname "$workdir/$f")
mkdir -p "$dir"
- $BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
+ if [[ -n $MAR_OLD_FORMAT ]]; then
+ $BZIP2 -cz9 "$newdir/$f" > "$workdir/$f"
+ else
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force --stdout "$newdir/$f" > "$workdir/$f"
+ fi
copy_perm "$newdir/$f" "$workdir/$f"
if check_for_add_if_not_update "$f"; then
@@ -303,8 +338,13 @@ for ((i=0; $i<$num_olddirs; i=$i+1)); do
fi
done
-$BZIP2 -z9 "$updatemanifestv2" && mv -f "$updatemanifestv2.bz2" "$updatemanifestv2"
-$BZIP2 -z9 "$updatemanifestv3" && mv -f "$updatemanifestv3.bz2" "$updatemanifestv3"
+if [[ -n $MAR_OLD_FORMAT ]]; then
+ $BZIP2 -z9 "$updatemanifestv2" && mv -f "$updatemanifestv2.bz2" "$updatemanifestv2"
+ $BZIP2 -z9 "$updatemanifestv3" && mv -f "$updatemanifestv3.bz2" "$updatemanifestv3"
+else
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$updatemanifestv2" && mv -f "$updatemanifestv2.xz" "$updatemanifestv2"
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$updatemanifestv3" && mv -f "$updatemanifestv3.xz" "$updatemanifestv3"
+fi
mar_command="$MAR"
if [[ -n $MOZ_PRODUCT_VERSION ]]
diff --git a/tools/update-packaging/make_incremental_updates.py b/tools/update-packaging/make_incremental_updates.py
index d346ee2df0..dc7b3a01ea 100755
--- a/tools/update-packaging/make_incremental_updates.py
+++ b/tools/update-packaging/make_incremental_updates.py
@@ -4,7 +4,7 @@
import os
import shutil
-import sha
+import hashlib
from os.path import join, getsize
from stat import *
import re
@@ -12,9 +12,9 @@ import sys
import getopt
import time
import datetime
-import bz2
import string
import tempfile
+import io
class PatchInfo:
""" Represents the meta-data associated with a patch
@@ -107,23 +107,23 @@ class PatchInfo:
""" Create the v2 manifest file in the root of the work_dir """
manifest_file_path = os.path.join(self.work_dir,"updatev2.manifest")
manifest_file = open(manifest_file_path, "wb")
- manifest_file.writelines("type \"partial\"\n")
- manifest_file.writelines(string.join(self.manifestv2, '\n'))
- manifest_file.writelines("\n")
+ manifest_file.writelines(io.BytesIO(b"type \"partial\"\n"))
+ manifest_file.writelines(io.BytesIO('\n'.join(self.manifestv2).encode('ascii')))
+ manifest_file.writelines(io.BytesIO(b"\n"))
manifest_file.close()
- bzip_file(manifest_file_path)
+ xz_file(manifest_file_path)
self.archive_files.append('"updatev2.manifest"')
""" Create the v3 manifest file in the root of the work_dir """
manifest_file_path = os.path.join(self.work_dir,"updatev3.manifest")
manifest_file = open(manifest_file_path, "wb")
- manifest_file.writelines("type \"partial\"\n")
- manifest_file.writelines(string.join(self.manifestv3, '\n'))
- manifest_file.writelines("\n")
+ manifest_file.writelines(io.BytesIO(b"type \"partial\"\n"))
+ manifest_file.writelines(io.BytesIO('\n'.join(self.manifestv3).encode('ascii')))
+ manifest_file.writelines(io.BytesIO(b"\n"))
manifest_file.close()
- bzip_file(manifest_file_path)
+ xz_file(manifest_file_path)
self.archive_files.append('"updatev3.manifest"')
def build_marfile_entry_hash(self, root_path):
@@ -176,8 +176,8 @@ class MarFileEntry:
def calc_file_sha_digest(self, filename):
""" Returns sha digest of given filename"""
- file_content = open(filename, 'r').read()
- return sha.new(file_content).digest()
+ file_content = open(filename, 'rb').read()
+ return hashlib.sha1(file_content).digest()
def sha(self):
""" Returns sha digest of file repreesnted by this _marfile_entry"""
@@ -188,7 +188,7 @@ class MarFileEntry:
def exec_shell_cmd(cmd):
"""Execs shell cmd and raises an exception if the cmd fails"""
if (os.system(cmd)):
- raise Exception, "cmd failed "+cmd
+ raise Exception("cmd failed "+cmd)
def copy_file(src_file_abs_path, dst_file_abs_path):
@@ -199,19 +199,19 @@ def copy_file(src_file_abs_path, dst_file_abs_path):
# Copy the file over
shutil.copy2(src_file_abs_path, dst_file_abs_path)
-def bzip_file(filename):
- """ Bzip's the file in place. The original file is replaced with a bzip'd version of itself
+def xz_file(filename):
+ """ XZ compresses the file in place. The original file is replaced with the xz compressed version of itself
assumes the path is absolute"""
- exec_shell_cmd('bzip2 -z9 "' + filename+'"')
- os.rename(filename+".bz2",filename)
+ exec_shell_cmd('xz --compress --x86 --lzma2 --format=xz --check=crc64 "' + filename+'"')
+ os.rename(filename+".xz",filename)
-def bunzip_file(filename):
- """ Bzip's the file in palce. The original file is replaced with a bunzip'd version of itself.
- doesn't matter if the filename ends in .bz2 or not"""
- if not filename.endswith(".bz2"):
- os.rename(filename, filename+".bz2")
- filename=filename+".bz2"
- exec_shell_cmd('bzip2 -d "' + filename+'"')
+def xzunzip_file(filename):
+ """ xz decompresses the file in palce. The original file is replaced with a xz decompressed version of itself.
+ doesn't matter if the filename ends in .xz or not"""
+ if not filename.endswith(".xz"):
+ os.rename(filename, filename+".xz")
+ filename=filename+".xz"
+ exec_shell_cmd('xz -d "' + filename+'"')
def extract_mar(filename, work_dir):
@@ -241,14 +241,14 @@ def create_partial_patch_for_file(from_marfile_entry, to_marfile_entry, shas, pa
if not os.path.exists(patch_file_dir):
os.makedirs(patch_file_dir)
- # Create bzip'd patch file
+ # Create xz'd patch file
exec_shell_cmd("mbsdiff "+from_marfile_entry.abs_path+" "+to_marfile_entry.abs_path+" "+patch_file_abs_path)
- bzip_file(patch_file_abs_path)
+ xz_file(patch_file_abs_path)
- # Create bzip's full file
+ # Create xz full file
full_file_abs_path = os.path.join(patch_info.work_dir, to_marfile_entry.name)
shutil.copy2(to_marfile_entry.abs_path, full_file_abs_path)
- bzip_file(full_file_abs_path)
+ xz_file(full_file_abs_path)
if os.path.getsize(patch_file_abs_path) < os.path.getsize(full_file_abs_path):
# Patch is smaller than file. Remove the file and add patch to manifest
@@ -304,13 +304,17 @@ def process_explicit_remove_files(dir_path, patch_info):
list_file_path = os.path.join(dir_path, "Contents/Resources/removed-files")
if (os.path.exists(list_file_path)):
- list_file = bz2.BZ2File(list_file_path,"r") # throws if doesn't exist
+ fd, tmppath = tempfile.mkstemp('', 'tmp', os.getcwd())
+ os.close(fd)
+ exec_shell_cmd('xz -k -d --stdout "' + list_file_path + '" > "'+tmppath+'"')
+ list_file = open(tmppath)
lines = []
for line in list_file:
lines.append(line.strip())
- list_file.close()
+ list_file.close()
+ os.remove(tmppath)
lines.sort(reverse=True)
for line in lines:
# Exclude any blank and comment lines.
@@ -406,7 +410,7 @@ def create_partial_patch(from_dir_path, to_dir_path, patch_filename, shas, patch
patch_info.create_manifest_files()
# And construct the mar
- mar_cmd = 'mar -C '+patch_info.work_dir+' -c output.mar '+string.join(patch_info.archive_files, ' ')
+ mar_cmd = 'mar -C '+patch_info.work_dir+' -c output.mar '+' '.join(patch_info.archive_files)
exec_shell_cmd(mar_cmd)
# Copy mar to final destination
@@ -431,11 +435,18 @@ def get_buildid(work_dir):
print 'WARNING: application.ini not found, cannot find build ID'
return ''
- file = bz2.BZ2File(ini)
+ fd, tmppath = tempfile.mkstemp('', 'tmp', os.getcwd())
+ os.close(fd)
+ exec_shell_cmd('xz -k -d --stdout "' + ini + '" > "'+tmppath+'"')
+ file = open(tmppath)
for line in file:
if line.find('BuildID') == 0:
+ file.close()
+ os.remove(tmppath)
return line.strip().split('=')[1]
- print 'WARNING: cannot find build ID in application.ini'
+ print('WARNING: cannot find build ID in application.ini')
+ file.close()
+ os.remove(tmppath)
return ''
def decode_filename(filepath):
@@ -486,7 +497,7 @@ def create_partial_patches(patches):
extract_mar(from_filename,work_dir_from)
from_decoded = decode_filename(from_filename)
from_buildid = get_buildid(work_dir_from)
- from_shasum = sha.sha(open(from_filename).read()).hexdigest()
+ from_shasum = hashlib.sha1(open(from_filename, "rb").read()).hexdigest()
from_size = str(os.path.getsize(to_filename))
# Extract to mar into to dir
@@ -495,14 +506,14 @@ def create_partial_patches(patches):
extract_mar(to_filename, work_dir_to)
to_decoded = decode_filename(from_filename)
to_buildid = get_buildid(work_dir_to)
- to_shasum = sha.sha(open(to_filename).read()).hexdigest()
+ to_shasum = hashlib.sha1(open(to_filename, 'rb').read()).hexdigest()
to_size = str(os.path.getsize(to_filename))
mar_extract_time = time.time()
partial_filename = create_partial_patch(work_dir_from, work_dir_to, patch_filename, shas, PatchInfo(work_dir, ['update.manifest','updatev2.manifest','updatev3.manifest'],[]),forced_updates,['channel-prefs.js','update-settings.ini'])
partial_buildid = to_buildid
- partial_shasum = sha.sha(open(partial_filename).read()).hexdigest()
+ partial_shasum = hashlib.sha1(open(partial_filename, "rb").read()).hexdigest()
partial_size = str(os.path.getsize(partial_filename))
metadata.append({
diff --git a/tools/update-packaging/test/catmanifest.sh b/tools/update-packaging/test/catmanifest.sh
index 354c3ff411..e6349d47a3 100755
--- a/tools/update-packaging/test/catmanifest.sh
+++ b/tools/update-packaging/test/catmanifest.sh
@@ -9,6 +9,6 @@ mkdir -p "$workdir"
cp "$1" "$workdir"
cd "$workdir"
mar -x "$1"
-mv updatev2.manifest updatev2.manifest.bz2
-bzip2 -d updatev2.manifest.bz2
+mv updatev2.manifest updatev2.manifest.xz
+xz -d updatev2.manifest.xz
cat updatev2.manifest
diff --git a/tools/update-packaging/test/common.sh b/tools/update-packaging/test/common.sh
index 7c133724e5..a9c904f037 100755
--- a/tools/update-packaging/test/common.sh
+++ b/tools/update-packaging/test/common.sh
@@ -10,9 +10,9 @@
# In here to use the local common.sh to allow the full mars to have unfiltered files
# -----------------------------------------------------------------------------
-# By default just assume that these tools exist on our path
+# By default just assume that these tools exist in our path
MAR=${MAR:-mar}
-BZIP2=${BZIP2:-bzip2}
+XZ=${XZ:-xz}
MBSDIFF=${MBSDIFF:-mbsdiff}
# -----------------------------------------------------------------------------
diff --git a/tools/update-packaging/test/diffmar.sh b/tools/update-packaging/test/diffmar.sh
index 771b6b0ce1..f1dfc7fbdd 100755
--- a/tools/update-packaging/test/diffmar.sh
+++ b/tools/update-packaging/test/diffmar.sh
@@ -30,19 +30,19 @@ cp "$2" "$todir"
cd "$fromdir"
mar -x "$1"
rm "$1"
-mv updatev2.manifest updatev2.manifest.bz2
-bzip2 -d updatev2.manifest.bz2
-mv updatev3.manifest updatev3.manifest.bz2
-bzip2 -d updatev3.manifest.bz2
+mv updatev2.manifest updatev2.manifest.xz
+xz -d updatev2.manifest.xz
+mv updatev3.manifest updatev3.manifest.xz
+xz -d updatev3.manifest.xz
ls $lsargs > files.txt
cd "$todir"
mar -x "$2"
rm "$2"
-mv updatev2.manifest updatev2.manifest.bz2
-bzip2 -d updatev2.manifest.bz2
-mv updatev3.manifest updatev3.manifest.bz2
-bzip2 -d updatev3.manifest.bz2
+mv updatev2.manifest updatev2.manifest.xz
+xz -d updatev2.manifest.xz
+mv updatev3.manifest updatev3.manifest.xz
+xz -d updatev3.manifest.xz
ls $lsargs > files.txt
echo "diffing $fromdir and $todir"
diff --git a/tools/update-packaging/test/make_full_update.sh b/tools/update-packaging/test/make_full_update.sh
index f2907da9ee..d6a01dcb76 100755
--- a/tools/update-packaging/test/make_full_update.sh
+++ b/tools/update-packaging/test/make_full_update.sh
@@ -94,7 +94,7 @@ for ((i=0; $i<$num_files; i=$i+1)); do
dir=$(dirname "$f")
mkdir -p "$workdir/$dir"
- $BZIP2 -cz9 "$targetdir/$f" > "$workdir/$f"
+ $XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force --stdout "$targetdir/$f" > "$workdir/$f"
copy_perm "$targetdir/$f" "$workdir/$f"
targetfiles="$targetfiles \"$f\""
@@ -105,8 +105,8 @@ notice ""
notice "Adding file and directory remove instructions from file 'removed-files'"
append_remove_instructions "$targetdir" "$updatemanifestv2" "$updatemanifestv3"
-$BZIP2 -z9 "$updatemanifestv2" && mv -f "$updatemanifestv2.bz2" "$updatemanifestv2"
-$BZIP2 -z9 "$updatemanifestv3" && mv -f "$updatemanifestv3.bz2" "$updatemanifestv3"
+$XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$updatemanifestv2" && mv -f "$updatemanifestv2.xz" "$updatemanifestv2"
+$XZ --compress --x86 --lzma2 --format=xz --check=crc64 --force "$updatemanifestv3" && mv -f "$updatemanifestv3.xz" "$updatemanifestv3"
eval "$MAR -C \"$workdir\" -c output.mar $targetfiles"
mv -f "$workdir/output.mar" "$archive"
diff --git a/tools/update-packaging/unwrap_full_update.pl b/tools/update-packaging/unwrap_full_update.pl
index ead1157db9..90aa8ee726 100755
--- a/tools/update-packaging/unwrap_full_update.pl
+++ b/tools/update-packaging/unwrap_full_update.pl
@@ -13,7 +13,7 @@
use Getopt::Std;
-my ($MAR, $BZIP2, $archive, @marentries, @marfiles);
+my ($MAR, $XZ, $BZIP2, $MAR_OLD_FORMAT, $archive, @marentries, @marfiles);
if (defined($ENV{"MAR"})) {
$MAR = $ENV{"MAR"};
@@ -29,6 +29,18 @@ else {
$BZIP2 = "bzip2";
}
+if (defined($ENV{"XZ"})) {
+ $XZ = $ENV{"XZ"};
+}
+else {
+ if (system("xz --version > /dev/null 2>&1") != 0) {
+ die("The xz executable must be in the path.");
+ }
+ else {
+ $XZ = "xz";
+ }
+}
+
sub print_usage
{
print "Usage: unwrap_full_update.pl [OPTIONS] ARCHIVE\n\n";
@@ -50,18 +62,43 @@ $archive = $ARGV[0];
$? && die("Couldn't run \"$MAR\" -t");
-shift @marentries;
+if (system("$MAR -x \"$archive\"") != 0) {
+ die "Couldn't run $MAR -x";
+}
+
+# Try to determine if the mar file contains bzip2 compressed files and if not
+# assume that the mar file contains lzma compressed files. The updatev3.manifest
+# file is checked since a valid mar file must have this file in the root path.
+open(my $testfilename, "updatev3.manifest") or die $!;
+binmode($testfilename);
+read($testfilename, my $bytes, 3);
+if ($bytes eq "BZh") {
+ $MAR_OLD_FORMAT = 1;
+} else {
+ undef $MAR_OLD_FORMAT;
+}
+close $testfilename;
-system("$MAR -x \"$archive\"") == 0 || die "Couldn't run $MAR -x";
+shift @marentries;
foreach (@marentries) {
tr/\n\r//d;
my @splits = split(/\t/,$_);
my $file = $splits[2];
- system("mv \"$file\" \"$file.bz2\"") == 0 ||
- die "Couldn't mv \"$file\"";
- system("\"$BZIP2\" -d \"$file.bz2\"") == 0 ||
- die "Couldn't decompress \"$file\"";
+ print "Decompressing: " . $file . "\n";
+ if ($MAR_OLD_FORMAT == 1) {
+ system("mv \"$file\" \"$file.bz2\"") == 0 ||
+ die "Couldn't mv \"$file\"";
+ system("\"$BZIP2\" -d \"$file.bz2\"") == 0 ||
+ die "Couldn't decompress \"$file\"";
+ }
+ else {
+ system("mv \"$file\" \"$file.xz\"") == 0 ||
+ die "Couldn't mv \"$file\"";
+ system("\"$XZ\" -d \"$file.xz\"") == 0 ||
+ die "Couldn't decompress \"$file\"";
+ }
}
+print "Finished\n";
diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp
index 02a555f04c..dc7d200041 100644
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -384,6 +384,9 @@ static const nsDefaultMimeTypeEntry defaultMimeEntries[] =
{ "application/xhtml+xml", "xhtml" },
{ "application/xhtml+xml", "xht" },
{ TEXT_PLAIN, "txt" },
+ { APPLICATION_JSON, "json"},
+ { APPLICATION_XJAVASCRIPT, "js"},
+ { APPLICATION_XJAVASCRIPT, "jsm"},
{ VIDEO_OGG, "ogv" },
{ VIDEO_OGG, "ogg" },
{ APPLICATION_OGG, "ogg" },
diff --git a/xpcom/base/nscore.h b/xpcom/base/nscore.h
index c667a8ae31..6300099ef6 100644
--- a/xpcom/base/nscore.h
+++ b/xpcom/base/nscore.h
@@ -134,18 +134,10 @@
*
* where nsIFoo::typeFunc is any method declared as
* NS_IMETHOD typeFunc(nsISupports*);
- *
- * XXX this can be simplified to always use the non-typeof implementation
- * when http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11893 is fixed.
*/
-#ifdef __GNUC__
-#define NS_STDCALL_FUNCPROTO(ret, name, class, func, args) \
- typeof(&class::func) name
-#else
#define NS_STDCALL_FUNCPROTO(ret, name, class, func, args) \
ret (NS_STDCALL class::*name) args
-#endif
/**
* Deprecated declarations.
diff --git a/xpcom/glue/nsCOMPtr.h b/xpcom/glue/nsCOMPtr.h
index 7ab6a143c5..3b1833c359 100644
--- a/xpcom/glue/nsCOMPtr.h
+++ b/xpcom/glue/nsCOMPtr.h
@@ -59,10 +59,8 @@
#ifdef __GNUC__
// Our use of nsCOMPtr_base::mRawPtr violates the C++ standard's aliasing
- // rules. Mark it with the may_alias attribute so that gcc 3.3 and higher
- // don't reorder instructions based on aliasing assumptions for
- // this variable. Fortunately, gcc versions < 3.3 do not do any
- // optimizations that break nsCOMPtr.
+ // rules. Mark it with the may_alias attribute so that gcc doesn't reorder
+ // instructions based on aliasing assumptions for this variable.
#define NS_MAY_ALIAS_PTR(t) t* __attribute__((__may_alias__))
#else
diff --git a/xpcom/string/nsTSubstring.h b/xpcom/string/nsTSubstring.h
index 8e3b417441..a1c1264193 100644
--- a/xpcom/string/nsTSubstring.h
+++ b/xpcom/string/nsTSubstring.h
@@ -991,7 +991,6 @@ protected:
friend class nsTObsoleteAStringThunk_CharT;
friend class nsTSubstringTuple_CharT;
- // XXX GCC 3.4 needs this :-(
friend class nsTPromiseFlatString_CharT;
char_type* mData;