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

This commit is contained in:
roytam1 2024-11-21 21:09:29 +08:00
commit 310c05b97a
177 changed files with 514 additions and 4888 deletions

View file

@ -334,19 +334,6 @@ bool nsMediaFragmentURIParser::ParseXYWH(nsDependentSubstring aString)
return false;
}
bool nsMediaFragmentURIParser::ParseMozSampleSize(nsDependentSubstring aString)
{
int32_t sampleSize;
// Read and validate coordinates.
if (ParseInteger(aString, sampleSize) && sampleSize > 0) {
mSampleSize.emplace(sampleSize);
return true;
}
return false;
}
void nsMediaFragmentURIParser::Parse(nsACString& aRef)
{
// Create an array of possibly-invalid media fragments.
@ -367,9 +354,9 @@ void nsMediaFragmentURIParser::Parse(nsACString& aRef)
}
// Parse the media fragment values.
bool gotTemporal = false, gotSpatial = false, gotSampleSize = false;
bool gotTemporal = false, gotSpatial = false;
for (int i = fragments.Length() - 1 ; i >= 0 ; --i) {
if (gotTemporal && gotSpatial && gotSampleSize) {
if (gotTemporal && gotSpatial) {
// We've got one of each possible type. No need to look at the rest.
break;
} else if (!gotTemporal && fragments[i].first.EqualsLiteral("t")) {
@ -378,9 +365,6 @@ void nsMediaFragmentURIParser::Parse(nsACString& aRef)
} else if (!gotSpatial && fragments[i].first.EqualsLiteral("xywh")) {
nsAutoString value = NS_ConvertUTF8toUTF16(fragments[i].second);
gotSpatial = ParseXYWH(nsDependentSubstring(value, 0));
} else if (!gotSampleSize && fragments[i].first.EqualsLiteral("-moz-samplesize")) {
nsAutoString value = NS_ConvertUTF8toUTF16(fragments[i].second);
gotSampleSize = ParseMozSampleSize(nsDependentSubstring(value, 0));
}
}
}

View file

@ -63,10 +63,6 @@ public:
// returns the unit used.
ClipUnit GetClipUnit() const { return mClipUnit; }
bool HasSampleSize() const { return mSampleSize.isSome(); }
int GetSampleSize() const { return *mSampleSize; }
private:
// Parse the URI ref provided, looking for media fragments. This is
// the top-level parser the invokes the others below.
@ -88,14 +84,12 @@ private:
bool ParseNPTMM(nsDependentSubstring& aString, uint32_t& aMinute);
bool ParseNPTSS(nsDependentSubstring& aString, uint32_t& aSecond);
bool ParseXYWH(nsDependentSubstring aString);
bool ParseMozSampleSize(nsDependentSubstring aString);
// Media fragment information.
Maybe<double> mStart;
Maybe<double> mEnd;
Maybe<nsIntRect> mClip;
ClipUnit mClipUnit;
Maybe<int> mSampleSize;
};
} // namespace net

View file

