| OLD | NEW |
| 1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 12505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12516 | 12516 |
| 12517 v8::TryCatch try_catch; | 12517 v8::TryCatch try_catch; |
| 12518 re = v8::RegExp::New(v8_str("foo["), v8::RegExp::kNone); | 12518 re = v8::RegExp::New(v8_str("foo["), v8::RegExp::kNone); |
| 12519 CHECK(re.IsEmpty()); | 12519 CHECK(re.IsEmpty()); |
| 12520 CHECK(try_catch.HasCaught()); | 12520 CHECK(try_catch.HasCaught()); |
| 12521 context->Global()->Set(v8_str("ex"), try_catch.Exception()); | 12521 context->Global()->Set(v8_str("ex"), try_catch.Exception()); |
| 12522 ExpectTrue("ex instanceof SyntaxError"); | 12522 ExpectTrue("ex instanceof SyntaxError"); |
| 12523 } | 12523 } |
| 12524 | 12524 |
| 12525 | 12525 |
| 12526 THREADED_TEST(Equals) { |
| 12527 v8::HandleScope handleScope; |
| 12528 LocalContext localContext; |
| 12529 |
| 12530 v8::Handle<v8::Object> globalProxy = localContext->Global(); |
| 12531 v8::Handle<Value> global = globalProxy->GetPrototype(); |
| 12532 |
| 12533 CHECK(global->StrictEquals(global)); |
| 12534 CHECK(!global->StrictEquals(globalProxy)); |
| 12535 CHECK(!globalProxy->StrictEquals(global)); |
| 12536 CHECK(globalProxy->StrictEquals(globalProxy)); |
| 12537 |
| 12538 CHECK(global->Equals(global)); |
| 12539 CHECK(!global->Equals(globalProxy)); |
| 12540 CHECK(!globalProxy->Equals(global)); |
| 12541 CHECK(globalProxy->Equals(globalProxy)); |
| 12542 } |
| 12543 |
| 12544 |
| 12526 static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property, | 12545 static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property, |
| 12527 const v8::AccessorInfo& info ) { | 12546 const v8::AccessorInfo& info ) { |
| 12528 return v8_str("42!"); | 12547 return v8_str("42!"); |
| 12529 } | 12548 } |
| 12530 | 12549 |
| 12531 | 12550 |
| 12532 static v8::Handle<v8::Array> Enumerator(const v8::AccessorInfo& info) { | 12551 static v8::Handle<v8::Array> Enumerator(const v8::AccessorInfo& info) { |
| 12533 v8::Handle<v8::Array> result = v8::Array::New(); | 12552 v8::Handle<v8::Array> result = v8::Array::New(); |
| 12534 result->Set(0, v8_str("universalAnswer")); | 12553 result->Set(0, v8_str("universalAnswer")); |
| 12535 return result; | 12554 return result; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 12558 v8::Handle<v8::Function> define_property = | 12577 v8::Handle<v8::Function> define_property = |
| 12559 CompileRun("(function() {" | 12578 CompileRun("(function() {" |
| 12560 " Object.defineProperty(" | 12579 " Object.defineProperty(" |
| 12561 " this," | 12580 " this," |
| 12562 " 1," | 12581 " 1," |
| 12563 " { configurable: true, enumerable: true, value: 3 });" | 12582 " { configurable: true, enumerable: true, value: 3 });" |
| 12564 "})").As<Function>(); | 12583 "})").As<Function>(); |
| 12565 context->DetachGlobal(); | 12584 context->DetachGlobal(); |
| 12566 define_property->Call(proxy, 0, NULL); | 12585 define_property->Call(proxy, 0, NULL); |
| 12567 } | 12586 } |
| OLD | NEW |