summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-18 18:43:03 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-18 18:43:03 +0000
commit7131465c53d8705cf2243b6bb464c99a6da56f42 (patch)
tree13f3e0f1ef59031df1e9cbf7bf6e186233da60d4 /ppapi/cpp
parent2029581c413cad19feb2e4a11ce55c5c6907b252 (diff)
downloadchromium_src-7131465c53d8705cf2243b6bb464c99a6da56f42.zip
chromium_src-7131465c53d8705cf2243b6bb464c99a6da56f42.tar.gz
chromium_src-7131465c53d8705cf2243b6bb464c99a6da56f42.tar.bz2
Don't send PP_Vars/V8 values with cycles across PostMessage
This prevents PP_Vars/V8 values with cycles being transmitted across PostMessage. An undefined value will be sent instead and an error will be logged to the console. BUG=236958 Review URL: https://chromiumcodereview.appspot.com/16140011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r--ppapi/cpp/instance.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h
index 48bca90..6bf4e83 100644
--- a/ppapi/cpp/instance.h
+++ b/ppapi/cpp/instance.h
@@ -244,6 +244,12 @@ class Instance {
/// JavaScript execution will not be blocked while HandleMessage() is
/// processing the message.
///
+ /// When converting JavaScript arrays, any object properties whose name
+ /// is not an array index are ignored. When passing arrays and objects, the
+ /// entire reference graph will be converted and transferred. If the reference
+ /// graph has cycles, the message will not be sent and an error will be logged
+ /// to the console.
+ ///
/// <strong>Example:</strong>
///
/// The following JavaScript code invokes <code>HandleMessage</code>, passing
@@ -264,9 +270,10 @@ class Instance {
///
/// Refer to PostMessage() for sending messages to JavaScript.
///
- /// @param[in] message A <code>Var</code> containing the data sent from
- /// JavaScript. Message can have an int32_t, double, bool, or string value
- /// (objects are not supported).
+ /// @param[in] message A <code>Var</code> which has been converted from a
+ /// JavaScript value. JavaScript array/object types are supported from Chrome
+ /// M29 onward. All JavaScript values are copied when passing them to the
+ /// plugin.
virtual void HandleMessage(const Var& message);
/// @}
@@ -453,6 +460,11 @@ class Instance {
///
/// The browser will pop-up an alert saying "Hello world!"
///
+ /// When passing array or dictionary <code>PP_Var</code>s, the entire
+ /// reference graph will be converted and transferred. If the reference graph
+ /// has cycles, the message will not be sent and an error will be logged to
+ /// the console.
+ ///
/// Listeners for message events in JavaScript code will receive an object
/// conforming to the HTML 5 <code>MessageEvent</code> interface.
/// Specifically, the value of message will be contained as a property called
@@ -466,9 +478,9 @@ class Instance {
/// Refer to HandleMessage() for receiving events from JavaScript.
///
/// @param[in] message A <code>Var</code> containing the data to be sent to
- /// JavaScript. Message can have a numeric, boolean, or string value; arrays
- /// and dictionaries are not yet supported. Ref-counted var types are copied,
- /// and are therefore not shared between the instance and the browser.
+ /// JavaScript. Message can have a numeric, boolean, or string value.
+ /// Array/Dictionary types are supported from Chrome M29 onward.
+ /// All var types are copied when passing them to JavaScript.
void PostMessage(const Var& message);
/// @}