@ -12,7 +12,6 @@
#include "mozilla/Preferences.h"
#include "nsNetUtil.h"
#include "nsNetUtilInlines.h"
#include "mozIApplicationClearPrivateDataParams.h"
#include "nsCategoryCache.h"
#include "nsContentUtils.h"
#include "nsHashKeys.h"
@ -568,16 +567,7 @@ NS_LoadGroupMatchesPrincipal(nsILoadGroup *aLoadGroup,
getter_AddRefs(loadContext));
NS_ENSURE_TRUE(loadContext, false);
// Verify load context appId and browser flag match the principal
uint32_t contextAppId;
bool contextInIsolatedBrowser;
nsresult rv = loadContext->GetAppId(&contextAppId);
NS_ENSURE_SUCCESS(rv, false);
rv = loadContext->GetIsInIsolatedMozBrowserElement(&contextInIsolatedBrowser);
NS_ENSURE_SUCCESS(rv, false);
return contextAppId == aPrincipal->GetAppId() &&
contextInIsolatedBrowser == aPrincipal->GetIsInIsolatedMozBrowserElement();
return true;
}
nsresult
@ -1333,39 +1323,6 @@ NS_HasBeenCrossOrigin(nsIChannel* aChannel, bool aReport)
return NS_FAILED(loadingPrincipal->CheckMayLoad(uri, aReport, dataInherits));
}
nsresult
NS_GetAppInfoFromClearDataNotification(nsISupports *aSubject,
uint32_t *aAppID,
bool *aBrowserOnly)
{
nsresult rv;
nsCOMPtr<mozIApplicationClearPrivateDataParams>
clearParams(do_QueryInterface(aSubject));
MOZ_ASSERT(clearParams);
if (!clearParams) {
return NS_ERROR_UNEXPECTED;
}
uint32_t appId;
rv = clearParams->GetAppId(&appId);
MOZ_ASSERT(NS_SUCCEEDED(rv));
MOZ_ASSERT(appId != NECKO_UNKNOWN_APP_ID);
NS_ENSURE_SUCCESS(rv, rv);
if (appId == NECKO_UNKNOWN_APP_ID) {
return NS_ERROR_UNEXPECTED;
}
bool browserOnly = false;
rv = clearParams->GetBrowserOnly(&browserOnly);
MOZ_ASSERT(NS_SUCCEEDED(rv));
NS_ENSURE_SUCCESS(rv, rv);
*aAppID = appId;
*aBrowserOnly = browserOnly;
return NS_OK;
}
bool
NS_ShouldCheckAppCache(nsIURI *aURI, bool usePrivateBrowsing)
{
@ -2385,39 +2342,18 @@ NS_CompareLoadInfoAndLoadContext(nsIChannel *aChannel)
return NS_OK;
}
uint32_t loadContextAppId = 0;
nsresult rv = loadContext->GetAppId(&loadContextAppId);
if (NS_FAILED(rv)) {
return NS_ERROR_UNEXPECTED;
}
bool loadContextIsInBE = false;
rv = loadContext->GetIsInIsolatedMozBrowserElement(&loadContextIsInBE);
if (NS_FAILED(rv)) {
return NS_ERROR_UNEXPECTED;
}
OriginAttributes originAttrsLoadInfo = loadInfo->GetOriginAttributes();
DocShellOriginAttributes originAttrsLoadContext;
loadContext->GetOriginAttributes(originAttrsLoadContext);
LOG(("NS_CompareLoadInfoAndLoadContext - loadInfo: %d, %d, %d, %d; "
"loadContext: %d %d, %d, %d. [channel=%p]",
originAttrsLoadInfo.mAppId, originAttrsLoadInfo.mInIsolatedMozBrowser,
originAttrsLoadInfo.mUserContextId, originAttrsLoadInfo.mPrivateBrowsingId,
loadContextAppId, loadContextIsInBE,
originAttrsLoadContext.mUserContextId, originAttrsLoadContext.mPrivateBrowsingId,
LOG(("NS_CompareLoadInfoAndLoadContext - loadInfo: %d, %d; "
"loadContext: %d, %d. [channel=%p]",
originAttrsLoadInfo.mUserContextId,
originAttrsLoadInfo.mPrivateBrowsingId,
originAttrsLoadContext.mUserContextId,
originAttrsLoadContext.mPrivateBrowsingId,
aChannel));
MOZ_ASSERT(originAttrsLoadInfo.mAppId == loadContextAppId,
"AppId in the loadContext and in the loadInfo are not the "
"same!");
MOZ_ASSERT(originAttrsLoadInfo.mInIsolatedMozBrowser ==
loadContextIsInBE,
"The value of InIsolatedMozBrowser in the loadContext and in "
"the loadInfo are not the same!");
MOZ_ASSERT(originAttrsLoadInfo.mUserContextId ==
originAttrsLoadContext.mUserContextId,
"The value of mUserContextId in the loadContext and in the "

View file

@ -682,15 +682,6 @@ bool NS_GetAppInfo(nsIChannel *aChannel,
uint32_t *aAppID,
bool *aIsInIsolatedMozBrowserElement);
/**
* Gets appId and browserOnly parameters from the TOPIC_WEB_APP_CLEAR_DATA
* nsIObserverService notification. Used when clearing user data or
* uninstalling web apps.
*/
nsresult NS_GetAppInfoFromClearDataNotification(nsISupports *aSubject,
uint32_t *aAppID,
bool *aBrowserOnly);
/**
* Determines whether appcache should be checked for a given URI.
*/

View file

@ -612,8 +612,7 @@ nsUDPSocket::InitWithAddress(const NetAddr *aAddr, nsIPrincipal *aPrincipal,
if (aPrincipal) {
mAppId = aPrincipal->GetAppId();
mIsInIsolatedMozBrowserElement =
aPrincipal->GetIsInIsolatedMozBrowserElement();
mIsInIsolatedMozBrowserElement = false;
}
uint16_t port;