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

Unified Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 10832207: Browser Plugin: Report Guest crash to Javascript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/browser_plugin/browser_plugin_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/browser_plugin/browser_plugin.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index e7bb338cb142b610d6ad2acb138ece7a60123cbf..124350e9e5f44b88de1d06d74e6712c829b05e13 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -37,6 +37,7 @@ using WebKit::WebVector;
namespace content {
namespace {
+const char kCrashEventName[] = "crash";
const char kNavigationEventName[] = "navigation";
const char* kSrcAttribute = "src";
}
@@ -184,6 +185,21 @@ void BrowserPlugin::UpdateRect(
void BrowserPlugin::GuestCrashed() {
guest_crashed_ = true;
container_->invalidate();
+
+ if (!HasListeners(kCrashEventName))
+ return;
+
+ EventListeners& listeners = event_listener_map_[kCrashEventName];
+ EventListeners::iterator it = listeners.begin();
+ for (; it != listeners.end(); ++it) {
+ v8::Context::Scope context_scope(v8::Context::New());
+ v8::HandleScope handle_scope;
+ container()->element().document().frame()->
+ callFunctionEvenIfScriptDisabled(*it,
+ v8::Object::New(),
+ 0,
+ NULL);
+ }
}
void BrowserPlugin::DidNavigate(const GURL& url) {
« no previous file with comments | « no previous file | content/renderer/browser_plugin/browser_plugin_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698