Make ValidateAndApplyPropertyDescriptor pass on its ShouldThrow mode.

This fixes a bug affecting module namespace objects, which are currently
implemented using native accessors.

Bug: v8:6681, v8:1569
Change-Id: I6a678652573a332c47315497d927c390d9da0926
Reviewed-on: https://chromium-review.googlesource.com/606027
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47238}
This commit is contained in:
Georg Neis 2017-08-09 10:34:25 +02:00 committed by Commit Bot
parent 083ac1797f
commit b7227dc8d2
2 changed files with 12 additions and 3 deletions

View File

@ -6918,9 +6918,8 @@ Maybe<bool> JSReceiver::ValidateAndApplyPropertyDescriptor(
? current->value()
: Handle<Object>::cast(
isolate->factory()->undefined_value()));
MaybeHandle<Object> result =
JSObject::DefineOwnPropertyIgnoreAttributes(it, value, attrs);
if (result.is_null()) return Nothing<bool>();
return JSObject::DefineOwnPropertyIgnoreAttributes(it, value, attrs,
should_throw);
} else {
DCHECK(desc_is_accessor_descriptor ||
(desc_is_generic_descriptor &&

View File

@ -0,0 +1,10 @@
// 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.
//
// MODULE
import * as ns from "./regress-6681.js";
export var foo;
assertEquals(false, Reflect.defineProperty(ns, 'foo', {value: 123}));