| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "gin/arguments.h" | 6 #include "gin/arguments.h" |
| 7 #include "gin/handle.h" | 7 #include "gin/handle.h" |
| 8 #include "gin/object_template_builder.h" | 8 #include "gin/object_template_builder.h" |
| 9 #include "gin/per_isolate_data.h" | 9 #include "gin/per_isolate_data.h" |
| 10 #include "gin/public/isolate_holder.h" | 10 #include "gin/public/isolate_holder.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 v8::Handle<v8::Function> func; | 184 v8::Handle<v8::Function> func; |
| 185 EXPECT_TRUE(ConvertFromV8(isolate, val, &func)); | 185 EXPECT_TRUE(ConvertFromV8(isolate, val, &func)); |
| 186 v8::Handle<v8::Value> argv[] = { | 186 v8::Handle<v8::Value> argv[] = { |
| 187 ConvertToV8(isolate, object.get()) | 187 ConvertToV8(isolate, object.get()) |
| 188 }; | 188 }; |
| 189 func->Call(v8::Undefined(isolate), 1, argv); | 189 func->Call(v8::Undefined(isolate), 1, argv); |
| 190 EXPECT_FALSE(try_catch.HasCaught()); | 190 EXPECT_FALSE(try_catch.HasCaught()); |
| 191 EXPECT_EQ("Hello, Lily", object->result); | 191 EXPECT_EQ("Hello, Lily", object->result); |
| 192 } | 192 } |
| 193 | 193 |
| 194 TEST_F(WrappableTest, ErrorInObjectConstructorProperty) { |
| 195 v8::Isolate* isolate = instance_->isolate(); |
| 196 v8::HandleScope handle_scope(isolate); |
| 197 |
| 198 v8::Handle<v8::String> source = StringToV8( |
| 199 isolate, |
| 200 "(function() {" |
| 201 " Object.defineProperty(Object.prototype, 'constructor', {" |
| 202 " get: function() { throw 'Error'; }," |
| 203 " set: function() { throw 'Error'; }" |
| 204 " });" |
| 205 "})();"); |
| 206 EXPECT_FALSE(source.IsEmpty()); |
| 207 v8::Handle<v8::Script> script = v8::Script::New(source); |
| 208 script->Run(); |
| 209 |
| 210 gin::TryCatch try_catch; |
| 211 gin::Handle<MyObject> obj = MyObject::Create(isolate); |
| 212 EXPECT_TRUE(obj.IsEmpty()); |
| 213 EXPECT_TRUE(try_catch.HasCaught()); |
| 214 } |
| 215 |
| 194 } // namespace gin | 216 } // namespace gin |
| OLD | NEW |