OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 11290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11301 ExpectFalse("Object.prototype.hasOwnProperty.call(other, \'0\')"); | 11301 ExpectFalse("Object.prototype.hasOwnProperty.call(other, \'0\')"); |
11302 | 11302 |
11303 CHECK_EQ(false, global0->HasRealIndexedProperty(0)); | 11303 CHECK_EQ(false, global0->HasRealIndexedProperty(0)); |
11304 CHECK_EQ(false, global0->HasRealNamedProperty(v8_str("x"))); | 11304 CHECK_EQ(false, global0->HasRealNamedProperty(v8_str("x"))); |
11305 CHECK_EQ(false, global0->HasRealNamedCallbackProperty(v8_str("x"))); | 11305 CHECK_EQ(false, global0->HasRealNamedCallbackProperty(v8_str("x"))); |
11306 | 11306 |
11307 // Reset the failed access check callback so it does not influence | 11307 // Reset the failed access check callback so it does not influence |
11308 // the other tests. | 11308 // the other tests. |
11309 v8::V8::SetFailedAccessCheckCallbackFunction(NULL); | 11309 v8::V8::SetFailedAccessCheckCallbackFunction(NULL); |
11310 } | 11310 } |
| 11311 |
| 11312 |
| 11313 TEST(StringCheckMultipleContexts) { |
| 11314 const char* code = |
| 11315 "(function() { return \"a\".charAt(0); })()"; |
| 11316 |
| 11317 { |
| 11318 // Run the code twice in the first context to initialize the call IC. |
| 11319 v8::HandleScope scope; |
| 11320 LocalContext context1; |
| 11321 ExpectString(code, "a"); |
| 11322 ExpectString(code, "a"); |
| 11323 } |
| 11324 |
| 11325 { |
| 11326 // Change the String.prototype in the second context and check |
| 11327 // that the right function gets called. |
| 11328 v8::HandleScope scope; |
| 11329 LocalContext context2; |
| 11330 CompileRun("String.prototype.charAt = function() { return \"not a\"; }"); |
| 11331 ExpectString(code, "not a"); |
| 11332 } |
| 11333 } |
| 11334 |
| 11335 |
| 11336 TEST(NumberCheckMultipleContexts) { |
| 11337 const char* code = |
| 11338 "(function() { return (42).toString(); })()"; |
| 11339 |
| 11340 { |
| 11341 // Run the code twice in the first context to initialize the call IC. |
| 11342 v8::HandleScope scope; |
| 11343 LocalContext context1; |
| 11344 ExpectString(code, "42"); |
| 11345 ExpectString(code, "42"); |
| 11346 } |
| 11347 |
| 11348 { |
| 11349 // Change the Number.prototype in the second context and check |
| 11350 // that the right function gets called. |
| 11351 v8::HandleScope scope; |
| 11352 LocalContext context2; |
| 11353 CompileRun("Number.prototype.toString = function() { return \"not 42\"; }"); |
| 11354 ExpectString(code, "not 42"); |
| 11355 } |
| 11356 } |
| 11357 |
| 11358 |
| 11359 TEST(BooleanCheckMultipleContexts) { |
| 11360 const char* code = |
| 11361 "(function() { return true.toString(); })()"; |
| 11362 |
| 11363 { |
| 11364 // Run the code twice in the first context to initialize the call IC. |
| 11365 v8::HandleScope scope; |
| 11366 LocalContext context1; |
| 11367 ExpectString(code, "true"); |
| 11368 ExpectString(code, "true"); |
| 11369 } |
| 11370 |
| 11371 { |
| 11372 // Change the Boolean.prototype in the second context and check |
| 11373 // that the right function gets called. |
| 11374 v8::HandleScope scope; |
| 11375 LocalContext context2; |
| 11376 CompileRun("Boolean.prototype.toString = function() { return \"\"; }"); |
| 11377 ExpectString(code, ""); |
| 11378 } |
| 11379 } |
OLD | NEW |