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

Side by Side Diff: native_client_sdk/src/examples/hello_nacl_mounts/example.js

Issue 11887021: [NaCl SDK] Add HTTP mount. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years, 11 months 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 | « no previous file | native_client_sdk/src/examples/hello_nacl_mounts/hello_nacl_mounts.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 function moduleDidLoad() { 5 function moduleDidLoad() {
6 common.hideModule(); 6 common.hideModule();
7 } 7 }
8 8
9 // Called by the common.js module. 9 // Called by the common.js module.
10 function domContentLoaded(name, tc, config, width, height) { 10 function domContentLoaded(name, tc, config, width, height) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 * @param {string} prefix The prefix to search for in |s|. 133 * @param {string} prefix The prefix to search for in |s|.
134 */ 134 */
135 function startsWith(s, prefix) { 135 function startsWith(s, prefix) {
136 // indexOf would search the entire string, lastIndexOf(p, 0) only checks at 136 // indexOf would search the entire string, lastIndexOf(p, 0) only checks at
137 // the first index. See: http://stackoverflow.com/a/4579228 137 // the first index. See: http://stackoverflow.com/a/4579228
138 return s.lastIndexOf(prefix, 0) === 0; 138 return s.lastIndexOf(prefix, 0) === 0;
139 } 139 }
140 140
141 function logMessage(msg) { 141 function logMessage(msg) {
142 var logEl = document.getElementById('log'); 142 var logEl = document.getElementById('log');
143
144 // Perform some basic escaping.
145 msg = msg.replace(/&/g, '&')
146 .replace(/</g, '&lt;')
147 .replace(/>/g, '&gt;')
148 .replace(/"/g, '&quot;')
149 .replace(/'/g, '&apos;');
150
143 logEl.innerHTML += msg + '<br>'; 151 logEl.innerHTML += msg + '<br>';
144 } 152 }
145 153
146 function makeCall(func) { 154 function makeCall(func) {
147 var message = func; 155 var message = func;
148 for (var i = 1; i < arguments.length; ++i) { 156 for (var i = 1; i < arguments.length; ++i) {
149 message += '\1' + arguments[i]; 157 message += '\1' + arguments[i];
150 } 158 }
151 159
152 return message; 160 return message;
(...skipping 12 matching lines...) Expand all
165 var result_func = window[func_result_name]; 173 var result_func = window[func_result_name];
166 174
167 if (!result_func) { 175 if (!result_func) {
168 logMessage('Error: Bad message received from NaCl module.'); 176 logMessage('Error: Bad message received from NaCl module.');
169 return; 177 return;
170 } 178 }
171 179
172 result_func.apply(null, params.slice(1)); 180 result_func.apply(null, params.slice(1));
173 } 181 }
174 } 182 }
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/examples/hello_nacl_mounts/hello_nacl_mounts.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698