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

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

Issue 609273002: Access checks test for stores to 'super'. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9638 matching lines...) Expand 10 before | Expand all | Expand 10 after
9649 i::FLAG_harmony_classes = true; 9649 i::FLAG_harmony_classes = true;
9650 v8::Isolate* isolate = CcTest::isolate(); 9650 v8::Isolate* isolate = CcTest::isolate();
9651 v8::HandleScope handle_scope(isolate); 9651 v8::HandleScope handle_scope(isolate);
9652 v8::Handle<v8::ObjectTemplate> obj_template = 9652 v8::Handle<v8::ObjectTemplate> obj_template =
9653 v8::ObjectTemplate::New(isolate); 9653 v8::ObjectTemplate::New(isolate);
9654 obj_template->SetAccessCheckCallbacks(BlockEverythingNamed, 9654 obj_template->SetAccessCheckCallbacks(BlockEverythingNamed,
9655 BlockEverythingIndexed); 9655 BlockEverythingIndexed);
9656 LocalContext env; 9656 LocalContext env;
9657 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance()); 9657 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance());
9658 9658
9659 v8::TryCatch try_catch; 9659 {
9660 CompileRun( 9660 v8::TryCatch try_catch;
9661 "function f() { return super.hasOwnProperty; };" 9661 CompileRun(
9662 "var m = f.toMethod(prohibited);" 9662 "function f() { return super.hasOwnProperty; };"
9663 "m();"); 9663 "var m = f.toMethod(prohibited);"
9664 CHECK(try_catch.HasCaught()); 9664 "m();");
9665 CHECK(try_catch.HasCaught());
9666 }
9667
9668 {
9669 v8::TryCatch try_catch;
9670 CompileRun(
9671 "function f() { super.hasOwnProperty = function () {}; };"
9672 "var m = f.toMethod(prohibited);"
9673 "m();");
9674 CHECK(try_catch.HasCaught());
9675 }
9676
9677 {
9678 v8::TryCatch try_catch;
9679 CompileRun(
9680 "Object.defineProperty(Object.prototype, 'x', { set : function(){}});"
9681 "function f() { "
9682 " 'use strict';"
9683 " super.x = function () {}; "
9684 "};"
9685 "var m = f.toMethod(prohibited);"
9686 "m();");
9687 CHECK(try_catch.HasCaught());
9688 }
9665 } 9689 }
9666 9690
9667 9691
9668 static void IndexedPropertyEnumerator( 9692 static void IndexedPropertyEnumerator(
9669 const v8::PropertyCallbackInfo<v8::Array>& info) { 9693 const v8::PropertyCallbackInfo<v8::Array>& info) {
9670 v8::Handle<v8::Array> result = v8::Array::New(info.GetIsolate(), 2); 9694 v8::Handle<v8::Array> result = v8::Array::New(info.GetIsolate(), 2);
9671 result->Set(0, v8::Integer::New(info.GetIsolate(), 7)); 9695 result->Set(0, v8::Integer::New(info.GetIsolate(), 7));
9672 result->Set(1, v8::Object::New(info.GetIsolate())); 9696 result->Set(1, v8::Object::New(info.GetIsolate()));
9673 info.GetReturnValue().Set(result); 9697 info.GetReturnValue().Set(result);
9674 } 9698 }
(...skipping 13719 matching lines...) Expand 10 before | Expand all | Expand 10 after
23394 " var foobXXXXX"; // Too many bytes which look like incomplete chars! 23418 " var foobXXXXX"; // Too many bytes which look like incomplete chars!
23395 char chunk2[] = 23419 char chunk2[] =
23396 "r = 13;\n" 23420 "r = 13;\n"
23397 " return foob\xeb\x91\x80\x80\x80r;\n" 23421 " return foob\xeb\x91\x80\x80\x80r;\n"
23398 "}\n"; 23422 "}\n";
23399 for (int i = 0; i < 5; ++i) chunk1[strlen(chunk1) - 5 + i] = reference[i]; 23423 for (int i = 0; i < 5; ++i) chunk1[strlen(chunk1) - 5 + i] = reference[i];
23400 23424
23401 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; 23425 const char* chunks[] = {chunk1, chunk2, "foo();", NULL};
23402 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, false); 23426 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, false);
23403 } 23427 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698