Re: [heycam/webidl] Detached ArrayBuffer objects should not throw (#605)

annevk commented on this pull request.



> @@ -8171,8 +8171,8 @@ a reference to the same object that the IDL value represents.
         1.  Set |offset| to the value of |O|’s \[[ByteOffset]] [=internal slot=].
         1.  Set |length| to the value of |O|’s \[[ByteLength]] [=internal slot=].
     1.  Otherwise, set |length| to the value of |O|’s \[[ArrayBufferByteLength]] [=internal slot=].
-    1.  If <a abstract-op>IsDetachedBuffer</a>(|O|), then
-        [=ECMAScript/throw=] a {{ECMAScript/TypeError}}.
+    1.  If <a abstract-op>IsDetachedBuffer</a>(|arrayBuffer|) is <emu-val>true</emu-val>, then
+        return a reference to or a copy of (as required) the empty byte sequence.

There's two ways to invoke the algorithm and the algorithm is expected depending on how it's invoked to either return a reference to bytes or a copy thereof. So this matches the existing expectations of callers and the existing way things are phrased for return values.

I agree that this could be done in a somewhat cleaner way, but that seems like a follow-up of sorts as it affects the whole algorithm (and potentially callers).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/605#discussion_r246488749

Received on Wednesday, 9 January 2019 18:58:33 UTC