summaryrefslogtreecommitdiffstats
path: root/docshell/base
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /docshell/base
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'docshell/base')
-rw-r--r--docshell/base/BaseHistory.cpp9
-rw-r--r--docshell/base/BrowsingContext.cpp45
-rw-r--r--docshell/base/CanonicalBrowsingContext.cpp10
-rw-r--r--docshell/base/nsDocShell.cpp31
-rw-r--r--docshell/base/nsDocShell.h3
-rw-r--r--docshell/base/nsDocShellTreeOwner.cpp9
6 files changed, 62 insertions, 45 deletions
diff --git a/docshell/base/BaseHistory.cpp b/docshell/base/BaseHistory.cpp
index 3932711b5b..84e257a54c 100644
--- a/docshell/base/BaseHistory.cpp
+++ b/docshell/base/BaseHistory.cpp
@@ -94,8 +94,15 @@ void BaseHistory::RegisterVisitedCallback(nsIURI* aURI, Link* aLink) {
mTrackedURIs.WithEntryHandle(aURI, [&](auto&& entry) -> ObservingLinks* {
MOZ_DIAGNOSTIC_ASSERT(!entry || !entry->mLinks.IsEmpty(),
"An empty key was kept around in our hashtable!");
+
if (!entry) {
- ScheduleVisitedQuery(aURI, nullptr);
+ // If the URI has userpass, skip the visit query scheduling, because
+ // these URIs are not stored by history, and their status is only
+ // updated at the time of a visit.
+ bool hasUserPass;
+ if (NS_FAILED(aURI->GetHasUserPass(&hasUserPass)) || !hasUserPass) {
+ ScheduleVisitedQuery(aURI, nullptr);
+ }
}
return &entry.OrInsertWith([] { return ObservingLinks{}; });
diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp
index 141036a86c..6e1a1b6893 100644
--- a/docshell/base/BrowsingContext.cpp
+++ b/docshell/base/BrowsingContext.cpp
@@ -20,6 +20,7 @@
#endif
#include "mozilla/AppShutdown.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
+#include "mozilla/dom/BindingIPCUtils.h"
#include "mozilla/dom/BrowserHost.h"
#include "mozilla/dom/BrowserChild.h"
#include "mozilla/dom/BrowserParent.h"
@@ -96,23 +97,17 @@ namespace IPC {
// Allow serialization and deserialization of OrientationType over IPC
template <>
struct ParamTraits<mozilla::dom::OrientationType>
- : public ContiguousEnumSerializer<
- mozilla::dom::OrientationType,
- mozilla::dom::OrientationType::Portrait_primary,
- mozilla::dom::OrientationType::EndGuard_> {};
+ : public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::OrientationType> {
+};
template <>
struct ParamTraits<mozilla::dom::DisplayMode>
- : public ContiguousEnumSerializer<mozilla::dom::DisplayMode,
- mozilla::dom::DisplayMode::Browser,
- mozilla::dom::DisplayMode::EndGuard_> {};
+ : public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::DisplayMode> {};
template <>
struct ParamTraits<mozilla::dom::PrefersColorSchemeOverride>
- : public ContiguousEnumSerializer<
- mozilla::dom::PrefersColorSchemeOverride,
- mozilla::dom::PrefersColorSchemeOverride::None,
- mozilla::dom::PrefersColorSchemeOverride::EndGuard_> {};
+ : public mozilla::dom::WebIDLEnumSerializer<
+ mozilla::dom::PrefersColorSchemeOverride> {};
template <>
struct ParamTraits<mozilla::dom::ExplicitActiveStatus>
@@ -124,10 +119,8 @@ struct ParamTraits<mozilla::dom::ExplicitActiveStatus>
// Allow serialization and deserialization of TouchEventsOverride over IPC
template <>
struct ParamTraits<mozilla::dom::TouchEventsOverride>
- : public ContiguousEnumSerializer<
- mozilla::dom::TouchEventsOverride,
- mozilla::dom::TouchEventsOverride::Disabled,
- mozilla::dom::TouchEventsOverride::EndGuard_> {};
+ : public mozilla::dom::WebIDLEnumSerializer<
+ mozilla::dom::TouchEventsOverride> {};
template <>
struct ParamTraits<mozilla::dom::EmbedderColorSchemes> {
@@ -168,6 +161,9 @@ static StaticAutoPtr<BrowsingContextMap> sBrowsingContexts;
// Top-level Content BrowsingContexts only, indexed by BrowserId instead of Id
static StaticAutoPtr<BrowsingContextMap> sCurrentTopByBrowserId;
+static bool gIPCEnabledAnnotation = false;
+static bool gFissionEnabledAnnotation = false;
+
static void UnregisterBrowserId(BrowsingContext* aBrowsingContext) {
if (!aBrowsingContext->IsTopContent() || !sCurrentTopByBrowserId) {
return;
@@ -255,6 +251,11 @@ void BrowsingContext::Init() {
sCurrentTopByBrowserId = new BrowsingContextMap();
ClearOnShutdown(&sBrowsingContexts);
ClearOnShutdown(&sCurrentTopByBrowserId);
+ CrashReporter::RegisterAnnotationBool(
+ CrashReporter::Annotation::DOMIPCEnabled, &gIPCEnabledAnnotation);
+ CrashReporter::RegisterAnnotationBool(
+ CrashReporter::Annotation::DOMFissionEnabled,
+ &gFissionEnabledAnnotation);
}
}
@@ -1665,11 +1666,8 @@ NS_IMETHODIMP BrowsingContext::SetRemoteTabs(bool aUseRemoteTabs) {
return NS_ERROR_FAILURE;
}
- static bool annotated = false;
- if (aUseRemoteTabs && !annotated) {
- annotated = true;
- CrashReporter::AnnotateCrashReport(CrashReporter::Annotation::DOMIPCEnabled,
- true);
+ if (aUseRemoteTabs && !gIPCEnabledAnnotation) {
+ gIPCEnabledAnnotation = true;
}
// Don't allow non-remote tabs with remote subframes.
@@ -1693,11 +1691,8 @@ NS_IMETHODIMP BrowsingContext::SetRemoteSubframes(bool aUseRemoteSubframes) {
return NS_ERROR_FAILURE;
}
- static bool annotated = false;
- if (aUseRemoteSubframes && !annotated) {
- annotated = true;
- CrashReporter::AnnotateCrashReport(
- CrashReporter::Annotation::DOMFissionEnabled, true);
+ if (aUseRemoteSubframes && !gFissionEnabledAnnotation) {
+ gFissionEnabledAnnotation = true;
}
// Don't allow non-remote tabs with remote subframes.
diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp
index 33ed5aab28..84f2d2960a 100644
--- a/docshell/base/CanonicalBrowsingContext.cpp
+++ b/docshell/base/CanonicalBrowsingContext.cpp
@@ -1220,7 +1220,8 @@ Maybe<int32_t> CanonicalBrowsingContext::HistoryGo(
// Check for user interaction if desired, except for the first and last
// history entries. We compare with >= to account for the case where
// aOffset >= length.
- if (!aRequireUserInteraction || index.value() >= shistory->Length() - 1 ||
+ if (!StaticPrefs::browser_navigation_requireUserInteraction() ||
+ !aRequireUserInteraction || index.value() >= shistory->Length() - 1 ||
index.value() <= 0) {
break;
}
@@ -2579,11 +2580,6 @@ nsresult CanonicalBrowsingContext::WriteSessionStorageToSessionStore(
void CanonicalBrowsingContext::UpdateSessionStoreSessionStorage(
const std::function<void()>& aDone) {
- if (!StaticPrefs::browser_sessionstore_collect_session_storage_AtStartup()) {
- aDone();
- return;
- }
-
using DataPromise = BackgroundSessionStorageManager::DataPromise;
BackgroundSessionStorageManager::GetData(
this, StaticPrefs::browser_sessionstore_dom_storage_limit(),
@@ -2612,7 +2608,7 @@ void CanonicalBrowsingContext::UpdateSessionStoreForStorage(
}
void CanonicalBrowsingContext::MaybeScheduleSessionStoreUpdate() {
- if (!StaticPrefs::browser_sessionstore_platform_collection_AtStartup()) {
+ if (!SessionStorePlatformCollection()) {
return;
}
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index f2a9e0fa59..3404597343 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -5666,7 +5666,7 @@ nsDocShell::OnStateChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
mBusyFlags = (BusyFlags)(BUSY_FLAGS_BUSY | BUSY_FLAGS_BEFORE_PAGE_LOAD);
if ((aStateFlags & STATE_RESTORING) == 0) {
- if (StaticPrefs::browser_sessionstore_platform_collection_AtStartup()) {
+ if (SessionStorePlatformCollection()) {
if (IsForceReloadType(mLoadType)) {
if (WindowContext* windowContext =
mBrowsingContext->GetCurrentWindowContext()) {
@@ -6393,7 +6393,7 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
// incorrectly overrides session store data from the following load.
return NS_OK;
}
- if (StaticPrefs::browser_sessionstore_platform_collection_AtStartup()) {
+ if (SessionStorePlatformCollection()) {
if (WindowContext* windowContext =
mBrowsingContext->GetCurrentWindowContext()) {
using Change = SessionStoreChangeListener::Change;
@@ -6475,6 +6475,9 @@ nsresult nsDocShell::CreateAboutBlankDocumentViewer(
nsCOMPtr<nsIDocumentViewer> viewer;
nsresult rv = NS_ERROR_FAILURE;
+ PROFILER_MARKER_UNTYPED("CreateAboutBlankDocumentViewer", DOM,
+ MarkerStack::Capture());
+
MOZ_ASSERT_IF(aActor, aActor->DocumentPrincipal() == aPrincipal);
/* mCreatingDocument should never be true at this point. However, it's
@@ -10590,7 +10593,8 @@ static nsresult AppendSegmentToString(nsIInputStream* aIn, void* aClosure,
}
/* static */ uint32_t nsDocShell::ComputeURILoaderFlags(
- BrowsingContext* aBrowsingContext, uint32_t aLoadType) {
+ BrowsingContext* aBrowsingContext, uint32_t aLoadType,
+ bool aIsDocumentLoad) {
MOZ_ASSERT(aBrowsingContext);
uint32_t openFlags = 0;
@@ -10601,6 +10605,13 @@ static nsresult AppendSegmentToString(nsIInputStream* aIn, void* aClosure,
openFlags |= nsIURILoader::DONT_RETARGET;
}
+ // Unless the pref is set, object/embed loads always specify DONT_RETARGET.
+ // See bug 1868001 for details.
+ if (!aIsDocumentLoad &&
+ !StaticPrefs::dom_navigation_object_embed_allow_retargeting()) {
+ openFlags |= nsIURILoader::DONT_RETARGET;
+ }
+
return openFlags;
}
@@ -11376,11 +11387,14 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI,
if (mozilla::SessionHistoryInParent()) {
MOZ_LOG(gSHLog, LogLevel::Debug,
("nsDocShell %p UpdateActiveEntry (not replacing)", this));
+
nsString title(mActiveEntry->GetTitle());
+ nsCOMPtr<nsIReferrerInfo> referrerInfo = mActiveEntry->GetReferrerInfo();
+
UpdateActiveEntry(false,
/* aPreviousScrollPos = */ Some(scrollPos), aNewURI,
/* aOriginalURI = */ nullptr,
- /* aReferrerInfo = */ nullptr,
+ /* aReferrerInfo = */ referrerInfo,
/* aTriggeringPrincipal = */ aDocument->NodePrincipal(),
csp, title, scrollRestorationIsManual, aData,
uriWasModified);
@@ -11399,12 +11413,14 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI,
// mode from the current entry.
newSHEntry->SetScrollRestorationIsManual(scrollRestorationIsManual);
+ // Set the new SHEntry's title (bug 655273).
nsString title;
mOSHE->GetTitle(title);
-
- // Set the new SHEntry's title (bug 655273).
newSHEntry->SetTitle(title);
+ nsCOMPtr<nsIReferrerInfo> referrerInfo = mOSHE->GetReferrerInfo();
+ newSHEntry->SetReferrerInfo(referrerInfo);
+
// Link the new SHEntry to the old SHEntry's BFCache entry, since the
// two entries correspond to the same document.
NS_ENSURE_SUCCESS(newSHEntry->AdoptBFCacheEntry(oldOSHE),
@@ -11453,6 +11469,8 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI,
mOSHE = newSHEntry;
}
+ nsCOMPtr<nsIReferrerInfo> referrerInfo = mOSHE->GetReferrerInfo();
+
newSHEntry->SetURI(aNewURI);
newSHEntry->SetOriginalURI(aNewURI);
// We replaced the URI of the entry, clear the unstripped URI as it
@@ -11463,6 +11481,7 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI,
// in our case. We could also set it to aNewURI, with the same result.
newSHEntry->SetResultPrincipalURI(nullptr);
newSHEntry->SetLoadReplace(false);
+ newSHEntry->SetReferrerInfo(referrerInfo);
}
if (!mozilla::SessionHistoryInParent()) {
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
index 9f2d9a17dc..82ac6c9ab9 100644
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -489,7 +489,8 @@ class nsDocShell final : public nsDocLoader,
bool HasDocumentViewer() const { return !!mDocumentViewer; }
static uint32_t ComputeURILoaderFlags(
- mozilla::dom::BrowsingContext* aBrowsingContext, uint32_t aLoadType);
+ mozilla::dom::BrowsingContext* aBrowsingContext, uint32_t aLoadType,
+ bool aIsDocumentLoad = true);
void SetLoadingSessionHistoryInfo(
const mozilla::dom::LoadingSessionHistoryInfo& aLoadingInfo,
diff --git a/docshell/base/nsDocShellTreeOwner.cpp b/docshell/base/nsDocShellTreeOwner.cpp
index 9f1ab23a6c..6d8eb11cc6 100644
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -18,7 +18,7 @@
#include "nsAtom.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
-#include "mozilla/LookAndFeel.h"
+#include "mozilla/StaticPrefs_ui.h"
// Interfaces needed to be included
#include "nsPresContext.h"
@@ -1177,16 +1177,15 @@ nsresult ChromeTooltipListener::MouseMove(Event* aMouseEvent) {
}
if (!mShowingTooltip) {
- if (nsCOMPtr<EventTarget> eventTarget = aMouseEvent->GetComposedTarget()) {
+ if (nsCOMPtr<EventTarget> eventTarget = aMouseEvent->GetOriginalTarget()) {
mPossibleTooltipNode = nsINode::FromEventTarget(eventTarget);
}
if (mPossibleTooltipNode) {
nsresult rv = NS_NewTimerWithFuncCallback(
getter_AddRefs(mTooltipTimer), sTooltipCallback, this,
- LookAndFeel::GetInt(LookAndFeel::IntID::TooltipDelay, 500),
- nsITimer::TYPE_ONE_SHOT, "ChromeTooltipListener::MouseMove",
- GetMainThreadSerialEventTarget());
+ StaticPrefs::ui_tooltip_delay_ms(), nsITimer::TYPE_ONE_SHOT,
+ "ChromeTooltipListener::MouseMove", GetMainThreadSerialEventTarget());
if (NS_FAILED(rv)) {
mPossibleTooltipNode = nullptr;
NS_WARNING("Could not create a timer for tooltip tracking");