OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 if (sym->Name()->IsUndefined()) return; | 2128 if (sym->Name()->IsUndefined()) return; |
2129 info.GetReturnValue().Set(info.Data()); | 2129 info.GetReturnValue().Set(info.Data()); |
2130 } | 2130 } |
2131 | 2131 |
2132 static void ThrowingSymbolAccessorGetter( | 2132 static void ThrowingSymbolAccessorGetter( |
2133 Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { | 2133 Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { |
2134 info.GetReturnValue().Set(info.GetIsolate()->ThrowException(name)); | 2134 info.GetReturnValue().Set(info.GetIsolate()->ThrowException(name)); |
2135 } | 2135 } |
2136 | 2136 |
2137 | 2137 |
2138 THREADED_TEST(ExecutableAccessorIsPreservedOnAttributeChange) { | 2138 THREADED_TEST(AccessorIsPreservedOnAttributeChange) { |
2139 v8::Isolate* isolate = CcTest::isolate(); | 2139 v8::Isolate* isolate = CcTest::isolate(); |
2140 v8::HandleScope scope(isolate); | 2140 v8::HandleScope scope(isolate); |
2141 LocalContext env; | 2141 LocalContext env; |
2142 v8::Local<v8::Value> res = CompileRun("var a = []; a;"); | 2142 v8::Local<v8::Value> res = CompileRun("var a = []; a;"); |
2143 i::Handle<i::JSReceiver> a(v8::Utils::OpenHandle(v8::Object::Cast(*res))); | 2143 i::Handle<i::JSReceiver> a(v8::Utils::OpenHandle(v8::Object::Cast(*res))); |
2144 CHECK(a->map()->instance_descriptors()->IsFixedArray()); | 2144 CHECK(a->map()->instance_descriptors()->IsFixedArray()); |
2145 CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); | 2145 CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); |
2146 CompileRun("Object.defineProperty(a, 'length', { writable: false });"); | 2146 CompileRun("Object.defineProperty(a, 'length', { writable: false });"); |
2147 CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); | 2147 CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); |
2148 // But we should still have an ExecutableAccessorInfo. | 2148 // But we should still have an AccessorInfo. |
2149 i::Handle<i::String> name(v8::Utils::OpenHandle(*v8_str("length"))); | 2149 i::Handle<i::String> name(v8::Utils::OpenHandle(*v8_str("length"))); |
2150 i::LookupIterator it(a, name, i::LookupIterator::OWN_SKIP_INTERCEPTOR); | 2150 i::LookupIterator it(a, name, i::LookupIterator::OWN_SKIP_INTERCEPTOR); |
2151 CHECK_EQ(i::LookupIterator::ACCESSOR, it.state()); | 2151 CHECK_EQ(i::LookupIterator::ACCESSOR, it.state()); |
2152 CHECK(it.GetAccessors()->IsExecutableAccessorInfo()); | 2152 CHECK(it.GetAccessors()->IsAccessorInfo()); |
2153 } | 2153 } |
2154 | 2154 |
2155 | 2155 |
2156 THREADED_TEST(UndefinedIsNotEnumerable) { | 2156 THREADED_TEST(UndefinedIsNotEnumerable) { |
2157 LocalContext env; | 2157 LocalContext env; |
2158 v8::HandleScope scope(env->GetIsolate()); | 2158 v8::HandleScope scope(env->GetIsolate()); |
2159 v8::Local<Value> result = CompileRun("this.propertyIsEnumerable(undefined)"); | 2159 v8::Local<Value> result = CompileRun("this.propertyIsEnumerable(undefined)"); |
2160 CHECK(result->IsFalse()); | 2160 CHECK(result->IsFalse()); |
2161 } | 2161 } |
2162 | 2162 |
(...skipping 22179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24342 CHECK(proxy->GetTarget()->SameValue(target)); | 24342 CHECK(proxy->GetTarget()->SameValue(target)); |
24343 CHECK(proxy->GetHandler()->SameValue(handler)); | 24343 CHECK(proxy->GetHandler()->SameValue(handler)); |
24344 | 24344 |
24345 proxy->Revoke(); | 24345 proxy->Revoke(); |
24346 CHECK(proxy->IsProxy()); | 24346 CHECK(proxy->IsProxy()); |
24347 CHECK(!target->IsProxy()); | 24347 CHECK(!target->IsProxy()); |
24348 CHECK(proxy->IsRevoked()); | 24348 CHECK(proxy->IsRevoked()); |
24349 CHECK(proxy->GetTarget()->SameValue(target)); | 24349 CHECK(proxy->GetTarget()->SameValue(target)); |
24350 CHECK(proxy->GetHandler()->IsNull()); | 24350 CHECK(proxy->GetHandler()->IsNull()); |
24351 } | 24351 } |
OLD | NEW |