v8/test/unittests/api/v8-object-unittest.cc
machenbach 653f43d579 Revert of Set the current context to the function's context when entering to LAP. (patchset #14 id:540001 of https://codereview.chromium.org/2770003002/ )
Reason for revert:
Speculative: Seems to break webkit_unit_tests:
https://build.chromium.org/p/tryserver.v8/builders/v8_linux_blink_rel/builds/23247
https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Mac/builds/11038

Original issue's description:
> Set the current context to the function's context when entering to LAP.
>
> In case of LAP(lazy accessor pair), the function's creation context
> must be equal to the accessor holder's creation context, so this CL
> changes the current context to the accessor holder's creation context.
>
> BUG=v8:6156
>
> Review-Url: https://codereview.chromium.org/2770003002
> Cr-Commit-Position: refs/heads/master@{#46406}
> Committed: 18e73287dc

TBR=jochen@chromium.org,verwaest@chromium.org,mstarzinger@chromium.org,tebbi@google.com,yukishiino@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:6156

Review-Url: https://codereview.chromium.org/2973593002
Cr-Commit-Position: refs/heads/master@{#46408}
2017-07-05 10:41:22 +00:00

38 lines
1.2 KiB
C++

// 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.
#include "include/v8.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace v8 {
namespace {
using ObjectTest = TestWithContext;
void accessor_name_getter_callback(Local<Name>,
const PropertyCallbackInfo<Value>&) {}
TEST_F(ObjectTest, SetAccessorWhenUnconfigurablePropAlreadyDefined) {
TryCatch try_catch(isolate());
Local<Object> global = context()->Global();
Local<String> property_name =
String::NewFromUtf8(isolate(), "foo", NewStringType::kNormal)
.ToLocalChecked();
PropertyDescriptor prop_desc;
prop_desc.set_configurable(false);
global->DefineProperty(context(), property_name, prop_desc).ToChecked();
Maybe<bool> result = global->SetAccessor(context(), property_name,
accessor_name_getter_callback);
ASSERT_TRUE(result.IsJust());
ASSERT_FALSE(result.FromJust());
ASSERT_FALSE(try_catch.HasCaught());
}
} // namespace
} // namespace v8