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

Side by Side Diff: content/renderer/pepper/plugin_object.cc

Issue 640033003: Don't call SetProperty on the plugin unless HasProperty is true (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | 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 (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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698