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

var startTime = new Date;

if (window.testRunner) {
    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");
    var testProperty = pluginElement.fooBar;
    
    if (testProperty)
        testFailed("testProperty should not have returned anything, but it returned " + testProperty);

    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.");
    else
        testPassed("Accessing the property took less than 550ms, meaning the plug-in had not finished initializing after our call to the plug-in script object returned.");

    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 accessing the script object of a plug-in that hasn't been initialized fails instead of waiting for initialization to finish.");
var unused = document.body.offsetTop;
</script>
