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

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

Issue 1079713002: api: introduce SealHandleScope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix typo in a test Created 5 years, 8 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 | « test/cctest/cctest.status ('k') | 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 21882 matching lines...) Expand 10 before | Expand all | Expand 10 after
21893 } 21893 }
21894 { 21894 {
21895 v8::TryCatch try_catch; 21895 v8::TryCatch try_catch;
21896 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); 21896 uint16_t* data = reinterpret_cast<uint16_t*>(buffer);
21897 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, 21897 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString,
21898 length).IsEmpty()); 21898 length).IsEmpty());
21899 CHECK(!try_catch.HasCaught()); 21899 CHECK(!try_catch.HasCaught());
21900 } 21900 }
21901 free(buffer); 21901 free(buffer);
21902 } 21902 }
21903
21904
21905 TEST(SealHandleScope) {
21906 v8::Isolate* isolate = CcTest::isolate();
21907 v8::HandleScope handle_scope(isolate);
21908 LocalContext env;
21909
21910 v8::SealHandleScope seal(isolate);
21911
21912 // Should fail
21913 v8::Local<v8::Object> obj = v8::Object::New(isolate);
21914
21915 USE(obj);
21916 }
21917
21918
21919 TEST(SealHandleScopeNested) {
21920 v8::Isolate* isolate = CcTest::isolate();
21921 v8::HandleScope handle_scope(isolate);
21922 LocalContext env;
21923
21924 v8::SealHandleScope seal(isolate);
21925
21926 {
21927 v8::HandleScope handle_scope(isolate);
21928
21929 // Should work
21930 v8::Local<v8::Object> obj = v8::Object::New(isolate);
21931
21932 USE(obj);
21933 }
21934 }
OLDNEW
« no previous file with comments | « test/cctest/cctest.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698