diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-10 06:51:48 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-10 06:51:48 +0000 |
commit | 67600b937c4b6b905998fcc36b6c9bd1891356f6 (patch) | |
tree | 88bf474e00a2816651ca9e96474166d34649e454 /ppapi/example/example.cc | |
parent | e6658d22661ce644d6ada160a951a1eee87b6201 (diff) | |
download | chromium_src-67600b937c4b6b905998fcc36b6c9bd1891356f6.zip chromium_src-67600b937c4b6b905998fcc36b6c9bd1891356f6.tar.gz chromium_src-67600b937c4b6b905998fcc36b6c9bd1891356f6.tar.bz2 |
Fix a crash related to PPAPI scripting.
SerializedVar and MessageChannel didn't properly handle the case that the dispatcher goes away while waiting for the reply to a sync message.
BUG=110095
TEST=When click the Test button on ppapi/example/example.html, the plugin is removed but the renderer doesn't crash.
Review URL: http://codereview.chromium.org/9655019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/example/example.cc')
-rw-r--r-- | ppapi/example/example.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ppapi/example/example.cc b/ppapi/example/example.cc index 17ac037..0832dee 100644 --- a/ppapi/example/example.cc +++ b/ppapi/example/example.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -59,8 +59,15 @@ class MyScriptableObject : public pp::deprecated::ScriptableObject { } virtual bool HasProperty(const pp::Var& name, pp::Var* exception) { - if (name.is_string() && name.AsString() == "blah") - return true; + if (name.is_string()) { + if (name.AsString() == "blah") { + return true; + } else if (name.AsString() == "removePluginWhenHasPropertyCalled") { + pp::Var script("var plugin = document.getElementById('plugin');" + "plugin.parentElement.removeChild(plugin);"); + instance_->ExecuteScript(script); + } + } return false; } @@ -473,7 +480,8 @@ int gettimeofday(struct timeval *tv, struct timezone*) { }; void FlushCallback(void* data, int32_t result) { - static_cast<MyInstance*>(data)->OnFlush(); + if (result == PP_OK) + static_cast<MyInstance*>(data)->OnFlush(); } class MyModule : public pp::Module { |