<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<script>
function main() 
{
    if (!window.testRunner) {
        debug("This test can only run from within DumpRenderTree because it requires TestNetscapePlugin.\n");
        return;
    }

    testRunner.waitUntilDone();
}
main();

function runTest()
{
    debug("destroyStream() returns zero to indicate success, or a non-zero error code to indicate failure");

    shouldBe("document.getElementById('plugin').hasStream", "true");
    shouldBe("document.getElementById('plugin').destroyStream()", "2"); // we expect to fail because the stream should already have completed loading and destroyed itself
    shouldBe("document.getElementById('plugin').destroyStream()", "2"); // try again, just for good measure

    shouldBe("document.getElementById('plugin').destroyNullStream()", "2"); // Now try destroying a null stream

    debug("PASS: You didn't crash.\n");

    isSuccessfullyParsed();
    testRunner.notifyDone();
}
</script>
<embed id="plugin" 
       type="application/x-webkit-test-netscape"
       src="data:text/plain,"
       style="width:10px; height:10px"
       onstreamload="setTimeout(runTest, 0);">
</embed>

<script>
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");


</script>
