| <!-- |
| Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html> |
| <head> |
| <meta http-equiv="Pragma" content="no-cache" /> |
| <meta http-equiv="Expires" content="-1" /> |
| <script type="text/javascript" src="nacltest.js"></script> |
| <title>Native Client Untrusted Crash Test</title> |
| </head> |
| |
| <body> |
| <h1>Native Client Untrusted Crash Test</h1> |
| |
| <div id="scratch_space"></div> |
| |
| <script type="text/javascript"> |
| |
| var tester = new Tester(); |
| |
| tester.addAsyncTest('untrusted_crash', function(status) { |
| var embed = document.createElement('embed'); |
| embed.width = 0; |
| embed.height = 0; |
| embed.src = 'crash_test.nmf'; |
| embed.type = 'application/x-nacl'; |
| embed.name = 'foo'; |
| |
| // Webkit Bug Workaround |
| // THIS SHOULD BE REMOVED WHEN Webkit IS FIXED |
| // http://code.google.com/p/nativeclient/issues/detail?id=2428 |
| // http://code.google.com/p/chromium/issues/detail?id=103588 |
| ForcePluginLoadOnTimeout(embed, tester, 15000); |
| |
| var div = document.createElement('div'); |
| div.appendChild(embed); |
| |
| div.addEventListener('load', status.wrap(function(event) { |
| status.fail('We expected this process to crash during startup'); |
| }), true); |
| |
| div.addEventListener('error', status.wrap(function(event) { |
| status.log('Received error: ' + embed.lastError); |
| status.assert( |
| embed.lastError.indexOf('SRPC connection failure') != -1 || |
| embed.lastError.indexOf('Nexe crashed during startup') != -1); |
| status.pass(); |
| }), true); |
| |
| div.addEventListener('crash', status.wrap(function(event) { |
| status.log('Received crash: ' + embed.lastError); |
| status.assert(embed.lastError.indexOf('NaCl module crashed') != -1); |
| status.pass(); |
| }), true); |
| |
| document.getElementById('scratch_space').appendChild(div); |
| }); |
| |
| tester.run(); |
| |
| </script> |