1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Once we load, hide the plugin
6 function moduleDidLoad() {
10 // Called by the common.js module.
11 // nacl_io/ppapi_simple generates two different types of messages:
12 // - messages from /dev/tty (prefixed with PS_TTY_PREFIX)
13 // - exit message (prefixed with PS_EXIT_MESSAGE)
14 function handleMessage(message) {
15 if (message.data.indexOf("exit:") == 0) {
16 // When we receive the exit message we post an empty reply back to
17 // confirm, at which point the module will exit.
18 message.srcElement.postMessage({"exit" : ""});
19 } else if (message.data.indexOf("tty:") == 0) {
20 common.logMessage(message.data.slice("tty:".length));
22 console.log("Unhandled message: " + message.data);