v8/test/mjsunit/disallow-codegen-from-strings.js
Jakob Kummerow 0bcb1d6f2d [flags] Introduce --disallow-code-generation-from-strings
Exposing the existing Context::AllowCodeGenerationFromStrings(false) API
to the command line.

Bug: v8:7134
Change-Id: I062ccff0b03c5bcf6878c41c455c0ded37a1d743
Reviewed-on: https://chromium-review.googlesource.com/809631
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49911}
2017-12-06 19:10:33 +00:00

10 lines
361 B
JavaScript

// Copyright 2017 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: --disallow-code-generation-from-strings
assertThrows("1 + 1", EvalError);
assertThrows(() => eval("1 + 1"), EvalError);
assertThrows(() => Function("x", "return x + 1"), EvalError);