| 16 | } |
| 17 | |
| 18 | Value TestCreateSharedArrayBuffer(const CallbackInfo& info) { |
| 19 | if (info.Length() < 1) { |
| 20 | Error::New(info.Env(), "Wrong number of arguments") |
| 21 | .ThrowAsJavaScriptException(); |
| 22 | return Value(); |
| 23 | } else if (!info[0].IsNumber()) { |
| 24 | Error::New(info.Env(), |
| 25 | "Wrong type of arguments. Expects a number as first argument.") |
| 26 | .ThrowAsJavaScriptException(); |
| 27 | return Value(); |
| 28 | } |
| 29 | |
| 30 | auto byte_length = info[0].As<Number>().Uint32Value(); |
| 31 | if (byte_length == 0) { |
| 32 | Error::New(info.Env(), |
| 33 | "Invalid byte length. Expects a non-negative integer.") |
| 34 | .ThrowAsJavaScriptException(); |
| 35 | return Value(); |
| 36 | } |
| 37 | |
| 38 | return SharedArrayBuffer::New(info.Env(), byte_length); |
| 39 | } |
| 40 | |
| 41 | Value TestGetSharedArrayBufferInfo(const CallbackInfo& info) { |
| 42 | if (info.Length() < 1) { |
nothing calls this directly
no test coverage detected