summaryrefslogtreecommitdiffstats
path: root/dom/webgpu/tests/cts/checkout/src/webgpu/idl/exposed.html.ts
diff options
context:
space:
mode:
Diffstat (limited to 'dom/webgpu/tests/cts/checkout/src/webgpu/idl/exposed.html.ts')
-rw-r--r--dom/webgpu/tests/cts/checkout/src/webgpu/idl/exposed.html.ts52
1 files changed, 52 insertions, 0 deletions
diff --git a/dom/webgpu/tests/cts/checkout/src/webgpu/idl/exposed.html.ts b/dom/webgpu/tests/cts/checkout/src/webgpu/idl/exposed.html.ts
new file mode 100644
index 0000000000..7aee998a9f
--- /dev/null
+++ b/dom/webgpu/tests/cts/checkout/src/webgpu/idl/exposed.html.ts
@@ -0,0 +1,52 @@
+// WPT-specific test checking that WebGPU is available iff isSecureContext.
+
+import { assert } from '../../common/util/util.js';
+
+const items = [
+ globalThis.navigator.gpu,
+ globalThis.GPU,
+ globalThis.GPUAdapter,
+ globalThis.GPUAdapterInfo,
+ globalThis.GPUBindGroup,
+ globalThis.GPUBindGroupLayout,
+ globalThis.GPUBuffer,
+ globalThis.GPUBufferUsage,
+ globalThis.GPUCanvasContext,
+ globalThis.GPUColorWrite,
+ globalThis.GPUCommandBuffer,
+ globalThis.GPUCommandEncoder,
+ globalThis.GPUCompilationInfo,
+ globalThis.GPUCompilationMessage,
+ globalThis.GPUComputePassEncoder,
+ globalThis.GPUComputePipeline,
+ globalThis.GPUDevice,
+ globalThis.GPUDeviceLostInfo,
+ globalThis.GPUError,
+ globalThis.GPUExternalTexture,
+ globalThis.GPUMapMode,
+ globalThis.GPUOutOfMemoryError,
+ globalThis.GPUPipelineLayout,
+ globalThis.GPUQuerySet,
+ globalThis.GPUQueue,
+ globalThis.GPURenderBundle,
+ globalThis.GPURenderBundleEncoder,
+ globalThis.GPURenderPassEncoder,
+ globalThis.GPURenderPipeline,
+ globalThis.GPUSampler,
+ globalThis.GPUShaderModule,
+ globalThis.GPUShaderStage,
+ globalThis.GPUSupportedLimits,
+ globalThis.GPUTexture,
+ globalThis.GPUTextureUsage,
+ globalThis.GPUTextureView,
+ globalThis.GPUUncapturedErrorEvent,
+ globalThis.GPUValidationError,
+];
+
+for (const item of items) {
+ if (globalThis.isSecureContext) {
+ assert(item !== undefined, 'Item/interface should be exposed on secure context');
+ } else {
+ assert(item === undefined, 'Item/interface should not be exposed on insecure context');
+ }
+}