Commit 2aac5561 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

Make CreateDynamicFunction throw if disallowed

... instead of returning undefined.

Bug: chromium:1065094
Change-Id: I0b0397a8affd44b58e7f4777f32ba22bbd001ab1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2124837Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66902}
parent 85238bd7
......@@ -31,7 +31,7 @@ MaybeHandle<Object> CreateDynamicFunction(Isolate* isolate,
if (!Builtins::AllowDynamicFunction(isolate, target, target_global_proxy)) {
isolate->CountUsage(v8::Isolate::kFunctionConstructorReturnedUndefined);
return isolate->factory()->undefined_value();
THROW_NEW_ERROR(isolate, NewTypeError(MessageTemplate::kNoAccess), Object);
}
// Build the source string.
......
......@@ -158,6 +158,9 @@
# Only makes sense in the no_i18n variant.
'es6/unicode-regexp-ignore-case-noi18n':
[['no_i18n == True', PASS], ['no_i18n == False', FAIL]],
# Needs to be adapted after changes to Function constructor. chromium:1065094
'cross-realm-filtering': [SKIP],
}], # ALWAYS
##############################################################################
......
// 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.
// Flags: --allow-natives-syntax
function f(fnConstructor) {
return Object.is(new fnConstructor(), undefined);
}
const realmIndex = Realm.createAllowCrossRealmAccess();
const otherFunction = Realm.global(realmIndex).Function;
Realm.detachGlobal(realmIndex);
%PrepareFunctionForOptimization(f);
assertFalse(f(Function));
assertThrows(_ => f(otherFunction));
%OptimizeFunctionOnNextCall(f);
assertThrows(_ => f(otherFunction));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment