LayoutTests:
[WebKit-https.git] / LayoutTests / plugins / destroy-stream-twice.html
1 <head>
2 <link rel="stylesheet" href="../fast/js/resources/js-test-style.css">
3 <script src="../fast/js/resources/js-test-pre.js"></script>
4 </head>
5 <body>
6 <p id="description"></p>
7 <div id="console"></div>
8 <embed id="plugin" 
9        type="application/x-webkit-test-netscape"
10        src="data:text/plain,"
11        style="width:0; height:0">
12 </embed>
13
14 <script>
15 description("Test for http://bugs.webkit.org/show_bug.cgi?id=13203: REGRESSION: Repro crash in -[WebBaseNetscapePluginView(WebNPPCallbacks) destroyStream:reason:] navigating away from page with DivX movie plug-in");
16
17 function runTest()
18 {
19     debug("destroyStream() returns zero to indicate success, or a non-zero error code to indicate failure");
20
21     shouldBe("document.getElementById('plugin').hasStream", "true");
22     shouldBe("document.getElementById('plugin').destroyStream()", "2"); // we expect to fail because the stream should already have completed loading and destroyed itself
23     shouldBe("document.getElementById('plugin').destroyStream()", "2"); // try again, just for good measure
24
25     debug("PASS: You didn't crash.\n");
26
27     shouldBeTrue("successfullyParsed");
28     debug('<br><span class="pass">TEST COMPLETE</span>');
29     layoutTestController.notifyDone();
30 }
31
32 function main() 
33 {
34     if (!window.layoutTestController) {
35         debug("This test can only run from within DumpRenderTree because it requires TestNetscapePlugin.\n");
36         return;
37     }
38
39     layoutTestController.waitUntilDone();
40     setTimeout(runTest, 5); // FIXME: Don't know how to wait until a plug-in stream has loaded.
41 }
42 main();
43
44 successfullyParsed = true;
45 </script>