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

Unified Diff: ppapi/tests/test_post_message.cc

Issue 459553003: Replace NPObject usage in ppapi with gin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/shared_impl/scoped_pp_var.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_post_message.cc
diff --git a/ppapi/tests/test_post_message.cc b/ppapi/tests/test_post_message.cc
index 5413b54f00b759f5fe9ed7889bcd80cffa0c6807..6a415bbd58e9e5e906995ced5c0c743b5e7b827a 100644
--- a/ppapi/tests/test_post_message.cc
+++ b/ppapi/tests/test_post_message.cc
@@ -172,6 +172,14 @@ TestPostMessage::~TestPostMessage() {
bool TestPostMessage::Init() {
bool success = CheckTestingInterface();
+ // Add a post condition to tests which caches the postMessage function and
+ // then calls it after the instance is destroyed. The ensures that no UAF
+ // occurs because the MessageChannel may still be alive after the plugin
+ // instance is destroyed (it will get garbage collected eventually).
+ instance_->EvalScript("window.pluginPostMessage = "
+ "document.getElementById('plugin').postMessage");
+ instance_->AddPostCondition("window.pluginPostMessage('') === undefined");
+
// Set up a special listener that only responds to a FINISHED_WAITING string.
// This is for use by WaitForMessages.
std::string js_code;
« no previous file with comments | « ppapi/shared_impl/scoped_pp_var.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698