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 17158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17169 templ->SetNamedPropertyHandler(HasOwnPropertyNamedPropertyGetter, | 17169 templ->SetNamedPropertyHandler(HasOwnPropertyNamedPropertyGetter, |
17170 0, | 17170 0, |
17171 HasOwnPropertyNamedPropertyQuery2); | 17171 HasOwnPropertyNamedPropertyQuery2); |
17172 Handle<Object> instance = templ->NewInstance(); | 17172 Handle<Object> instance = templ->NewInstance(); |
17173 CHECK(!instance->HasOwnProperty(v8_str("foo"))); | 17173 CHECK(!instance->HasOwnProperty(v8_str("foo"))); |
17174 CHECK(instance->HasOwnProperty(v8_str("bar"))); | 17174 CHECK(instance->HasOwnProperty(v8_str("bar"))); |
17175 } | 17175 } |
17176 } | 17176 } |
17177 | 17177 |
17178 | 17178 |
| 17179 TEST(IndexedInterceptorWithStringProto) { |
| 17180 v8::HandleScope scope; |
| 17181 Handle<ObjectTemplate> templ = ObjectTemplate::New(); |
| 17182 templ->SetIndexedPropertyHandler(NULL, |
| 17183 NULL, |
| 17184 HasOwnPropertyIndexedPropertyQuery); |
| 17185 LocalContext context; |
| 17186 context->Global()->Set(v8_str("obj"), templ->NewInstance()); |
| 17187 CompileRun("var s = new String('foobar'); obj.__proto__ = s;"); |
| 17188 // These should be intercepted. |
| 17189 CHECK(CompileRun("42 in obj")->BooleanValue()); |
| 17190 CHECK(CompileRun("'42' in obj")->BooleanValue()); |
| 17191 // These should fall through to the String prototype. |
| 17192 CHECK(CompileRun("0 in obj")->BooleanValue()); |
| 17193 CHECK(CompileRun("'0' in obj")->BooleanValue()); |
| 17194 // And these should both fail. |
| 17195 CHECK(!CompileRun("32 in obj")->BooleanValue()); |
| 17196 CHECK(!CompileRun("'32' in obj")->BooleanValue()); |
| 17197 } |
| 17198 |
| 17199 |
17179 void CheckCodeGenerationAllowed() { | 17200 void CheckCodeGenerationAllowed() { |
17180 Handle<Value> result = CompileRun("eval('42')"); | 17201 Handle<Value> result = CompileRun("eval('42')"); |
17181 CHECK_EQ(42, result->Int32Value()); | 17202 CHECK_EQ(42, result->Int32Value()); |
17182 result = CompileRun("(function(e) { return e('42'); })(eval)"); | 17203 result = CompileRun("(function(e) { return e('42'); })(eval)"); |
17183 CHECK_EQ(42, result->Int32Value()); | 17204 CHECK_EQ(42, result->Int32Value()); |
17184 result = CompileRun("var f = new Function('return 42'); f()"); | 17205 result = CompileRun("var f = new Function('return 42'); f()"); |
17185 CHECK_EQ(42, result->Int32Value()); | 17206 CHECK_EQ(42, result->Int32Value()); |
17186 } | 17207 } |
17187 | 17208 |
17188 | 17209 |
(...skipping 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18268 i::Semaphore* sem_; | 18289 i::Semaphore* sem_; |
18269 volatile int sem_value_; | 18290 volatile int sem_value_; |
18270 }; | 18291 }; |
18271 | 18292 |
18272 | 18293 |
18273 THREADED_TEST(SemaphoreInterruption) { | 18294 THREADED_TEST(SemaphoreInterruption) { |
18274 ThreadInterruptTest().RunTest(); | 18295 ThreadInterruptTest().RunTest(); |
18275 } | 18296 } |
18276 | 18297 |
18277 #endif // WIN32 | 18298 #endif // WIN32 |
OLD | NEW |