OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/renderer/pepper/plugin_object.h" | 5 #include "content/renderer/pepper/plugin_object.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 bool PluginObject::SetNamedProperty(v8::Isolate* isolate, | 91 bool PluginObject::SetNamedProperty(v8::Isolate* isolate, |
92 const std::string& identifier, | 92 const std::string& identifier, |
93 v8::Local<v8::Value> value) { | 93 v8::Local<v8::Value> value) { |
94 if (!instance_) | 94 if (!instance_) |
95 return false; | 95 return false; |
96 ScopedPPVar identifier_var(ScopedPPVar::PassRef(), | 96 ScopedPPVar identifier_var(ScopedPPVar::PassRef(), |
97 StringVar::StringToPPVar(identifier)); | 97 StringVar::StringToPPVar(identifier)); |
98 PepperTryCatchV8 try_catch(instance_, V8VarConverter::kAllowObjectVars, | 98 PepperTryCatchV8 try_catch(instance_, V8VarConverter::kAllowObjectVars, |
99 isolate); | 99 isolate); |
| 100 |
| 101 bool has_property = |
| 102 ppp_class_->HasProperty(ppp_class_data_, identifier_var.get(), |
| 103 try_catch.exception()); |
| 104 if (try_catch.ThrowException()) |
| 105 return false; |
| 106 |
| 107 if (!has_property) |
| 108 return false; |
| 109 |
100 ScopedPPVar var = try_catch.FromV8(value); | 110 ScopedPPVar var = try_catch.FromV8(value); |
101 if (try_catch.ThrowException()) | 111 if (try_catch.ThrowException()) |
102 return false; | 112 return false; |
103 | 113 |
104 ppp_class_->SetProperty(ppp_class_data_, identifier_var.get(), var.get(), | 114 ppp_class_->SetProperty(ppp_class_data_, identifier_var.get(), var.get(), |
105 try_catch.exception()); | 115 try_catch.exception()); |
106 | 116 |
107 // If the plugin threw an exception, then throw a V8 version of it to | 117 // If the plugin threw an exception, then throw a V8 version of it to |
108 // JavaScript. Either way, return true, because we successfully dispatched | 118 // JavaScript. Either way, return true, because we successfully dispatched |
109 // the call to the plugin. | 119 // the call to the plugin. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 return; | 256 return; |
247 | 257 |
248 v8::Handle<v8::Value> result = try_catch.ToV8(result_var.get()); | 258 v8::Handle<v8::Value> result = try_catch.ToV8(result_var.get()); |
249 if (try_catch.ThrowException()) | 259 if (try_catch.ThrowException()) |
250 return; | 260 return; |
251 | 261 |
252 args->Return(result); | 262 args->Return(result); |
253 } | 263 } |
254 | 264 |
255 } // namespace content | 265 } // namespace content |
OLD | NEW |