summaryrefslogtreecommitdiff
path: root/ext/webgpu
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2024-05-23 00:03:35 +0200
committerGitHub <noreply@github.com>2024-05-23 00:03:35 +0200
commit971f09abe486185247e1faf4e8d1419ba2506b8d (patch)
tree3ed0cf608116ad06e88a87552333e930824cc790 /ext/webgpu
parent6c167c64d61ecfc912dc1b68d300f02aa3677235 (diff)
fix(runtime): use more null proto objects (#23921)
This is a primordialization effort to improve resistance against users tampering with the global `Object` prototype. --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/webgpu')
-rw-r--r--ext/webgpu/01_webgpu.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/ext/webgpu/01_webgpu.js b/ext/webgpu/01_webgpu.js
index 502de2124..338678d38 100644
--- a/ext/webgpu/01_webgpu.js
+++ b/ext/webgpu/01_webgpu.js
@@ -358,7 +358,7 @@ class GPU {
* @param {GPURequestAdapterOptions} options
*/
// deno-lint-ignore require-await
- async requestAdapter(options = {}) {
+ async requestAdapter(options = { __proto__: null }) {
webidl.assertBranded(this, GPUPrototype);
options = webidl.converters.GPURequestAdapterOptions(
options,
@@ -449,7 +449,7 @@ class GPUAdapter {
* @returns {Promise<GPUDevice>}
*/
// deno-lint-ignore require-await
- async requestDevice(descriptor = {}) {
+ async requestDevice(descriptor = { __proto__: null }) {
webidl.assertBranded(this, GPUAdapterPrototype);
const prefix = "Failed to execute 'requestDevice' on 'GPUAdapter'";
descriptor = webidl.converters.GPUDeviceDescriptor(
@@ -1174,7 +1174,7 @@ class GPUDevice extends EventTarget {
* @param {GPUSamplerDescriptor} descriptor
* @returns {GPUSampler}
*/
- createSampler(descriptor = {}) {
+ createSampler(descriptor = { __proto__: null }) {
webidl.assertBranded(this, GPUDevicePrototype);
const prefix = "Failed to execute 'createSampler' on 'GPUDevice'";
descriptor = webidl.converters.GPUSamplerDescriptor(
@@ -1687,7 +1687,7 @@ class GPUDevice extends EventTarget {
* @param {GPUCommandEncoderDescriptor} descriptor
* @returns {GPUCommandEncoder}
*/
- createCommandEncoder(descriptor = {}) {
+ createCommandEncoder(descriptor = { __proto__: null }) {
webidl.assertBranded(this, GPUDevicePrototype);
const prefix = "Failed to execute 'createCommandEncoder' on 'GPUDevice'";
descriptor = webidl.converters.GPUCommandEncoderDescriptor(
@@ -1842,7 +1842,7 @@ defineEventHandler(GPUDevice.prototype, "uncapturederror");
class GPUPipelineError extends DOMException {
#reason;
- constructor(message = "", options = {}) {
+ constructor(message = "", options = { __proto__: null }) {
const prefix = "Failed to construct 'GPUPipelineError'";
message = webidl.converters.DOMString(message, prefix, "Argument 1");
options = webidl.converters.GPUPipelineErrorInit(
@@ -2499,7 +2499,7 @@ class GPUTexture {
/**
* @param {GPUTextureViewDescriptor} descriptor
*/
- createView(descriptor = {}) {
+ createView(descriptor = { __proto__: null }) {
webidl.assertBranded(this, GPUTexturePrototype);
const prefix = "Failed to execute 'createView' on 'GPUTexture'";
webidl.requiredArguments(arguments.length, 0, prefix);
@@ -3306,7 +3306,7 @@ class GPUCommandEncoder {
/**
* @param {GPUComputePassDescriptor} descriptor
*/
- beginComputePass(descriptor = {}) {
+ beginComputePass(descriptor = { __proto__: null }) {
webidl.assertBranded(this, GPUCommandEncoderPrototype);
const prefix =
"Failed to execute 'beginComputePass' on 'GPUCommandEncoder'";
@@ -3757,7 +3757,7 @@ class GPUCommandEncoder {
* @param {GPUCommandBufferDescriptor} descriptor
* @returns {GPUCommandBuffer}
*/
- finish(descriptor = {}) {
+ finish(descriptor = { __proto__: null }) {
webidl.assertBranded(this, GPUCommandEncoderPrototype);
const prefix = "Failed to execute 'finish' on 'GPUCommandEncoder'";
descriptor = webidl.converters.GPUCommandBufferDescriptor(
@@ -4774,7 +4774,7 @@ class GPURenderBundleEncoder {
/**
* @param {GPURenderBundleDescriptor} descriptor
*/
- finish(descriptor = {}) {
+ finish(descriptor = { __proto__: null }) {
webidl.assertBranded(this, GPURenderBundleEncoderPrototype);
const prefix = "Failed to execute 'finish' on 'GPURenderBundleEncoder'";
descriptor = webidl.converters.GPURenderBundleDescriptor(