"use strict"; /** * @license * SPDX-License-Identifier: Apache-2.0 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.globalEval = void 0; var script_impl_1 = require("../../internals/script_impl"); /** * Evaluates a SafeScript value in the given scope using eval. * * Strongly consider avoiding this, as eval blocks CSP adoption and does not * benefit from compiler optimizations. */ function globalEval(win, script) { var trustedScript = (0, script_impl_1.unwrapScript)(script); var result = win.eval(trustedScript); if (result === trustedScript) { // https://crbug.com/1024786 manifesting in workers. result = win.eval(trustedScript.toString()); } return result; } exports.globalEval = globalEval;