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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 6881012: Keep the module in scope when executing scripts. This prevents a crash when the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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
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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 // Get the current frame to pass to the evaluate function. 657 // Get the current frame to pass to the evaluate function.
658 WebFrame* frame = container_->element().document().frame(); 658 WebFrame* frame = container_->element().document().frame();
659 if (!frame) { 659 if (!frame) {
660 try_catch.SetException("No frame to execute script in."); 660 try_catch.SetException("No frame to execute script in.");
661 return PP_MakeUndefined(); 661 return PP_MakeUndefined();
662 } 662 }
663 663
664 NPVariant result; 664 NPVariant result;
665 bool ok = WebBindings::evaluate(NULL, frame->windowObject(), &np_script, 665 bool ok = WebBindings::evaluate(NULL, frame->windowObject(), &np_script,
666 &result); 666 &result);
667 // DANGER! |this| could be deleted at this point if the script removed the
668 // plugin from the DOM.
667 if (!ok) { 669 if (!ok) {
668 // TODO(brettw) bug 54011: The TryCatch isn't working properly and 670 // TODO(brettw) bug 54011: The TryCatch isn't working properly and
669 // doesn't actually catch this exception. 671 // doesn't actually catch this exception.
670 try_catch.SetException("Exception caught"); 672 try_catch.SetException("Exception caught");
671 WebBindings::releaseVariantValue(&result); 673 WebBindings::releaseVariantValue(&result);
672 return PP_MakeUndefined(); 674 return PP_MakeUndefined();
673 } 675 }
674 676
675 PP_Var ret = Var::NPVariantToPPVar(this, &result); 677 PP_Var ret = Var::NPVariantToPPVar(this, &result);
676 WebBindings::releaseVariantValue(&result); 678 WebBindings::releaseVariantValue(&result);
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 return found->second; 1467 return found->second;
1466 } 1468 }
1467 1469
1468 bool PluginInstance::IsFullPagePlugin() const { 1470 bool PluginInstance::IsFullPagePlugin() const {
1469 WebFrame* frame = container()->element().document().frame(); 1471 WebFrame* frame = container()->element().document().frame();
1470 return frame->view()->mainFrame()->document().isPluginDocument(); 1472 return frame->view()->mainFrame()->document().isPluginDocument();
1471 } 1473 }
1472 1474
1473 } // namespace ppapi 1475 } // namespace ppapi
1474 } // namespace webkit 1476 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698