<head><!-- webkit-test-runner [ AsynchronousPluginInitializationEnabled=true AsynchronousPluginInitializationEnabledForAllPlugins=true ] -->
<script src="../../../resources/js-test-pre.js"></script>
<script>

var startTime = new Date;

if (window.testRunner) {
    window.internals.settings.setCanStartMedia(false);
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function runTest() 
{
    if (!window.testRunner) {
        debug("This test can only run from within DumpRenderTree because it requires test runner internals.\n");
        return;
    }
	
	var pluginElement = document.getElementById("TestElement");
	pluginElement.parentNode.removeChild(pluginElement);

    testPassed("Removing the plug-in element did not crash.");

	var endTime = new Date;
	if (endTime - startTime > 549)
		testFailed("This test took over 549ms meaning the plug-in with a 550ms startup delay was actually initialized.  It never should've been initialized.");

    testRunner.notifyDone();
}
</script>

</head>
<body onload="setTimeout('runTest()', 0)">
<embed id="TestElement" type="application/x-webkit-test-netscape" test="slow-npp-new"></embed>
<p id="description"></p>
<div id="console"></div>
</body>

<script>
description("Tests that when media/plugin playback is disabled (such as when in a background tab), removing a plug-in element that was never initialized does not crash.");
var unused = document.body.offsetTop;
</script>
