Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / plugins / refcount-leaks.html
blob0980fe1b275022a35f3739c7ced425f67bdc1bb6
1 <script>
2 function noop(x) {
5 function doGC() {
6 if (window.GCController) {
7 window.GCController.collectAll();
11 function runtest() {
12 if (window.testRunner)
13 testRunner.dumpAsText();
16 var output = document.getElementById("output");
17 output.innerHTML = "";
19 // Test that objects are deleted after their JS references are released.
20 var countOrig = plug.testObjectCount;
21 o1 = plug.testCreateTestObject();
22 o2 = plug.testCreateTestObject();
23 o3 = plug.testCreateTestObject();
24 var countAfterCreate = plug.testObjectCount;
25 o1 = o2 = o3 = null;
26 doGC();
27 var countAfterGC = plug.testObjectCount;
29 output.innerHTML += "--- num test objects:<br>";
30 output.innerHTML += "countAfterCreate == countOrig + 3? "
31 + ((countAfterCreate == countOrig + 3) ? "PASS" : "FAIL")
32 + "<br>";
33 output.innerHTML += "countOrig == countAfterGC? "
34 + ((countOrig == countAfterGC) ? "PASS" : "FAIL")
35 + "<br>";
36 output.innerHTML += "<br>";
38 // Test that the object refcount returns to normal after JS references
39 // are released.
40 var testObj = plug.testObject;
41 var refOrig = testObj.refCount;
42 var o1 = plug.testObject;
43 var o2 = plug.testObject;
44 var o3 = plug.testObject;
45 var refAfterGet = testObj.refCount;
46 o1 = o2 = o3 = null;
47 doGC();
48 var refAfterGetGC = testObj.refCount;
50 // Test that calling NPN_Invoke with our object as a parameter returns
51 // our refcount to normal (may require a GC).
52 plug.testPassTestObject("noop", testObj);
53 plug.testPassTestObject("noop", testObj);
54 plug.testPassTestObject("noop", testObj);
55 doGC();
56 var refAfterPass = testObj.refCount;
58 output.innerHTML += "--- refcount on plug.testObject:<br>";
59 output.innerHTML += "originally: " + refOrig + "<br>";
60 output.innerHTML += "after GC: " + refAfterGetGC + "<br>";
61 output.innerHTML += "after passing: " + refAfterPass + "<br>";
63 var success = (countAfterGC == countOrig) && (refAfterPass == refOrig);
64 output.innerHTML += (success ? "SUCCESS" : "FAILURE");
66 </script>
68 <body onload="runtest()">
70 Test that we can get an NPObject returned through a method on
71 an NPAPI Object.<P>
73 Prints "SUCCESS" on success, "FAILURE" on failure.
75 <embed name="plug" type="application/x-webkit-test-netscape">
77 <div id=output>FAILURE</div>
79 </body>