CRASH at WebCore::TrackListBase::remove
[WebKit-https.git] / LayoutTests / media / media-source / media-source-error-crash.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <title>media-source-error-crash</title>
5     <script src="media-source-loader.js"></script>
6     <script src="../video-test.js"></script>
7     <script>
8     var loader;
9     var source;
10     var sourceBuffer;
11     var sourceBuffer2;
12
13     function concatArrayBuffers(buffer1, buffer2) {
14         var view = new Uint8Array(buffer1.byteLength + buffer2.byteLength);
15         view.set(new Uint8Array(buffer1), 0);
16         view.set(new Uint8Array(buffer2), buffer1.byteLength);
17         return view.buffer;
18     }
19
20     function runTest() {
21         findMediaElement();
22
23         loader = new MediaSourceLoader('content/test-fragmented-manifest.json');
24         loader.onload = mediaDataLoaded;
25         loader.onerror = mediaDataLoadingFailed;
26     }
27
28     function mediaDataLoadingFailed() {
29         failTest('Media data loading failed');
30     }
31
32     function mediaDataLoaded() {
33         source = new MediaSource();
34         waitForEvent('sourceopen', sourceOpen, false, false, source);
35         run('video.src = URL.createObjectURL(source)');
36     }
37
38     function sourceOpen() {
39         run('source.duration = loader.duration()');
40         run('sourceBuffer = source.addSourceBuffer(loader.type())');
41         run('sourceBuffer2 = source.addSourceBuffer(loader.type())');
42         waitForEventAndEnd('error');
43         consoleWrite('Append an invalid media segment; should not crash.')
44         run('sourceBuffer.appendBuffer(concatArrayBuffers(loader.initSegment(), new ArrayBuffer(512)))');
45     }
46
47     </script>
48 </head>
49 <body onload="runTest()">
50     <video controls></video>
51 </body>
52 </html>