v8/test/mjsunit/regress/regress-10508.js
Toon Verwaest 7e05ebe2a4 [runtime] Return undefined as CallSite::getFunction for scripts
Scripts aren't callable functions. Even though internally they were for a
while, they aren't anymore. We shouldn't return them to users as if they were.
We already remove strict-mode functions from CallSites, so we now do the same
for internal functions that are created for scripts.

Bug: v8:10508
Change-Id: I270c714524439fba9ad90dd29826bed4811ba2b4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2193716
Auto-Submit: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67709}
2020-05-11 13:06:11 +00:00

16 lines
416 B
JavaScript

// Copyright 2020 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.
Error.prepareStackTrace = (error, frames) => {
// JSON.stringify executes the replacer, triggering the relevant
// code in Invoke().
JSON.stringify({}, frames[0].getFunction());
};
let v0;
try {
throw new Error();
} catch (e) {
e.stack
}