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

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

Issue 914713002: Remove Function.prototype.toMethod (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove comment Created 5 years, 10 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 | « src/messages.js ('k') | test/mjsunit/harmony/super.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 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 8692 matching lines...) Expand 10 before | Expand all | Expand 10 after
8703 8703
8704 value = CompileRun("Object.getOwnPropertyNames(object).length == 0"); 8704 value = CompileRun("Object.getOwnPropertyNames(object).length == 0");
8705 CHECK(value.IsEmpty()); 8705 CHECK(value.IsEmpty());
8706 8706
8707 context1->Exit(); 8707 context1->Exit();
8708 context0->Exit(); 8708 context0->Exit();
8709 } 8709 }
8710 8710
8711 8711
8712 TEST(SuperAccessControl) { 8712 TEST(SuperAccessControl) {
8713 i::FLAG_allow_natives_syntax = true;
8713 i::FLAG_harmony_classes = true; 8714 i::FLAG_harmony_classes = true;
8715 i::FLAG_harmony_object_literals = true;
8714 v8::Isolate* isolate = CcTest::isolate(); 8716 v8::Isolate* isolate = CcTest::isolate();
8715 v8::HandleScope handle_scope(isolate); 8717 v8::HandleScope handle_scope(isolate);
8716 v8::Handle<v8::ObjectTemplate> obj_template = 8718 v8::Handle<v8::ObjectTemplate> obj_template =
8717 v8::ObjectTemplate::New(isolate); 8719 v8::ObjectTemplate::New(isolate);
8718 obj_template->SetAccessCheckCallbacks(BlockEverythingNamed, 8720 obj_template->SetAccessCheckCallbacks(BlockEverythingNamed,
8719 BlockEverythingIndexed); 8721 BlockEverythingIndexed);
8720 LocalContext env; 8722 LocalContext env;
8721 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance()); 8723 env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance());
8722 8724
8723 { 8725 {
8724 v8::TryCatch try_catch; 8726 v8::TryCatch try_catch;
8725 CompileRun( 8727 CompileRun(
8726 "function f() { return super.hasOwnProperty; };" 8728 "var f = { m() { return super.hasOwnProperty; } }.m;"
8727 "var m = f.toMethod(prohibited);" 8729 "var m = %ToMethod(f, prohibited);"
8728 "m();"); 8730 "m();");
8729 CHECK(try_catch.HasCaught()); 8731 CHECK(try_catch.HasCaught());
8730 } 8732 }
8731 8733
8732 { 8734 {
8733 v8::TryCatch try_catch; 8735 v8::TryCatch try_catch;
8734 CompileRun( 8736 CompileRun(
8735 "function f() { return super[42]; };" 8737 "var f = {m() { return super[42]; } }.m;"
8736 "var m = f.toMethod(prohibited);" 8738 "var m = %ToMethod(f, prohibited);"
8737 "m();"); 8739 "m();");
8738 CHECK(try_catch.HasCaught()); 8740 CHECK(try_catch.HasCaught());
8739 } 8741 }
8740 8742
8741 { 8743 {
8742 v8::TryCatch try_catch; 8744 v8::TryCatch try_catch;
8743 CompileRun( 8745 CompileRun(
8744 "function f() { super.hasOwnProperty = function () {}; };" 8746 "var f = {m() { super.hasOwnProperty = function () {}; } }.m;"
8745 "var m = f.toMethod(prohibited);" 8747 "var m = %ToMethod(f, prohibited);"
8746 "m();"); 8748 "m();");
8747 CHECK(try_catch.HasCaught()); 8749 CHECK(try_catch.HasCaught());
8748 } 8750 }
8749 8751
8750 { 8752 {
8751 v8::TryCatch try_catch; 8753 v8::TryCatch try_catch;
8752 CompileRun( 8754 CompileRun(
8753 "Object.defineProperty(Object.prototype, 'x', { set : function(){}});" 8755 "Object.defineProperty(Object.prototype, 'x', { set : function(){}});"
8754 "function f() { " 8756 "var f = {"
8755 " 'use strict';" 8757 " m() { "
8756 " super.x = function () {}; " 8758 " 'use strict';"
8757 "};" 8759 " super.x = function () {};"
8758 "var m = f.toMethod(prohibited);" 8760 " }"
8761 "}.m;"
8762 "var m = %ToMethod(f, prohibited);"
8759 "m();"); 8763 "m();");
8760 CHECK(try_catch.HasCaught()); 8764 CHECK(try_catch.HasCaught());
8761 } 8765 }
8762 } 8766 }
8763 8767
8764 8768
8765 static void ConstTenGetter(Local<String> name, 8769 static void ConstTenGetter(Local<String> name,
8766 const v8::PropertyCallbackInfo<v8::Value>& info) { 8770 const v8::PropertyCallbackInfo<v8::Value>& info) {
8767 info.GetReturnValue().Set(v8_num(10)); 8771 info.GetReturnValue().Set(v8_num(10));
8768 } 8772 }
(...skipping 13208 matching lines...) Expand 10 before | Expand all | Expand 10 after
21977 "bar2.js"); 21981 "bar2.js");
21978 } 21982 }
21979 21983
21980 21984
21981 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { 21985 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) {
21982 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", 21986 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#",
21983 " sourceMappingURL=bar2.js\n", "foo();", NULL}; 21987 " sourceMappingURL=bar2.js\n", "foo();", NULL};
21984 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, 21988 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL,
21985 "bar2.js"); 21989 "bar2.js");
21986 } 21990 }
OLDNEW
« no previous file with comments | « src/messages.js ('k') | test/mjsunit/harmony/super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698