-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for detached buffer validation on TypedArray methods #527
Conversation
65f55e6
to
a1dd2f1
Compare
Reuse changes on tc39#527
a1dd2f1
to
7d6a584
Compare
I rearranged the commits to isolate the harness/detachArrayBuffer.js file in a single commit. There are also rebased with the last changes on master. |
includes: [testTypedArray.js, detachArrayBuffer.js] | ||
---*/ | ||
|
||
var buffer = new ArrayBuffer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This invocation needs to specify a valid buffer size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I almost got it valid! tc39/ecma262#410 :)
maybe in a near future, but I'll fix this for now.
We want something defined at Speaking of which, I think the usage of the helper is incorrect here. Every Up until now, we've been using the |
|
||
testWithTypedArrayConstructors(function(TA) { | ||
var sample = new TA(buffer); | ||
$DETACHBUFFER(sample); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it might be a good idea to create a new buffer for each iteration. Implementations might define guards against detaching an already-detached buffer (es6draft does this). It's tricky because we can't account for all behaviors of a non-standard function, but it seems like this is a likely error we could avoid easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the
sure thing
The tests we have on |
9c40cc6
to
f483954
Compare
Reuse changes on tc39#527
Actually, yes. I was over-thinking the amount of indirection we'd need. Let's
Sounds good to me |
Doing it. It's funny how this is a 100% guaranteed way to land valid but failing tests. fixing a typo from a past comment as it bugs me: I could remove the calls for |
done. 5441ac3 |
---*/ | ||
|
||
var obj = { | ||
valueOf() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good idea, but it doesn't serve the intended purpose. The spec calls ToString, so the method to define here is toString
.
5441ac3
to
937cfbe
Compare
937cfbe
to
d806df0
Compare
inline comments fixed at d806df0 |
Reuse changes on tc39#527
these tests requires an extra implementation on the runners. Ref
harness/detachArrayBuffer.js