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 21090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 21101 | 21101 |
| 21102 { | 21102 { |
| 21103 v8::TryCatch try_catch; | 21103 v8::TryCatch try_catch; |
| 21104 v8::Handle<Value> args[] = {v8_num(42), v8_num(555)}; | 21104 v8::Handle<Value> args[] = {v8_num(42), v8_num(555)}; |
| 21105 fun->Call(v8::Undefined(isolate), arraysize(args), args); | 21105 fun->Call(v8::Undefined(isolate), arraysize(args), args); |
| 21106 CHECK(!try_catch.HasCaught()); | 21106 CHECK(!try_catch.HasCaught()); |
| 21107 } | 21107 } |
| 21108 } | 21108 } |
| 21109 | 21109 |
| 21110 | 21110 |
| 21111 TEST(StrongModeObjectDelete) { | |
|
rossberg
2015/05/22 11:34:50
Nit: StrongObjectDelete (especially since the dele
conradw
2015/05/22 13:37:56
Done.
| |
| 21112 i::FLAG_strong_mode = true; | |
| 21113 LocalContext env; | |
| 21114 v8::Isolate* isolate = env->GetIsolate(); | |
| 21115 v8::HandleScope scope(isolate); | |
| 21116 Local<Object> obj; | |
| 21117 { | |
| 21118 v8::TryCatch try_catch; | |
| 21119 obj = Local<Object>::Cast(CompileRun( | |
| 21120 "function f(x) { 'use strong'; }" | |
| 21121 "f")); | |
| 21122 | |
| 21123 CHECK(!try_catch.HasCaught()); | |
| 21124 } | |
| 21125 obj->ForceSet(v8_str("foo"), v8_num(1), v8::None); | |
| 21126 obj->ForceSet(v8_num(2), v8_num(1), v8::None); | |
| 21127 CHECK(!obj->Delete(v8_str("foo"))); | |
| 21128 CHECK(!obj->Delete(2)); | |
| 21129 } | |
| 21130 | |
| 21131 | |
| 21111 TEST(ExtrasExportsObject) { | 21132 TEST(ExtrasExportsObject) { |
| 21112 v8::Isolate* isolate = CcTest::isolate(); | 21133 v8::Isolate* isolate = CcTest::isolate(); |
| 21113 v8::HandleScope handle_scope(isolate); | 21134 v8::HandleScope handle_scope(isolate); |
| 21114 LocalContext env; | 21135 LocalContext env; |
| 21115 | 21136 |
| 21116 // standalone.gypi ensures we include the test-extra.js file, which should | 21137 // standalone.gypi ensures we include the test-extra.js file, which should |
| 21117 // add the testExtraShouldReturnFive export | 21138 // add the testExtraShouldReturnFive export |
| 21118 v8::Local<v8::Object> exports = env->GetExtrasExportsObject(); | 21139 v8::Local<v8::Object> exports = env->GetExtrasExportsObject(); |
| 21119 | 21140 |
| 21120 auto func = | 21141 auto func = |
| 21121 exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>(); | 21142 exports->Get(v8_str("testExtraShouldReturnFive")).As<v8::Function>(); |
| 21122 auto undefined = v8::Undefined(isolate); | 21143 auto undefined = v8::Undefined(isolate); |
| 21123 auto result = func->Call(undefined, 0, {}).As<v8::Number>(); | 21144 auto result = func->Call(undefined, 0, {}).As<v8::Number>(); |
| 21124 | 21145 |
| 21125 CHECK(result->Value() == 5.0); | 21146 CHECK(result->Value() == 5.0); |
| 21126 } | 21147 } |
| OLD | NEW |