Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: test/cctest/test-api.cc

Issue 42508: Fix bug in context stores, where the store was ignored if there was a... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/getter-in-prototype.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6077 matching lines...) Expand 10 before | Expand all | Expand 10 after
6088 6088
6089 // Local context should still be live. 6089 // Local context should still be live.
6090 CHECK(!local_env.IsEmpty()); 6090 CHECK(!local_env.IsEmpty());
6091 local_env->Enter(); 6091 local_env->Enter();
6092 6092
6093 // Should complete without problems. 6093 // Should complete without problems.
6094 RegExpStringModificationTest().RunTest(); 6094 RegExpStringModificationTest().RunTest();
6095 6095
6096 local_env->Exit(); 6096 local_env->Exit();
6097 } 6097 }
6098
6099
6100 // Test that we can set a property on the global object even if there
6101 // is a read-only property in the prototype chain.
6102 TEST(ReadOnlyPropertyInGlobalProto) {
6103 v8::HandleScope scope;
6104 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New();
6105 LocalContext context(0, templ);
6106 v8::Handle<v8::Object> global = context->Global();
6107 v8::Handle<v8::Object> global_proto =
6108 v8::Handle<v8::Object>::Cast(global->Get(v8_str("__proto__")));
6109 global_proto->Set(v8_str("x"), v8::Integer::New(0), v8::ReadOnly);
6110 global_proto->Set(v8_str("y"), v8::Integer::New(0), v8::ReadOnly);
6111 // Check without 'eval' or 'with'.
6112 v8::Handle<v8::Value> res =
6113 CompileRun("function f() { x = 42; return x; }; f()");
6114 // Check with 'eval'.
6115 res = CompileRun("function f() { eval('1'); y = 42; return y; }; f()");
6116 CHECK_EQ(v8::Integer::New(42), res);
6117 // Check with 'with'.
6118 res = CompileRun("function f() { with (this) { y = 42 }; return y; }; f()");
6119 CHECK_EQ(v8::Integer::New(42), res);
6120 }
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/getter-in-prototype.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698