diff --git a/dom/webgpu/Device.cpp b/dom/webgpu/Device.cpp index 118e6e5f5bdb..a47295c2f18a 100644 --- a/dom/webgpu/Device.cpp +++ b/dom/webgpu/Device.cpp @@ -247,16 +247,17 @@ already_AddRefed Device::CreateBindGroup( } already_AddRefed Device::CreateShaderModule( - JSContext* aCx, const dom::GPUShaderModuleDescriptor& aDesc) { + JSContext* aCx, const dom::GPUShaderModuleDescriptor& aDesc, + ErrorResult& aRv) { Unused << aCx; if (!mBridge->CanSend()) { + aRv.ThrowInvalidStateError("Connection to GPU process has shut down"); return nullptr; } - ErrorResult err; - RefPtr promise = dom::Promise::Create(GetParentObject(), err); - if (NS_WARN_IF(err.Failed())) { + RefPtr promise = dom::Promise::Create(GetParentObject(), aRv); + if (NS_WARN_IF(aRv.Failed())) { return nullptr; } diff --git a/dom/webgpu/Device.h b/dom/webgpu/Device.h index bb595c971534..486fbd03ae61 100644 --- a/dom/webgpu/Device.h +++ b/dom/webgpu/Device.h @@ -165,7 +165,8 @@ class Device final : public DOMEventTargetHelper, public SupportsWeakPtr { const dom::GPUBindGroupDescriptor& aDesc); MOZ_CAN_RUN_SCRIPT already_AddRefed CreateShaderModule( - JSContext* aCx, const dom::GPUShaderModuleDescriptor& aDesc); + JSContext* aCx, const dom::GPUShaderModuleDescriptor& aDesc, + ErrorResult& aRv); already_AddRefed CreateComputePipeline( const dom::GPUComputePipelineDescriptor& aDesc); already_AddRefed CreateRenderPipeline( diff --git a/dom/webgpu/crashtests/1809567.html b/dom/webgpu/crashtests/1809567.html new file mode 100644 index 000000000000..7b922182ebc8 --- /dev/null +++ b/dom/webgpu/crashtests/1809567.html @@ -0,0 +1,72 @@ + + + + + + diff --git a/dom/webgpu/crashtests/crashtests.list b/dom/webgpu/crashtests/crashtests.list new file mode 100644 index 000000000000..4f0094f2a3ff --- /dev/null +++ b/dom/webgpu/crashtests/crashtests.list @@ -0,0 +1 @@ +load 1809567.html diff --git a/dom/webidl/WebGPU.webidl b/dom/webidl/WebGPU.webidl index acc0318b4bad..58e259258d32 100644 --- a/dom/webidl/WebGPU.webidl +++ b/dom/webidl/WebGPU.webidl @@ -157,6 +157,7 @@ interface GPUDevice : EventTarget { GPUPipelineLayout createPipelineLayout(GPUPipelineLayoutDescriptor descriptor); GPUBindGroup createBindGroup(GPUBindGroupDescriptor descriptor); + [Throws] GPUShaderModule createShaderModule(GPUShaderModuleDescriptor descriptor); GPUComputePipeline createComputePipeline(GPUComputePipelineDescriptor descriptor); GPURenderPipeline createRenderPipeline(GPURenderPipelineDescriptor descriptor); diff --git a/testing/crashtest/crashtests.list b/testing/crashtest/crashtests.list index 0f9f8687d40b..fdbb938ae89f 100644 --- a/testing/crashtest/crashtests.list +++ b/testing/crashtest/crashtests.list @@ -33,6 +33,7 @@ include ../../dom/smil/crashtests/crashtests.list include ../../dom/streams/crashtests/crashtests.list include ../../dom/svg/crashtests/crashtests.list include ../../dom/vr/test/crashtests/crashtests.list +include ../../dom/webgpu/crashtests/crashtests.list include ../../dom/workers/test/crashtests/crashtests.list include ../../dom/xhr/tests/crashtests/crashtests.list include ../../dom/xml/crashtests/crashtests.list