2 if (window.layoutTestController) {
3 layoutTestController.dumpAsText();
8 var results = document.getElementById('results');
9 results.innerHTML += m + '<br>';
12 function shouldBe(aDescription, a, b)
15 log("PASS: " + aDescription + " should be '" + b + "' and is.");
17 log("FAIL: " + aDescription + " should be '" + b + "' but instead is '" + a + "'.");
21 function dispatchCustomEvent(name, value)
23 var ev = document.createEvent("CustomEvent");
24 ev.initCustomEvent(name, true, false, value);
25 document.dispatchEvent(ev);
30 addEventListener("blah", function() {
31 shouldBe("arguments[0].detail.result of the CustomEvent", arguments[0].detail.result, "success");
33 addEventListener("blah2", function() {
34 shouldBe("arguments[0].detail of the CustomEvent", arguments[0].detail, "success");
37 dispatchCustomEvent("blah", { result: "success" });
38 dispatchCustomEvent("blah2", "success");
42 <body onload="runTests()">
43 <div id="results"></div>