summaryrefslogtreecommitdiffstats
path: root/native_client_sdk/src/tools/create_html.py
diff options
context:
space:
mode:
authorsbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-18 20:48:48 +0000
committersbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-18 20:48:48 +0000
commitb9f70908edaa980d0c8a611cb93b240c6909d41d (patch)
tree888f0f4e15f0cf85dd24073aa049cab03f8b6de1 /native_client_sdk/src/tools/create_html.py
parent4af922a70543c2c28eadf6a62ce000085eb7b3d1 (diff)
downloadchromium_src-b9f70908edaa980d0c8a611cb93b240c6909d41d.zip
chromium_src-b9f70908edaa980d0c8a611cb93b240c6909d41d.tar.gz
chromium_src-b9f70908edaa980d0c8a611cb93b240c6909d41d.tar.bz2
[NaCl SDK] create_html.py now adds PS_TTY_PREFIX attribute to NaCl embed.
This fixes tty output handling for ppapi_simple-based applications. R=binji@chromium.org Review URL: https://codereview.chromium.org/341893005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278167 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk/src/tools/create_html.py')
-rwxr-xr-xnative_client_sdk/src/tools/create_html.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/native_client_sdk/src/tools/create_html.py b/native_client_sdk/src/tools/create_html.py
index 6b8a2df..64f6d89 100755
--- a/native_client_sdk/src/tools/create_html.py
+++ b/native_client_sdk/src/tools/create_html.py
@@ -27,11 +27,11 @@ HTML_TEMPLATE = '''\
Sample html container for embedded NaCl module. This file was auto-generated
by the create_html tool which is part of the NaCl SDK.
-The embed tag is setup with ps_stdout and ps_stderr attributes which, for
-applications linked with ppapi_simple, will cause stdout and stderr to be sent
-to javascript via postMessage. Also, the postMessage listener assumes that
-all messages sent via postMessage are strings to be displayed in the output
-textarea.
+The embed tag is setup with PS_STDOUT, PS_STDERR and PS_TTY_PREFIX attributes
+which, for applications linked with ppapi_simple, will cause stdout and stderr
+to be sent to javascript via postMessage. Also, the postMessage listener
+assumes that all messages sent via postMessage are strings to be displayed in
+the output textarea.
-->
<html>
<head>
@@ -46,8 +46,10 @@ textarea.
<div id="listener">
<embed id="nacl_module" name="%(module_name)s" src="%(nmf)s"
- type="application/x-nacl" ps_stdout="/dev/tty" ps_stderr="/dev/tty"
- width=640 height=480 />
+ type="application/x-nacl" width=640 height=480
+ PS_TTY_PREFIX="tty:"
+ PS_STDOUT="/dev/tty"
+ PS_STDERR="/dev/tty" >/
</div>
<p>Standard output/error:</p>
@@ -69,7 +71,11 @@ function addToStdout(message) {
}
function handleMessage(message) {
- addToStdout(message.data)
+ var payload = message.data;
+ var prefix = "tty:";
+ if (typeof(payload) == 'string' && payload.indexOf(prefix) == 0) {
+ addToStdout(payload.slice(prefix.length));
+ }
}
function handleCrash(event) {