summaryrefslogtreecommitdiffstats
path: root/dom/ipc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /dom/ipc
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-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/ipc')
-rw-r--r--dom/ipc/BrowserChild.cpp30
-rw-r--r--dom/ipc/BrowserChild.h5
-rw-r--r--dom/ipc/BrowserParent.cpp99
-rw-r--r--dom/ipc/BrowserParent.h19
-rw-r--r--dom/ipc/ContentChild.cpp22
-rw-r--r--dom/ipc/ContentChild.h3
-rw-r--r--dom/ipc/ContentParent.cpp196
-rw-r--r--dom/ipc/ContentParent.h41
-rw-r--r--dom/ipc/DOMTypes.ipdlh8
-rw-r--r--dom/ipc/IPCTransferable.ipdlh9
-rw-r--r--dom/ipc/PBrowser.ipdl20
-rw-r--r--dom/ipc/PContent.ipdl38
-rw-r--r--dom/ipc/PWindowGlobal.ipdl4
-rw-r--r--dom/ipc/TabContext.cpp4
-rw-r--r--dom/ipc/WindowGlobalChild.cpp23
-rw-r--r--dom/ipc/WindowGlobalParent.cpp28
-rw-r--r--dom/ipc/WindowGlobalParent.h2
17 files changed, 309 insertions, 242 deletions
diff --git a/dom/ipc/BrowserChild.cpp b/dom/ipc/BrowserChild.cpp
index 3d1f399edb..ef348e0831 100644
--- a/dom/ipc/BrowserChild.cpp
+++ b/dom/ipc/BrowserChild.cpp
@@ -502,7 +502,6 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BrowserChild)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
- NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWindowProvider)
NS_INTERFACE_MAP_ENTRY(nsIBrowserChild)
@@ -628,18 +627,6 @@ NS_IMETHODIMP
BrowserChild::Blur() { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP
-BrowserChild::FocusNextElement(bool aForDocumentNavigation) {
- SendMoveFocus(true, aForDocumentNavigation);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-BrowserChild::FocusPrevElement(bool aForDocumentNavigation) {
- SendMoveFocus(false, aForDocumentNavigation);
- return NS_OK;
-}
-
-NS_IMETHODIMP
BrowserChild::GetInterface(const nsIID& aIID, void** aSink) {
// XXXbz should we restrict the set of interfaces we hand out here?
// See bug 537429
@@ -2151,18 +2138,23 @@ bool BrowserChild::DeallocPDocAccessibleChild(
#endif
RefPtr<VsyncMainChild> BrowserChild::GetVsyncChild() {
- // Initializing mVsyncChild here turns on per-BrowserChild Vsync for a
+ // Initializing VsyncMainChild here turns on per-BrowserChild Vsync for a
// given platform. Note: this only makes sense if nsWindow returns a
// window-specific VsyncSource.
#if defined(MOZ_WAYLAND)
- if (IsWaylandEnabled() && !mVsyncChild) {
- mVsyncChild = MakeRefPtr<VsyncMainChild>();
- if (!SendPVsyncConstructor(mVsyncChild)) {
- mVsyncChild = nullptr;
+ if (IsWaylandEnabled()) {
+ if (auto* actor = static_cast<VsyncMainChild*>(
+ LoneManagedOrNullAsserts(ManagedPVsyncChild()))) {
+ return actor;
}
+ auto actor = MakeRefPtr<VsyncMainChild>();
+ if (!SendPVsyncConstructor(actor)) {
+ return nullptr;
+ }
+ return actor;
}
#endif
- return mVsyncChild;
+ return nullptr;
}
mozilla::ipc::IPCResult BrowserChild::RecvLoadRemoteScript(
diff --git a/dom/ipc/BrowserChild.h b/dom/ipc/BrowserChild.h
index 90cb712476..7e84b80be1 100644
--- a/dom/ipc/BrowserChild.h
+++ b/dom/ipc/BrowserChild.h
@@ -12,7 +12,6 @@
#include "nsIWebNavigation.h"
#include "nsCOMPtr.h"
#include "nsIWebBrowserChrome.h"
-#include "nsIWebBrowserChromeFocus.h"
#include "nsIInterfaceRequestor.h"
#include "nsIWindowProvider.h"
#include "nsIDocShell.h"
@@ -128,7 +127,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
public ipc::MessageManagerCallback,
public PBrowserChild,
public nsIWebBrowserChrome,
- public nsIWebBrowserChromeFocus,
public nsIInterfaceRequestor,
public nsIWindowProvider,
public nsSupportsWeakReference,
@@ -185,7 +183,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIWEBBROWSERCHROME
- NS_DECL_NSIWEBBROWSERCHROMEFOCUS
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIWINDOWPROVIDER
NS_DECL_NSIBROWSERCHILD
@@ -761,8 +758,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
Maybe<bool> mLayersConnectRequested;
EffectsInfo mEffectsInfo;
- RefPtr<VsyncMainChild> mVsyncChild;
-
RefPtr<APZEventState> mAPZEventState;
// Position of client area relative to the outer window
diff --git a/dom/ipc/BrowserParent.cpp b/dom/ipc/BrowserParent.cpp
index 23c677c09c..75bfbd150b 100644
--- a/dom/ipc/BrowserParent.cpp
+++ b/dom/ipc/BrowserParent.cpp
@@ -265,7 +265,26 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BrowserParent)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventListener)
NS_INTERFACE_MAP_END
-NS_IMPL_CYCLE_COLLECTION_WEAK(BrowserParent, mFrameLoader, mBrowsingContext)
+
+NS_IMPL_CYCLE_COLLECTION_CLASS(BrowserParent)
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(BrowserParent)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mFrameLoader)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mBrowsingContext)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mFrameElement)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mBrowserDOMWindow)
+ tmp->UnlinkManager();
+ NS_IMPL_CYCLE_COLLECTION_UNLINK_WEAK_REFERENCE
+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
+
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(BrowserParent)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFrameLoader)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBrowsingContext)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFrameElement)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBrowserDOMWindow)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(Manager())
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+
NS_IMPL_CYCLE_COLLECTING_ADDREF(BrowserParent)
NS_IMPL_CYCLE_COLLECTING_RELEASE(BrowserParent)
@@ -275,7 +294,6 @@ BrowserParent::BrowserParent(ContentParent* aManager, const TabId& aTabId,
uint32_t aChromeFlags)
: TabContext(aContext),
mTabId(aTabId),
- mManager(aManager),
mBrowsingContext(aBrowsingContext),
mFrameElement(nullptr),
mBrowserDOMWindow(nullptr),
@@ -292,7 +310,6 @@ BrowserParent::BrowserParent(ContentParent* aManager, const TabId& aTabId,
mUpdatedDimensions(false),
mSizeMode(nsSizeMode_Normal),
mCreatingWindow(false),
- mVsyncParent(nullptr),
mMarkedDestroying(false),
mIsDestroyed(false),
mRemoteTargetSetsCursor(false),
@@ -307,6 +324,10 @@ BrowserParent::BrowserParent(ContentParent* aManager, const TabId& aTabId,
mShowingTooltip(false) {
MOZ_ASSERT(aManager);
+ // We access `Manager()` when updating priorities later in this constructor,
+ // so need to initialize it before IPC does.
+ SetManager(aManager);
+
RequestingAccessKeyEventData::OnBrowserParentCreated();
// When the input event queue is disabled, we don't need to handle the case
@@ -383,6 +404,10 @@ TabId BrowserParent::GetTabIdFrom(nsIDocShell* docShell) {
return TabId(0);
}
+ContentParent* BrowserParent::Manager() const {
+ return static_cast<ContentParent*>(PBrowserParent::Manager());
+}
+
void BrowserParent::AddBrowserParentToTable(layers::LayersId aLayersId,
BrowserParent* aBrowserParent) {
if (!sLayerToBrowserParentTable) {
@@ -1388,7 +1413,7 @@ IPCResult BrowserParent::RecvNewWindowGlobal(
}
}
- if (!mManager->ValidatePrincipal(aInit.principal(), validationOptions)) {
+ if (!Manager()->ValidatePrincipal(aInit.principal(), validationOptions)) {
ContentParent::LogAndAssertFailedPrincipalValidationInfo(aInit.principal(),
__func__);
}
@@ -1401,21 +1426,19 @@ IPCResult BrowserParent::RecvNewWindowGlobal(
return IPC_OK();
}
-PVsyncParent* BrowserParent::AllocPVsyncParent() {
- MOZ_ASSERT(!mVsyncParent);
- mVsyncParent = new VsyncParent();
- UpdateVsyncParentVsyncDispatcher();
- return mVsyncParent.get();
+already_AddRefed<PVsyncParent> BrowserParent::AllocPVsyncParent() {
+ return MakeAndAddRef<VsyncParent>();
}
-bool BrowserParent::DeallocPVsyncParent(PVsyncParent* aActor) {
- MOZ_ASSERT(aActor);
- mVsyncParent = nullptr;
- return true;
+IPCResult BrowserParent::RecvPVsyncConstructor(PVsyncParent* aActor) {
+ UpdateVsyncParentVsyncDispatcher();
+ return IPC_OK();
}
void BrowserParent::UpdateVsyncParentVsyncDispatcher() {
- if (!mVsyncParent) {
+ VsyncParent* actor = static_cast<VsyncParent*>(
+ LoneManagedOrNullAsserts(ManagedPVsyncParent()));
+ if (!actor) {
return;
}
@@ -1424,7 +1447,7 @@ void BrowserParent::UpdateVsyncParentVsyncDispatcher() {
if (!vsyncDispatcher) {
vsyncDispatcher = gfxPlatform::GetPlatform()->GetGlobalVsyncDispatcher();
}
- mVsyncParent->UpdateVsyncDispatcher(vsyncDispatcher);
+ actor->UpdateVsyncDispatcher(vsyncDispatcher);
}
}
@@ -2297,12 +2320,9 @@ mozilla::ipc::IPCResult BrowserParent::RecvAsyncMessage(
}
mozilla::ipc::IPCResult BrowserParent::RecvSetCursor(
- const nsCursor& aCursor, const bool& aHasCustomCursor,
- Maybe<BigBuffer>&& aCursorData, const uint32_t& aWidth,
- const uint32_t& aHeight, const float& aResolutionX,
- const float& aResolutionY, const uint32_t& aStride,
- const gfx::SurfaceFormat& aFormat, const uint32_t& aHotspotX,
- const uint32_t& aHotspotY, const bool& aForce) {
+ const nsCursor& aCursor, Maybe<IPCImage>&& aCustomCursor,
+ const float& aResolutionX, const float& aResolutionY,
+ const uint32_t& aHotspotX, const uint32_t& aHotspotY, const bool& aForce) {
nsCOMPtr<nsIWidget> widget = GetWidget();
if (!widget) {
return IPC_OK();
@@ -2312,38 +2332,21 @@ mozilla::ipc::IPCResult BrowserParent::RecvSetCursor(
widget->ClearCachedCursor();
}
- nsCOMPtr<imgIContainer> cursorImage;
- if (aHasCustomCursor) {
- const bool cursorDataValid = [&] {
- if (!aCursorData) {
- return false;
- }
- auto expectedSize = CheckedInt<uint32_t>(aHeight) * aStride;
- if (!expectedSize.isValid() ||
- expectedSize.value() != aCursorData->Size()) {
- return false;
- }
- auto minStride =
- CheckedInt<uint32_t>(aWidth) * gfx::BytesPerPixel(aFormat);
- if (!minStride.isValid() || aStride < minStride.value()) {
- return false;
- }
- return true;
- }();
- if (!cursorDataValid) {
+ nsCOMPtr<imgIContainer> customCursorImage;
+ if (aCustomCursor) {
+ RefPtr<gfx::DataSourceSurface> customCursorSurface =
+ nsContentUtils::IPCImageToSurface(*aCustomCursor);
+ if (!customCursorSurface) {
return IPC_FAIL(this, "Invalid custom cursor data");
}
- const gfx::IntSize size(aWidth, aHeight);
- RefPtr<gfx::DataSourceSurface> customCursor =
- gfx::CreateDataSourceSurfaceFromData(size, aFormat, aCursorData->Data(),
- aStride);
- RefPtr<gfxDrawable> drawable = new gfxSurfaceDrawable(customCursor, size);
- cursorImage = image::ImageOps::CreateFromDrawable(drawable);
+ RefPtr<gfxDrawable> drawable = new gfxSurfaceDrawable(
+ customCursorSurface, customCursorSurface->GetSize());
+ customCursorImage = image::ImageOps::CreateFromDrawable(drawable);
}
mCursor = nsIWidget::Cursor{aCursor,
- std::move(cursorImage),
+ std::move(customCursorImage),
aHotspotX,
aHotspotY,
{aResolutionX, aResolutionY}};
@@ -3962,7 +3965,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvQueryVisitedState(
}
auto* gvHistory = static_cast<GeckoViewHistory*>(history.get());
- gvHistory->QueryVisitedState(widget, mManager, std::move(aURIs));
+ gvHistory->QueryVisitedState(widget, Manager(), std::move(aURIs));
return IPC_OK();
#else
return IPC_FAIL(this, "QueryVisitedState is Android-only");
diff --git a/dom/ipc/BrowserParent.h b/dom/ipc/BrowserParent.h
index 63a52c6ac4..c7fc196c25 100644
--- a/dom/ipc/BrowserParent.h
+++ b/dom/ipc/BrowserParent.h
@@ -131,7 +131,7 @@ class BrowserParent final : public PBrowserParent,
const TabId GetTabId() const { return mTabId; }
- ContentParent* Manager() const { return mManager; }
+ ContentParent* Manager() const;
CanonicalBrowsingContext* GetBrowsingContext() { return mBrowsingContext; }
@@ -383,12 +383,9 @@ class BrowserParent final : public PBrowserParent,
nsTArray<nsCString>&& aDisabledCommands);
mozilla::ipc::IPCResult RecvSetCursor(
- const nsCursor& aValue, const bool& aHasCustomCursor,
- Maybe<BigBuffer>&& aCursorData, const uint32_t& aWidth,
- const uint32_t& aHeight, const float& aResolutionX,
- const float& aResolutionY, const uint32_t& aStride,
- const gfx::SurfaceFormat& aFormat, const uint32_t& aHotspotX,
- const uint32_t& aHotspotY, const bool& aForce);
+ const nsCursor& aValue, Maybe<IPCImage>&& aCustomCursor,
+ const float& aResolutionX, const float& aResolutionY,
+ const uint32_t& aHotspotX, const uint32_t& aHotspotY, const bool& aForce);
mozilla::ipc::IPCResult RecvSetLinkStatus(const nsString& aStatus);
@@ -423,9 +420,9 @@ class BrowserParent final : public PBrowserParent,
const nsString& aTitle, const nsString& aInitialColor,
const nsTArray<nsString>& aDefaultColors);
- PVsyncParent* AllocPVsyncParent();
+ already_AddRefed<PVsyncParent> AllocPVsyncParent();
- bool DeallocPVsyncParent(PVsyncParent* aActor);
+ mozilla::ipc::IPCResult RecvPVsyncConstructor(PVsyncParent* aActor) override;
#ifdef ACCESSIBILITY
PDocAccessibleParent* AllocPDocAccessibleParent(
@@ -855,10 +852,8 @@ class BrowserParent final : public PBrowserParent,
private:
TabId mTabId;
- RefPtr<ContentParent> mManager;
// The root browsing context loaded in this BrowserParent.
RefPtr<CanonicalBrowsingContext> mBrowsingContext;
- nsCOMPtr<nsILoadContext> mLoadContext;
RefPtr<Element> mFrameElement;
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
// We keep a strong reference to the frameloader after we've sent the
@@ -942,8 +937,6 @@ class BrowserParent final : public PBrowserParent,
nsTArray<nsString> mVerifyDropLinks;
- RefPtr<VsyncParent> mVsyncParent;
-
#ifdef DEBUG
int32_t mActiveSupressDisplayportCount = 0;
#endif
diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp
index 2ebdd303d8..403cb3c9b8 100644
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -2781,6 +2781,20 @@ mozilla::ipc::IPCResult ContentChild::RecvNotifyProcessPriorityChanged(
moz_set_max_dirty_page_modifier(4);
} else if (mProcessPriority == hal::PROCESS_PRIORITY_BACKGROUND) {
moz_set_max_dirty_page_modifier(-2);
+
+#if defined(MOZ_MEMORY)
+ if (StaticPrefs::dom_memory_memory_pressure_on_background() == 1) {
+ jemalloc_free_dirty_pages();
+ }
+#endif
+ if (StaticPrefs::dom_memory_memory_pressure_on_background() == 2) {
+ nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
+ obsServ->NotifyObservers(nullptr, "memory-pressure", u"heap-minimize");
+ } else if (StaticPrefs::dom_memory_memory_pressure_on_background() == 3) {
+ nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
+ obsServ->NotifyObservers(nullptr, "memory-pressure", u"low-memory");
+ }
+
} else {
moz_set_max_dirty_page_modifier(0);
}
@@ -4446,14 +4460,6 @@ mozilla::ipc::IPCResult ContentChild::RecvDispatchBeforeUnloadToSubtree(
return IPC_OK();
}
-mozilla::ipc::IPCResult ContentChild::RecvDecoderSupportedMimeTypes(
- nsTArray<nsCString>&& aSupportedTypes) {
-#ifdef MOZ_WIDGET_ANDROID
- AndroidDecoderModule::SetSupportedMimeTypes(std::move(aSupportedTypes));
-#endif
- return IPC_OK();
-}
-
mozilla::ipc::IPCResult ContentChild::RecvInitNextGenLocalStorageEnabled(
const bool& aEnabled) {
mozilla::dom::RecvInitNextGenLocalStorageEnabled(aEnabled);
diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h
index 12b6c3cabf..3d4b0d3e59 100644
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -779,9 +779,6 @@ class ContentChild final : public PContentChild,
const MaybeDiscarded<BrowsingContext>& aStartingAt,
DispatchBeforeUnloadToSubtreeResolver&& aResolver);
- mozilla::ipc::IPCResult RecvDecoderSupportedMimeTypes(
- nsTArray<nsCString>&& aSupportedTypes);
-
mozilla::ipc::IPCResult RecvInitNextGenLocalStorageEnabled(
const bool& aEnabled);
diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp
index 412b7e8796..2070f4ab3c 100644
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -4,10 +4,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifdef MOZ_WIDGET_ANDROID
-# include "AndroidDecoderModule.h"
-#endif
-
#include "mozilla/AppShutdown.h"
#include "mozilla/DebugOnly.h"
@@ -320,6 +316,11 @@
# include "mozilla/fuzzing/IPCFuzzController.h"
#endif
+#ifdef ENABLE_WEBDRIVER
+# include "nsIMarionette.h"
+# include "nsIRemoteAgent.h"
+#endif
+
// For VP9Benchmark::sBenchmarkFpsPref
#include "Benchmark.h"
@@ -724,8 +725,7 @@ uint32_t ContentParent::GetPoolSize(const nsACString& aContentProcessType) {
return *sBrowserContentParents->GetOrInsertNew(aContentProcessType);
}
-const nsDependentCSubstring RemoteTypePrefix(
- const nsACString& aContentProcessType) {
+nsDependentCSubstring RemoteTypePrefix(const nsACString& aContentProcessType) {
// The suffix after a `=` in a remoteType is dynamic, and used to control the
// process pool to use.
int32_t equalIdx = aContentProcessType.FindChar(L'=');
@@ -2021,11 +2021,6 @@ void ContentParent::MarkAsDead() {
mLifecycleState = LifecycleState::DEAD;
}
-void ContentParent::OnChannelError() {
- RefPtr<ContentParent> kungFuDeathGrip(this);
- PContentParent::OnChannelError();
-}
-
void ContentParent::ProcessingError(Result aCode, const char* aReason) {
if (MsgDropped == aCode) {
return;
@@ -2321,7 +2316,7 @@ bool ContentParent::ShouldKeepProcessAlive() {
return false;
}
- auto contentParents = sBrowserContentParents->Get(mRemoteType);
+ auto* contentParents = sBrowserContentParents->Get(mRemoteType);
if (!contentParents) {
return false;
}
@@ -2440,7 +2435,7 @@ void ContentParent::NotifyTabDestroyed(const TabId& aTabId,
MOZ_LOG(ContentParent::GetLog(), LogLevel::Verbose,
("NotifyTabDestroyed %p", this));
- MaybeBeginShutDown(/* aExpectedBrowserCount */ 1);
+ MaybeBeginShutDown();
}
TestShellParent* ContentParent::CreateTestShell() {
@@ -2645,9 +2640,7 @@ bool ContentParent::BeginSubprocessLaunch(ProcessPriority aPriority) {
#ifdef MOZ_WIDGET_GTK
// This is X11-only pending a solution for WebGL in Wayland mode.
- if (StaticPrefs::dom_ipc_avoid_gtk() &&
- StaticPrefs::widget_non_native_theme_enabled() &&
- widget::GdkIsX11Display()) {
+ if (StaticPrefs::dom_ipc_avoid_gtk() && widget::GdkIsX11Display()) {
mSubprocess->SetEnv("MOZ_HEADLESS", "1");
}
#endif
@@ -3071,14 +3064,6 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {
Unused << SendUpdateMediaCodecsSupported(location, supported);
}
-#ifdef MOZ_WIDGET_ANDROID
- if (!(StaticPrefs::media_utility_process_enabled() &&
- StaticPrefs::media_utility_android_media_codec_enabled())) {
- Unused << SendDecoderSupportedMimeTypes(
- AndroidDecoderModule::GetSupportedMimeTypesPrefixed());
- }
-#endif
-
// Must send screen info before send initialData
ScreenManager& screenManager = ScreenManager::GetSingleton();
screenManager.CopyScreensToRemote(this);
@@ -3409,15 +3394,16 @@ void ContentParent::OnVarChanged(const GfxVarUpdate& aVar) {
}
mozilla::ipc::IPCResult ContentParent::RecvSetClipboard(
- const IPCTransferable& aTransferable, const int32_t& aWhichClipboard) {
+ const IPCTransferable& aTransferable, const int32_t& aWhichClipboard,
+ const MaybeDiscarded<WindowContext>& aRequestingWindowContext) {
// aRequestingPrincipal is allowed to be nullptr here.
- if (!ValidatePrincipal(aTransferable.requestingPrincipal(),
+ if (!ValidatePrincipal(aTransferable.dataPrincipal(),
{ValidatePrincipalOptions::AllowNullPtr,
ValidatePrincipalOptions::AllowExpanded,
ValidatePrincipalOptions::AllowSystem})) {
- LogAndAssertFailedPrincipalValidationInfo(
- aTransferable.requestingPrincipal(), __func__);
+ LogAndAssertFailedPrincipalValidationInfo(aTransferable.dataPrincipal(),
+ __func__);
}
nsresult rv;
@@ -3434,7 +3420,12 @@ mozilla::ipc::IPCResult ContentParent::RecvSetClipboard(
true /* aFilterUnknownFlavors */);
NS_ENSURE_SUCCESS(rv, IPC_OK());
- clipboard->SetData(trans, nullptr, aWhichClipboard);
+ // OK if this is null
+ RefPtr<WindowGlobalParent> window;
+ if (!aRequestingWindowContext.IsDiscarded()) {
+ window = aRequestingWindowContext.get_canonical();
+ }
+ clipboard->SetData(trans, nullptr, aWhichClipboard, window);
return IPC_OK();
}
@@ -3469,7 +3460,7 @@ static Result<nsCOMPtr<nsITransferable>, nsresult> CreateTransferable(
mozilla::ipc::IPCResult ContentParent::RecvGetClipboard(
nsTArray<nsCString>&& aTypes, const int32_t& aWhichClipboard,
const MaybeDiscarded<WindowContext>& aRequestingWindowContext,
- IPCTransferableData* aTransferableData) {
+ IPCTransferableDataOrError* aTransferableDataOrError) {
nsresult rv;
// We expect content processes to always pass a non-null window so Content
// Analysis can analyze it. (if Content Analysis is active)
@@ -3479,6 +3470,7 @@ mozilla::ipc::IPCResult ContentParent::RecvGetClipboard(
NS_WARNING(
"discarded window passed to RecvGetClipboard(); returning no clipboard "
"content");
+ *aTransferableDataOrError = NS_ERROR_FAILURE;
return IPC_OK();
}
if (aRequestingWindowContext.IsNull()) {
@@ -3488,21 +3480,29 @@ mozilla::ipc::IPCResult ContentParent::RecvGetClipboard(
// Retrieve clipboard
nsCOMPtr<nsIClipboard> clipboard(do_GetService(kCClipboardCID, &rv));
if (NS_FAILED(rv)) {
+ *aTransferableDataOrError = rv;
return IPC_OK();
}
// Create transferable
auto result = CreateTransferable(aTypes);
if (result.isErr()) {
+ *aTransferableDataOrError = result.unwrapErr();
return IPC_OK();
}
// Get data from clipboard
nsCOMPtr<nsITransferable> trans = result.unwrap();
- clipboard->GetData(trans, aWhichClipboard, window);
+ rv = clipboard->GetData(trans, aWhichClipboard, window);
+ if (NS_FAILED(rv)) {
+ *aTransferableDataOrError = rv;
+ return IPC_OK();
+ }
+ IPCTransferableData transferableData;
nsContentUtils::TransferableToIPCTransferableData(
- trans, aTransferableData, true /* aInSyncMessage */, this);
+ trans, &transferableData, true /* aInSyncMessage */, this);
+ *aTransferableDataOrError = std::move(transferableData);
return IPC_OK();
}
@@ -3682,10 +3682,15 @@ mozilla::ipc::IPCResult ContentParent::RecvGetClipboardDataSnapshotSync(
already_AddRefed<PClipboardWriteRequestParent>
ContentParent::AllocPClipboardWriteRequestParent(
- const int32_t& aClipboardType) {
+ const int32_t& aClipboardType,
+ const MaybeDiscarded<WindowContext>& aSettingWindowContext) {
+ WindowContext* settingWindowContext = nullptr;
+ if (!aSettingWindowContext.IsDiscarded()) {
+ settingWindowContext = aSettingWindowContext.get();
+ }
RefPtr<ClipboardWriteRequestParent> request =
MakeAndAddRef<ClipboardWriteRequestParent>(this);
- request->Init(aClipboardType);
+ request->Init(aClipboardType, settingWindowContext);
return request.forget();
}
@@ -4065,8 +4070,9 @@ ContentParent::Observe(nsISupports* aSubject, const char* aTopic,
!strcmp(aTopic, "alertdisablecallback") ||
!strcmp(aTopic, "alertsettingscallback")) {
if (!SendNotifyAlertsObserver(nsDependentCString(aTopic),
- nsDependentString(aData)))
+ nsDependentString(aData))) {
return NS_ERROR_NOT_AVAILABLE;
+ }
} else if (!strcmp(aTopic, "child-gc-request")) {
Unused << SendGarbageCollect();
} else if (!strcmp(aTopic, "child-cc-request")) {
@@ -4227,7 +4233,7 @@ bool ContentParent::CanOpenBrowser(const IPCTabContext& aContext) {
if (aContext.type() == IPCTabContext::TPopupIPCTabContext) {
const PopupIPCTabContext& popupContext = aContext.get_PopupIPCTabContext();
- auto opener = BrowserParent::GetFrom(popupContext.opener().AsParent());
+ auto* opener = BrowserParent::GetFrom(popupContext.opener().AsParent());
if (!opener) {
MOZ_CRASH_UNLESS_FUZZING(
"Got null opener from child; aborting AllocPBrowserParent.");
@@ -4338,7 +4344,7 @@ mozilla::ipc::IPCResult ContentParent::RecvUpdateRemotePrintSettings(
return IPC_OK();
}
- Unused << bp->SendUpdateRemotePrintSettings(std::move(aPrintData));
+ Unused << bp->SendUpdateRemotePrintSettings(aPrintData);
return IPC_OK();
}
@@ -4380,7 +4386,7 @@ mozilla::ipc::IPCResult ContentParent::RecvConstructPopupBrowser(
// type PopupIPCTabContext, and that the opener BrowserParent is
// reachable.
const PopupIPCTabContext& popupContext = aContext.get_PopupIPCTabContext();
- auto opener = BrowserParent::GetFrom(popupContext.opener().AsParent());
+ auto* opener = BrowserParent::GetFrom(popupContext.opener().AsParent());
openerTabId = opener->GetTabId();
openerCpId = opener->Manager()->ChildID();
@@ -5109,7 +5115,7 @@ mozilla::ipc::IPCResult ContentParent::RecvReportFrameTimingData(
"No need to bounce around if in the same process");
Unused << parent->GetContentParent()->SendReportFrameTimingData(
- loadInfoArgs, entryName, initiatorType, std::move(aData));
+ loadInfoArgs, entryName, initiatorType, aData);
return IPC_OK();
}
@@ -5117,30 +5123,30 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptError(
const nsAString& aMessage, const nsAString& aSourceName,
const nsAString& aSourceLine, const uint32_t& aLineNumber,
const uint32_t& aColNumber, const uint32_t& aFlags,
- const nsACString& aCategory, const bool& aFromPrivateWindow,
- const uint64_t& aInnerWindowId, const bool& aFromChromeContext) {
+ const nsACString& aCategory, const bool& aIsFromPrivateWindow,
+ const uint64_t& aInnerWindowId, const bool& aIsFromChromeContext) {
return RecvScriptErrorInternal(aMessage, aSourceName, aSourceLine,
aLineNumber, aColNumber, aFlags, aCategory,
- aFromPrivateWindow, aFromChromeContext);
+ aIsFromPrivateWindow, aIsFromChromeContext);
}
mozilla::ipc::IPCResult ContentParent::RecvScriptErrorWithStack(
const nsAString& aMessage, const nsAString& aSourceName,
const nsAString& aSourceLine, const uint32_t& aLineNumber,
const uint32_t& aColNumber, const uint32_t& aFlags,
- const nsACString& aCategory, const bool& aFromPrivateWindow,
- const bool& aFromChromeContext, const ClonedMessageData& aFrame) {
+ const nsACString& aCategory, const bool& aIsFromPrivateWindow,
+ const bool& aIsFromChromeContext, const ClonedMessageData& aStack) {
return RecvScriptErrorInternal(
aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber, aFlags,
- aCategory, aFromPrivateWindow, aFromChromeContext, &aFrame);
+ aCategory, aIsFromPrivateWindow, aIsFromChromeContext, &aStack);
}
mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal(
const nsAString& aMessage, const nsAString& aSourceName,
const nsAString& aSourceLine, const uint32_t& aLineNumber,
const uint32_t& aColNumber, const uint32_t& aFlags,
- const nsACString& aCategory, const bool& aFromPrivateWindow,
- const bool& aFromChromeContext, const ClonedMessageData* aStack) {
+ const nsACString& aCategory, const bool& aIsFromPrivateWindow,
+ const bool& aIsFromChromeContext, const ClonedMessageData* aStack) {
nsresult rv;
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID, &rv);
@@ -5181,7 +5187,7 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal(
}
rv = msg->Init(aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber,
- aFlags, aCategory, aFromPrivateWindow, aFromChromeContext);
+ aFlags, aCategory, aIsFromPrivateWindow, aIsFromChromeContext);
if (NS_FAILED(rv)) return IPC_OK();
msg->SetIsForwardedFromContentProcess(true);
@@ -5197,9 +5203,9 @@ bool ContentParent::DoLoadMessageManagerScript(const nsAString& aURL,
}
nsresult ContentParent::DoSendAsyncMessage(const nsAString& aMessage,
- StructuredCloneData& aHelper) {
+ StructuredCloneData& aData) {
ClonedMessageData data;
- if (!BuildClonedMessageData(aHelper, data)) {
+ if (!BuildClonedMessageData(aData, data)) {
return NS_ERROR_DOM_DATA_CLONE_ERR;
}
if (!SendAsyncMessage(aMessage, data)) {
@@ -5229,8 +5235,7 @@ mozilla::ipc::IPCResult ContentParent::RecvFindImageText(
return IPC_FAIL(this, "Text recognition not available.");
}
- RefPtr<DataSourceSurface> surf =
- nsContentUtils::IPCImageToSurface(std::move(aImage));
+ RefPtr<DataSourceSurface> surf = nsContentUtils::IPCImageToSurface(aImage);
if (!surf) {
aResolver(TextRecognitionResultOrError("Failed to read image"_ns));
return IPC_OK();
@@ -5255,14 +5260,14 @@ bool ContentParent::ShouldContinueFromReplyTimeout() {
}
mozilla::ipc::IPCResult ContentParent::RecvAddIdleObserver(
- const uint64_t& aObserver, const uint32_t& aIdleTimeInS) {
+ const uint64_t& aObserverId, const uint32_t& aIdleTimeInS) {
nsresult rv;
nsCOMPtr<nsIUserIdleService> idleService =
do_GetService("@mozilla.org/widget/useridleservice;1", &rv);
NS_ENSURE_SUCCESS(rv, IPC_FAIL(this, "Failed to get UserIdleService."));
RefPtr<ParentIdleListener> listener =
- new ParentIdleListener(this, aObserver, aIdleTimeInS);
+ new ParentIdleListener(this, aObserverId, aIdleTimeInS);
rv = idleService->AddIdleObserver(listener, aIdleTimeInS);
NS_ENSURE_SUCCESS(rv, IPC_FAIL(this, "AddIdleObserver failed."));
mIdleListeners.AppendElement(listener);
@@ -5270,11 +5275,11 @@ mozilla::ipc::IPCResult ContentParent::RecvAddIdleObserver(
}
mozilla::ipc::IPCResult ContentParent::RecvRemoveIdleObserver(
- const uint64_t& aObserver, const uint32_t& aIdleTimeInS) {
+ const uint64_t& aObserverId, const uint32_t& aIdleTimeInS) {
RefPtr<ParentIdleListener> listener;
for (int32_t i = mIdleListeners.Length() - 1; i >= 0; --i) {
listener = static_cast<ParentIdleListener*>(mIdleListeners[i].get());
- if (listener->mObserver == aObserver && listener->mTime == aIdleTimeInS) {
+ if (listener->mObserver == aObserverId && listener->mTime == aIdleTimeInS) {
nsresult rv;
nsCOMPtr<nsIUserIdleService> idleService =
do_GetService("@mozilla.org/widget/useridleservice;1", &rv);
@@ -5381,7 +5386,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateAudioIPCConnection(
} else {
result = NS_ERROR_FAILURE;
}
- aResolver(std::move(result));
+ aResolver(result);
return IPC_OK();
}
@@ -5781,7 +5786,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
PBrowserParent* aThisTab, const MaybeDiscarded<BrowsingContext>& aParent,
PBrowserParent* aNewTab, const uint32_t& aChromeFlags,
const bool& aCalledFromJS, const bool& aForPrinting,
- const bool& aForPrintPreview, nsIURI* aURIToLoad,
+ const bool& aForWindowDotPrint, nsIURI* aURIToLoad,
const nsACString& aFeatures, const UserActivation::Modifiers& aModifiers,
nsIPrincipal* aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
nsIReferrerInfo* aReferrerInfo, const OriginAttributes& aOriginAttributes,
@@ -5867,8 +5872,8 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
int32_t openLocation = nsIBrowserDOMWindow::OPEN_NEWWINDOW;
mozilla::ipc::IPCResult ipcResult = CommonCreateWindow(
aThisTab, *parent, newBCOpenerId != 0, aChromeFlags, aCalledFromJS,
- aForPrinting, aForPrintPreview, aURIToLoad, aFeatures, aModifiers, newTab,
- VoidString(), rv, newRemoteTab, &cwi.windowOpened(), openLocation,
+ aForPrinting, aForWindowDotPrint, aURIToLoad, aFeatures, aModifiers,
+ newTab, VoidString(), rv, newRemoteTab, &cwi.windowOpened(), openLocation,
aTriggeringPrincipal, aReferrerInfo, /* aLoadUri = */ false, aCsp,
aOriginAttributes);
if (!ipcResult) {
@@ -6272,9 +6277,9 @@ ContentParent::RecvUnstoreAndBroadcastBlobURLUnregistration(
}
mozilla::ipc::IPCResult ContentParent::RecvGetFilesRequest(
- const nsID& aUUID, const nsAString& aDirectoryPath,
+ const nsID& aID, const nsAString& aDirectoryPath,
const bool& aRecursiveFlag) {
- MOZ_ASSERT(!mGetFilesPendingRequests.GetWeak(aUUID));
+ MOZ_ASSERT(!mGetFilesPendingRequests.GetWeak(aID));
if (!mozilla::Preferences::GetBool("dom.filesystem.pathcheck.disabled",
false)) {
@@ -6290,30 +6295,30 @@ mozilla::ipc::IPCResult ContentParent::RecvGetFilesRequest(
ErrorResult rv;
RefPtr<GetFilesHelper> helper = GetFilesHelperParent::Create(
- aUUID, aDirectoryPath, aRecursiveFlag, this, rv);
+ aID, aDirectoryPath, aRecursiveFlag, this, rv);
if (NS_WARN_IF(rv.Failed())) {
- if (!SendGetFilesResponse(aUUID,
+ if (!SendGetFilesResponse(aID,
GetFilesResponseFailure(rv.StealNSResult()))) {
return IPC_FAIL(this, "SendGetFilesResponse failed.");
}
return IPC_OK();
}
- mGetFilesPendingRequests.InsertOrUpdate(aUUID, std::move(helper));
+ mGetFilesPendingRequests.InsertOrUpdate(aID, std::move(helper));
return IPC_OK();
}
mozilla::ipc::IPCResult ContentParent::RecvDeleteGetFilesRequest(
- const nsID& aUUID) {
- mGetFilesPendingRequests.Remove(aUUID);
+ const nsID& aID) {
+ mGetFilesPendingRequests.Remove(aID);
return IPC_OK();
}
void ContentParent::SendGetFilesResponseAndForget(
- const nsID& aUUID, const GetFilesResponseResult& aResult) {
- if (mGetFilesPendingRequests.Remove(aUUID)) {
- Unused << SendGetFilesResponse(aUUID, aResult);
+ const nsID& aID, const GetFilesResponseResult& aResult) {
+ if (mGetFilesPendingRequests.Remove(aID)) {
+ Unused << SendGetFilesResponse(aID, aResult);
}
}
@@ -6615,8 +6620,34 @@ mozilla::ipc::IPCResult ContentParent::RecvRecordDiscardedData(
return IPC_OK();
}
+static bool WebdriverRunning() {
+#ifdef ENABLE_WEBDRIVER
+ nsCOMPtr<nsIMarionette> marionette = do_GetService(NS_MARIONETTE_CONTRACTID);
+ if (marionette) {
+ bool marionetteRunning = false;
+ marionette->GetRunning(&marionetteRunning);
+ if (marionetteRunning) {
+ return true;
+ }
+ }
+
+ nsCOMPtr<nsIRemoteAgent> agent = do_GetService(NS_REMOTEAGENT_CONTRACTID);
+ if (agent) {
+ bool remoteAgentRunning = false;
+ agent->GetRunning(&remoteAgentRunning);
+ if (remoteAgentRunning) {
+ return true;
+ }
+ }
+#endif
+
+ return false;
+}
+
mozilla::ipc::IPCResult ContentParent::RecvRecordPageLoadEvent(
- const mozilla::glean::perf::PageLoadExtra& aPageLoadEventExtra) {
+ mozilla::glean::perf::PageLoadExtra&& aPageLoadEventExtra) {
+ // Check whether a webdriver is running.
+ aPageLoadEventExtra.usingWebdriver = mozilla::Some(WebdriverRunning());
mozilla::glean::perf::page_load.Record(mozilla::Some(aPageLoadEventExtra));
// Send the PageLoadPing after every 30 page loads, or on startup.
@@ -6735,7 +6766,7 @@ bool ContentParent::DeallocPSessionStorageObserverParent(
}
mozilla::ipc::IPCResult ContentParent::RecvBHRThreadHang(
- const HangDetails& aDetails) {
+ const HangDetails& aHangDetails) {
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
// Copy the HangDetails recieved over the network into a nsIHangDetails, and
@@ -6743,7 +6774,7 @@ mozilla::ipc::IPCResult ContentParent::RecvBHRThreadHang(
// XXX: We should be able to avoid this potentially expensive copy here by
// moving our deserialized argument.
nsCOMPtr<nsIHangDetails> hangDetails =
- new nsHangDetails(HangDetails(aDetails), PersistedToDisk::No);
+ new nsHangDetails(HangDetails(aHangDetails), PersistedToDisk::No);
obs->NotifyObservers(hangDetails, "bhr-thread-hang", nullptr);
}
return IPC_OK();
@@ -7151,6 +7182,19 @@ mozilla::ipc::IPCResult ContentParent::RecvNotifyPositionStateChanged(
return IPC_OK();
}
+mozilla::ipc::IPCResult ContentParent::RecvNotifyGuessedPositionStateChanged(
+ const MaybeDiscarded<BrowsingContext>& aContext, const nsID& aMediaId,
+ const Maybe<PositionState>& aState) {
+ if (aContext.IsNullOrDiscarded()) {
+ return IPC_OK();
+ }
+ if (RefPtr<IMediaInfoUpdater> updater =
+ aContext.get_canonical()->GetMediaController()) {
+ updater->UpdateGuessedPositionState(aContext.ContextId(), aMediaId, aState);
+ }
+ return IPC_OK();
+}
+
mozilla::ipc::IPCResult ContentParent::RecvAddOrRemovePageAwakeRequest(
const MaybeDiscarded<BrowsingContext>& aContext,
const bool& aShouldAddCount) {
@@ -7221,16 +7265,14 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateBrowsingContext(
if (parent && parent->Group() != group) {
if (parent->Group()->Id() != aGroupId) {
return IPC_FAIL(this, "Parent has different group ID");
- } else {
- return IPC_FAIL(this, "Parent has different group object");
}
+ return IPC_FAIL(this, "Parent has different group object");
}
if (opener && opener->Group() != group) {
if (opener->Group()->Id() != aGroupId) {
return IPC_FAIL(this, "Opener has different group ID");
- } else {
- return IPC_FAIL(this, "Opener has different group object");
}
+ return IPC_FAIL(this, "Opener has different group object");
}
if (!parent && !opener && !group->Toplevels().IsEmpty()) {
return IPC_FAIL(this, "Unrelated context from child in stale group");
diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h
index 31cfa6de88..8040f4a07b 100644
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -410,7 +410,7 @@ class ContentParent final : public PContentParent,
* WARNING: aReason appears in telemetry, so any new value passed in requires
* data review.
*/
- void KillHard(const char* aWhy);
+ void KillHard(const char* aReason);
ContentParentId ChildID() const { return mChildID; }
@@ -422,8 +422,6 @@ class ContentParent final : public PContentParent,
*/
void FriendlyName(nsAString& aName, bool aAnonymize = false);
- virtual void OnChannelError() override;
-
mozilla::ipc::IPCResult RecvInitCrashReporter(
const NativeThreadId& aThreadId);
@@ -473,12 +471,11 @@ class ContentParent final : public PContentParent,
void ForkNewProcess(bool aBlocking);
mozilla::ipc::IPCResult RecvCreateWindow(
- PBrowserParent* aThisBrowserParent,
- const MaybeDiscarded<BrowsingContext>& aParent, PBrowserParent* aNewTab,
- const uint32_t& aChromeFlags, const bool& aCalledFromJS,
- const bool& aForPrinting, const bool& aForWindowDotPrint,
- nsIURI* aURIToLoad, const nsACString& aFeatures,
- const UserActivation::Modifiers& aModifiers,
+ PBrowserParent* aThisTab, const MaybeDiscarded<BrowsingContext>& aParent,
+ PBrowserParent* aNewTab, const uint32_t& aChromeFlags,
+ const bool& aCalledFromJS, const bool& aForPrinting,
+ const bool& aForWindowDotPrint, nsIURI* aURIToLoad,
+ const nsACString& aFeatures, const UserActivation::Modifiers& aModifiers,
nsIPrincipal* aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
nsIReferrerInfo* aReferrerInfo, const OriginAttributes& aOriginAttributes,
CreateWindowResolver&& aResolve);
@@ -879,7 +876,7 @@ class ContentParent final : public PContentParent,
const MaybeDiscarded<BrowsingContext>& aTarget, PrintData&& aPrintData);
mozilla::ipc::IPCResult RecvConstructPopupBrowser(
- ManagedEndpoint<PBrowserParent>&& actor,
+ ManagedEndpoint<PBrowserParent>&& aBrowserEp,
ManagedEndpoint<PWindowGlobalParent>&& windowEp, const TabId& tabId,
const IPCTabContext& context, const WindowGlobalInit& initialWindowInit,
const uint32_t& chromeFlags);
@@ -949,13 +946,14 @@ class ContentParent final : public PContentParent,
PBrowserParent* aBrowser,
const MaybeDiscarded<BrowsingContext>& aContext);
- mozilla::ipc::IPCResult RecvSetClipboard(const IPCTransferable& aTransferable,
- const int32_t& aWhichClipboard);
+ mozilla::ipc::IPCResult RecvSetClipboard(
+ const IPCTransferable& aTransferable, const int32_t& aWhichClipboard,
+ const MaybeDiscarded<WindowContext>& aRequestingWindowContext);
mozilla::ipc::IPCResult RecvGetClipboard(
nsTArray<nsCString>&& aTypes, const int32_t& aWhichClipboard,
const MaybeDiscarded<WindowContext>& aRequestingWindowContext,
- IPCTransferableData* aTransferableData);
+ IPCTransferableDataOrError* aTransferableDataOrError);
mozilla::ipc::IPCResult RecvEmptyClipboard(const int32_t& aWhichClipboard);
@@ -975,7 +973,9 @@ class ContentParent final : public PContentParent,
ClipboardReadRequestOrError* aRequestOrError);
already_AddRefed<PClipboardWriteRequestParent>
- AllocPClipboardWriteRequestParent(const int32_t& aClipboardType);
+ AllocPClipboardWriteRequestParent(
+ const int32_t& aClipboardType,
+ const MaybeDiscarded<WindowContext>& aSettingWindowContext);
mozilla::ipc::IPCResult RecvGetIconForExtension(const nsACString& aFileExt,
const uint32_t& aIconSize,
@@ -1085,10 +1085,10 @@ class ContentParent final : public PContentParent,
mozilla::ipc::IPCResult RecvEndDriverCrashGuard(const uint32_t& aGuardType);
- mozilla::ipc::IPCResult RecvAddIdleObserver(const uint64_t& observerId,
+ mozilla::ipc::IPCResult RecvAddIdleObserver(const uint64_t& aObserverId,
const uint32_t& aIdleTimeInS);
- mozilla::ipc::IPCResult RecvRemoveIdleObserver(const uint64_t& observerId,
+ mozilla::ipc::IPCResult RecvRemoveIdleObserver(const uint64_t& aObserverId,
const uint32_t& aIdleTimeInS);
mozilla::ipc::IPCResult RecvBackUpXResources(
@@ -1184,7 +1184,7 @@ class ContentParent final : public PContentParent,
mozilla::ipc::IPCResult RecvRecordDiscardedData(
const DiscardedData& aDiscardedData);
mozilla::ipc::IPCResult RecvRecordPageLoadEvent(
- const mozilla::glean::perf::PageLoadExtra& aPageLoadEventExtra);
+ mozilla::glean::perf::PageLoadExtra&& aPageLoadEventExtra);
mozilla::ipc::IPCResult RecvRecordOrigin(const uint32_t& aMetricId,
const nsACString& aOrigin);
mozilla::ipc::IPCResult RecvReportContentBlockingLog(
@@ -1272,6 +1272,10 @@ class ContentParent final : public PContentParent,
const MaybeDiscarded<BrowsingContext>& aContext,
const Maybe<PositionState>& aState);
+ mozilla::ipc::IPCResult RecvNotifyGuessedPositionStateChanged(
+ const MaybeDiscarded<BrowsingContext>& aContext, const nsID& aMediaId,
+ const Maybe<PositionState>& aState);
+
mozilla::ipc::IPCResult RecvAddOrRemovePageAwakeRequest(
const MaybeDiscarded<BrowsingContext>& aContext,
const bool& aShouldAddCount);
@@ -1660,8 +1664,7 @@ class ThreadsafeContentParentHandle final {
};
// This is the C++ version of remoteTypePrefix in E10SUtils.sys.mjs.
-const nsDependentCSubstring RemoteTypePrefix(
- const nsACString& aContentProcessType);
+nsDependentCSubstring RemoteTypePrefix(const nsACString& aContentProcessType);
// This is based on isWebRemoteType in E10SUtils.sys.mjs.
bool IsWebRemoteType(const nsACString& aContentProcessType);
diff --git a/dom/ipc/DOMTypes.ipdlh b/dom/ipc/DOMTypes.ipdlh
index 1be3537e68..034410eb4d 100644
--- a/dom/ipc/DOMTypes.ipdlh
+++ b/dom/ipc/DOMTypes.ipdlh
@@ -39,6 +39,7 @@ using mozilla::CSSRect from "Units.h";
using mozilla::CSSSize from "Units.h";
using mozilla::ScreenIntSize from "Units.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
+using mozilla::ImageIntSize from "Units.h";
using nsSizeMode from "nsIWidgetListener.h";
using mozilla::ScrollbarPreference from "mozilla/ScrollbarPreferences.h";
using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";
@@ -326,5 +327,12 @@ struct OwnerShowInfo {
nsSizeMode sizeMode;
};
+struct IPCImage {
+ BigBuffer data;
+ uint32_t stride;
+ SurfaceFormat format;
+ ImageIntSize size;
+};
+
} // namespace dom
} // namespace mozilla
diff --git a/dom/ipc/IPCTransferable.ipdlh b/dom/ipc/IPCTransferable.ipdlh
index 1e277d05dd..9eecbf2dce 100644
--- a/dom/ipc/IPCTransferable.ipdlh
+++ b/dom/ipc/IPCTransferable.ipdlh
@@ -7,6 +7,7 @@
include "mozilla/GfxMessageUtils.h";
include "mozilla/dom/PermissionMessageUtils.h";
+include DOMTypes;
include IPCBlob;
include NeckoChannelParams;
@@ -42,11 +43,7 @@ struct IPCTransferableDataInputStream
struct IPCTransferableDataImageContainer
{
- BigBuffer data;
- uint32_t width;
- uint32_t height;
- uint32_t stride;
- SurfaceFormat format;
+ IPCImage image;
};
struct IPCTransferableDataBlob
@@ -83,7 +80,7 @@ struct IPCTransferable
{
IPCTransferableData data;
bool isPrivateData;
- nullable nsIPrincipal requestingPrincipal;
+ nullable nsIPrincipal dataPrincipal;
CookieJarSettingsArgs? cookieJarSettings;
nsContentPolicyType contentPolicyType;
nullable nsIReferrerInfo referrerInfo;
diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl
index 372a81b139..e8df017ca2 100644
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -376,23 +376,12 @@ parent:
* Set the native cursor.
* @param value
* The widget cursor to set.
- * @param hasCustomCursor
- * Whether there's any custom cursor represented by cursorData and
- * company.
- * @param customCursorData
- * Serialized image data.
- * @param width
- * Width of the image.
- * @param height
- * Height of the image.
+ * @param customCursor
+ * Serialized image data for custom cursor.
* @param resolutionX
* Resolution of the image X axis in dppx units.
* @param resolutionY
* Resolution of the image Y axis in dppx units.
- * @param stride
- * Stride used in the image data.
- * @param format
- * Image format, see gfx::SurfaceFormat for possible values.
* @param hotspotX
* Horizontal hotspot of the image, as specified by the css cursor property.
* @param hotspotY
@@ -402,11 +391,8 @@ parent:
* update.
*/
async SetCursor(nsCursor value,
- bool hasCustomCursor,
- BigBuffer? customCursorData,
- uint32_t width, uint32_t height,
+ IPCImage? customCursor,
float resolutionX, float resolutionY,
- uint32_t stride, SurfaceFormat format,
uint32_t hotspotX, uint32_t hotspotY, bool force);
/**
diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl
index 67c4c298e4..0aaef08b7b 100644
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -101,7 +101,6 @@ using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
using mozilla::EventMessage from "mozilla/EventForwards.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using mozilla::ImagePoint from "Units.h";
-using mozilla::ImageIntSize from "Units.h";
using mozilla::widget::ThemeChangeKind from "mozilla/widget/WidgetMessageUtils.h";
using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h";
[MoveOnly=data] using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h";
@@ -463,13 +462,6 @@ union TextRecognitionResultOrError {
nsCString;
};
-struct IPCImage {
- BigBuffer data;
- uint32_t stride;
- SurfaceFormat format;
- ImageIntSize size;
-};
-
struct ClipboardReadRequest {
ManagedEndpoint<PClipboardReadRequestChild> childEndpoint;
nsCString[] availableTypes;
@@ -1052,9 +1044,6 @@ child:
// Update the cached list of codec supported in the given process.
async UpdateMediaCodecsSupported(RemoteDecodeIn aLocation, MediaCodecsSupported aSupported);
- // Send the list of the supported mimetypes in the given process. GeckoView-specific
- async DecoderSupportedMimeTypes(nsCString[] supportedTypes);
-
// Used to initialize the global variable in content processes with the
// latched value in the parent process. See dom/LocalStorageCommon.h for more
// details.
@@ -1214,12 +1203,12 @@ parent:
async ConsoleMessage(nsString message);
async ScriptErrorWithStack(nsString message, nsString sourceName, nsString sourceLine,
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
- nsCString category, bool privateWindow,
- bool fromChromeContext, ClonedMessageData stack);
+ nsCString category, bool isFromPrivateWindow,
+ bool isFromChromeContext, ClonedMessageData stack);
// Places the items within dataTransfer on the clipboard.
async SetClipboard(IPCTransferable aTransferable,
- int32_t aWhichClipboard);
+ int32_t aWhichClipboard, MaybeDiscardedWindowContext aRequestingWindowContext);
// Given a list of supported types, returns the clipboard data for the
// first type that matches.
@@ -1227,7 +1216,7 @@ parent:
// which is used for content analysis.
sync GetClipboard(nsCString[] aTypes, int32_t aWhichClipboard,
MaybeDiscardedWindowContext aRequestingWindowContext)
- returns (IPCTransferableData transferableData);
+ returns (IPCTransferableDataOrError transferableDataOrError);
// Requests getting data from clipboard.
async GetClipboardAsync(nsCString[] aTypes, int32_t aWhichClipboard,
@@ -1252,8 +1241,12 @@ parent:
* and that the data will be sent over another IPC message once it is ready.
* @param aClipboardType
* The clipboard type defined in nsIClipboard.
+ * @param aSettingWindowContext
+ * The window context that is setting the clipboard, if any. This is used
+ * to possibly bypass Content Analysis if a set clipboard and get clipboard
+ * operation are done on the same page.
*/
- async PClipboardWriteRequest(int32_t aClipboardType);
+ async PClipboardWriteRequest(int32_t aClipboardType, MaybeDiscardedWindowContext aSettingWindowContext);
sync GetIconForExtension(nsCString aFileExt, uint32_t aIconSize)
returns (uint8_t[] bits);
@@ -1741,6 +1734,15 @@ parent:
PositionState? aState);
/**
+ * This method is used to update a media's position state whenever its
+ * guessed position state is being updated.
+ */
+ async NotifyGuessedPositionStateChanged(
+ MaybeDiscardedBrowsingContext aContext,
+ nsID aMediaId,
+ PositionState? aState);
+
+ /**
* This method will make canonical browsing context to update the count of
* callers which want to keep the page from being suspended even if the page
* is inactive.
@@ -1819,8 +1821,8 @@ parent:
both:
async ScriptError(nsString message, nsString sourceName, nsString sourceLine,
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
- nsCString category, bool privateWindow, uint64_t innerWindowId,
- bool fromChromeContext);
+ nsCString category, bool isFromPrivateWindow, uint64_t innerWindowId,
+ bool isFromChromeContext);
/**
* Used in fission to report timing data when the parent window is in
diff --git a/dom/ipc/PWindowGlobal.ipdl b/dom/ipc/PWindowGlobal.ipdl
index a063852f56..49141fd1ce 100644
--- a/dom/ipc/PWindowGlobal.ipdl
+++ b/dom/ipc/PWindowGlobal.ipdl
@@ -219,6 +219,10 @@ parent:
bool fromHttp,
CookieStruct[] cookies);
+ // Notify parent of storage access in the content process. This only happens
+ // once per window lifetime to avoid redundant IPC.
+ async OnInitialStorageAccess();
+
child:
async NotifyPermissionChange(nsCString type, uint32_t permission);
};
diff --git a/dom/ipc/TabContext.cpp b/dom/ipc/TabContext.cpp
index 4344ec221a..e92005603a 100644
--- a/dom/ipc/TabContext.cpp
+++ b/dom/ipc/TabContext.cpp
@@ -17,9 +17,7 @@ using namespace mozilla::layout;
namespace mozilla::dom {
TabContext::TabContext()
- : mInitialized(false),
- mChromeOuterWindowID(0),
- mMaxTouchPoints(0) {}
+ : mInitialized(false), mChromeOuterWindowID(0), mMaxTouchPoints(0) {}
uint64_t TabContext::ChromeOuterWindowID() const {
return mChromeOuterWindowID;
diff --git a/dom/ipc/WindowGlobalChild.cpp b/dom/ipc/WindowGlobalChild.cpp
index 4072828911..7fb95709ee 100644
--- a/dom/ipc/WindowGlobalChild.cpp
+++ b/dom/ipc/WindowGlobalChild.cpp
@@ -867,9 +867,26 @@ nsISupports* WindowGlobalChild::GetParentObject() {
return xpc::NativeGlobal(xpc::PrivilegedJunkScope());
}
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_WEAK_PTR(WindowGlobalChild, mWindowGlobal,
- mContainerFeaturePolicy,
- mWindowContext)
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(WindowGlobalChild)
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(WindowGlobalChild)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindowGlobal)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mContainerFeaturePolicy)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindowContext)
+ tmp->UnlinkManager();
+ NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
+ NS_IMPL_CYCLE_COLLECTION_UNLINK_WEAK_PTR
+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
+
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(WindowGlobalChild)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindowGlobal)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContainerFeaturePolicy)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindowContext)
+ if (!tmp->IsInProcess()) {
+ CycleCollectionNoteChild(cb, static_cast<BrowserChild*>(tmp->Manager()),
+ "Manager()");
+ }
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WindowGlobalChild)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
diff --git a/dom/ipc/WindowGlobalParent.cpp b/dom/ipc/WindowGlobalParent.cpp
index f60790a155..4379c7280c 100644
--- a/dom/ipc/WindowGlobalParent.cpp
+++ b/dom/ipc/WindowGlobalParent.cpp
@@ -10,6 +10,7 @@
#include "mozilla/AntiTrackingUtils.h"
#include "mozilla/AsyncEventDispatcher.h"
+#include "mozilla/BounceTrackingStorageObserver.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/ContentBlockingAllowList.h"
#include "mozilla/dom/InProcessParent.h"
@@ -75,7 +76,7 @@
#include "mozilla/net/PCookieServiceParent.h"
#include "mozilla/net/CookieServiceParent.h"
-#include "SessionStoreFunctions.h"
+#include "nsISessionStoreFunctions.h"
#include "nsIXPConnect.h"
#include "nsImportModule.h"
#include "nsIXULRuntime.h"
@@ -1705,8 +1706,29 @@ IPCResult WindowGlobalParent::RecvSetCookies(
aCookies, GetBrowsingContext());
}
-NS_IMPL_CYCLE_COLLECTION_INHERITED(WindowGlobalParent, WindowContext,
- mPageUseCountersWindow)
+IPCResult WindowGlobalParent::RecvOnInitialStorageAccess() {
+ DebugOnly<nsresult> rv =
+ BounceTrackingStorageObserver::OnInitialStorageAccess(this);
+ NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to notify storage access");
+ return IPC_OK();
+}
+
+NS_IMPL_CYCLE_COLLECTION_CLASS(WindowGlobalParent)
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(WindowGlobalParent,
+ WindowContext)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mPageUseCountersWindow)
+ tmp->UnlinkManager();
+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
+
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(WindowGlobalParent,
+ WindowContext)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPageUseCountersWindow)
+ if (!tmp->IsInProcess()) {
+ CycleCollectionNoteChild(cb, static_cast<BrowserParent*>(tmp->Manager()),
+ "Manager()");
+ }
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(WindowGlobalParent,
WindowContext)
diff --git a/dom/ipc/WindowGlobalParent.h b/dom/ipc/WindowGlobalParent.h
index be801de0d3..3680c14596 100644
--- a/dom/ipc/WindowGlobalParent.h
+++ b/dom/ipc/WindowGlobalParent.h
@@ -329,6 +329,8 @@ class WindowGlobalParent final : public WindowContext,
const nsCString& aBaseDomain, const OriginAttributes& aOriginAttributes,
nsIURI* aHost, bool aFromHttp, const nsTArray<CookieStruct>& aCookies);
+ mozilla::ipc::IPCResult RecvOnInitialStorageAccess();
+
private:
WindowGlobalParent(CanonicalBrowsingContext* aBrowsingContext,
uint64_t aInnerWindowId, uint64_t aOuterWindowId,