mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 17:31:47 +09:00
Merge remote-tracking branch 'origin/master' into custom
This commit is contained in:
commit
2ffe6398eb
42 changed files with 222 additions and 1023 deletions
|
|
@ -11,4 +11,4 @@ The in-tree copy is updated by running
|
|||
sh update.sh
|
||||
from within the modules/brotli directory.
|
||||
|
||||
Current version: [commit e61745a6b7add50d380cfd7d3883dd6c62fc2c71].
|
||||
Current version: 1.0.9 Re-release [commit e61745a6b7add50d380cfd7d3883dd6c62fc2c71].
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Script to update the mozilla in-tree copy of the Brotli decompressor.
|
||||
# Script to update the mozilla in-tree copy of the Brotli library.
|
||||
# Run this within the /modules/brotli directory of the source tree.
|
||||
|
||||
MY_TEMP_DIR=`mktemp -d -t brotli_update.XXXXXX` || exit 1
|
||||
GIT=git
|
||||
|
||||
$GIT clone git://github.com/google/brotli.git ${MY_TEMP_DIR}/brotli
|
||||
$GIT -C ${MY_TEMP_DIR}/brotli checkout v1.0.9
|
||||
git clone https://github.com/google/brotli ${MY_TEMP_DIR}/brotli
|
||||
git -C ${MY_TEMP_DIR}/brotli checkout v1.0.9
|
||||
|
||||
COMMIT=$(${GIT} -C ${MY_TEMP_DIR}/brotli rev-parse HEAD)
|
||||
COMMIT=$(git -C ${MY_TEMP_DIR}/brotli rev-parse HEAD)
|
||||
perl -p -i -e "s/\[commit [0-9a-f]{40}\]/[commit ${COMMIT}]/" README.mozilla;
|
||||
|
||||
DIRS="common dec enc include tools"
|
||||
|
|
@ -20,9 +19,7 @@ for d in $DIRS; do
|
|||
done
|
||||
rm -rf ${MY_TEMP_DIR}
|
||||
|
||||
#hg addremove $DIRS
|
||||
|
||||
echo "###"
|
||||
echo "### Updated brotli/dec to $COMMIT."
|
||||
echo "### Updated brotli to $COMMIT."
|
||||
echo "### Remember to verify and commit the changes to source control!"
|
||||
echo "###"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "nsJARInputStream.h"
|
||||
#include "zipstruct.h" // defines ZIP compression codes
|
||||
#include "brotli/decode.h"
|
||||
#include "nsZipArchive.h"
|
||||
|
||||
#include "nsEscape.h"
|
||||
|
|
@ -51,6 +52,13 @@ nsJARInputStream::InitFile(nsJAR *aJar, nsZipItem *item)
|
|||
mOutCrc = crc32(0L, Z_NULL, 0);
|
||||
break;
|
||||
|
||||
case MOZ_JAR_BROTLI:
|
||||
mBrotliState = BrotliDecoderCreateInstance(nullptr, nullptr, nullptr);
|
||||
mMode = MODE_BROTLI;
|
||||
mInCrc = item->CRC32();
|
||||
mOutCrc = crc32(0L, Z_NULL, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
@ -166,6 +174,7 @@ nsJARInputStream::Available(uint64_t *_retval)
|
|||
break;
|
||||
|
||||
case MODE_INFLATE:
|
||||
case MODE_BROTLI:
|
||||
case MODE_COPY:
|
||||
*_retval = mOutSize - mZs.total_out;
|
||||
break;
|
||||
|
|
@ -195,7 +204,8 @@ MOZ_WIN_MEM_TRY_BEGIN
|
|||
return ReadDirectory(aBuffer, aCount, aBytesRead);
|
||||
|
||||
case MODE_INFLATE:
|
||||
if (mFd) {
|
||||
case MODE_BROTLI:
|
||||
if (mZs.total_out < mOutSize) {
|
||||
rv = ContinueInflate(aBuffer, aCount, aBytesRead);
|
||||
}
|
||||
// be aggressive about releasing the file!
|
||||
|
|
@ -246,6 +256,9 @@ nsJARInputStream::Close()
|
|||
if (mMode == MODE_INFLATE) {
|
||||
inflateEnd(&mZs);
|
||||
}
|
||||
if (mMode == MODE_BROTLI) {
|
||||
BrotliDecoderDestroyInstance(mBrotliState);
|
||||
}
|
||||
mMode = MODE_CLOSED;
|
||||
mFd = nullptr;
|
||||
return NS_OK;
|
||||
|
|
@ -255,6 +268,8 @@ nsresult
|
|||
nsJARInputStream::ContinueInflate(char* aBuffer, uint32_t aCount,
|
||||
uint32_t* aBytesRead)
|
||||
{
|
||||
bool finished = false;
|
||||
|
||||
// No need to check the args, ::Read did that, but assert them at least
|
||||
NS_ASSERTION(aBuffer,"aBuffer parameter must not be null");
|
||||
NS_ASSERTION(aBytesRead,"aBytesRead parameter must not be null");
|
||||
|
|
@ -266,11 +281,35 @@ nsJARInputStream::ContinueInflate(char* aBuffer, uint32_t aCount,
|
|||
mZs.avail_out = std::min(aCount, (mOutSize-oldTotalOut));
|
||||
mZs.next_out = (unsigned char*)aBuffer;
|
||||
|
||||
// now inflate
|
||||
int zerr = inflate(&mZs, Z_SYNC_FLUSH);
|
||||
if ((zerr != Z_OK) && (zerr != Z_STREAM_END)) {
|
||||
nsZipArchive::sFileCorruptedReason = "nsJARInputStream: error while inflating";
|
||||
return NS_ERROR_FILE_CORRUPTED;
|
||||
if (mMode == MODE_INFLATE) {
|
||||
// now inflate
|
||||
int zerr = inflate(&mZs, Z_SYNC_FLUSH);
|
||||
if ((zerr != Z_OK) && (zerr != Z_STREAM_END)) {
|
||||
nsZipArchive::sFileCorruptedReason = "nsJARInputStream: error while inflating";
|
||||
return NS_ERROR_FILE_CORRUPTED;
|
||||
}
|
||||
finished = (zerr == Z_STREAM_END);
|
||||
} else {
|
||||
MOZ_ASSERT(mMode == MODE_BROTLI);
|
||||
/* The brotli library wants size_t, but z_stream only contains
|
||||
* unsigned int for avail_* and unsigned long for total_*.
|
||||
* So use temporary stack values. */
|
||||
size_t avail_in = mZs.avail_in;
|
||||
size_t avail_out = mZs.avail_out;
|
||||
size_t total_out = mZs.total_out;
|
||||
BrotliDecoderResult result = BrotliDecoderDecompressStream(
|
||||
mBrotliState,
|
||||
&avail_in, const_cast<const unsigned char**>(&mZs.next_in),
|
||||
&avail_out, &mZs.next_out, &total_out);
|
||||
/* We don't need to update avail_out, it's not used outside this
|
||||
* function. */
|
||||
mZs.total_out = total_out;
|
||||
mZs.avail_in = avail_in;
|
||||
if (result == BROTLI_DECODER_RESULT_ERROR) {
|
||||
nsZipArchive::sFileCorruptedReason = "nsJARInputStream: brotli decompression error";
|
||||
return NS_ERROR_FILE_CORRUPTED;
|
||||
}
|
||||
finished = (result == BROTLI_DECODER_RESULT_SUCCESS);
|
||||
}
|
||||
|
||||
*aBytesRead = (mZs.total_out - oldTotalOut);
|
||||
|
|
@ -280,8 +319,10 @@ nsJARInputStream::ContinueInflate(char* aBuffer, uint32_t aCount,
|
|||
|
||||
// be aggressive about ending the inflation
|
||||
// for some reason we don't always get Z_STREAM_END
|
||||
if (zerr == Z_STREAM_END || mZs.total_out == mOutSize) {
|
||||
inflateEnd(&mZs);
|
||||
if (finished || mZs.total_out == mOutSize) {
|
||||
if (mMode == MODE_INFLATE) {
|
||||
inflateEnd(&mZs);
|
||||
}
|
||||
|
||||
// stop returning valid data as soon as we know we have a bad CRC
|
||||
if (mOutCrc != mInCrc) {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
#include "nsTArray.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
struct BrotliDecoderStateStruct;
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Class nsJARInputStream declaration. This class defines the type of the
|
||||
* object returned by calls to nsJAR::GetInputStream(filename) for the
|
||||
|
|
@ -20,9 +22,15 @@
|
|||
class nsJARInputStream final : public nsIInputStream
|
||||
{
|
||||
public:
|
||||
nsJARInputStream() :
|
||||
mOutSize(0), mInCrc(0), mOutCrc(0), mNameLen(0),
|
||||
mCurPos(0), mArrPos(0), mMode(MODE_NOTINITED)
|
||||
nsJARInputStream()
|
||||
: mOutSize(0)
|
||||
, mInCrc(0)
|
||||
, mOutCrc(0)
|
||||
, mBrotliState(nullptr)
|
||||
, mNameLen(0)
|
||||
, mCurPos(0)
|
||||
, mArrPos(0)
|
||||
, mMode(MODE_NOTINITED)
|
||||
{
|
||||
memset(&mZs, 0, sizeof(z_stream));
|
||||
}
|
||||
|
|
@ -45,6 +53,7 @@ class nsJARInputStream final : public nsIInputStream
|
|||
uint32_t mInCrc; // CRC as provided by the zipentry
|
||||
uint32_t mOutCrc; // CRC as calculated by me
|
||||
z_stream mZs; // zip data structure
|
||||
BrotliDecoderStateStruct* mBrotliState; // Brotli decoder state
|
||||
|
||||
/* For directory reading */
|
||||
RefPtr<nsJAR> mJar; // string reference to zipreader
|
||||
|
|
@ -59,6 +68,7 @@ class nsJARInputStream final : public nsIInputStream
|
|||
MODE_CLOSED,
|
||||
MODE_DIRECTORY,
|
||||
MODE_INFLATE,
|
||||
MODE_BROTLI,
|
||||
MODE_COPY
|
||||
} JISMode;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* This module implements a simple archive extractor for the PKZIP format.
|
||||
* This module implements a simple archive extractor.
|
||||
*
|
||||
* The underlying nsZipArchive is NOT thread-safe. Do not pass references
|
||||
* or pointers to it across thread boundaries.
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#define READTYPE int32_t
|
||||
#include "zlib.h"
|
||||
#include "brotli/decode.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "prio.h"
|
||||
#include "plstr.h"
|
||||
|
|
@ -1186,6 +1187,7 @@ nsZipCursor::nsZipCursor(nsZipItem *item, nsZipArchive *aZip, uint8_t* aBuf,
|
|||
: mItem(item)
|
||||
, mBuf(aBuf)
|
||||
, mBufSize(aBufSize)
|
||||
, mBrotliState(nullptr)
|
||||
, mCRC(0)
|
||||
, mDoCRC(doCRC)
|
||||
{
|
||||
|
|
@ -1200,6 +1202,10 @@ nsZipCursor::nsZipCursor(nsZipItem *item, nsZipArchive *aZip, uint8_t* aBuf,
|
|||
|
||||
mZs.avail_in = item->Size();
|
||||
mZs.next_in = (Bytef*)aZip->GetData(item);
|
||||
|
||||
if (mItem->Compression() == MOZ_JAR_BROTLI) {
|
||||
mBrotliState = BrotliDecoderCreateInstance(nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
if (doCRC)
|
||||
mCRC = crc32(0L, Z_NULL, 0);
|
||||
|
|
@ -1210,6 +1216,9 @@ nsZipCursor::~nsZipCursor()
|
|||
if (mItem->Compression() == DEFLATED) {
|
||||
inflateEnd(&mZs);
|
||||
}
|
||||
if (mItem->Compression() == MOZ_JAR_BROTLI) {
|
||||
BrotliDecoderDestroyInstance(mBrotliState);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t* nsZipCursor::ReadOrCopy(uint32_t *aBytesRead, bool aCopy) {
|
||||
|
|
@ -1246,6 +1255,29 @@ MOZ_WIN_MEM_TRY_BEGIN
|
|||
*aBytesRead = mZs.next_out - buf;
|
||||
verifyCRC = (zerr == Z_STREAM_END);
|
||||
break;
|
||||
case MOZ_JAR_BROTLI: {
|
||||
buf = mBuf;
|
||||
mZs.next_out = buf;
|
||||
/* The brotli library wants size_t, but z_stream only contains
|
||||
* unsigned int for avail_*. So use temporary stack values. */
|
||||
size_t avail_out = mBufSize;
|
||||
size_t avail_in = mZs.avail_in;
|
||||
BrotliDecoderResult result = BrotliDecoderDecompressStream(
|
||||
mBrotliState,
|
||||
&avail_in, const_cast<const unsigned char**>(&mZs.next_in),
|
||||
&avail_out, &mZs.next_out, nullptr);
|
||||
/* We don't need to update avail_out, it's not used outside this
|
||||
* function. */
|
||||
mZs.avail_in = avail_in;
|
||||
|
||||
if (result == BROTLI_DECODER_RESULT_ERROR) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
*aBytesRead = mZs.next_out - buf;
|
||||
verifyCRC = (result == BROTLI_DECODER_RESULT_SUCCESS);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -1272,7 +1304,9 @@ nsZipItemPtr_base::nsZipItemPtr_base(nsZipArchive *aZip,
|
|||
return;
|
||||
|
||||
uint32_t size = 0;
|
||||
if (item->Compression() == DEFLATED) {
|
||||
bool compressed = (item->Compression() == DEFLATED) ||
|
||||
(item->Compression() == MOZ_JAR_BROTLI);
|
||||
if (compressed) {
|
||||
size = item->RealSize();
|
||||
mAutoBuf = MakeUniqueFallible<uint8_t[]>(size);
|
||||
if (!mAutoBuf) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
class nsZipFind;
|
||||
struct PRFileDesc;
|
||||
struct BrotliDecoderStateStruct;
|
||||
|
||||
/**
|
||||
* This file defines some of the basic structures used by libjar to
|
||||
|
|
@ -314,6 +315,7 @@ private:
|
|||
uint8_t *mBuf;
|
||||
uint32_t mBufSize;
|
||||
z_stream mZs;
|
||||
BrotliDecoderStateStruct* mBrotliState;
|
||||
uint32_t mCRC;
|
||||
bool mDoCRC;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ typedef struct ZipEnd_
|
|||
#define TOKENIZED 7
|
||||
#define DEFLATED 8
|
||||
#define UNSUPPORTED 0xFF
|
||||
|
||||
/* non-standard extension */
|
||||
#define MOZ_JAR_BROTLI 0x81
|
||||
|
||||
#endif /* _zipstruct_h */
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ pref("keyword.enabled", false);
|
|||
pref("general.useragent.locale", "chrome://global/locale/intl.properties");
|
||||
pref("general.useragent.compatMode.gecko", false);
|
||||
pref("general.useragent.compatMode.firefox", false);
|
||||
pref("general.useragent.compatMode.version", "68.9");
|
||||
pref("general.useragent.compatMode.version", "68.0");
|
||||
pref("general.useragent.appVersionIsBuildID", false);
|
||||
|
||||
// This pref exists only for testing purposes. In order to disable all
|
||||
|
|
@ -4746,10 +4746,6 @@ pref("dom.event.handling-user-input-time-limit", 1000);
|
|||
// Whether we should layerize all animated images (if otherwise possible).
|
||||
pref("layout.animated-image-layers.enabled", false);
|
||||
|
||||
pref("dom.vibrator.enabled", true);
|
||||
pref("dom.vibrator.max_vibrate_ms", 10000);
|
||||
pref("dom.vibrator.max_vibrate_list_len", 128);
|
||||
|
||||
// Abort API
|
||||
pref("dom.abortController.enabled", true);
|
||||
|
||||
|
|
@ -5421,8 +5417,8 @@ pref("osfile.reset_worker_delay", 30000);
|
|||
#endif
|
||||
|
||||
#if !defined(MOZ_WIDGET_ANDROID)
|
||||
pref("dom.webkitBlink.dirPicker.enabled", true);
|
||||
pref("dom.webkitBlink.filesystem.enabled", true);
|
||||
pref("dom.webkitBlink.dirPicker.enabled", false);
|
||||
pref("dom.webkitBlink.filesystem.enabled", false);
|
||||
#endif
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue