| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 protected: | 641 protected: |
| 642 virtual v8::Handle<Integer> Query(Local<String> key) { | 642 virtual v8::Handle<Integer> Query(Local<String> key) { |
| 643 // Let it seem that the property exists in the hidden prototype object. | 643 // Let it seem that the property exists in the hidden prototype object. |
| 644 return Integer::New(v8::None); | 644 return Integer::New(v8::None); |
| 645 } | 645 } |
| 646 | 646 |
| 647 // Install the hidden prototype after the global object has been created. | 647 // Install the hidden prototype after the global object has been created. |
| 648 virtual void PostInitializeContext(Handle<Context> context) { | 648 virtual void PostInitializeContext(Handle<Context> context) { |
| 649 Local<Object> global_object = context->Global(); | 649 Local<Object> global_object = context->Global(); |
| 650 Local<Object> hidden_proto = hidden_proto_->GetFunction()->NewInstance(); | 650 Local<Object> hidden_proto = hidden_proto_->GetFunction()->NewInstance(); |
| 651 context->DetachGlobal(); | 651 Local<Object> inner_global = |
| 652 context->Global()->SetPrototype(hidden_proto); | 652 Local<Object>::Cast(global_object->GetPrototype()); |
| 653 context->ReattachGlobal(global_object); | 653 inner_global->SetPrototype(hidden_proto); |
| 654 } | 654 } |
| 655 | 655 |
| 656 // Use the hidden prototype as the holder for the interceptors. | 656 // Use the hidden prototype as the holder for the interceptors. |
| 657 virtual Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) { | 657 virtual Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) { |
| 658 return hidden_proto_->InstanceTemplate(); | 658 return hidden_proto_->InstanceTemplate(); |
| 659 } | 659 } |
| 660 | 660 |
| 661 private: | 661 private: |
| 662 Local<FunctionTemplate> hidden_proto_; | 662 Local<FunctionTemplate> hidden_proto_; |
| 663 }; | 663 }; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 SimpleContext context; | 856 SimpleContext context; |
| 857 context.Check(firsts[i], EXPECT_RESULT, Number::New(1)); | 857 context.Check(firsts[i], EXPECT_RESULT, Number::New(1)); |
| 858 // TODO(rossberg): All tests should actually be errors in Harmony, | 858 // TODO(rossberg): All tests should actually be errors in Harmony, |
| 859 // but we currently do not detect the cases where the first declaration | 859 // but we currently do not detect the cases where the first declaration |
| 860 // is not lexical. | 860 // is not lexical. |
| 861 context.Check(seconds[j], | 861 context.Check(seconds[j], |
| 862 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2)); | 862 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2)); |
| 863 } | 863 } |
| 864 } | 864 } |
| 865 } | 865 } |
| OLD | NEW |