1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/test/mochitest/test_hanging.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +<head> 1.5 + <title>Plugin hanging</title> 1.6 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.7 + <script type="application/javascript" src="utils.js"></script> 1.8 + 1.9 +<body> 1.10 + <script class="testbody" type="application/javascript"> 1.11 + SimpleTest.waitForExplicitFinish(); 1.12 + setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); 1.13 + 1.14 + window.frameLoaded = function frameLoaded_toCrash() { 1.15 + if (!SimpleTest.testPluginIsOOP()) { 1.16 + ok(true, "Skipping this test when test plugin is not OOP."); 1.17 + SimpleTest.finish(); 1.18 + return; 1.19 + } 1.20 + 1.21 + SimpleTest.expectChildProcessCrash(); 1.22 + 1.23 + // the default timeout is annoying high for mochitest runs 1.24 + var timeoutPref = "dom.ipc.plugins.timeoutSecs"; 1.25 + SpecialPowers.setIntPref(timeoutPref, 5); 1.26 + 1.27 + var iframe = document.getElementById('iframe1'); 1.28 + var p = iframe.contentDocument.getElementById('plugin1'); 1.29 + 1.30 + p.setColor("FFFF00FF"); 1.31 + 1.32 + try { 1.33 + p.hang(); 1.34 + ok(false, "p.hang() should throw an exception"); 1.35 + } 1.36 + catch (e) { 1.37 + ok(true, "p.hang() should throw an exception"); 1.38 + } 1.39 + 1.40 + try { 1.41 + p.setColor("FFFF0000"); 1.42 + ok(false, "p.setColor should throw after the plugin crashes"); 1.43 + } 1.44 + catch (e) { 1.45 + ok(true, "p.setColor should throw after the plugin crashes"); 1.46 + } 1.47 + 1.48 + window.frameLoaded = function reloaded() { 1.49 + var p = iframe.contentDocument.getElementById('plugin1'); 1.50 + try { 1.51 + p.setColor('FF00FF00'); 1.52 + ok(true, "Reloading worked"); 1.53 + } 1.54 + catch (e) { 1.55 + ok(false, "Reloading didn't give us a usable plugin"); 1.56 + } 1.57 + 1.58 + try { 1.59 + SpecialPowers.clearUserPref(timeoutPref); 1.60 + } 1.61 + catch(e) { 1.62 + ok(false, "Couldn't reset timeout pref"); 1.63 + } 1.64 + 1.65 + SimpleTest.finish(); 1.66 + } 1.67 + 1.68 + iframe.contentWindow.location.reload(); 1.69 + } 1.70 + 1.71 + </script> 1.72 + <iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>