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

Side by Side Diff: tests/ruby/ruby.js

Issue 440018: Ruby for NaCl. Please assign the appropriate reviewer. (Closed) Base URL: http://nativeclient.googlecode.com/svn/trunk/src/native_client/
Patch Set: '' Created 11 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/ruby/ruby.html ('k') | tests/ruby/stdin » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /* Copyright 2009 The Native Client Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can
3 * be found in the LICENSE file. */
4
5 var client;
6 var ruby;
7
8 var PostInit = function() {
9 if (client == undefined) {
10 alert('Unable to load, try reloading page (or missing plugins?)');
11 return;
12 }
13 if (client.rubyEval === undefined) {
14 setTimeout(PostInit, 100);
15 } else {
16 document.getElementById("output").innerHTML = "Ruby is loaded<br>";
17 }
18 }
19
20 function escapeHTML(html) {
21 if (html === null || typeof(html) == "undefined") {
22 return "";
23 }
24 return html.replace(/&/g,'&amp;').replace(/>/g,'&gt;').
25 replace(/</g,'&lt;').replace(/"/g,'&quot;');
26 }
27
28 function start() {
29 client = document.getElementById('client');
30 PostInit();
31 }
32
33 function doExecute() {
34 var element = document.getElementById('rubyCode');
35 var code = element.value;
36 document.getElementById('output').innerHTML +=
37 ("&gt; " + code + "<br>").replace('\n', '<br>');
38 element.value = '';
39 try {
40 if (code.indexOf("puts ") != 0) {
41 code = "puts " + code;
42 }
43 var result = client.rubyEval(code);
44 document.getElementById('output').innerHTML +=
45 escapeHTML(result).replace('\n', '<br>');
46 } catch (e) {
47 alert('error while executing Ruby code "' + code + '" err:' + e);
48 }
49 }
OLDNEW
« no previous file with comments | « tests/ruby/ruby.html ('k') | tests/ruby/stdin » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698