Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: src/objects.cc

Issue 2331223004: [api] Throw in defineProperty() when necessary. (Closed)
Patch Set: Fix formatting. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 } 1678 }
1679 1679
1680 Maybe<bool> DefinePropertyWithInterceptorInternal( 1680 Maybe<bool> DefinePropertyWithInterceptorInternal(
1681 LookupIterator* it, Handle<InterceptorInfo> interceptor, 1681 LookupIterator* it, Handle<InterceptorInfo> interceptor,
1682 Object::ShouldThrow should_throw, PropertyDescriptor& desc) { 1682 Object::ShouldThrow should_throw, PropertyDescriptor& desc) {
1683 Isolate* isolate = it->isolate(); 1683 Isolate* isolate = it->isolate();
1684 // Make sure that the top context does not change when doing callbacks or 1684 // Make sure that the top context does not change when doing callbacks or
1685 // interceptor calls. 1685 // interceptor calls.
1686 AssertNoContextChange ncc(isolate); 1686 AssertNoContextChange ncc(isolate);
1687 1687
1688 // Throw if setter callback is defined and define property is called with a
jochen (gone - plz use gerrit) 2016/09/14 08:43:01 how about only doing this if we don't have a defin
Franzi 2016/09/14 16:19:51 If I understand the IDL specification correctly, w
1689 // non data descriptor.
1690 if (!interceptor->setter()->IsUndefined(isolate) &&
1691 !PropertyDescriptor::IsDataDescriptor(&desc)) {
1692 isolate->Throw(*isolate->factory()->NewTypeError(
1693 MessageTemplate::kDefineDisallowedWithNonDataDescriptor,
1694 it->GetName()));
1695 return Nothing<bool>();
1696 }
1688 if (interceptor->definer()->IsUndefined(isolate)) return Just(false); 1697 if (interceptor->definer()->IsUndefined(isolate)) return Just(false);
1689 1698
1690 Handle<JSObject> holder = it->GetHolder<JSObject>(); 1699 Handle<JSObject> holder = it->GetHolder<JSObject>();
1691 bool result; 1700 bool result;
1692 Handle<Object> receiver = it->GetReceiver(); 1701 Handle<Object> receiver = it->GetReceiver();
1693 if (!receiver->IsJSReceiver()) { 1702 if (!receiver->IsJSReceiver()) {
1694 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver, 1703 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, receiver,
1695 Object::ConvertReceiver(isolate, receiver), 1704 Object::ConvertReceiver(isolate, receiver),
1696 Nothing<bool>()); 1705 Nothing<bool>());
1697 } 1706 }
(...skipping 17790 matching lines...) Expand 10 before | Expand all | Expand 10 after
19488 Handle<Object> JSModule::LoadExport(Handle<JSModule> module, 19497 Handle<Object> JSModule::LoadExport(Handle<JSModule> module,
19489 Handle<String> name) { 19498 Handle<String> name) {
19490 Isolate* isolate = module->GetIsolate(); 19499 Isolate* isolate = module->GetIsolate();
19491 LookupIterator it(module, name); 19500 LookupIterator it(module, name);
19492 Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it)); 19501 Handle<Cell> cell = Handle<Cell>::cast(JSObject::GetDataProperty(&it));
19493 return handle(cell->value(), isolate); 19502 return handle(cell->value(), isolate);
19494 } 19503 }
19495 19504
19496 } // namespace internal 19505 } // namespace internal
19497 } // namespace v8 19506 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698