cc04776632
Previously only JSFunctions seemed to be valid for toJSON, which doesn't match the ES6 specification that allows any object with [[Call]] internal method (i.e. any Callable in V8 terminology), including bound functions and proxies. BUG=chromium:595738, chromium:535408 R=yangguo@chromium.org LOG=n Review URL: https://codereview.chromium.org/1824533002 Cr-Commit-Position: refs/heads/master@{#34913}
8 lines
265 B
JavaScript
8 lines
265 B
JavaScript
// 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.
|
|
|
|
function foo() { return 1; }
|
|
var x = {toJSON: foo.bind()};
|
|
assertEquals("1", JSON.stringify(x));
|