Source/WebCore: [V8] Crash in npObjectGetProperty() in V8NPObject.cpp
[WebKit-https.git] / LayoutTests / plugins / return-error-from-new-stream-doesnt-invoke-destroy-stream.html
1 <html>
2     <head>
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
9         <script>
10             var destroyStreamCalled = false;
11
12             function main() {
13                 if (!window.layoutTestController) {
14                     debug("This test can only run from within DumpRenderTree, because it requires TestNetscapePlugin.\n");
15                     return;
16                 }
17                 layoutTestController.waitUntilDone();
18             }
19
20             main();
21
22             function streamStarted() {
23                 testFailed("TestNetscapePlugin should have returned an error from NewStream.");
24             }
25
26             function streamDestroyed() { destroyStreamCalled = true; }
27
28             function requestCompleted() {
29                 shouldBeFalse("destroyStreamCalled");
30
31                 debug('<br><span class="pass">TEST COMPLETE</span>');
32
33                 layoutTestController.notifyDone();
34             }
35         </script>
36
37         <embed
38             type="application/x-webkit-test-netscape"
39             onStreamLoad="streamStarted()"
40             onStreamDestroy="streamDestroyed"
41             onURLNotify="requestCompleted()"
42             id="plugin">
43     </body>
44     <script>
45         description("This tests that NPP_DestroyStream is not called if a plug-in returns an error from its NPP_NewStream callback.");
46
47         var plugin = document.getElementById("plugin");
48
49         plugin.returnErrorFromNewStream = true;
50         shouldBeTrue("plugin.returnErrorFromNewStream");
51
52         plugin.getURLNotify("data:,", null, "callback");
53     </script>
54 </html>
55