| 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 11267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11278 ExpectFalse("Object.prototype.hasOwnProperty.call(other, \'0\')"); | 11278 ExpectFalse("Object.prototype.hasOwnProperty.call(other, \'0\')"); |
| 11279 | 11279 |
| 11280 CHECK_EQ(false, global0->HasRealIndexedProperty(0)); | 11280 CHECK_EQ(false, global0->HasRealIndexedProperty(0)); |
| 11281 CHECK_EQ(false, global0->HasRealNamedProperty(v8_str("x"))); | 11281 CHECK_EQ(false, global0->HasRealNamedProperty(v8_str("x"))); |
| 11282 CHECK_EQ(false, global0->HasRealNamedCallbackProperty(v8_str("x"))); | 11282 CHECK_EQ(false, global0->HasRealNamedCallbackProperty(v8_str("x"))); |
| 11283 | 11283 |
| 11284 // Reset the failed access check callback so it does not influence | 11284 // Reset the failed access check callback so it does not influence |
| 11285 // the other tests. | 11285 // the other tests. |
| 11286 v8::V8::SetFailedAccessCheckCallbackFunction(NULL); | 11286 v8::V8::SetFailedAccessCheckCallbackFunction(NULL); |
| 11287 } | 11287 } |
| 11288 |
| 11289 |
| 11290 TEST(StringCheckMultipleContexts) { |
| 11291 const char* code = |
| 11292 "(function() { return \"a\".charAt(0); })()"; |
| 11293 |
| 11294 { |
| 11295 // Run the code twice in the first context to initialize the call IC. |
| 11296 v8::HandleScope scope; |
| 11297 LocalContext context1; |
| 11298 ExpectString(code, "a"); |
| 11299 ExpectString(code, "a"); |
| 11300 } |
| 11301 |
| 11302 { |
| 11303 // Change the String.prototype in the second context and check |
| 11304 // that the right function gets called. |
| 11305 v8::HandleScope scope; |
| 11306 LocalContext context2; |
| 11307 CompileRun("String.prototype.charAt = function() { return \"not a\"; }"); |
| 11308 ExpectString(code, "not a"); |
| 11309 } |
| 11310 } |
| 11311 |
| 11312 |
| 11313 TEST(NumberCheckMultipleContexts) { |
| 11314 const char* code = |
| 11315 "(function() { return (42).toString(); })()"; |
| 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, "42"); |
| 11322 ExpectString(code, "42"); |
| 11323 } |
| 11324 |
| 11325 { |
| 11326 // Change the Number.prototype in the second context and check |
| 11327 // that the right function gets called. |
| 11328 v8::HandleScope scope; |
| 11329 LocalContext context2; |
| 11330 CompileRun("Number.prototype.toString = function() { return \"not 42\"; }"); |
| 11331 ExpectString(code, "not 42"); |
| 11332 } |
| 11333 } |
| 11334 |
| 11335 |
| 11336 TEST(BooleanCheckMultipleContexts) { |
| 11337 const char* code = |
| 11338 "(function() { return true.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, "true"); |
| 11345 ExpectString(code, "true"); |
| 11346 } |
| 11347 |
| 11348 { |
| 11349 // Change the Boolean.prototype in the second context and check |
| 11350 // that the right function gets called. |
| 11351 v8::HandleScope scope; |
| 11352 LocalContext context2; |
| 11353 CompileRun("Boolean.prototype.toString = function() { return \"\"; }"); |
| 11354 ExpectString(code, ""); |
| 11355 } |
| 11356 } |
| OLD | NEW |