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()); MOZ_ASSERT(!aRv.Failed());
switch (aLoadResult) { switch (aLoadResult) {
case NS_ERROR_FILE_NOT_FOUND: case NS_ERROR_DOM_SECURITY_ERR:
case NS_ERROR_NOT_AVAILABLE: case NS_ERROR_DOM_SYNTAX_ERR:
case NS_ERROR_CORRUPTED_CONTENT: case NS_ERROR_DOM_NETWORK_ERR:
aLoadResult = NS_ERROR_DOM_NETWORK_ERR; // These are OK, pass them through immediately.
break; break;
case NS_ERROR_MALFORMED_URI: 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 // for this case, because that will make it impossible for consumers to
// realize that our error was NS_BINDING_ABORTED. // realize that our error was NS_BINDING_ABORTED.
aRv.Throw(aLoadResult); aRv.Throw(aLoadResult);
return;
case NS_ERROR_DOM_SECURITY_ERR:
case NS_ERROR_DOM_SYNTAX_ERR:
break; break;
case NS_ERROR_DOM_BAD_URI: case NS_ERROR_DOM_BAD_URI:
@ -2273,15 +2269,15 @@ void ReportLoadError(ErrorResult& aRv, nsresult aLoadResult,
aLoadResult = NS_ERROR_DOM_SECURITY_ERR; aLoadResult = NS_ERROR_DOM_SECURITY_ERR;
break; 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: default:
// For lack of anything better, go ahead and throw a NetworkError here. aLoadResult = NS_ERROR_DOM_NETWORK_ERR;
// We don't want to throw a JS exception, because for toplevel script break;
// 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;
} }
aRv.ThrowDOMException(aLoadResult, aRv.ThrowDOMException(aLoadResult,

View file

@ -1726,7 +1726,7 @@ _cairo_cff_font_create (cairo_scaled_font_subset_t *scaled_font_subset,
if (unlikely (status)) if (unlikely (status))
return status; return status;
font = malloc (sizeof (cairo_cff_font_t)); font = calloc (1, sizeof (cairo_cff_font_t));
if (unlikely (font == NULL)) if (unlikely (font == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY); 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_status_t status;
cairo_cff_font_t *font; cairo_cff_font_t *font;
font = malloc (sizeof (cairo_cff_font_t)); font = calloc (1, sizeof (cairo_cff_font_t));
if (unlikely (font == NULL)) if (unlikely (font == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY); return _cairo_error (CAIRO_STATUS_NO_MEMORY);

View file

@ -860,6 +860,10 @@ gfxFont::gfxFont(gfxFontEntry *aFontEntry, const gfxFontStyle *aFontStyle,
++gFontCount; ++gFontCount;
#endif #endif
mKerningSet = HasFeatureSet(HB_TAG('k','e','r','n'), mKerningEnabled); 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() gfxFont::~gfxFont()

View file

@ -520,8 +520,9 @@ ShareTableAndGetBlob(nsTArray<uint8_t>&& aTable,
mSharedBlobData, DeleteFontTableBlobData); mSharedBlobData, DeleteFontTableBlobData);
if (mBlob == hb_blob_get_empty() ) { if (mBlob == hb_blob_get_empty() ) {
// The FontTableBlobData was destroyed during hb_blob_create(). // 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. // reference.
mSharedBlobData = nullptr;
return hb_blob_reference(mBlob); 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. // Max size, in bytes, for received HTTP response header.
pref("network.http.max_response_header_size", 393216); 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 // default values for FTP
// in a DSCP environment this should be 40 (0x28, or AF11), per RFC-4594, // 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) // 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 // HttpLog.h should generally be included first
#include "HttpLog.h" #include "HttpLog.h"
#include "mozilla/Preferences.h"
#include "mozilla/Sprintf.h" #include "mozilla/Sprintf.h"
#include "nsHttp.h" #include "nsHttp.h"
@ -20,6 +21,7 @@
#include "nsCRT.h" #include "nsCRT.h"
#include "nsICryptoHash.h" #include "nsICryptoHash.h"
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "pk11pub.h"
namespace mozilla { namespace mozilla {
namespace net { namespace net {
@ -302,9 +304,16 @@ nsHttpDigestAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChannel,
// returned Authentication-Info header). also used for session info. // returned Authentication-Info header). also used for session info.
// //
nsAutoCString cnonce; nsAutoCString cnonce;
static const char hexChar[] = "0123456789abcdef"; nsTArray<uint8_t> cnonceBuf;
for (int i=0; i<16; ++i) { int cnonceLength = Preferences::GetInt("network.http.digest_auth_cnonce_length", 16);
cnonce.Append(hexChar[(int)(15.0 * rand()/(RAND_MAX + 1.0))]); 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())); LOG((" cnonce=%s\n", cnonce.get()));