[dart:html] Add SharedArrayBuffer constructor and slice

Fixes https://github.com/dart-lang/sdk/issues/35344

Change-Id: I5742adddf1fe01bfe40860a734a4c930091d8472
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253563
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
This commit is contained in:
Srujan Gaddam 2022-08-03 01:04:25 +00:00 committed by Commit Bot
parent 7f06a066d3
commit 409b426cfc
4 changed files with 30 additions and 0 deletions

View file

@ -55,11 +55,17 @@ Updated the Linter to `1.26.0`, which includes changes that
non-final variable.
- fix`use_build_context_synchronously` to handle `await`s in `if` conditions.
### Core libraries
#### `dart:io`
- **Breaking Change** [#49305](https://github.com/dart-lang/sdk/issues/49305):
Disallow negative or hexadecimal content-length headers.
#### `dart:html`
- Add constructor and `slice` to `SharedArrayBuffer`.
## 2.18.0
### Language

View file

@ -28225,7 +28225,20 @@ class SharedArrayBuffer extends JavaScriptObject {
throw new UnsupportedError("Not supported");
}
factory SharedArrayBuffer([int? length]) {
if (length != null) {
return SharedArrayBuffer._create_1(length);
}
return SharedArrayBuffer._create_2();
}
static SharedArrayBuffer _create_1(length) =>
JS('SharedArrayBuffer', 'new SharedArrayBuffer(#)', length);
static SharedArrayBuffer _create_2() =>
JS('SharedArrayBuffer', 'new SharedArrayBuffer()');
int? get byteLength native;
SharedArrayBuffer slice([int? begin, int? end]) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a

View file

@ -21240,8 +21240,12 @@
},
"SharedArrayBuffer": {
"members": {
"SharedArrayBuffer": {},
"byteLength": {
"support_level": "untriaged"
},
"slice": {
"support_level": "untriaged"
}
},
"support_level": "untriaged"

View file

@ -683,3 +683,10 @@ interface NoncedElement {
callback PositionCallback = void(object position);
interface MathMLElement : Element {};
[DartSupplemental,
CustomConstructor,
Constructor(optional unsigned long length)
] interface SharedArrayBuffer {
SharedArrayBuffer slice(optional unsigned long begin, optional unsigned long end);
};