dom/plugins/test/mochitest/test_crash_nested_loop.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <head>
     2   <title>Plugin crashing in nested loop</title>
     3   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     4   <script type="application/javascript" src="utils.js"></script>
     6 <body>
     7   <script class="testbody" type="application/javascript">
     8   SimpleTest.waitForExplicitFinish();
     9   setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    11   window.frameLoaded = function frameLoaded_toCrash() {
    12     if (!SimpleTest.testPluginIsOOP()) {
    13       ok(true, "Skipping this test when test plugin is not OOP.");
    14       SimpleTest.finish();
    15       return;
    16     }
    18     var iframe = document.getElementById('iframe1');
    19     var p = iframe.contentDocument.getElementById('plugin1');
    21     // This test is for bug 550026, which is inherently nondeterministic.
    22     // If we hit that bug, the browser process would crash when the plugin
    23     // crashes in crashInNestedLoop.  If not, we'll pass "spuriously".
    24     try {
    25       p.crashInNestedLoop();
    26       // The plugin didn't crash when expected.  This happens sometimes.  Give
    27       // it longer to crash.  If it crashes (but not at the apropriate time),
    28       // soft fail with a todo; if it doesn't crash then something went wrong,
    29       // so fail.
    30       setTimeout(
    31         function() {
    32           try {
    33             p.getPaintCount();
    34             ok(false, "plugin should crash");
    35           } catch (e) {
    36             todo(false, "p.crashInNestedLoop() should throw an exception");
    37           }
    39           SimpleTest.finish();
    40         },
    41         1000);
    42     }
    43     catch (e) {
    44       ok(true, "p.crashInNestedLoop() should throw an exception");
    45       SimpleTest.finish();
    46     }
    48   }
    50   </script>
    51   <iframe id="iframe1" src="crashing_subpage.html" width="600" height="600"></iframe>

mercurial