Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / media / lifetime.html
blobb9ef342ad514cb3faec8038cbfead425067a6407
1 <body onload="test()">
2 <p>Test Media object lifetime.</p>
3 <div id=result>Testing...</div>
4 <iframe src="about:blank"></iframe>
5 <script>
6 if (window.testRunner) {
7 testRunner.dumpAsText();
8 testRunner.waitUntilDone();
11 function gc()
13 if (window.GCController)
14 return GCController.collect();
16 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
17 var s = new String("abc");
21 function test()
23 if (!window.styleMedia) {
24 document.getElementById("result").innerHTML = "FAIL - window.styleMedia is not supported.";
25 return;
28 styleMedia.foo = "bar";
29 gc();
30 if (styleMedia.foo != "bar") {
31 document.getElementById("result").innerHTML = "FAIL - window.styelMedia doesn't return the same object each time.";
32 return;
35 var m = frames[0].styleMedia;
36 document.body.removeChild(document.getElementsByTagName("iframe")[0]);
37 try { m.matchMedium("foobar") } catch (ex) { }
38 setTimeout(function() {
39 gc();
40 try { m.matchMedium("foobar") } catch (ex) { }
41 document.getElementById("result").innerHTML = "PASS";
42 if (window.testRunner)
43 testRunner.notifyDone();
44 }, 0);
46 </script>