Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 14
#define V8_MINOR_VERSION 6
#define V8_BUILD_NUMBER 202
#define V8_PATCH_LEVEL 34
#define V8_PATCH_LEVEL 35

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
8 changes: 4 additions & 4 deletions deps/v8/src/execution/execution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,12 @@ MaybeDirectHandle<Context> NewScriptContext(

if (IsLexicalVariableMode(mode)) {
LookupIterator lookup_it(isolate, global_object, name, global_object,
LookupIterator::OWN_SKIP_INTERCEPTOR);
LookupIterator::OWN);
Maybe<PropertyAttributes> maybe =
JSReceiver::GetPropertyAttributes(&lookup_it);
// Can't fail since the we looking up own properties on the global object
// skipping interceptors.
CHECK(!maybe.IsNothing());
// The interceptor query callback may throw, in which case propagate the
// pending exception instead of continuing.
if (maybe.IsNothing()) return MaybeDirectHandle<Context>();
if ((maybe.FromJust() & DONT_DELETE) != 0) {
// ES#sec-globaldeclarationinstantiation 5.a:
// If envRec.HasVarDeclaration(name) is true, throw a SyntaxError
Expand Down
23 changes: 23 additions & 0 deletions test/parallel/test-vm-global-property-interceptors.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,26 @@
'use strict';
Object.defineProperty(this, 'f', { value: 'newF' });
`, ctx), /TypeError: Cannot redefine property: f/);

{
const restrictedCtx = vm.createContext({});
vm.runInContext(
"Object.defineProperty(this, 'foo', { value: 1, configurable: false });",
restrictedCtx);
assert.throws(() => vm.runInContext('let foo;', restrictedCtx), {
name: 'SyntaxError',
message: /Identifier 'foo' has already been declared/,
});
assert.throws(() => vm.runInContext('const foo = 2;', restrictedCtx), {
name: 'SyntaxError',
message: /Identifier 'foo' has already been declared/,
});

// A configurable global property does not restrict a lexical declaration.
const configurableCtx = vm.createContext({});
vm.runInContext(
"Object.defineProperty(this, 'bar', { value: 1, configurable: true });",
configurableCtx);
assert.doesNotThrow(() => vm.runInContext('let bar = 9; bar;',

Check failure on line 150 in test/parallel/test-vm-global-property-interceptors.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Do not use `assert.doesNotThrow()`. Write the code without the wrapper and add a comment instead
configurableCtx));
}
Loading