Commit 3d9c77d8 authored by bmeurer's avatar bmeurer Committed by Commit bot

[es6] Fix the %TypedArray% constructor.

The %TypedArray% constructor must not ever try to construct an instance,
but rather throw a TypeError instead.

R=jarin@chromium.org
BUG=v8:5763

Review-Url: https://codereview.chromium.org/2587413002
Cr-Commit-Position: refs/heads/master@{#41868}
parent b88d96c7
......@@ -844,12 +844,7 @@ function TypedArrayFrom(source, mapfn, thisArg) {
// TODO(bmeurer): Migrate this to a proper builtin.
function TypedArrayConstructor() {
if (IS_UNDEFINED(new.target)) {
throw %make_type_error(kConstructorNonCallable, "TypedArray");
}
if (new.target === GlobalTypedArray) {
throw %make_type_error(kConstructAbstractClass, "TypedArray");
}
throw %make_type_error(kConstructAbstractClass, "TypedArray");
}
function TypedArraySpecies() {
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
try {
var TA = Object.getPrototypeOf(Int8Array);
var obj = Reflect.construct(TA, [], Int8Array);
Int8Array.prototype.values.call(obj).next();
} catch (e) {}
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
try {
var TA = Object.getPrototypeOf(Int8Array);
var obj = Reflect.construct(TA, [], Int8Array);
new Int8Array(4).set(obj);
} catch (e) {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment