v8/test/mjsunit/es6/regress/regress-crbug-837939.js
Choongwoo Han c77c869cd1 Do not throw if the array is empty in Map constructor
Bug: chromium:837939
Change-Id: Iaca2bc5b52f47d8add13ed9b82497a53cb522933
Reviewed-on: https://chromium-review.googlesource.com/1034043
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52913}
2018-05-02 12:03:26 +00:00

18 lines
507 B
JavaScript

// Copyright 2018 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
// Create a double elements array.
const iterable = [123.123];
assertTrue(%HasDoubleElements(iterable))
iterable.length = 0;
assertTrue(%HasDoubleElements(iterable))
// Should not throw here.
let map = new Map(iterable);
assertEquals(0, map.size);
new WeakMap(iterable); // WeakMap does not have a size