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

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

Issue 408813004: PPAPI: Check for NULL before calling WebBindings::evaluate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/pepper_plugin_instance_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 2366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 StringVar* script_string = StringVar::FromPPVar(script); 2377 StringVar* script_string = StringVar::FromPPVar(script);
2378 if (!script_string) { 2378 if (!script_string) {
2379 try_catch.SetException("Script param to ExecuteScript must be a string."); 2379 try_catch.SetException("Script param to ExecuteScript must be a string.");
2380 return PP_MakeUndefined(); 2380 return PP_MakeUndefined();
2381 } 2381 }
2382 NPString np_script; 2382 NPString np_script;
2383 np_script.UTF8Characters = script_string->value().c_str(); 2383 np_script.UTF8Characters = script_string->value().c_str();
2384 np_script.UTF8Length = script_string->value().length(); 2384 np_script.UTF8Length = script_string->value().length();
2385 2385
2386 // Get the current frame to pass to the evaluate function. 2386 // Get the current frame to pass to the evaluate function.
2387 WebLocalFrame* frame = container_->element().document().frame(); 2387 WebLocalFrame* frame = NULL;
2388 if (!frame) { 2388 if (container_)
2389 frame = container_->element().document().frame();
2390 if (!frame || !frame->windowObject()) {
2389 try_catch.SetException("No frame to execute script in."); 2391 try_catch.SetException("No frame to execute script in.");
teravest 2014/07/21 19:38:04 This error message doesn't seem correct anymore. I
dmichael (off chromium) 2014/07/21 19:57:47 "improved"
2390 return PP_MakeUndefined(); 2392 return PP_MakeUndefined();
2391 } 2393 }
2392 2394
2393 NPVariant result; 2395 NPVariant result;
2394 bool ok = false; 2396 bool ok = false;
2395 if (IsProcessingUserGesture()) { 2397 if (IsProcessingUserGesture()) {
2396 blink::WebScopedUserGesture user_gesture(CurrentUserGestureToken()); 2398 blink::WebScopedUserGesture user_gesture(CurrentUserGestureToken());
2397 ok = 2399 ok =
2398 WebBindings::evaluate(NULL, frame->windowObject(), &np_script, &result); 2400 WebBindings::evaluate(NULL, frame->windowObject(), &np_script, &result);
2399 } else { 2401 } else {
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
3306 // Running out-of-process. Initiate an IPC call to notify the plugin 3308 // Running out-of-process. Initiate an IPC call to notify the plugin
3307 // process. 3309 // process.
3308 ppapi::proxy::HostDispatcher* dispatcher = 3310 ppapi::proxy::HostDispatcher* dispatcher =
3309 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); 3311 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());
3310 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 3312 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
3311 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); 3313 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data));
3312 } 3314 }
3313 } 3315 }
3314 3316
3315 } // namespace content 3317 } // 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