| 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 21928 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 21939   LocalContext env; | 21939   LocalContext env; | 
| 21940 | 21940 | 
| 21941   env->Global()->Set(v8_str("keys"), v8::Array::GetKeysIterator(isolate)); | 21941   env->Global()->Set(v8_str("keys"), v8::Array::GetKeysIterator(isolate)); | 
| 21942   env->Global()->Set(v8_str("values"), v8::Array::GetValuesIterator(isolate)); | 21942   env->Global()->Set(v8_str("values"), v8::Array::GetValuesIterator(isolate)); | 
| 21943   env->Global()->Set(v8_str("entries"), v8::Array::GetEntriesIterator(isolate)); | 21943   env->Global()->Set(v8_str("entries"), v8::Array::GetEntriesIterator(isolate)); | 
| 21944 | 21944 | 
| 21945   ExpectString("typeof keys", "function"); | 21945   ExpectString("typeof keys", "function"); | 
| 21946   ExpectString("typeof values", "function"); | 21946   ExpectString("typeof values", "function"); | 
| 21947   ExpectString("typeof entries", "function"); | 21947   ExpectString("typeof entries", "function"); | 
| 21948 } | 21948 } | 
|  | 21949 | 
|  | 21950 | 
|  | 21951 TEST(ObjectTemplateIntrinsics) { | 
|  | 21952   v8::Isolate* isolate = CcTest::isolate(); | 
|  | 21953   v8::HandleScope scope(isolate); | 
|  | 21954   LocalContext env; | 
|  | 21955 | 
|  | 21956   Local<ObjectTemplate> object_template = v8::ObjectTemplate::New(isolate); | 
|  | 21957   object_template->SetIntrinsicDataProperty(v8_str("values"), | 
|  | 21958                                             v8::kArrayProto_values); | 
|  | 21959   Local<Object> object = object_template->NewInstance(); | 
|  | 21960 | 
|  | 21961   env->Global()->Set(v8_str("obj1"), object); | 
|  | 21962   ExpectString("typeof obj1.values", "function"); | 
|  | 21963 | 
|  | 21964   auto values = Local<Function>::Cast(object->Get(v8_str("values"))); | 
|  | 21965   auto fn = v8::Utils::OpenHandle(*values); | 
|  | 21966   auto ctx = v8::Utils::OpenHandle(*env.local()); | 
|  | 21967   CHECK_EQ(fn->GetCreationContext(), *ctx); | 
|  | 21968 | 
|  | 21969   { | 
|  | 21970     LocalContext env2; | 
|  | 21971     Local<Object> object2 = object_template->NewInstance(); | 
|  | 21972     env2->Global()->Set(v8_str("obj2"), object2); | 
|  | 21973     ExpectString("typeof obj2.values", "function"); | 
|  | 21974     CHECK_NE(*object->Get(v8_str("values")), *object2->Get(v8_str("values"))); | 
|  | 21975 | 
|  | 21976     auto values2 = Local<Function>::Cast(object2->Get(v8_str("values"))); | 
|  | 21977     auto fn2 = v8::Utils::OpenHandle(*values2); | 
|  | 21978     auto ctx2 = v8::Utils::OpenHandle(*env2.local()); | 
|  | 21979     CHECK_EQ(fn2->GetCreationContext(), *ctx2); | 
|  | 21980   } | 
|  | 21981 } | 
| OLD | NEW | 
|---|