summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dom/canvas/CanvasRenderingContext2D.cpp12
-rw-r--r--dom/canvas/test/test_accelerated_canvas_context_loss.html12
-rw-r--r--dom/indexedDB/IDBFactory.cpp8
-rw-r--r--dom/indexedDB/IDBFactory.h2
-rw-r--r--dom/media/platforms/wmf/DXVA2Manager.cpp37
-rw-r--r--dom/webidl/IDBFactory.webidl1
6 files changed, 29 insertions, 43 deletions
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<DOMMatrix> 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<DOMMatrix> matrix =
- new DOMMatrix(GetParentObject(), mTarget->GetTransform());
+ RefPtr<DOMMatrix> 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<IDBOpenDBRequest> IDBFactory::DeleteDatabase(
/* aDeleting */ true, aCallerType, aRv);
}
-already_AddRefed<Promise> IDBFactory::Databases(JSContext* const aCx) {
+already_AddRefed<Promise> 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 = 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<Promise> Databases(JSContext* aCx);
+ already_AddRefed<Promise> Databases(JSContext* aCx, ErrorResult& aRv);
int16_t Cmp(JSContext* aCx, JS::Handle<JS::Value> aFirst,
JS::Handle<JS::Value> 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<ID3D11Device> 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<ID3D11Device> device = GetDeviceForDecoderCheck();
- if (!device) {
- LOG("Can't create decoder due to lacking of ID3D11Device!");
- return false;
- }
-
RefPtr<ID3D11VideoDevice> videoDevice;
- HRESULT hr = device->QueryInterface(
+ HRESULT hr = mDevice->QueryInterface(
static_cast<ID3D11VideoDevice**>(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<sequence<IDBDatabaseInfo>> databases();
[Throws]