Fix AllocateArrayBuffer By BoundFunction NewTarget

This is a historical problem:At first, we didn't support the full feature of newTarget in ECMA spec,in order to pass some cases of test262, hack the deleted code in AllocateArrayBuffer. In fact, the object so allocated is not an arrayBuffer.

Now, we support the full feature of newTarget, just delete it and do as ECMA spec.

add allocatearraybuffer unit test case.

Signed-off-by: ding <dingding5@huawei.com>
Change-Id: I2da7d8ce3dd58a63454ac9ecea4320458323fab9
This commit is contained in:
ding
2022-03-14 19:47:38 +08:00
parent b3eda09bdf
commit 1ca17779cb
5 changed files with 54 additions and 13 deletions
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var newTarget = function() {}.bind(null);
var arrayBuffer = Reflect.construct(ArrayBuffer, [16], newTarget);
print(arrayBuffer.length);