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

This commit is contained in:
roytam1 2025-03-23 12:27:56 +08:00
commit e2f07956fb
6 changed files with 30 additions and 22 deletions

View file

@ -13,6 +13,7 @@
#include "mozilla/IHistory.h" #include "mozilla/IHistory.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "nsIContent.h" // for nsLinkState #include "nsIContent.h" // for nsLinkState
#include "nsIContentPolicyBase.h" // for nsContentPolicyType
namespace mozilla { namespace mozilla {

View file

@ -4171,7 +4171,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
already_AddRefed<gfxPattern> GetPatternFor(Style aStyle) already_AddRefed<gfxPattern> GetPatternFor(Style aStyle)
{ {
const CanvasPattern* pat = mCtx->CurrentState().patternStyles[aStyle]; const CanvasPattern* pat = mCtx->CurrentState().patternStyles[aStyle];
RefPtr<gfxPattern> pattern = new gfxPattern(pat->mSurface, Matrix()); RefPtr<gfxPattern> pattern = new gfxPattern(pat->mSurface, pat->mTransform);
pattern->SetExtend(CvtCanvasRepeatToGfxRepeat(pat->mRepeat)); pattern->SetExtend(CvtCanvasRepeatToGfxRepeat(pat->mRepeat));
return pattern.forget(); return pattern.forget();
} }

View file

@ -10,6 +10,7 @@
#include "mozilla/dom/ShadowRoot.h" #include "mozilla/dom/ShadowRoot.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
#include "nsDocument.h" #include "nsDocument.h"
#include "nsLayoutUtils.h"
nsGenericHTMLElement* nsGenericHTMLElement*
NS_NewHTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, NS_NewHTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,

View file

@ -11,6 +11,7 @@
#include "mozilla/dom/TextTrackCue.h" #include "mozilla/dom/TextTrackCue.h"
#include "mozilla/dom/Event.h" #include "mozilla/dom/Event.h"
#include "mozilla/ClearOnShutdown.h" #include "mozilla/ClearOnShutdown.h"
#include "mozilla/CycleCollectedJSContext.h"
#include "nsComponentManagerUtils.h" #include "nsComponentManagerUtils.h"
#include "nsVariant.h" #include "nsVariant.h"
#include "nsVideoFrame.h" #include "nsVideoFrame.h"

View file

@ -15,6 +15,7 @@
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsNetCID.h" #include "nsNetCID.h"
#include "nsIProtocolHandler.h" #include "nsIProtocolHandler.h"
#include "nsContentUtils.h"
#include "nsIDNSListener.h" #include "nsIDNSListener.h"
#include "nsIWebProgressListener.h" #include "nsIWebProgressListener.h"

View file

@ -215,15 +215,18 @@ static bool EnsurePreflightCache()
void void
nsPreflightCache::CacheEntry::PurgeExpired(TimeStamp now) nsPreflightCache::CacheEntry::PurgeExpired(TimeStamp now)
{ {
uint32_t i; for (uint32_t i = 0, len = mMethods.Length(); i < len; ++i) {
for (i = 0; i < mMethods.Length(); ++i) {
if (now >= mMethods[i].expirationTime) { if (now >= mMethods[i].expirationTime) {
mMethods.RemoveElementAt(i--); mMethods.UnorderedRemoveElementAt(i);
--i; // Examine the element again, if necessary.
--len;
} }
} }
for (i = 0; i < mHeaders.Length(); ++i) { for (uint32_t i = 0, len = mHeaders.Length(); i < len; ++i) {
if (now >= mHeaders[i].expirationTime) { if (now >= mHeaders[i].expirationTime) {
mHeaders.RemoveElementAt(i--); mHeaders.UnorderedRemoveElementAt(i);
--i; // Examine the element again, if necessary.
--len;
} }
} }
} }
@ -235,25 +238,26 @@ nsPreflightCache::CacheEntry::CheckRequest(const nsCString& aMethod,
PurgeExpired(TimeStamp::NowLoRes()); PurgeExpired(TimeStamp::NowLoRes());
if (!aMethod.EqualsLiteral("GET") && !aMethod.EqualsLiteral("POST")) { if (!aMethod.EqualsLiteral("GET") && !aMethod.EqualsLiteral("POST")) {
uint32_t i; struct CheckToken {
for (i = 0; i < mMethods.Length(); ++i) { bool Equals(const TokenTime& e, const nsCString& method) const {
if (aMethod.Equals(mMethods[i].token)) return e.token.Equals(method);
break; }
} };
if (i == mMethods.Length()) {
if (!mMethods.Contains(aMethod, CheckToken())) {
return false; return false;
} }
} }
for (uint32_t i = 0; i < aHeaders.Length(); ++i) { struct CheckHeaderToken {
uint32_t j; bool Equals(const TokenTime& e, const nsCString& header) const {
for (j = 0; j < mHeaders.Length(); ++j) { return e.token.Equals(header, comparator);
if (aHeaders[i].Equals(mHeaders[j].token,
nsCaseInsensitiveCStringComparator())) {
break;
}
} }
if (j == mHeaders.Length()) {
const nsCaseInsensitiveCStringComparator comparator;
} checker;
for (uint32_t i = 0; i < aHeaders.Length(); ++i) {
if (!mHeaders.Contains(aHeaders[i], checker)) {
return false; return false;
} }
} }
@ -1382,8 +1386,8 @@ nsCORSPreflightListener::CheckPreflightRequestApproved(nsIRequest* aRequest)
) { ) {
continue; continue;
} }
if (!headers.Contains(mPreflightHeaders[i], const auto& comparator = nsCaseInsensitiveCStringArrayComparator();
nsCaseInsensitiveCStringArrayComparator())) { if (!headers.Contains(mPreflightHeaders[i], comparator)) {
LogBlockedRequest(aRequest, "CORSMissingAllowHeaderFromPreflight", LogBlockedRequest(aRequest, "CORSMissingAllowHeaderFromPreflight",
NS_ConvertUTF8toUTF16(mPreflightHeaders[i]).get()); NS_ConvertUTF8toUTF16(mPreflightHeaders[i]).get());
return NS_ERROR_DOM_BAD_URI; return NS_ERROR_DOM_BAD_URI;