Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <head> |
michael@0 | 2 | <title>Plugin hanging</title> |
michael@0 | 3 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 4 | <script type="application/javascript" src="utils.js"></script> |
michael@0 | 5 | |
michael@0 | 6 | <body> |
michael@0 | 7 | <script class="testbody" type="application/javascript"> |
michael@0 | 8 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 9 | setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); |
michael@0 | 10 | |
michael@0 | 11 | window.frameLoaded = function frameLoaded_toCrash() { |
michael@0 | 12 | if (!SimpleTest.testPluginIsOOP()) { |
michael@0 | 13 | ok(true, "Skipping this test when test plugin is not OOP."); |
michael@0 | 14 | SimpleTest.finish(); |
michael@0 | 15 | return; |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | SimpleTest.expectChildProcessCrash(); |
michael@0 | 19 | |
michael@0 | 20 | // the default timeout is annoying high for mochitest runs |
michael@0 | 21 | var timeoutPref = "dom.ipc.plugins.timeoutSecs"; |
michael@0 | 22 | SpecialPowers.setIntPref(timeoutPref, 5); |
michael@0 | 23 | |
michael@0 | 24 | var iframe = document.getElementById('iframe1'); |
michael@0 | 25 | var p = iframe.contentDocument.getElementById('plugin1'); |
michael@0 | 26 | |
michael@0 | 27 | p.setColor("FFFF00FF"); |
michael@0 | 28 | |
michael@0 | 29 | try { |
michael@0 | 30 | p.hang(); |
michael@0 | 31 | ok(false, "p.hang() should throw an exception"); |
michael@0 | 32 | } |
michael@0 | 33 | catch (e) { |
michael@0 | 34 | ok(true, "p.hang() should throw an exception"); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | try { |
michael@0 | 38 | p.setColor("FFFF0000"); |
michael@0 | 39 | ok(false, "p.setColor should throw after the plugin crashes"); |
michael@0 | 40 | } |
michael@0 | 41 | catch (e) { |
michael@0 | 42 | ok(true, "p.setColor should throw after the plugin crashes"); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | window.frameLoaded = function reloaded() { |
michael@0 | 46 | var p = iframe.contentDocument.getElementById('plugin1'); |
michael@0 | 47 | try { |
michael@0 | 48 | p.setColor('FF00FF00'); |
michael@0 | 49 | ok(true, "Reloading worked"); |
michael@0 | 50 | } |
michael@0 | 51 | catch (e) { |
michael@0 | 52 | ok(false, "Reloading didn't give us a usable plugin"); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | try { |
michael@0 | 56 | SpecialPowers.clearUserPref(timeoutPref); |
michael@0 | 57 | } |
michael@0 | 58 | catch(e) { |
michael@0 | 59 | ok(false, "Couldn't reset timeout pref"); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | SimpleTest.finish(); |
michael@0 | 63 | } |
michael@0 | 64 | |
michael@0 | 65 | iframe.contentWindow.location.reload(); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | </script> |
michael@0 | 69 | <iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe> |