diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /caps | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'caps')
-rw-r--r-- | caps/BasePrincipal.cpp | 7 | ||||
-rw-r--r-- | caps/BasePrincipal.h | 5 | ||||
-rw-r--r-- | caps/OriginAttributes.cpp | 7 | ||||
-rw-r--r-- | caps/OriginAttributes.h | 18 | ||||
-rw-r--r-- | caps/nsIPrincipal.idl | 11 | ||||
-rw-r--r-- | caps/tests/gtest/TestOriginAttributes.cpp | 6 | ||||
-rw-r--r-- | caps/tests/mochitest/browser_checkloaduri.js | 5 | ||||
-rw-r--r-- | caps/tests/unit/test_origin.js | 33 |
8 files changed, 5 insertions, 87 deletions
diff --git a/caps/BasePrincipal.cpp b/caps/BasePrincipal.cpp index 6cd94741b0..a805b6325c 100644 --- a/caps/BasePrincipal.cpp +++ b/caps/BasePrincipal.cpp @@ -1190,13 +1190,6 @@ BasePrincipal::GetPrivateBrowsingId(uint32_t* aPrivateBrowsingId) { return NS_OK; } -NS_IMETHODIMP -BasePrincipal::GetIsInIsolatedMozBrowserElement( - bool* aIsInIsolatedMozBrowserElement) { - *aIsInIsolatedMozBrowserElement = IsInIsolatedMozBrowserElement(); - return NS_OK; -} - nsresult BasePrincipal::GetAddonPolicy( extensions::WebExtensionPolicy** aResult) { AssertIsOnMainThread(); diff --git a/caps/BasePrincipal.h b/caps/BasePrincipal.h index 9304be7dee..c188664612 100644 --- a/caps/BasePrincipal.h +++ b/caps/BasePrincipal.h @@ -163,8 +163,6 @@ class BasePrincipal : public nsJSPrincipals { NS_IMETHOD GetIsIpAddress(bool* aIsIpAddress) override; NS_IMETHOD GetIsLocalIpAddress(bool* aIsIpAddress) override; NS_IMETHOD GetIsOnion(bool* aIsOnion) override; - NS_IMETHOD GetIsInIsolatedMozBrowserElement( - bool* aIsInIsolatedMozBrowserElement) final; NS_IMETHOD GetUserContextId(uint32_t* aUserContextId) final; NS_IMETHOD GetPrivateBrowsingId(uint32_t* aPrivateBrowsingId) final; NS_IMETHOD GetSiteOrigin(nsACString& aSiteOrigin) final; @@ -250,9 +248,6 @@ class BasePrincipal : public nsJSPrincipals { uint32_t PrivateBrowsingId() const { return mOriginAttributes.mPrivateBrowsingId; } - bool IsInIsolatedMozBrowserElement() const { - return mOriginAttributes.mInIsolatedMozBrowser; - } PrincipalKind Kind() const { return mKind; } diff --git a/caps/OriginAttributes.cpp b/caps/OriginAttributes.cpp index 734a230495..211d6b00e7 100644 --- a/caps/OriginAttributes.cpp +++ b/caps/OriginAttributes.cpp @@ -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); @@ -328,14 +324,13 @@ bool OriginAttributes::PopulateFromSuffix(const nsACString& aStr) { MOZ_RELEASE_ASSERT(mPartitionKey.IsEmpty()); return URLParams::Parse( - Substring(aStr, 1, aStr.Length() - 1), + Substring(aStr, 1, aStr.Length() - 1), true, [this](const nsAString& aName, const nsAString& aValue) { if (aName.EqualsLiteral("inBrowser")) { if (!aValue.EqualsLiteral("1")) { return false; } - mInIsolatedMozBrowser = true; return true; } diff --git a/caps/OriginAttributes.h b/caps/OriginAttributes.h index 02e52f0799..faf9d80050 100644 --- a/caps/OriginAttributes.h +++ b/caps/OriginAttributes.h @@ -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; diff --git a/caps/nsIPrincipal.idl b/caps/nsIPrincipal.idl index bf60f83b04..a3849dd723 100644 --- a/caps/nsIPrincipal.idl +++ b/caps/nsIPrincipal.idl @@ -587,17 +587,6 @@ interface nsIPrincipal : nsISupports [infallible] readonly attribute unsigned long privateBrowsingId; /** - * Returns true iff the principal is inside an isolated mozbrowser element. - * <xul:browser> is not considered to be a mozbrowser element. - * <iframe mozbrowser noisolation> does not count as isolated since - * isolation is disabled. Isolation can only be disabled if the - * containing document is chrome. - * - * May be called from any thread. - */ - [infallible] readonly attribute boolean isInIsolatedMozBrowserElement; - - /** * Returns true iff this is a null principal (corresponding to an * unknown, hence assumed minimally privileged, security context). * diff --git a/caps/tests/gtest/TestOriginAttributes.cpp b/caps/tests/gtest/TestOriginAttributes.cpp index fa759f80d5..61c66fd36a 100644 --- a/caps/tests/gtest/TestOriginAttributes.cpp +++ b/caps/tests/gtest/TestOriginAttributes.cpp @@ -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); diff --git a/caps/tests/mochitest/browser_checkloaduri.js b/caps/tests/mochitest/browser_checkloaduri.js index 11ff2d1a08..3b31164790 100644 --- a/caps/tests/mochitest/browser_checkloaduri.js +++ b/caps/tests/mochitest/browser_checkloaduri.js @@ -279,8 +279,9 @@ function testURL( } let inheritDisallowed = flags & ssm.DISALLOW_INHERIT_PRINCIPAL; let shouldThrow = inheritDisallowed ? !canLoadWithoutInherit : !canLoad; - ok( - threw == shouldThrow, + Assert.equal( + threw, + shouldThrow, "Should " + (shouldThrow ? "" : "not ") + "throw an error when loading " + diff --git a/caps/tests/unit/test_origin.js b/caps/tests/unit/test_origin.js index c0cbc2996a..a24fbab09a 100644 --- a/caps/tests/unit/test_origin.js +++ b/caps/tests/unit/test_origin.js @@ -24,10 +24,6 @@ function checkCrossOrigin(a, b) { function checkOriginAttributes(prin, attrs, suffix) { attrs = attrs || {}; - Assert.equal( - prin.originAttributes.inIsolatedMozBrowser, - attrs.inIsolatedMozBrowser || false - ); Assert.equal(prin.originSuffix, suffix || ""); Assert.equal(ChromeUtils.originAttributesToSuffix(attrs), suffix || ""); Assert.ok( @@ -59,9 +55,6 @@ function printAttrs(name, attrs) { "\tuserContextId: " + attrs.userContextId + ",\n" + - "\tinIsolatedMozBrowser: " + - attrs.inIsolatedMozBrowser + - ",\n" + "\tprivateBrowsingId: '" + attrs.privateBrowsingId + "',\n" + @@ -76,10 +69,6 @@ function checkValues(attrs, values) { // printAttrs("attrs", attrs); // printAttrs("values", values); Assert.equal(attrs.userContextId, values.userContextId || 0); - Assert.equal( - attrs.inIsolatedMozBrowser, - values.inIsolatedMozBrowser || false - ); Assert.equal(attrs.privateBrowsingId, values.privateBrowsingId || ""); Assert.equal(attrs.firstPartyDomain, values.firstPartyDomain || ""); } @@ -141,26 +130,6 @@ function run_test() { // Test origin attributes. // - // Just browser. - var exampleOrg_browser = ssm.createContentPrincipal( - makeURI("http://example.org"), - { inIsolatedMozBrowser: true } - ); - var nullPrin_browser = ssm.createNullPrincipal({ - inIsolatedMozBrowser: true, - }); - checkOriginAttributes( - exampleOrg_browser, - { inIsolatedMozBrowser: true }, - "^inBrowser=1" - ); - checkOriginAttributes( - nullPrin_browser, - { inIsolatedMozBrowser: true }, - "^inBrowser=1" - ); - Assert.equal(exampleOrg_browser.origin, "http://example.org^inBrowser=1"); - // First party Uri var exampleOrg_firstPartyDomain = ssm.createContentPrincipal( makeURI("http://example.org"), @@ -206,7 +175,6 @@ function run_test() { ); // Check that all of the above are cross-origin. - checkCrossOrigin(exampleOrg_browser, nullPrin_browser); checkCrossOrigin(exampleOrg_firstPartyDomain, exampleOrg); checkCrossOrigin(exampleOrg_userContext, exampleOrg); @@ -245,7 +213,6 @@ function run_test() { var tests = [ ["", {}], ["^userContextId=3", { userContextId: 3 }], - ["^inBrowser=1", { inIsolatedMozBrowser: true }], ["^firstPartyDomain=example.org", { firstPartyDomain: "example.org" }], ]; |