diff options
Diffstat (limited to 'dom/plugins/test/mochitest/test_hanging.html')
-rw-r--r-- | dom/plugins/test/mochitest/test_hanging.html | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/dom/plugins/test/mochitest/test_hanging.html b/dom/plugins/test/mochitest/test_hanging.html new file mode 100644 index 0000000000..b6dd1b12a7 --- /dev/null +++ b/dom/plugins/test/mochitest/test_hanging.html @@ -0,0 +1,59 @@ +<head> + <title>Plugin hanging</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="application/javascript" src="plugin-utils.js"></script> + +<body> + <script class="testbody" type="application/javascript"> + SimpleTest.waitForExplicitFinish(); + setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); + + window.frameLoaded = function frameLoaded_toCrash() { + SimpleTest.expectChildProcessCrash(); + + // the default timeout is annoying high for mochitest runs + var timeoutPref = "dom.ipc.plugins.timeoutSecs"; + SpecialPowers.setIntPref(timeoutPref, 5); + + var iframe = document.getElementById("iframe1"); + var p = iframe.contentDocument.getElementById("plugin1"); + + p.setColor("FFFF00FF"); + + try { + p.hang(); + ok(false, "p.hang() should throw an exception"); + } catch (e) { + ok(true, "p.hang() should throw an exception"); + } + + try { + p.setColor("FFFF0000"); + ok(false, "p.setColor should throw after the plugin crashes"); + } catch (e) { + ok(true, "p.setColor should throw after the plugin crashes"); + } + + window.frameLoaded = function reloaded() { + var p1 = iframe.contentDocument.getElementById("plugin1"); + try { + p1.setColor("FF00FF00"); + ok(true, "Reloading worked"); + } catch (e) { + ok(false, "Reloading didn't give us a usable plugin"); + } + + try { + SpecialPowers.clearUserPref(timeoutPref); + } catch (e) { + ok(false, "Couldn't reset timeout pref"); + } + + SimpleTest.finish(); + }; + + iframe.contentWindow.location.reload(); + }; + + </script> + <iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe> |