2017-02-07 17:17:31 +01:00
|
|
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
|
|
|
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
|
|
|
esid: sec-sharedarraybuffer-length
|
|
|
|
description: >
|
|
|
|
The new SharedArrayBuffer instance is created prior to allocating the Data Block.
|
2018-01-05 18:26:51 +01:00
|
|
|
info: |
|
2017-02-07 17:17:31 +01:00
|
|
|
SharedArrayBuffer( length )
|
|
|
|
|
|
|
|
...
|
|
|
|
3. Return AllocateSharedArrayBuffer(NewTarget, byteLength).
|
|
|
|
|
|
|
|
AllocateSharedArrayBuffer( constructor, byteLength )
|
|
|
|
1. Let obj be ? OrdinaryCreateFromConstructor(constructor, "%SharedArrayBufferPrototype%",
|
|
|
|
«[[ArrayBufferData]], [[ArrayBufferByteLength]]» ).
|
|
|
|
...
|
|
|
|
3. Let block be ? CreateByteDataBlock(byteLength).
|
|
|
|
...
|
2018-03-20 00:51:32 +01:00
|
|
|
features: [SharedArrayBuffer, Reflect.construct]
|
2017-02-07 17:17:31 +01:00
|
|
|
---*/
|
|
|
|
|
2018-02-15 21:51:40 +01:00
|
|
|
function DummyError() {}
|
2017-02-07 17:17:31 +01:00
|
|
|
|
2018-02-15 21:51:40 +01:00
|
|
|
var newTarget = function() {}.bind(null);
|
2017-02-07 17:17:31 +01:00
|
|
|
Object.defineProperty(newTarget, "prototype", {
|
|
|
|
get: function() {
|
|
|
|
throw new DummyError();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
assert.throws(DummyError, function() {
|
|
|
|
// Allocating 7 PiB should fail with a RangeError.
|
|
|
|
// Math.pow(1024, 5) = 1125899906842624
|
|
|
|
Reflect.construct(SharedArrayBuffer, [7 * 1125899906842624], newTarget);
|
|
|
|
});
|