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

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

Issue 1034523002: Test for access checks on super assignments. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase + typo Created 5 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
« 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 8715 matching lines...) Expand 10 before | Expand all | Expand 10 after
8726 " super.x = function () {};" 8726 " super.x = function () {};"
8727 " }" 8727 " }"
8728 "}.m;" 8728 "}.m;"
8729 "var m = %ToMethod(f, prohibited);" 8729 "var m = %ToMethod(f, prohibited);"
8730 "m();"); 8730 "m();");
8731 CHECK(try_catch.HasCaught()); 8731 CHECK(try_catch.HasCaught());
8732 } 8732 }
8733 } 8733 }
8734 8734
8735 8735
8736 TEST(Regress470113) {
8737 i::FLAG_harmony_classes = true;
8738 i::FLAG_harmony_object_literals = true;
8739 v8::Isolate* isolate = CcTest::isolate();
8740 v8::HandleScope handle_scope(isolate);
8741 v8::Handle<v8::ObjectTemplate> obj_template =
8742 v8::ObjectTemplate::New(isolate);
8743 obj_template->SetAccessCheckCallbacks(AccessAlwaysBlocked, NULL);
8744 LocalContext env;
8745 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance());
8746
8747 {
8748 v8::TryCatch try_catch;
8749 CompileRun(
8750 "'use strict';\n"
8751 "class C extends Object {\n"
8752 " m() { super.powned = 'Powned!'; }\n"
8753 "}\n"
8754 "let c = new C();\n"
8755 "c.m.call(prohibited)");
8756
8757 CHECK(try_catch.HasCaught());
8758 }
8759 }
8760
8761
8736 static void ConstTenGetter(Local<String> name, 8762 static void ConstTenGetter(Local<String> name,
8737 const v8::PropertyCallbackInfo<v8::Value>& info) { 8763 const v8::PropertyCallbackInfo<v8::Value>& info) {
8738 info.GetReturnValue().Set(v8_num(10)); 8764 info.GetReturnValue().Set(v8_num(10));
8739 } 8765 }
8740 8766
8741 8767
8742 THREADED_TEST(CrossDomainAccessors) { 8768 THREADED_TEST(CrossDomainAccessors) {
8743 v8::Isolate* isolate = CcTest::isolate(); 8769 v8::Isolate* isolate = CcTest::isolate();
8744 v8::HandleScope handle_scope(isolate); 8770 v8::HandleScope handle_scope(isolate);
8745 8771
(...skipping 13001 matching lines...) Expand 10 before | Expand all | Expand 10 after
21747 } 21773 }
21748 { 21774 {
21749 v8::TryCatch try_catch; 21775 v8::TryCatch try_catch;
21750 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); 21776 uint16_t* data = reinterpret_cast<uint16_t*>(buffer);
21751 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, 21777 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString,
21752 length).IsEmpty()); 21778 length).IsEmpty());
21753 CHECK(!try_catch.HasCaught()); 21779 CHECK(!try_catch.HasCaught());
21754 } 21780 }
21755 free(buffer); 21781 free(buffer);
21756 } 21782 }
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