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 crashing in nested loop</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 | var iframe = document.getElementById('iframe1'); |
michael@0 | 19 | var p = iframe.contentDocument.getElementById('plugin1'); |
michael@0 | 20 | |
michael@0 | 21 | // This test is for bug 550026, which is inherently nondeterministic. |
michael@0 | 22 | // If we hit that bug, the browser process would crash when the plugin |
michael@0 | 23 | // crashes in crashInNestedLoop. If not, we'll pass "spuriously". |
michael@0 | 24 | try { |
michael@0 | 25 | p.crashInNestedLoop(); |
michael@0 | 26 | // The plugin didn't crash when expected. This happens sometimes. Give |
michael@0 | 27 | // it longer to crash. If it crashes (but not at the apropriate time), |
michael@0 | 28 | // soft fail with a todo; if it doesn't crash then something went wrong, |
michael@0 | 29 | // so fail. |
michael@0 | 30 | setTimeout( |
michael@0 | 31 | function() { |
michael@0 | 32 | try { |
michael@0 | 33 | p.getPaintCount(); |
michael@0 | 34 | ok(false, "plugin should crash"); |
michael@0 | 35 | } catch (e) { |
michael@0 | 36 | todo(false, "p.crashInNestedLoop() should throw an exception"); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | SimpleTest.finish(); |
michael@0 | 40 | }, |
michael@0 | 41 | 1000); |
michael@0 | 42 | } |
michael@0 | 43 | catch (e) { |
michael@0 | 44 | ok(true, "p.crashInNestedLoop() should throw an exception"); |
michael@0 | 45 | SimpleTest.finish(); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | </script> |
michael@0 | 51 | <iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe> |