Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / event-properties-gc.html
blobada852dd771ffd93c4e81301a21df17de10aff20
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 window.jsTestIsAsync = true;
9 description("Tests that properties passed to events are not garbage collected prematurely.");
11 function addListener(eventType, prop) {
12 document.addEventListener(eventType, function(event) {
13 window.prop = prop;
14 // Despite the earlier assignement of the local variable to null and
15 // the following garabage collection, the property should still be
16 // present here.
17 shouldBeEqualToString("event[prop]", "foo");
19 window.prop = undefined;
20 window.postMessage("done", "*");
21 });
24 // Run the tests whenever a notification arrives, which indicates that the
25 // previous test has finished.
26 window.addEventListener("message", function(message) {
27 runNextTest();
28 }, false);
30 function newEvent(eventType, prop, value) {
31 return eval("new " + eventType + "('" + eventType + "', { " + prop + ": value })");
34 // The events that we want to test, with the properties that each one uses.
35 var events = [
36 { eventType: "CustomEvent", prop: "detail" },
37 { eventType: "MessageEvent", prop: "data" },
38 { eventType: "PopStateEvent", prop: "state" }
41 function runNextTest () {
42 var evt = events.pop();
43 if (!evt) {
44 finishJSTest();
45 return;
48 var value = "foo";
49 var eventToDispatch = newEvent(evt.eventType, evt.prop, value);
50 value = null;
51 gc();
53 addListener(evt.eventType, evt.prop);
54 document.dispatchEvent(eventToDispatch);
57 // This test is meaningless without testRunner.
58 if (window.testRunner) {
59 runNextTest();
61 </script>
62 </body>
63 </html>