From 8044fb82935e61fdcaca149c5666432e71cc5896 Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Thu, 27 Feb 2025 15:12:14 -0800 Subject: [PATCH] [js-api] Throw in toResizableBuffer if memory has no max --- document/js-api/index.bs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index c00cadeedc..b83407daf4 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -768,10 +768,9 @@ Immediately after a WebAssembly [=memory.grow=] instruction executes, perform th 1. Let |memaddr| be **this**.\[[Memory]]. 1. Let |store| be the [=surrounding agent=]'s [=associated store=]. 1. Let |memtype| be [=mem_type=](|store|, |memaddr|). - 1. If |memtype| has a max, - 1. Let |maxsize| be the max value in |memtype|. - 1. Otherwise, - 1. Let |maxsize| be 65536 × 65536. + 1. If |memtype| does not have a max, + 1. [=Throw=] a {{TypeError}} exception. + 1. Let |maxsize| be the max value in |memtype|. 1. Let |resizableBuffer| be the result of [=create a resizable memory buffer|creating a resizable memory buffer=] from |memaddr| and |maxsize|. 1. Perform [=!=] [$DetachArrayBuffer$](|buffer|, "WebAssembly.Memory"). 1. Set **this**.\[[BufferObject]] to |resizableBuffer|.