From 088c0cefd0f8b5482cc227955cc3057d47ec24b6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:02:01 +0200 Subject: Merging upstream version 126.0.1. Signed-off-by: Daniel Baumann --- dom/canvas/CanvasRenderingContext2D.cpp | 12 ++++--- .../test/test_accelerated_canvas_context_loss.html | 12 +++++++ dom/indexedDB/IDBFactory.cpp | 8 ++++- dom/indexedDB/IDBFactory.h | 2 +- dom/media/platforms/wmf/DXVA2Manager.cpp | 37 +--------------------- dom/webidl/IDBFactory.webidl | 1 + 6 files changed, 29 insertions(+), 43 deletions(-) (limited to 'dom') diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 1a79a9f734..54711aa981 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -2216,14 +2216,16 @@ void CanvasRenderingContext2D::Transform(double aM11, double aM12, double aM21, already_AddRefed CanvasRenderingContext2D::GetTransform( ErrorResult& aError) { - if (!EnsureTarget(aError)) { + // If we are silently failing, then we still need to return a transform while + // we are in the process of recovering. + Matrix transform; + if (EnsureTarget(aError)) { + transform = mTarget->GetTransform(); + } else if (aError.Failed()) { return nullptr; } - MOZ_ASSERT(IsTargetValid()); - - RefPtr matrix = - new DOMMatrix(GetParentObject(), mTarget->GetTransform()); + RefPtr matrix = new DOMMatrix(GetParentObject(), transform); return matrix.forget(); } diff --git a/dom/canvas/test/test_accelerated_canvas_context_loss.html b/dom/canvas/test/test_accelerated_canvas_context_loss.html index 6172420bcb..610c8d8fc3 100644 --- a/dom/canvas/test/test_accelerated_canvas_context_loss.html +++ b/dom/canvas/test/test_accelerated_canvas_context_loss.html @@ -58,6 +58,12 @@ let countRestoredEvents = 0; function onContextLost() { ok(context.isContextLost(), "Canvas context should be lost during contextlost event"); + + try { + let transform = context.getTransform(); + ok(transform.isIdentity, "Canvas context should return identity transform while context lost"); + } catch (e) {} + countLostEvents += 1; } @@ -88,6 +94,12 @@ async function start() { ok(!context.isContextLost(), "Canvas context should not be lost after initial fill"); + let transform = context.getTransform(); + ok(transform.isIdentity, "Canvas context should default to identity transform"); + context.setTransform(2.0, 3.0, 4.0, 5.0, 6.0, 7.0); + transform = context.getTransform(); + ok(!transform.isIdentity, "Canvas context should have non-identity transform"); + const restarted = await restartGPUProcess(); const expectedEvents = restarted ? 1 : 0; diff --git a/dom/indexedDB/IDBFactory.cpp b/dom/indexedDB/IDBFactory.cpp index 51d4c4df23..c0dc5aeab2 100644 --- a/dom/indexedDB/IDBFactory.cpp +++ b/dom/indexedDB/IDBFactory.cpp @@ -470,7 +470,13 @@ RefPtr IDBFactory::DeleteDatabase( /* aDeleting */ true, aCallerType, aRv); } -already_AddRefed IDBFactory::Databases(JSContext* const aCx) { +already_AddRefed IDBFactory::Databases(JSContext* const aCx, + ErrorResult& aRv) { + if (NS_WARN_IF(!GetOwnerGlobal())) { + aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); + return nullptr; + } + RefPtr promise = Promise::CreateInfallible(GetOwnerGlobal()); // Nothing can be done here if we have previously failed to create a diff --git a/dom/indexedDB/IDBFactory.h b/dom/indexedDB/IDBFactory.h index 7139b26f9c..d64d571a05 100644 --- a/dom/indexedDB/IDBFactory.h +++ b/dom/indexedDB/IDBFactory.h @@ -162,7 +162,7 @@ class IDBFactory final : public GlobalTeardownObserver, public nsWrapperCache { JSContext* aCx, const nsAString& aName, const IDBOpenDBOptions& aOptions, CallerType aCallerType, ErrorResult& aRv); - already_AddRefed Databases(JSContext* aCx); + already_AddRefed Databases(JSContext* aCx, ErrorResult& aRv); int16_t Cmp(JSContext* aCx, JS::Handle aFirst, JS::Handle aSecond, ErrorResult& aRv); diff --git a/dom/media/platforms/wmf/DXVA2Manager.cpp b/dom/media/platforms/wmf/DXVA2Manager.cpp index 9efe9dab55..064efd8209 100644 --- a/dom/media/platforms/wmf/DXVA2Manager.cpp +++ b/dom/media/platforms/wmf/DXVA2Manager.cpp @@ -127,35 +127,6 @@ using namespace gfx; StaticRefPtr sDevice; StaticMutex sDeviceMutex; -// We found an issue where the ID3D11VideoDecoder won't release its underlying -// resources properly if the decoder iscreated from a compositor device by -// ourselves. This problem has been observed with both VP9 and, reportedly, AV1 -// decoders, it does not seem to affect the H264 decoder, but the underlying -// decoder created by MFT seems not having this issue. -// Therefore, when checking whether we can use hardware decoding, we should use -// a non-compositor device to create a decoder in order to prevent resource -// leaking that can significantly degrade the performance. For the actual -// decoding, we will still use the compositor device if it's avaiable in order -// to avoid video copying. -static ID3D11Device* GetDeviceForDecoderCheck() { - StaticMutexAutoLock lock(sDeviceMutex); - if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdown)) { - return nullptr; - } - if (!sDevice) { - sDevice = gfx::DeviceManagerDx::Get()->CreateDecoderDevice( - {DeviceManagerDx::DeviceFlag::disableDeviceReuse}); - auto clearOnShutdown = [] { ClearOnShutdown(&sDevice); }; - if (!NS_IsMainThread()) { - Unused << NS_DispatchToMainThread( - NS_NewRunnableFunction(__func__, clearOnShutdown)); - } else { - clearOnShutdown(); - } - } - return sDevice.get(); -} - void GetDXVA2ExtendedFormatFromMFMediaType(IMFMediaType* pType, DXVA2_ExtendedFormat* pFormat) { // Get the interlace mode. @@ -1190,14 +1161,8 @@ D3D11DXVA2Manager::ConfigureForSize(IMFMediaType* aInputType, bool D3D11DXVA2Manager::CanCreateDecoder( const D3D11_VIDEO_DECODER_DESC& aDesc) const { - RefPtr device = GetDeviceForDecoderCheck(); - if (!device) { - LOG("Can't create decoder due to lacking of ID3D11Device!"); - return false; - } - RefPtr videoDevice; - HRESULT hr = device->QueryInterface( + HRESULT hr = mDevice->QueryInterface( static_cast(getter_AddRefs(videoDevice))); if (FAILED(hr)) { LOG("Failed to query ID3D11VideoDevice!"); diff --git a/dom/webidl/IDBFactory.webidl b/dom/webidl/IDBFactory.webidl index 76553037fc..9e9153324f 100644 --- a/dom/webidl/IDBFactory.webidl +++ b/dom/webidl/IDBFactory.webidl @@ -39,6 +39,7 @@ interface IDBFactory { deleteDatabase(DOMString name, optional IDBOpenDBOptions options = {}); + [Throws] Promise> databases(); [Throws] -- cgit v1.2.3