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 21627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21638 } | 21638 } |
21639 { | 21639 { |
21640 v8::TryCatch try_catch; | 21640 v8::TryCatch try_catch; |
21641 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); | 21641 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); |
21642 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, | 21642 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, |
21643 length).IsEmpty()); | 21643 length).IsEmpty()); |
21644 CHECK(try_catch.HasCaught()); | 21644 CHECK(try_catch.HasCaught()); |
21645 } | 21645 } |
21646 free(buffer); | 21646 free(buffer); |
21647 } | 21647 } |
| 21648 |
| 21649 |
| 21650 TEST(SealHandleScope) { |
| 21651 v8::Isolate* isolate = CcTest::isolate(); |
| 21652 v8::HandleScope handle_scope(isolate); |
| 21653 LocalContext env; |
| 21654 |
| 21655 v8::SealHandleScope seal(isolate); |
| 21656 |
| 21657 // Should fail |
| 21658 v8::Local<v8::Object> obj = v8::Object::New(isolate); |
| 21659 |
| 21660 USE(ob); |
| 21661 } |
| 21662 |
| 21663 |
| 21664 TEST(SealHandleScopeNested) { |
| 21665 v8::Isolate* isolate = CcTest::isolate(); |
| 21666 v8::HandleScope handle_scope(isolate); |
| 21667 LocalContext env; |
| 21668 |
| 21669 v8::SealHandleScope seal(isolate); |
| 21670 |
| 21671 { |
| 21672 v8::HandleScope handle_scope(isolate); |
| 21673 |
| 21674 // Should work |
| 21675 v8::Local<v8::Object> obj = v8::Object::New(isolate); |
| 21676 |
| 21677 USE(ob); |
| 21678 } |
| 21679 } |
OLD | NEW |