From cff300b04f8e302a34e2cd28ebb9730a7f15d872 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Thu, 19 Apr 2018 22:42:42 +0200 Subject: [PATCH 1/5] Layering: Check for the correct owner in DetachArrayBuffer (#1112) * Layering: Check for the correct owner in DetachArrayBuffer This patch gives ArrayBuffers an "owner" internal slot. This slot is used to throw a TypeError on inappropriate DetachArrayBuffer calls. WebAssembly needs it to be an error to detach an ArrayBuffer (e.g., through postMessage) for ArrayBuffers which come from WebAssembly.Memory objects. It should only be the Memory grow operation which ever detaches this ArrayBuffer. * Editorial: Clarifications based on code review --- spec.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/spec.html b/spec.html index fb92f118d4..25b6dbb761 100644 --- a/spec.html +++ b/spec.html @@ -35747,7 +35747,7 @@

Abstract Operations For ArrayBuffer Objects

AllocateArrayBuffer ( _constructor_, _byteLength_ )

The abstract operation AllocateArrayBuffer with arguments _constructor_ and _byteLength_ is used to create an ArrayBuffer object. It performs the following steps:

- 1. Let _obj_ be ? OrdinaryCreateFromConstructor(_constructor_, `"%ArrayBufferPrototype%"`, « [[ArrayBufferData]], [[ArrayBufferByteLength]] »). + 1. Let _obj_ be ? OrdinaryCreateFromConstructor(_constructor_, `"%ArrayBufferPrototype%"`, « [[ArrayBufferData]], [[ArrayBufferByteLength]], [[ArrayBufferDetachKey]] »). 1. Assert: _byteLength_ is an integer value ≥ 0. 1. Let _block_ be ? CreateByteDataBlock(_byteLength_). 1. Set _obj_.[[ArrayBufferData]] to _block_. @@ -35769,11 +35769,13 @@

IsDetachedBuffer ( _arrayBuffer_ )

-

DetachArrayBuffer ( _arrayBuffer_ )

-

The abstract operation DetachArrayBuffer with argument _arrayBuffer_ performs the following steps:

+

DetachArrayBuffer ( _arrayBuffer_ [ , _key_ ] )

+

The abstract operation DetachArrayBuffer with argument _arrayBuffer_ and optional argument _key_ performs the following steps:

- 1. Assert: Type(_arrayBuffer_) is Object and it has [[ArrayBufferData]] and [[ArrayBufferByteLength]] internal slots. + 1. Assert: Type(_arrayBuffer_) is Object and it has [[ArrayBufferData]], [[ArrayBufferByteLength]], and [[ArrayBufferDetachKey]] internal slots. 1. Assert: IsSharedArrayBuffer(_arrayBuffer_) is *false*. + 1. If _key_ is not provided, let _key_ be *undefined*. + 1. If SameValue(_arrayBuffer_.[[ArrayBufferDetachKey]], _key_) is *false*, throw a *TypeError* exception. 1. Set _arrayBuffer_.[[ArrayBufferData]] to *null*. 1. Set _arrayBuffer_.[[ArrayBufferByteLength]] to 0. 1. Return NormalCompletion(*null*). @@ -36038,8 +36040,9 @@

ArrayBuffer.prototype [ @@toStringTag ]

Properties of ArrayBuffer Instances

-

ArrayBuffer instances inherit properties from the ArrayBuffer prototype object. ArrayBuffer instances each have an [[ArrayBufferData]] internal slot and an [[ArrayBufferByteLength]] internal slot.

+

ArrayBuffer instances inherit properties from the ArrayBuffer prototype object. ArrayBuffer instances each have an [[ArrayBufferData]] internal slot, an [[ArrayBufferByteLength]] internal slot, and an [[ArrayBufferDetachKey]] internal slot.

ArrayBuffer instances whose [[ArrayBufferData]] is *null* are considered to be detached and all operators to access or modify data contained in the ArrayBuffer instance will fail.

+

ArrayBuffer instances whose [[ArrayBufferDetachKey]] is set to a value other than *undefined* need to have all DetachArrayBuffer calls passing that same "detach key" as an argument, otherwise a TypeError will result. This internal slot is only ever set by certain embedding environments, not by algorithms in this specification.

From cbe4679cffd45277d2074dad7cd6bdda1c979ce7 Mon Sep 17 00:00:00 2001 From: jmdyck Date: Mon, 23 Apr 2018 13:36:01 -0400 Subject: [PATCH 2/5] Editorial: Misc Editorial (#1182) * Editorial: "is not provided" -> "is not present" (See PR #953.) * Editorial: put '!' before ToInteger() invocation ... otherwise the comparison to _length_ is a bit odd. * Editorial: 'let' -> 'set' --- spec.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.html b/spec.html index 25b6dbb761..32bec2ea98 100644 --- a/spec.html +++ b/spec.html @@ -7776,7 +7776,7 @@

SetFunctionLength ( _F_, _length_ )

1. Assert: _F_ is an extensible object that does not have a `length` own property. 1. Assert: Type(_length_) is Number. - 1. Assert: _length_ ≥ 0 and ToInteger(_length_) is equal to _length_. + 1. Assert: _length_ ≥ 0 and ! ToInteger(_length_) is equal to _length_. 1. Return ! DefinePropertyOrThrow(_F_, `"length"`, PropertyDescriptor{[[Value]]: _length_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true*}). @@ -35774,7 +35774,7 @@

DetachArrayBuffer ( _arrayBuffer_ [ , _key_ ] )

1. Assert: Type(_arrayBuffer_) is Object and it has [[ArrayBufferData]], [[ArrayBufferByteLength]], and [[ArrayBufferDetachKey]] internal slots. 1. Assert: IsSharedArrayBuffer(_arrayBuffer_) is *false*. - 1. If _key_ is not provided, let _key_ be *undefined*. + 1. If _key_ is not present, set _key_ to *undefined*. 1. If SameValue(_arrayBuffer_.[[ArrayBufferDetachKey]], _key_) is *false*, throw a *TypeError* exception. 1. Set _arrayBuffer_.[[ArrayBufferData]] to *null*. 1. Set _arrayBuffer_.[[ArrayBufferByteLength]] to 0. From 38a771f50fb95b04f9b2134c0a27a4b99eaed89a Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Mon, 14 May 2018 13:13:40 -0700 Subject: [PATCH 3/5] Editorial: fix section IDs for some async generator sections. (#1141) Fixes #1140. --- spec.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spec.html b/spec.html index 32bec2ea98..e8c575d5db 100644 --- a/spec.html +++ b/spec.html @@ -19962,7 +19962,7 @@

Static Semantics: Early Errors

- +

Static Semantics: BoundNames

AsyncGeneratorDeclaration : `async` `function` `*` BindingIdentifier `(` FormalParameters `)` `{` AsyncGeneratorBody `}` @@ -19978,7 +19978,7 @@

Static Semantics: BoundNames

- +

Static Semantics: ComputedPropertyContains

With parameter _symbol_.

@@ -19988,7 +19988,7 @@

Static Semantics: ComputedPropertyContains

- +

Static Semantics: Contains

With parameter _symbol_.

@@ -20007,7 +20007,7 @@

Static Semantics: Contains

- +

Static Semantics: HasDirectSuper

AsyncGeneratorMethod : `async` `*` PropertyName `(` UniqueFormalParameters `)` `{` AsyncGeneratorBody `}` @@ -20017,7 +20017,7 @@

Static Semantics: HasDirectSuper

- +

Static Semantics: HasName

AsyncGeneratorExpression : `async` `function` `*` `(` FormalParameters `)` `{` AsyncGeneratorBody `}` @@ -20030,7 +20030,7 @@

Static Semantics: HasName

- +

Static Semantics: IsConstantDeclaration

@@ -20043,7 +20043,7 @@

Static Semantics: IsConstantDeclaration

- +

Static Semantics: IsFunctionDefinition

AsyncGeneratorExpression : `async` `function` `*` BindingIdentifier? `(` FormalParameters `)` `{` AsyncGeneratorBody `}` @@ -20052,7 +20052,7 @@

Static Semantics: IsFunctionDefinition

- +

Static Semantics: PropName

AsyncGeneratorMethod : `async` `*` PropertyName `(` UniqueFormalParameters `)` `{` AsyncGeneratorBody `}` From e5b66059c566a64b666dc28bedd86b9aae4df414 Mon Sep 17 00:00:00 2001 From: Toru Nagashima Date: Tue, 15 May 2018 05:46:05 +0900 Subject: [PATCH 4/5] Normative: add RegExp lookbehind assertions to annex B (#1102) --- spec.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec.html b/spec.html index e8c575d5db..97f63ecca1 100644 --- a/spec.html +++ b/spec.html @@ -40801,6 +40801,8 @@

Syntax

[+U] `(` `?` `=` Disjunction[+U, ?N] `)` [+U] `(` `?` `!` Disjunction[+U, ?N] `)` [~U] QuantifiableAssertion[?N] + `(` `?` `<=` Disjunction[?U, ?N] `)` + `(` `?` `<!` Disjunction[?U, ?N] `)` QuantifiableAssertion[N] :: `(` `?` `=` Disjunction[~U, ?N] `)` From a956a03e47d92c3889ab1bfd178ca436585aac22 Mon Sep 17 00:00:00 2001 From: jmdyck Date: Mon, 14 May 2018 17:19:03 -0400 Subject: [PATCH 5/5] Editorial: clarify that [[Construct]] implies [[Call]] (#1187) * Editorial: clarify that [[Construct]] implies [[Call]] That is, an object with a [[Construct]] internal method must have a [[Call]] internal method. Previously, this was assumed but not explicitly stated. See https://stackoverflow.com/questions/50109554/ * Editorial: Add 'additionally' --- spec.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec.html b/spec.html index 97f63ecca1..67c2f78e2f 100644 --- a/spec.html +++ b/spec.html @@ -1514,7 +1514,7 @@

Object Internal Methods and Internal Slots

-

summarizes additional essential internal methods that are supported by objects that may be called as functions. A function object is an object that supports the [[Call]] internal method. A constructor (also referred to as a constructor function) is a function object that supports the [[Construct]] internal method.

+

summarizes additional essential internal methods that are supported by objects that may be called as functions. A function object is an object that supports the [[Call]] internal method. A constructor is an object that additionally supports the [[Construct]] internal method. A constructor must be a function object, and so is also referred to as a constructor function.