Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 9504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9515 // return false and keep VM in sane state. | 9515 // return false and keep VM in sane state. |
| 9516 v8::TryCatch try_catch; | 9516 v8::TryCatch try_catch; |
| 9517 CHECK(!o1->SetPrototype(o0)); | 9517 CHECK(!o1->SetPrototype(o0)); |
| 9518 CHECK(!try_catch.HasCaught()); | 9518 CHECK(!try_catch.HasCaught()); |
| 9519 ASSERT(!i::Isolate::Current()->has_pending_exception()); | 9519 ASSERT(!i::Isolate::Current()->has_pending_exception()); |
| 9520 | 9520 |
| 9521 CHECK_EQ(42, CompileRun("function f() { return 42; }; f()")->Int32Value()); | 9521 CHECK_EQ(42, CompileRun("function f() { return 42; }; f()")->Int32Value()); |
| 9522 } | 9522 } |
| 9523 | 9523 |
| 9524 | 9524 |
| 9525 THREADED_TEST(FunctionRemovePrototype) { | |
| 9526 LocalContext context; | |
| 9527 v8::HandleScope handle_scope(context->GetIsolate()); | |
| 9528 | |
| 9529 Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(); | |
| 9530 t1->RemovePrototype(); | |
| 9531 context->Global()->Set(v8_str("fun"), t1->GetFunction()); | |
| 9532 CHECK(!CompileRun("'prototype' in fun")->BooleanValue()); | |
|
Michael Starzinger
2013/08/15 08:49:24
Can we add an additional check that "fun" actually
| |
| 9533 } | |
| 9534 | |
| 9535 | |
| 9525 THREADED_TEST(GetterSetterExceptions) { | 9536 THREADED_TEST(GetterSetterExceptions) { |
| 9526 LocalContext context; | 9537 LocalContext context; |
| 9527 v8::HandleScope handle_scope(context->GetIsolate()); | 9538 v8::HandleScope handle_scope(context->GetIsolate()); |
| 9528 CompileRun( | 9539 CompileRun( |
| 9529 "function Foo() { };" | 9540 "function Foo() { };" |
| 9530 "function Throw() { throw 5; };" | 9541 "function Throw() { throw 5; };" |
| 9531 "var x = { };" | 9542 "var x = { };" |
| 9532 "x.__defineSetter__('set', Throw);" | 9543 "x.__defineSetter__('set', Throw);" |
| 9533 "x.__defineGetter__('get', Throw);"); | 9544 "x.__defineGetter__('get', Throw);"); |
| 9534 Local<v8::Object> x = | 9545 Local<v8::Object> x = |
| (...skipping 10632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20167 CheckCorrectThrow("%HasProperty(other, 'x')"); | 20178 CheckCorrectThrow("%HasProperty(other, 'x')"); |
| 20168 CheckCorrectThrow("%HasElement(other, 1)"); | 20179 CheckCorrectThrow("%HasElement(other, 1)"); |
| 20169 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); | 20180 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); |
| 20170 CheckCorrectThrow("%GetPropertyNames(other)"); | 20181 CheckCorrectThrow("%GetPropertyNames(other)"); |
| 20171 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); | 20182 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); |
| 20172 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" | 20183 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" |
| 20173 "other, 'x', null, null, 1)"); | 20184 "other, 'x', null, null, 1)"); |
| 20174 } | 20185 } |
| 20175 | 20186 |
| 20176 #endif // WIN32 | 20187 #endif // WIN32 |
| OLD | NEW |