Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2024-05-22 15:26:11 +08:00
commit f8f3b3ee43
6 changed files with 38 additions and 22 deletions

View file

@ -2243,10 +2243,10 @@ void ReportLoadError(ErrorResult& aRv, nsresult aLoadResult,
MOZ_ASSERT(!aRv.Failed());
switch (aLoadResult) {
case NS_ERROR_FILE_NOT_FOUND:
case NS_ERROR_NOT_AVAILABLE:
case NS_ERROR_CORRUPTED_CONTENT:
aLoadResult = NS_ERROR_DOM_NETWORK_ERR;
case NS_ERROR_DOM_SECURITY_ERR:
case NS_ERROR_DOM_SYNTAX_ERR:
case NS_ERROR_DOM_NETWORK_ERR:
// These are OK, pass them through immediately.
break;
case NS_ERROR_MALFORMED_URI:
@ -2262,10 +2262,6 @@ void ReportLoadError(ErrorResult& aRv, nsresult aLoadResult,
// for this case, because that will make it impossible for consumers to
// realize that our error was NS_BINDING_ABORTED.
aRv.Throw(aLoadResult);
return;
case NS_ERROR_DOM_SECURITY_ERR:
case NS_ERROR_DOM_SYNTAX_ERR:
break;
case NS_ERROR_DOM_BAD_URI:
@ -2273,15 +2269,15 @@ void ReportLoadError(ErrorResult& aRv, nsresult aLoadResult,
aLoadResult = NS_ERROR_DOM_SECURITY_ERR;
break;
case NS_ERROR_FILE_NOT_FOUND:
case NS_ERROR_NOT_AVAILABLE:
case NS_ERROR_CORRUPTED_CONTENT:
// For lack of anything better, go ahead and throw a NetworkError here.
// We don't want to throw a JS exception, because for toplevel script
// loads that would get squelched.
default:
// For lack of anything better, go ahead and throw a NetworkError here.
// We don't want to throw a JS exception, because for toplevel script
// loads that would get squelched.
aRv.ThrowDOMException(NS_ERROR_DOM_NETWORK_ERR,
nsPrintfCString("Failed to load worker script at %s (nsresult = 0x%x)",
NS_ConvertUTF16toUTF8(aScriptURL).get(),
aLoadResult));
return;
aLoadResult = NS_ERROR_DOM_NETWORK_ERR;
break;
}
aRv.ThrowDOMException(aLoadResult,

View file

@ -1726,7 +1726,7 @@ _cairo_cff_font_create (cairo_scaled_font_subset_t *scaled_font_subset,
if (unlikely (status))
return status;
font = malloc (sizeof (cairo_cff_font_t));
font = calloc (1, sizeof (cairo_cff_font_t));
if (unlikely (font == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -1994,7 +1994,7 @@ _cairo_cff_font_fallback_create (cairo_scaled_font_subset_t *scaled_font_subset
cairo_status_t status;
cairo_cff_font_t *font;
font = malloc (sizeof (cairo_cff_font_t));
font = calloc (1, sizeof (cairo_cff_font_t));
if (unlikely (font == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -860,6 +860,10 @@ gfxFont::gfxFont(gfxFontEntry *aFontEntry, const gfxFontStyle *aFontStyle,
++gFontCount;
#endif
mKerningSet = HasFeatureSet(HB_TAG('k','e','r','n'), mKerningEnabled);
// Ensure the gfxFontEntry's unitsPerEm and extents fields are initialized,
// so that GetFontExtents can use them without risk of races.
Unused << mFontEntry->UnitsPerEm();
}
gfxFont::~gfxFont()

View file

@ -520,8 +520,9 @@ ShareTableAndGetBlob(nsTArray<uint8_t>&& aTable,
mSharedBlobData, DeleteFontTableBlobData);
if (mBlob == hb_blob_get_empty() ) {
// The FontTableBlobData was destroyed during hb_blob_create().
// The (empty) blob is still be held in the hashtable with a strong
// The (empty) blob will still be held in the hashtable with a strong
// reference.
mSharedBlobData = nullptr;
return hb_blob_reference(mBlob);
}

View file

@ -1648,6 +1648,12 @@ pref("network.http.keep_empty_response_headers_as_empty_string", true);
// Max size, in bytes, for received HTTP response header.
pref("network.http.max_response_header_size", 393216);
// This sets the nonce length to verify the server response (via a
// server-returned Authentication-Info header). Also used for session info.
// Note: Range-checked to 4..256, if OOB defaults to 16.
// Note: Chrome uses 16. Larger values may break sites. See Bug 1892449.
pref("network.http.digest_auth_cnonce_length", 16);
// default values for FTP
// in a DSCP environment this should be 40 (0x28, or AF11), per RFC-4594,
// Section 4.8 "High-Throughput Data Service Class", and 80 (0x50, or AF22)

View file

@ -7,6 +7,7 @@
// HttpLog.h should generally be included first
#include "HttpLog.h"
#include "mozilla/Preferences.h"
#include "mozilla/Sprintf.h"
#include "nsHttp.h"
@ -20,6 +21,7 @@
#include "nsCRT.h"
#include "nsICryptoHash.h"
#include "nsComponentManagerUtils.h"
#include "pk11pub.h"
namespace mozilla {
namespace net {
@ -302,9 +304,16 @@ nsHttpDigestAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel,
// returned Authentication-Info header). also used for session info.
//
nsAutoCString cnonce;
static const char hexChar[] = "0123456789abcdef";
for (int i=0; i<16; ++i) {
cnonce.Append(hexChar[(int)(15.0 * rand()/(RAND_MAX + 1.0))]);
nsTArray<uint8_t> cnonceBuf;
int cnonceLength = Preferences::GetInt("network.http.digest_auth_cnonce_length", 16);
if (cnonceLength < 4 || cnonceLength > 256) {
cnonceLength = 16;
}
cnonceBuf.SetLength(cnonceLength / 2);
PK11_GenerateRandom(reinterpret_cast<unsigned char*>(cnonceBuf.Elements()),
cnonceBuf.Length());
for (auto byte : cnonceBuf) {
cnonce.AppendPrintf("%02x", byte);
}
LOG((" cnonce=%s\n", cnonce.get()));