Revise the API ArrayBuffer related operations (#4284)

- External ArrayBuffer construction with 0 length should be equivalent to `new ArrayBuffer(0)`
- Internally allocated ArrayBuffers should be detachable
- Externally allocated ArrayBuffers free callback should be called when underlying buffer is detached

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
This commit is contained in:
Robert Fancsik authored and GitHub committed 2020-10-09 15:12:45 +02:00
1 parent 5b9a6deb93
commit e3481d431b
7 files changed
+93 -59

No files matched your search

+5 -1
View File
@@ -9011,7 +9011,9 @@ jerry_get_arraybuffer_pointer (const jerry_value_t value);
- `value` - Array Buffer object.
- return value
- pointer to the Array Buffer's data area.
- NULL if the `value` is not an Array Buffer object.
- NULL if the `value` is:
- not an ArrayBuffer object
- an external ArrayBuffer has been detached
*New in version 2.0*.
@@ -9096,6 +9098,8 @@ jerry_value_t
jerry_detach_arraybuffer (const jerry_value_t value);
```
*Note*: If the ArrayBuffer has been created with `jerry_create_arraybuffer_external` the optional free callback is called on a successful detach operation
- `value` - ArrayBuffer to be detached
- return
- null value if success