Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / workers / worker-document-leak.html
blobfc99dbe02792effcc87e25034f9691dd04b48796
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script src='resources/worker-util.js'></script>
6 </script>
7 <body>
8 <script>
9 description('Verify that creation of a worker does not leak its creating document.');
11 window.jsTestIsAsync = true;
13 function log(message)
15 document.getElementById("console").innerHTML += message + "<br>";
18 if (window.testRunner) {
19 testRunner.dumpAsText();
20 testRunner.waitUntilDone();
23 // Set this number as high as possible without introducing timeouts in debug builds.
24 // Reducing it does not require rebaselines.
25 var numIterations = 6;
27 var currentIteration = 0;
28 var iframe = null;
29 var numLiveAtStart = 0;
30 var numLiveAtEnd = 0;
32 window.onmessage = function(event) {
33 if (event.data == "done") {
34 runOneIteration();
38 function startTest()
40 gc();
41 if (window.internals && window.internals.numberOfLiveDocuments) {
42 numLiveAtStart = window.internals.numberOfLiveDocuments();
43 // Depending on which tests ran before this one in DumpRenderTree,
44 // their Document instances may not have been fully cleaned up yet.
45 // When this test is run in isolation, there should be only one
46 // live document at this point.
47 runOneIteration();
48 } else {
49 debug("window.internals.numberOfLiveDocuments not available -- no point in running test");
50 finishTest();
54 function runOneIteration() {
55 if (currentIteration < numIterations) {
56 ++currentIteration;
58 var createdIframe = false;
59 if (!iframe) {
60 iframe = document.createElement("iframe");
61 createdIframe = true;
63 iframe.setAttribute("src", "resources/worker-document-leak-iframe.html");
64 if (createdIframe)
65 document.body.appendChild(iframe);
66 return;
68 asyncGC(finishTest);
71 function finishTest()
73 gc();
75 if (window.internals && window.internals.numberOfLiveDocuments) {
76 numLiveAtEnd = window.internals.numberOfLiveDocuments();
77 // Under no circumstances should the number of live documents
78 // at the end be more than 1 greater than the number at the
79 // beginning (because of the iframe).
80 if (numLiveAtEnd > numLiveAtStart + 1) {
81 testFailed("leaked documents during test run (started with " + numLiveAtStart + ", ended with " + numLiveAtEnd + ")");
82 } else {
83 testPassed("did not leak documents during test run");
86 finishJSTest();
89 window.onload = startTest;
90 </script>
91 </body>
92 </html>