OLD | NEW |
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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 } | 223 } |
224 | 224 |
225 function getcwd(e) { | 225 function getcwd(e) { |
226 nacl_module.postMessage(makeCall('getcwd')); | 226 nacl_module.postMessage(makeCall('getcwd')); |
227 } | 227 } |
228 | 228 |
229 function getcwdResult(dirname) { | 229 function getcwdResult(dirname) { |
230 common.logMessage('getcwd: ' + dirname + '.'); | 230 common.logMessage('getcwd: ' + dirname + '.'); |
231 } | 231 } |
232 | 232 |
| 233 function getaddrinfo(e) { |
| 234 var name = document.getElementById('getaddrinfoName').value; |
| 235 var family = document.getElementById('getaddrinfoFamily').value; |
| 236 nacl_module.postMessage(makeCall('getaddrinfo', name, family)); |
| 237 } |
| 238 |
| 239 function getaddrinfoResult(name, addr_type) { |
| 240 common.logMessage('getaddrinfo returned successfully'); |
| 241 common.logMessage('ai_cannonname = ' + name + '.'); |
| 242 var count = 1; |
| 243 for (var i = 1; i < arguments.length; i+=2) { |
| 244 var msg = 'Address number ' + count + ' = ' + arguments[i] + |
| 245 ' (' + arguments[i+1] + ')'; |
| 246 common.logMessage(msg); |
| 247 count += 1; |
| 248 } |
| 249 } |
| 250 |
233 function gethostbyname(e) { | 251 function gethostbyname(e) { |
234 var name = document.getElementById('gethostbynameName').value; | 252 var name = document.getElementById('gethostbynameName').value; |
235 nacl_module.postMessage(makeCall('gethostbyname', name)); | 253 nacl_module.postMessage(makeCall('gethostbyname', name)); |
236 } | 254 } |
237 | 255 |
238 function gethostbynameResult(name, addr_type) { | 256 function gethostbynameResult(name, addr_type) { |
239 common.logMessage('gethostbyname returned successfully'); | 257 common.logMessage('gethostbyname returned successfully'); |
240 common.logMessage('h_name = ' + name + '.'); | 258 common.logMessage('h_name = ' + name + '.'); |
241 common.logMessage('h_addr_type = ' + addr_type + '.'); | 259 common.logMessage('h_addr_type = ' + addr_type + '.'); |
242 for (var i = 2; i < arguments.length; i++) { | 260 for (var i = 2; i < arguments.length; i++) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 339 |
322 if (!resultFunc) { | 340 if (!resultFunc) { |
323 common.logMessage('Error: Bad message ' + funcName + | 341 common.logMessage('Error: Bad message ' + funcName + |
324 ' received from NaCl module.'); | 342 ' received from NaCl module.'); |
325 return; | 343 return; |
326 } | 344 } |
327 | 345 |
328 resultFunc.apply(null, params.slice(1)); | 346 resultFunc.apply(null, params.slice(1)); |
329 } | 347 } |
330 } | 348 } |
OLD | NEW |