Chromium Code Reviews| Index: native_client_sdk/src/tools/create_html.py |
| diff --git a/native_client_sdk/src/tools/create_html.py b/native_client_sdk/src/tools/create_html.py |
| index 6b8a2df9e62630eb27b413d170cc0bf1b902f8e8..64f6d89afdaea0247f1832d540494dd9e36f1b84 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:"; |
|
binji
2014/06/18 20:43:32
I'd like to remove this message format as well (st
Sam Clegg
2014/06/18 20:48:38
Agreed.
|
| + if (typeof(payload) == 'string' && payload.indexOf(prefix) == 0) { |
| + addToStdout(payload.slice(prefix.length)); |
| + } |
| } |
| function handleCrash(event) { |