зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1770944 - Remove other references to inBrowserElement, r=cookie-reviewers,valentin,janv,decoder
Depends on D183230 Differential Revision: https://phabricator.services.mozilla.com/D189490
This commit is contained in:
Родитель
8a817efa45
Коммит
bb8df1117c
|
@ -874,9 +874,6 @@ add_task(async function checkAllTheFiles() {
|
|||
// Wait for all manifest to be parsed
|
||||
await PerfTestHelpers.throttledMapPromises(manifestURIs, parseManifest);
|
||||
|
||||
for (let jsm of Components.manager.getComponentJSMs()) {
|
||||
gReferencesFromCode.set(jsm, null);
|
||||
}
|
||||
for (let esModule of Components.manager.getComponentESModules()) {
|
||||
gReferencesFromCode.set(esModule, null);
|
||||
}
|
||||
|
|
|
@ -229,10 +229,6 @@ void OriginAttributes::CreateSuffix(nsACString& aStr) const {
|
|||
// naming.
|
||||
//
|
||||
|
||||
if (mInIsolatedMozBrowser) {
|
||||
params.Set(u"inBrowser"_ns, u"1"_ns);
|
||||
}
|
||||
|
||||
if (mUserContextId != nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID) {
|
||||
value.Truncate();
|
||||
value.AppendInt(mUserContextId);
|
||||
|
@ -335,7 +331,6 @@ bool OriginAttributes::PopulateFromSuffix(const nsACString& aStr) {
|
|||
return false;
|
||||
}
|
||||
|
||||
mInIsolatedMozBrowser = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
|
|||
public:
|
||||
OriginAttributes() = default;
|
||||
|
||||
explicit OriginAttributes(bool aInIsolatedMozBrowser) {
|
||||
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
|
||||
}
|
||||
|
||||
explicit OriginAttributes(const OriginAttributesDictionary& aOther)
|
||||
: OriginAttributesDictionary(aOther) {}
|
||||
|
||||
|
@ -74,8 +70,7 @@ class OriginAttributes : public dom::OriginAttributesDictionary {
|
|||
}
|
||||
|
||||
[[nodiscard]] bool EqualsIgnoringFPD(const OriginAttributes& aOther) const {
|
||||
return mInIsolatedMozBrowser == aOther.mInIsolatedMozBrowser &&
|
||||
mUserContextId == aOther.mUserContextId &&
|
||||
return mUserContextId == aOther.mUserContextId &&
|
||||
mPrivateBrowsingId == aOther.mPrivateBrowsingId &&
|
||||
mGeckoViewSessionContextId == aOther.mGeckoViewSessionContextId;
|
||||
}
|
||||
|
@ -159,11 +154,6 @@ class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary {
|
|||
|
||||
// Performs a match of |aAttrs| against this pattern.
|
||||
bool Matches(const OriginAttributes& aAttrs) const {
|
||||
if (mInIsolatedMozBrowser.WasPassed() &&
|
||||
mInIsolatedMozBrowser.Value() != aAttrs.mInIsolatedMozBrowser) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mUserContextId.WasPassed() &&
|
||||
mUserContextId.Value() != aAttrs.mUserContextId) {
|
||||
return false;
|
||||
|
@ -227,12 +217,6 @@ class OriginAttributesPattern : public dom::OriginAttributesPatternDictionary {
|
|||
}
|
||||
|
||||
bool Overlaps(const OriginAttributesPattern& aOther) const {
|
||||
if (mInIsolatedMozBrowser.WasPassed() &&
|
||||
aOther.mInIsolatedMozBrowser.WasPassed() &&
|
||||
mInIsolatedMozBrowser.Value() != aOther.mInIsolatedMozBrowser.Value()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mUserContextId.WasPassed() && aOther.mUserContextId.WasPassed() &&
|
||||
mUserContextId.Value() != aOther.mUserContextId.Value()) {
|
||||
return false;
|
||||
|
|
|
@ -45,12 +45,6 @@ TEST(OriginAttributes, Suffix_default)
|
|||
TestSuffix(attrs);
|
||||
}
|
||||
|
||||
TEST(OriginAttributes, Suffix_inIsolatedMozBrowser)
|
||||
{
|
||||
OriginAttributes attrs(true);
|
||||
TestSuffix(attrs);
|
||||
}
|
||||
|
||||
TEST(OriginAttributes, FirstPartyDomain_default)
|
||||
{
|
||||
bool oldFpiPref = Preferences::GetBool(FPI_PREF);
|
||||
|
|
|
@ -129,8 +129,7 @@ class ChromeUtils {
|
|||
static bool IsOriginAttributesEqualIgnoringFPD(
|
||||
const dom::OriginAttributesDictionary& aA,
|
||||
const dom::OriginAttributesDictionary& aB) {
|
||||
return aA.mInIsolatedMozBrowser == aB.mInIsolatedMozBrowser &&
|
||||
aA.mUserContextId == aB.mUserContextId &&
|
||||
return aA.mUserContextId == aB.mUserContextId &&
|
||||
aA.mPrivateBrowsingId == aB.mPrivateBrowsingId;
|
||||
}
|
||||
|
||||
|
|
|
@ -951,7 +951,6 @@ dictionary IOActivityDataDictionary {
|
|||
[GenerateInitFromJSON]
|
||||
dictionary OriginAttributesDictionary {
|
||||
unsigned long userContextId = 0;
|
||||
boolean inIsolatedMozBrowser = false;
|
||||
unsigned long privateBrowsingId = 0;
|
||||
DOMString firstPartyDomain = "";
|
||||
DOMString geckoViewSessionContextId = "";
|
||||
|
@ -961,7 +960,6 @@ dictionary OriginAttributesDictionary {
|
|||
[GenerateInitFromJSON, GenerateToJSON]
|
||||
dictionary OriginAttributesPatternDictionary {
|
||||
unsigned long userContextId;
|
||||
boolean inIsolatedMozBrowser;
|
||||
unsigned long privateBrowsingId;
|
||||
DOMString firstPartyDomain;
|
||||
DOMString geckoViewSessionContextId;
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/net/ExtensionProtocolHandler.h"
|
||||
#include "mozilla/StorageOriginAttributes.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsBaseHashtable.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -3203,7 +3204,7 @@ nsresult QuotaManager::CreateDirectoryMetadata(
|
|||
const OriginMetadata& aOriginMetadata) {
|
||||
AssertIsOnIOThread();
|
||||
|
||||
OriginAttributes groupAttributes;
|
||||
StorageOriginAttributes groupAttributes;
|
||||
|
||||
nsCString groupNoSuffix;
|
||||
QM_TRY(OkIf(groupAttributes.PopulateFromOrigin(aOriginMetadata.mGroup,
|
||||
|
@ -3211,11 +3212,11 @@ nsresult QuotaManager::CreateDirectoryMetadata(
|
|||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCString groupPrefix;
|
||||
GetJarPrefix(groupAttributes.mInIsolatedMozBrowser, groupPrefix);
|
||||
GetJarPrefix(groupAttributes.InIsolatedMozBrowser(), groupPrefix);
|
||||
|
||||
nsCString group = groupPrefix + groupNoSuffix;
|
||||
|
||||
OriginAttributes originAttributes;
|
||||
StorageOriginAttributes originAttributes;
|
||||
|
||||
nsCString originNoSuffix;
|
||||
QM_TRY(OkIf(originAttributes.PopulateFromOrigin(aOriginMetadata.mOrigin,
|
||||
|
@ -3223,7 +3224,7 @@ nsresult QuotaManager::CreateDirectoryMetadata(
|
|||
NS_ERROR_FAILURE);
|
||||
|
||||
nsCString originPrefix;
|
||||
GetJarPrefix(originAttributes.mInIsolatedMozBrowser, originPrefix);
|
||||
GetJarPrefix(originAttributes.InIsolatedMozBrowser(), originPrefix);
|
||||
|
||||
nsCString origin = originPrefix + originNoSuffix;
|
||||
|
||||
|
|
|
@ -216,11 +216,7 @@ void OriginParser::HandleToken(const nsDependentCSubstring& aToken) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (aToken.First() == 't') {
|
||||
mInIsolatedMozBrowser = true;
|
||||
} else if (aToken.First() == 'f') {
|
||||
mInIsolatedMozBrowser = false;
|
||||
} else {
|
||||
if ((aToken.First() != 't') && (aToken.First() != 'f')) {
|
||||
QM_WARNING("'%s' is not a valid value for the inMozBrowser flag!",
|
||||
nsCString(aToken).get());
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ class MOZ_STACK_CLASS OriginParser final {
|
|||
|
||||
SchemeType mSchemeType;
|
||||
State mState;
|
||||
bool mInIsolatedMozBrowser;
|
||||
bool mUniversalFileOrigin;
|
||||
bool mMaybeDriveLetter;
|
||||
bool mError;
|
||||
|
@ -80,7 +79,6 @@ class MOZ_STACK_CLASS OriginParser final {
|
|||
mTokenizer(aOrigin, '+'),
|
||||
mSchemeType(eNone),
|
||||
mState(eExpectingAppIdOrScheme),
|
||||
mInIsolatedMozBrowser(false),
|
||||
mUniversalFileOrigin(false),
|
||||
mMaybeDriveLetter(false),
|
||||
mError(false),
|
||||
|
|
|
@ -64,7 +64,6 @@ struct ParamTraits<mozilla::OriginAttributesPattern> {
|
|||
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mFirstPartyDomain);
|
||||
WriteParam(aWriter, aParam.mInIsolatedMozBrowser);
|
||||
WriteParam(aWriter, aParam.mPrivateBrowsingId);
|
||||
WriteParam(aWriter, aParam.mUserContextId);
|
||||
WriteParam(aWriter, aParam.mGeckoViewSessionContextId);
|
||||
|
@ -72,7 +71,6 @@ struct ParamTraits<mozilla::OriginAttributesPattern> {
|
|||
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mFirstPartyDomain) &&
|
||||
ReadParam(aReader, &aResult->mInIsolatedMozBrowser) &&
|
||||
ReadParam(aReader, &aResult->mPrivateBrowsingId) &&
|
||||
ReadParam(aReader, &aResult->mUserContextId) &&
|
||||
ReadParam(aReader, &aResult->mGeckoViewSessionContextId);
|
||||
|
|
|
@ -57,4 +57,19 @@ bool StorageOriginAttributes::PopulateFromOrigin(const nsACString& aOrigin,
|
|||
return PopulateFromSuffix(Substring(origin, pos));
|
||||
}
|
||||
|
||||
void StorageOriginAttributes::CreateSuffix(nsACString& aStr) const {
|
||||
URLParams params;
|
||||
nsAutoString value;
|
||||
|
||||
if (mInIsolatedMozBrowser) {
|
||||
params.Set(u"inBrowser"_ns, u"1"_ns);
|
||||
}
|
||||
|
||||
params.Serialize(value, true);
|
||||
if (!value.IsEmpty()) {
|
||||
aStr.AppendLiteral("^");
|
||||
aStr.Append(NS_ConvertUTF16toUTF8(value));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -15,12 +15,20 @@ namespace mozilla {
|
|||
// in OriginAttributes class anymore.
|
||||
class StorageOriginAttributes {
|
||||
public:
|
||||
StorageOriginAttributes() = default;
|
||||
explicit StorageOriginAttributes(bool aInIsolatedMozBrowser) {
|
||||
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
|
||||
}
|
||||
bool InIsolatedMozBrowser() const { return mInIsolatedMozBrowser; }
|
||||
|
||||
uint32_t UserContextId() const { return mOriginAttributes.mUserContextId; }
|
||||
|
||||
// New getters can be added here incrementally.
|
||||
|
||||
void SetInIsolatedMozBrowser(bool aInIsolatedMozBrowser) {
|
||||
mInIsolatedMozBrowser = aInIsolatedMozBrowser;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool PopulateFromSuffix(const nsACString& aStr);
|
||||
|
||||
// Populates the attributes from a string like
|
||||
|
@ -28,6 +36,10 @@ class StorageOriginAttributes {
|
|||
[[nodiscard]] bool PopulateFromOrigin(const nsACString& aOrigin,
|
||||
nsACString& aOriginNoSuffix);
|
||||
|
||||
/* XXX This method only supports the legacy mInIsolatedMozBrowser at the
|
||||
moment, other origin attributes won't be serialized */
|
||||
void CreateSuffix(nsACString& aStr) const;
|
||||
|
||||
private:
|
||||
OriginAttributes mOriginAttributes;
|
||||
|
||||
|
|
|
@ -162,4 +162,24 @@ TEST(DOM_Quota_StorageOriginAttributes, PopulateFromOrigin_Mixed_Invalid)
|
|||
}
|
||||
}
|
||||
|
||||
TEST(DOM_Quota_StorageOriginAttributes, CreateSuffix_Mozbrowser)
|
||||
{
|
||||
{
|
||||
StorageOriginAttributes originAttributes(true);
|
||||
nsCString suffix;
|
||||
originAttributes.CreateSuffix(suffix);
|
||||
ASSERT_EQ(suffix, "^inBrowser=1");
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DOM_Quota_StorageOriginAttributes, CreateSuffix_NoMozbrowser)
|
||||
{
|
||||
{
|
||||
StorageOriginAttributes originAttributes(false);
|
||||
nsCString suffix;
|
||||
originAttributes.CreateSuffix(suffix);
|
||||
ASSERT_EQ(suffix, "");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla::dom::quota::test
|
||||
|
|
|
@ -219,7 +219,7 @@ TEST(ServiceWorkerRegistrar, TestReadData)
|
|||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
|
@ -280,30 +280,24 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
|
|||
{
|
||||
RefPtr<ServiceWorkerRegistrarTest> swr = new ServiceWorkerRegistrarTest;
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
ServiceWorkerRegistrationData reg;
|
||||
ServiceWorkerRegistrationData reg;
|
||||
|
||||
reg.scope() = nsPrintfCString("https://scope_write_%d.org", i);
|
||||
reg.currentWorkerURL() = nsPrintfCString("currentWorkerURL write %d", i);
|
||||
reg.currentWorkerHandlesFetch() = true;
|
||||
reg.cacheName() =
|
||||
NS_ConvertUTF8toUTF16(nsPrintfCString("cacheName write %d", i));
|
||||
reg.updateViaCache() =
|
||||
nsIServiceWorkerRegistrationInfo::UPDATE_VIA_CACHE_IMPORTS;
|
||||
reg.scope() = "https://scope_write_0.org"_ns;
|
||||
reg.currentWorkerURL() = "currentWorkerURL write 0"_ns;
|
||||
reg.currentWorkerHandlesFetch() = true;
|
||||
reg.cacheName() = u"cacheName write 0"_ns;
|
||||
reg.updateViaCache() =
|
||||
nsIServiceWorkerRegistrationInfo::UPDATE_VIA_CACHE_IMPORTS;
|
||||
|
||||
reg.currentWorkerInstalledTime() = PR_Now();
|
||||
reg.currentWorkerActivatedTime() = PR_Now();
|
||||
reg.lastUpdateTime() = PR_Now();
|
||||
reg.currentWorkerInstalledTime() = PR_Now();
|
||||
reg.currentWorkerActivatedTime() = PR_Now();
|
||||
reg.lastUpdateTime() = PR_Now();
|
||||
|
||||
nsAutoCString spec;
|
||||
spec.AppendPrintf("spec write %d", i);
|
||||
const auto spec = "spec write 0"_ns;
|
||||
reg.principal() = mozilla::ipc::ContentPrincipalInfo(
|
||||
mozilla::OriginAttributes(), spec, spec, mozilla::Nothing(), spec);
|
||||
|
||||
reg.principal() = mozilla::ipc::ContentPrincipalInfo(
|
||||
mozilla::OriginAttributes(i % 2), spec, spec, mozilla::Nothing(),
|
||||
spec);
|
||||
|
||||
swr->TestRegisterServiceWorker(reg);
|
||||
}
|
||||
swr->TestRegisterServiceWorker(reg);
|
||||
|
||||
nsresult rv = swr->TestWriteData();
|
||||
ASSERT_EQ(NS_OK, rv) << "WriteData() should not fail";
|
||||
|
@ -314,47 +308,37 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
|
|||
nsresult rv = swr->TestReadData();
|
||||
ASSERT_EQ(NS_OK, rv) << "ReadData() should not fail";
|
||||
|
||||
const nsTArray<ServiceWorkerRegistrationData>& data = swr->TestGetData();
|
||||
ASSERT_EQ((uint32_t)2, data.Length()) << "2 entries should be found";
|
||||
const nsTArray<ServiceWorkerRegistrationData>& dataArr = swr->TestGetData();
|
||||
ASSERT_EQ((uint32_t)1, dataArr.Length()) << "1 entries should be found";
|
||||
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
nsAutoCString test;
|
||||
const auto& data = dataArr[0];
|
||||
|
||||
ASSERT_EQ(data[i].principal().type(),
|
||||
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo = data[i].principal();
|
||||
ASSERT_EQ(data.principal().type(),
|
||||
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo = data.principal();
|
||||
|
||||
mozilla::OriginAttributes attrs(i % 2);
|
||||
nsAutoCString suffix, expectSuffix;
|
||||
attrs.CreateSuffix(expectSuffix);
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
mozilla::OriginAttributes attrs;
|
||||
nsAutoCString suffix, expectSuffix;
|
||||
attrs.CreateSuffix(expectSuffix);
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
|
||||
ASSERT_STREQ(expectSuffix.get(), suffix.get());
|
||||
ASSERT_STREQ(expectSuffix.get(), suffix.get());
|
||||
|
||||
test.AppendPrintf("https://scope_write_%d.org", i);
|
||||
ASSERT_STREQ(test.get(), cInfo.spec().get());
|
||||
ASSERT_STREQ("https://scope_write_0.org", cInfo.spec().get());
|
||||
ASSERT_STREQ("https://scope_write_0.org", data.scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL write 0", data.currentWorkerURL().get());
|
||||
|
||||
test.Truncate();
|
||||
test.AppendPrintf("https://scope_write_%d.org", i);
|
||||
ASSERT_STREQ(test.get(), data[i].scope().get());
|
||||
ASSERT_EQ(true, data.currentWorkerHandlesFetch());
|
||||
|
||||
test.Truncate();
|
||||
test.AppendPrintf("currentWorkerURL write %d", i);
|
||||
ASSERT_STREQ(test.get(), data[i].currentWorkerURL().get());
|
||||
ASSERT_STREQ("cacheName write 0",
|
||||
NS_ConvertUTF16toUTF8(data.cacheName()).get());
|
||||
|
||||
ASSERT_EQ(true, data[i].currentWorkerHandlesFetch());
|
||||
ASSERT_EQ(nsIServiceWorkerRegistrationInfo::UPDATE_VIA_CACHE_IMPORTS,
|
||||
data.updateViaCache());
|
||||
|
||||
test.Truncate();
|
||||
test.AppendPrintf("cacheName write %d", i);
|
||||
ASSERT_STREQ(test.get(), NS_ConvertUTF16toUTF8(data[i].cacheName()).get());
|
||||
|
||||
ASSERT_EQ(nsIServiceWorkerRegistrationInfo::UPDATE_VIA_CACHE_IMPORTS,
|
||||
data[i].updateViaCache());
|
||||
|
||||
ASSERT_NE((int64_t)0, data[i].currentWorkerInstalledTime());
|
||||
ASSERT_NE((int64_t)0, data[i].currentWorkerActivatedTime());
|
||||
ASSERT_NE((int64_t)0, data[i].lastUpdateTime());
|
||||
}
|
||||
ASSERT_NE((int64_t)0, data.currentWorkerInstalledTime());
|
||||
ASSERT_NE((int64_t)0, data.currentWorkerActivatedTime());
|
||||
ASSERT_NE((int64_t)0, data.lastUpdateTime());
|
||||
}
|
||||
|
||||
TEST(ServiceWorkerRegistrar, TestVersion2Migration)
|
||||
|
@ -394,7 +378,7 @@ TEST(ServiceWorkerRegistrar, TestVersion2Migration)
|
|||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
|
@ -464,7 +448,7 @@ TEST(ServiceWorkerRegistrar, TestVersion3Migration)
|
|||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
|
@ -532,7 +516,7 @@ TEST(ServiceWorkerRegistrar, TestVersion4Migration)
|
|||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
|
@ -604,7 +588,7 @@ TEST(ServiceWorkerRegistrar, TestVersion5Migration)
|
|||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
|
@ -678,7 +662,7 @@ TEST(ServiceWorkerRegistrar, TestVersion6Migration)
|
|||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
|
@ -765,7 +749,7 @@ TEST(ServiceWorkerRegistrar, TestVersion7Migration)
|
|||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
|
@ -850,7 +834,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeRead)
|
|||
nsAutoCString suffix0;
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("", suffix0.get());
|
||||
ASSERT_STREQ("https://scope_0.org", cInfo0.spec().get());
|
||||
ASSERT_STREQ("https://scope_0.org", data[0].scope().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
|
@ -903,8 +887,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeWrite)
|
|||
spec.AppendPrintf("spec write dedupe/%d", i);
|
||||
|
||||
reg.principal() = mozilla::ipc::ContentPrincipalInfo(
|
||||
mozilla::OriginAttributes(false), spec, spec, mozilla::Nothing(),
|
||||
spec);
|
||||
mozilla::OriginAttributes(), spec, spec, mozilla::Nothing(), spec);
|
||||
|
||||
swr->TestRegisterServiceWorker(reg);
|
||||
}
|
||||
|
@ -926,7 +909,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeWrite)
|
|||
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo = data[0].principal();
|
||||
|
||||
mozilla::OriginAttributes attrs(false);
|
||||
mozilla::OriginAttributes attrs;
|
||||
nsAutoCString suffix, expectSuffix;
|
||||
attrs.CreateSuffix(expectSuffix);
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "mozilla/Tokenizer.h"
|
||||
#include "mozIStorageConnection.h"
|
||||
#include "mozStorageHelper.h"
|
||||
#include "mozilla/StorageOriginAttributes.h"
|
||||
|
||||
// Current version of the database schema
|
||||
#define CURRENT_SCHEMA_VERSION 2
|
||||
|
@ -131,8 +132,8 @@ class ExtractOriginData : protected mozilla::Tokenizer {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
OriginAttributes attrs(inIsolatedMozBrowser);
|
||||
attrs.CreateSuffix(suffix);
|
||||
StorageOriginAttributes originAttributes(inIsolatedMozBrowser);
|
||||
originAttributes.CreateSuffix(suffix);
|
||||
}
|
||||
|
||||
// Consume the rest of the input as "origin".
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/StorageOriginAttributes.h"
|
||||
|
||||
namespace mozilla::dom::StorageUtils {
|
||||
|
||||
|
@ -61,16 +62,16 @@ nsCString Scheme0Scope(const nsACString& aOriginSuffix,
|
|||
const nsACString& aOriginNoSuffix) {
|
||||
nsCString result;
|
||||
|
||||
OriginAttributes oa;
|
||||
StorageOriginAttributes oa;
|
||||
if (!aOriginSuffix.IsEmpty()) {
|
||||
DebugOnly<bool> success = oa.PopulateFromSuffix(aOriginSuffix);
|
||||
MOZ_ASSERT(success);
|
||||
}
|
||||
|
||||
if (oa.mInIsolatedMozBrowser) {
|
||||
if (oa.InIsolatedMozBrowser()) {
|
||||
result.AppendInt(0); // This is the appId to be removed.
|
||||
result.Append(':');
|
||||
result.Append(oa.mInIsolatedMozBrowser ? 't' : 'f');
|
||||
result.Append(oa.InIsolatedMozBrowser() ? 't' : 'f');
|
||||
result.Append(':');
|
||||
}
|
||||
|
||||
|
@ -80,7 +81,7 @@ nsCString Scheme0Scope(const nsACString& aOriginSuffix,
|
|||
// with originAttributes and originKey columns) so that switch between
|
||||
// schema 1 and 0 always works in both ways.
|
||||
nsAutoCString remaining;
|
||||
oa.mInIsolatedMozBrowser = false;
|
||||
oa.SetInIsolatedMozBrowser(false);
|
||||
oa.CreateSuffix(remaining);
|
||||
if (!remaining.IsEmpty()) {
|
||||
MOZ_ASSERT(!aOriginSuffix.IsEmpty());
|
||||
|
|
|
@ -1208,7 +1208,6 @@ nsresult PermissionManager::TryInitDB(bool aRemoveFile,
|
|||
entry.mExpireType = stmt->AsInt32(3);
|
||||
entry.mExpireTime = stmt->AsInt64(4);
|
||||
entry.mModificationTime = stmt->AsInt64(5);
|
||||
entry.mIsInBrowserElement = static_cast<bool>(stmt->AsInt32(6));
|
||||
|
||||
mMigrationEntries.AppendElement(entry);
|
||||
}
|
||||
|
@ -1363,7 +1362,6 @@ nsresult PermissionManager::TryInitDB(bool aRemoveFile,
|
|||
entry.mExpireType = stmt->AsInt32(3);
|
||||
entry.mExpireTime = stmt->AsInt64(4);
|
||||
entry.mModificationTime = stmt->AsInt64(5);
|
||||
entry.mIsInBrowserElement = static_cast<bool>(stmt->AsInt32(6));
|
||||
|
||||
mMigrationEntries.AppendElement(entry);
|
||||
}
|
||||
|
|
|
@ -596,8 +596,7 @@ class PermissionManager final : public nsIPermissionManager,
|
|||
mPermission(0),
|
||||
mExpireType(0),
|
||||
mExpireTime(0),
|
||||
mModificationTime(0),
|
||||
mIsInBrowserElement(false) {}
|
||||
mModificationTime(0) {}
|
||||
|
||||
nsCString mHost;
|
||||
nsCString mType;
|
||||
|
@ -606,9 +605,6 @@ class PermissionManager final : public nsIPermissionManager,
|
|||
uint32_t mExpireType;
|
||||
int64_t mExpireTime;
|
||||
int64_t mModificationTime;
|
||||
|
||||
// Legacy, for migration.
|
||||
bool mIsInBrowserElement;
|
||||
};
|
||||
|
||||
// List of entries read from the database. It will be populated OMT and
|
||||
|
|
|
@ -187,7 +187,6 @@ extern "C" const char* __lsan_default_suppressions() {
|
|||
"leak:js::frontend::Parse\n"
|
||||
"leak:xpc::CIGSHelper\n"
|
||||
"leak:mozJSModuleLoader\n"
|
||||
"leak:mozilla::xpcom::ConstructJSMComponent\n"
|
||||
"leak:XPCWrappedNativeJSOps\n"
|
||||
|
||||
// End of suppressions.
|
||||
|
|
|
@ -90,7 +90,6 @@ class KeyParser : protected Tokenizer {
|
|||
break;
|
||||
case 'b':
|
||||
// Leaving to be able to read and understand oldformatted entries
|
||||
originAttribs.mInIsolatedMozBrowser = true;
|
||||
break;
|
||||
case 'a':
|
||||
isAnonymous = true;
|
||||
|
|
|
@ -132,14 +132,7 @@ NS_IMETHODIMP
|
|||
ConvertAppIdToOriginAttrsSQLFunction::OnFunctionCall(
|
||||
mozIStorageValueArray* aFunctionArguments, nsIVariant** aResult) {
|
||||
nsresult rv;
|
||||
int32_t inIsolatedMozBrowser;
|
||||
|
||||
rv = aFunctionArguments->GetInt32(1, &inIsolatedMozBrowser);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Create an originAttributes object by inIsolatedMozBrowser.
|
||||
// Then create the originSuffix string from this object.
|
||||
OriginAttributes attrs(inIsolatedMozBrowser != 0);
|
||||
OriginAttributes attrs;
|
||||
nsAutoCString suffix;
|
||||
attrs.CreateSuffix(suffix);
|
||||
|
||||
|
@ -205,7 +198,7 @@ SetInBrowserFromOriginAttributesSQLFunction::OnFunctionCall(
|
|||
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
||||
|
||||
RefPtr<nsVariant> outVar(new nsVariant());
|
||||
rv = outVar->SetAsInt32(attrs.mInIsolatedMozBrowser);
|
||||
rv = outVar->SetAsInt32(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
outVar.forget(aResult);
|
||||
|
|
|
@ -123,7 +123,7 @@ const char* NeckoParent::GetValidatedOriginAttributes(
|
|||
if (!aSerialized.IsNotNull()) {
|
||||
// If serialized is null, we cannot validate anything. We have to assume
|
||||
// that this requests comes from a SystemPrincipal.
|
||||
aAttrs = OriginAttributes(false);
|
||||
aAttrs = OriginAttributes();
|
||||
} else {
|
||||
aAttrs = aSerialized.mOriginAttributes;
|
||||
}
|
||||
|
|
|
@ -83,10 +83,6 @@ const nsXPTInterface gInterfaces[] = {
|
|||
//# @interfaces@
|
||||
};
|
||||
|
||||
const StringOffset gComponentJSMs[] = {
|
||||
//# @component_jsms@
|
||||
};
|
||||
|
||||
const StringOffset gComponentESModules[] = {
|
||||
//# @component_esmodules@
|
||||
};
|
||||
|
@ -114,7 +110,7 @@ bool ContractEntry::Matches(const nsACString& aContractID) const {
|
|||
enum class ComponentType { JSM, ESM };
|
||||
|
||||
template <ComponentType type>
|
||||
static nsresult ConstructJSMOrESMComponent(const nsACString& aURI,
|
||||
[[maybe_unused]] static nsresult ConstructJSMOrESMComponent(const nsACString& aURI,
|
||||
const char* aConstructor,
|
||||
nsISupports** aResult) {
|
||||
if (!nsComponentManagerImpl::JSLoaderReady()) {
|
||||
|
@ -148,13 +144,6 @@ static nsresult ConstructJSMOrESMComponent(const nsACString& aURI,
|
|||
(void**)aResult);
|
||||
}
|
||||
|
||||
static nsresult ConstructJSMComponent(const nsACString& aURI,
|
||||
const char* aConstructor,
|
||||
nsISupports** aResult) {
|
||||
return ConstructJSMOrESMComponent<ComponentType::JSM>(
|
||||
aURI, aConstructor, aResult);
|
||||
}
|
||||
|
||||
static nsresult ConstructESModuleComponent(const nsACString& aURI,
|
||||
const char* aConstructor,
|
||||
nsISupports** aResult) {
|
||||
|
@ -349,20 +338,6 @@ const StaticProtocolHandler* StaticProtocolHandler::Lookup(const nsACString& aSc
|
|||
return false;
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<nsIUTF8StringEnumerator>
|
||||
StaticComponents::GetComponentJSMs() {
|
||||
auto jsms = MakeUnique<nsTArray<nsCString>>(MOZ_ARRAY_LENGTH(gComponentJSMs));
|
||||
|
||||
for (const auto& entry : gComponentJSMs) {
|
||||
jsms->AppendElement(GetString(entry));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIUTF8StringEnumerator> result;
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_NewAdoptingUTF8StringEnumerator(getter_AddRefs(result),
|
||||
jsms.release()));
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<nsIUTF8StringEnumerator>
|
||||
StaticComponents::GetComponentESModules() {
|
||||
auto esModules = MakeUnique<nsTArray<nsCString>>(MOZ_ARRAY_LENGTH(gComponentESModules));
|
||||
|
|
|
@ -267,7 +267,6 @@ class StaticComponents final {
|
|||
static bool InvalidateContractID(const nsACString& aContractID,
|
||||
bool aInvalid = true);
|
||||
|
||||
static already_AddRefed<nsIUTF8StringEnumerator> GetComponentJSMs();
|
||||
static already_AddRefed<nsIUTF8StringEnumerator> GetComponentESModules();
|
||||
|
||||
static Span<const JSServiceEntry> GetJSServices();
|
||||
|
|
|
@ -428,14 +428,6 @@ class ModuleEntry(object):
|
|||
)
|
||||
return res
|
||||
|
||||
if self.jsm:
|
||||
res += (
|
||||
" nsCOMPtr<nsISupports> inst;\n"
|
||||
" MOZ_TRY(ConstructJSMComponent(nsLiteralCString(%s),\n"
|
||||
" %s,\n"
|
||||
" getter_AddRefs(inst)));"
|
||||
"\n" % (json.dumps(self.jsm), json.dumps(self.constructor))
|
||||
)
|
||||
elif self.esModule:
|
||||
res += (
|
||||
" nsCOMPtr<nsISupports> inst;\n"
|
||||
|
@ -951,9 +943,6 @@ def gen_substs(manifests):
|
|||
|
||||
gen_includes(substs, headers)
|
||||
|
||||
substs["component_jsms"] = (
|
||||
"\n".join(" %s," % strings.entry_to_cxx(jsm) for jsm in sorted(jsms)) + "\n"
|
||||
)
|
||||
substs["component_esmodules"] = (
|
||||
"\n".join(
|
||||
" %s," % strings.entry_to_cxx(esModule) for esModule in sorted(esModules)
|
||||
|
|
|
@ -1472,14 +1472,6 @@ nsComponentManagerImpl::RemoveBootstrappedManifestLocation(nsIFile* aLocation) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::GetComponentJSMs(nsIUTF8StringEnumerator** aJSMs) {
|
||||
nsCOMPtr<nsIUTF8StringEnumerator> result =
|
||||
StaticComponents::GetComponentJSMs();
|
||||
result.forget(aJSMs);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::GetComponentESModules(
|
||||
nsIUTF8StringEnumerator** aESModules) {
|
||||
|
|
|
@ -96,12 +96,6 @@ interface nsIComponentManager : nsISupports
|
|||
*/
|
||||
nsIArray getManifestLocations();
|
||||
|
||||
/**
|
||||
* Returns a list of JSM URLs which are used to create components. This
|
||||
* should only be used in automation.
|
||||
*/
|
||||
nsIUTF8StringEnumerator getComponentJSMs();
|
||||
|
||||
/**
|
||||
* Returns a list of ESM URLs which are used to create components. This
|
||||
* should only be used in automation.
|
||||
|
|
Загрузка…
Ссылка в новой задаче