diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /dom/base/Document.cpp | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/base/Document.cpp')
-rw-r--r-- | dom/base/Document.cpp | 70 |
1 files changed, 37 insertions, 33 deletions
diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index 8cbf8b8075..68e4100540 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -16423,47 +16423,33 @@ WindowContext* Document::GetWindowContextForPageUseCounters() const { return wc; } -void Document::UpdateIntersectionObservations(TimeStamp aNowTime) { - if (mIntersectionObservers.IsEmpty()) { - return; - } - - DOMHighResTimeStamp time = 0; - if (nsPIDOMWindowInner* win = GetInnerWindow()) { - if (Performance* perf = win->GetPerformance()) { - time = perf->TimeStampToDOMHighResForRendering(aNowTime); +void Document::UpdateIntersections(TimeStamp aNowTime) { + if (!mIntersectionObservers.IsEmpty()) { + DOMHighResTimeStamp time = 0; + if (nsPIDOMWindowInner* win = GetInnerWindow()) { + if (Performance* perf = win->GetPerformance()) { + time = perf->TimeStampToDOMHighResForRendering(aNowTime); + } } - } - - const auto observers = ToTArray<nsTArray<RefPtr<DOMIntersectionObserver>>>( - mIntersectionObservers); - for (const auto& observer : observers) { - if (observer) { + for (DOMIntersectionObserver* observer : mIntersectionObservers) { observer->Update(*this, time); } + Dispatch(NewRunnableMethod("Document::NotifyIntersectionObservers", this, + &Document::NotifyIntersectionObservers)); } -} - -void Document::ScheduleIntersectionObserverNotification() { - if (mIntersectionObservers.IsEmpty()) { - return; - } - MOZ_RELEASE_ASSERT(NS_IsMainThread()); - nsCOMPtr<nsIRunnable> notification = - NewRunnableMethod("Document::NotifyIntersectionObservers", this, - &Document::NotifyIntersectionObservers); - Dispatch(notification.forget()); + EnumerateSubDocuments([aNowTime](Document& aDoc) { + aDoc.UpdateIntersections(aNowTime); + return CallState::Continue; + }); } void Document::NotifyIntersectionObservers() { const auto observers = ToTArray<nsTArray<RefPtr<DOMIntersectionObserver>>>( mIntersectionObservers); for (const auto& observer : observers) { - if (observer) { - // MOZ_KnownLive because the 'observers' array guarantees to keep it - // alive. - MOZ_KnownLive(observer)->Notify(); - } + // MOZ_KnownLive because the 'observers' array guarantees to keep it + // alive. + MOZ_KnownLive(observer)->Notify(); } } @@ -18647,6 +18633,13 @@ nsICookieJarSettings* Document::CookieJarSettings() { if (!mCookieJarSettings) { Document* inProcessParent = GetInProcessParentDocument(); + auto shouldInheritFrom = [this](Document* aDoc) { + return aDoc && (this->NodePrincipal()->Equals(aDoc->NodePrincipal()) || + this->NodePrincipal()->GetIsNullPrincipal()); + }; + RefPtr<BrowsingContext> opener = + GetBrowsingContext() ? GetBrowsingContext()->GetOpener() : nullptr; + if (inProcessParent) { mCookieJarSettings = net::CookieJarSettings::Create( inProcessParent->CookieJarSettings()->GetCookieBehavior(), @@ -18674,6 +18667,18 @@ nsICookieJarSettings* Document::CookieJarSettings() { ->SetTopLevelWindowContextId( net::CookieJarSettings::Cast(inProcessParent->CookieJarSettings()) ->GetTopLevelWindowContextId()); + } else if (opener && shouldInheritFrom(opener->GetDocument())) { + mCookieJarSettings = net::CookieJarSettings::Create(NodePrincipal()); + + nsTArray<uint8_t> randomKey; + nsresult rv = opener->GetDocument() + ->CookieJarSettings() + ->GetFingerprintingRandomizationKey(randomKey); + + if (NS_SUCCEEDED(rv)) { + net::CookieJarSettings::Cast(mCookieJarSettings) + ->SetFingerprintingRandomizationKey(randomKey); + } } else { mCookieJarSettings = net::CookieJarSettings::Create(NodePrincipal()); @@ -18933,8 +18938,7 @@ void Document::AddPendingFrameStaticClone(nsFrameLoaderOwner* aElement, } bool Document::ShouldAvoidNativeTheme() const { - return StaticPrefs::widget_non_native_theme_enabled() && - (!IsInChromeDocShell() || XRE_IsContentProcess()); + return !IsInChromeDocShell() || XRE_IsContentProcess(); } bool Document::UseRegularPrincipal() const { |