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

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

Issue 558513002: Don't try to access a NULL plugin element or document in PepperPluginInstanceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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) 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 v8::Local<v8::Object> PepperPluginInstanceImpl::GetMessageChannelObject() { 666 v8::Local<v8::Object> PepperPluginInstanceImpl::GetMessageChannelObject() {
667 return v8::Local<v8::Object>::New(isolate_, message_channel_object_); 667 return v8::Local<v8::Object>::New(isolate_, message_channel_object_);
668 } 668 }
669 669
670 void PepperPluginInstanceImpl::MessageChannelDestroyed() { 670 void PepperPluginInstanceImpl::MessageChannelDestroyed() {
671 message_channel_ = NULL; 671 message_channel_ = NULL;
672 message_channel_object_.Reset(); 672 message_channel_object_.Reset();
673 } 673 }
674 674
675 v8::Local<v8::Context> PepperPluginInstanceImpl::GetContext() { 675 v8::Local<v8::Context> PepperPluginInstanceImpl::GetContext() {
676 if (!container_) 676 if (!container_ ||
677 container_->element().isNull() ||
678 container_->element().document().isNull() ||
679 !container_->element().document().frame()) {
677 return v8::Handle<v8::Context>(); 680 return v8::Handle<v8::Context>();
678 WebLocalFrame* frame = container_->element().document().frame(); 681 }
679 if (!frame)
680 return v8::Handle<v8::Context>();
681 682
682 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); 683 v8::Local<v8::Context> context =
684 container_->element().document().frame()->mainWorldScriptContext();
683 DCHECK(context->GetIsolate() == isolate_); 685 DCHECK(context->GetIsolate() == isolate_);
684 return context; 686 return context;
685 } 687 }
686 688
687 void PepperPluginInstanceImpl::Delete() { 689 void PepperPluginInstanceImpl::Delete() {
688 is_deleted_ = true; 690 is_deleted_ = true;
689 691
690 if (render_frame_ && 692 if (render_frame_ &&
691 render_frame_->render_view()->plugin_find_handler() == this) { 693 render_frame_->render_view()->plugin_find_handler() == this) {
692 render_frame_->render_view()->set_plugin_find_handler(NULL); 694 render_frame_->render_view()->set_plugin_find_handler(NULL);
(...skipping 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after
3365 // Running out-of-process. Initiate an IPC call to notify the plugin 3367 // Running out-of-process. Initiate an IPC call to notify the plugin
3366 // process. 3368 // process.
3367 ppapi::proxy::HostDispatcher* dispatcher = 3369 ppapi::proxy::HostDispatcher* dispatcher =
3368 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); 3370 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());
3369 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 3371 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
3370 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); 3372 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data));
3371 } 3373 }
3372 } 3374 }
3373 3375
3374 } // namespace content 3376 } // 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