1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/test/mochitest/test_bug777098.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=777098 1.8 +--> 1.9 +<head> 1.10 + <meta charset="utf-8"> 1.11 + <title>Test for Bug 777098</title> 1.12 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <script type="application/javascript" src="utils.js"></script> 1.14 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.15 +</head> 1.16 +<body onload="go();"> 1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=777098">Mozilla Bug 777098</a> 1.18 +<pre id="test"> 1.19 +<script type="application/javascript"> 1.20 + 1.21 +/** Test for passing dead NPObjects back into plugins. **/ 1.22 +SimpleTest.waitForExplicitFinish(); 1.23 +setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); 1.24 + 1.25 +function go() { 1.26 + var plugin = document.getElementById('plugin'); 1.27 + 1.28 + // Get wrapped npobject from plugin (plugin.__proto__) 1.29 + var val = plugin.getObjectValue(); 1.30 + 1.31 + // Force a re-instantiate by re-setting dummy uri, 1.32 + // making val a wrapper for a dead plugin 1.33 + plugin.data = plugin.data; 1.34 + 1.35 + // The correct behavior is an exception, if plugin.checkObjectValue succeeds 1.36 + // the plugin wasn't torn down for some reason, and if we crash... that's bad 1.37 + function pluginCheck() { 1.38 + try { 1.39 + plugin.checkObjectValue(val); 1.40 + } catch (e) { 1.41 + return true; 1.42 + } 1.43 + return false; 1.44 + } 1.45 + 1.46 + // Spin the event loop so the instantiation can complete 1.47 + window.setTimeout(function () { 1.48 + ok(pluginCheck(), "Shouldn't explode"); 1.49 + 1.50 + // All done. 1.51 + SimpleTest.finish(); 1.52 + }, 0); 1.53 +} 1.54 + 1.55 +</script> 1.56 +</pre> 1.57 + 1.58 +<object data="data:text/plain,a" width=200 height=200 type="application/x-test" id="plugin"></object> 1.59 + 1.60 +</body> 1.61 +</html>