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

This commit is contained in:
roytam1 2024-06-12 15:16:10 +08:00
commit 6d9126c486
2 changed files with 15 additions and 13 deletions

View file

@ -27,24 +27,22 @@ public:
: mSink(sink)
, mTarget(target)
, mLock("nsTransportEventSinkProxy.mLock")
, mLastEvent(nullptr)
{
NS_ADDREF(mSink);
}
private:
virtual ~nsTransportEventSinkProxy()
{
// our reference to mSink could be the last, so be sure to release
// it on the target thread. otherwise, we could get into trouble.
NS_ProxyRelease(mTarget, dont_AddRef(mSink));
// it on the target thread, otherwise, we could get into trouble.
NS_ProxyRelease(mTarget, mSink.forget());
}
public:
nsITransportEventSink *mSink;
nsCOMPtr<nsITransportEventSink> mSink;
nsCOMPtr<nsIEventTarget> mTarget;
Mutex mLock;
nsTransportStatusEvent *mLastEvent;
RefPtr<nsTransportStatusEvent> mLastEvent;
};
class nsTransportStatusEvent : public Runnable
@ -70,12 +68,14 @@ public:
// if not coalescing all, then last event may not equal self!
{
MutexAutoLock lock(mProxy->mLock);
if (mProxy->mLastEvent == this)
mProxy->mLastEvent = nullptr;
if (mProxy->mLastEvent == this) {
mProxy->mLastEvent = nullptr;
}
}
mProxy->mSink->OnTransportStatus(mTransport, mStatus, mProgress,
mProgressMax);
mProxy = nullptr;
return NS_OK;
}

View file

@ -3346,7 +3346,7 @@ nsCookieService::SetCookieInternal(nsIURI *aHostURI,
return newCookie;
}
if (!CheckHiddenPrefix(cookieAttributes)) {
COOKIE_LOGFAILURE(SET_COOKIE, aHostURI, savedCookieHeader, "failed the CheckHiddenPrefix tests");
COOKIE_LOGFAILURE(SET_COOKIE, aHostURI, savedCookieHeader, "failed the hidden prefix tests");
return newCookie;
}
// magic prefix checks. MUST be run after CheckDomain() and CheckPath()
@ -4159,8 +4159,9 @@ nsCookieService::CheckHiddenPrefix(nsCookieAttributes &aCookie) {
static const int kSecureLen = sizeof( kSecure ) - 1;
static const int kHostLen = sizeof( kHost ) - 1;
bool isSecure = strncmp( aCookie.value.get(), kSecure, kSecureLen ) == 0;
bool isHost = strncmp( aCookie.value.get(), kHost, kHostLen ) == 0;
// As of RFC 6265 bis-11 draft, this should be a case *in*sensitive match.
bool isSecure = nsCRT::strncasecmp(aCookie.value.get(), kSecure, kSecureLen) == 0;
bool isHost = nsCRT::strncasecmp(aCookie.value.get(), kHost, kHostLen) == 0;
if (isSecure || isHost) {
return false;
@ -4186,8 +4187,9 @@ nsCookieService::CheckPrefixes(nsCookieAttributes &aCookie,
static const int kSecureLen = sizeof( kSecure ) - 1;
static const int kHostLen = sizeof( kHost ) - 1;
bool isSecure = strncmp( aCookie.value.get(), kSecure, kSecureLen ) == 0;
bool isHost = strncmp( aCookie.value.get(), kHost, kHostLen ) == 0;
// As of RFC 6265 bis-11 draft, this should be a case *in*sensitive match.
bool isSecure = nsCRT::strncasecmp(aCookie.value.get(), kSecure, kSecureLen) == 0;
bool isHost = nsCRT::strncasecmp(aCookie.value.get(), kHost, kHostLen) == 0;
if ( !isSecure && !isHost ) {
// not one of the magic prefixes: carry on