c0a6e85153
Bug: chromium:804801 Change-Id: I2d54e98df09b0ed5ccfcddd0815ad162641e03d6 Reviewed-on: https://chromium-review.googlesource.com/883121 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Peter Marshall <petermarshall@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#50827}
35 lines
804 B
JavaScript
35 lines
804 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.
|
|
|
|
function f() { return 42; }
|
|
const bound_function = f.bind();
|
|
const callable_proxy = new Proxy(function(){}.__proto__, {});
|
|
|
|
function testSet(ctor) {
|
|
new ctor([]);
|
|
new ctor([{},{}]);
|
|
}
|
|
|
|
function testMap(ctor) {
|
|
new ctor([]);
|
|
new ctor([[{},{}],[{},{}]]);
|
|
}
|
|
|
|
function testAllVariants(set_or_add_function) {
|
|
Set.prototype.add = set_or_add_function;
|
|
testSet(Set);
|
|
|
|
WeakSet.prototype.add = set_or_add_function;
|
|
testSet(WeakSet);
|
|
|
|
Map.prototype.set = set_or_add_function;
|
|
testMap(Map);
|
|
|
|
WeakMap.prototype.set = set_or_add_function;
|
|
testMap(WeakMap);
|
|
}
|
|
|
|
testAllVariants(bound_function);
|
|
testAllVariants(callable_proxy);
|