4 <p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=71229 (V8MessageEvent::dataAccessorGetter does not return a reference to its caller). If it succeeds, DONE will appear below. If it fails, you should see messages containing unexpected strings that were received and/or a renderer crash.
10 document.getElementById("log").innerHTML += message + "<br>";
15 // Make a long prefix string. This seems to make it more likely that a use-
16 // after-free problem will cause an observable error.
17 var kPrefix = "Hello";
18 for (var i = 0; i < 10; ++i)
22 function HandleMessage(message_event) {
23 if (message_event.data !== kPrefix + num.toString()) {
24 log("Expected '" + num + "', Got: '" + message_event.data + "'");
27 layoutTestController.notifyDone();
31 setTimeout(SendString, 0);
35 function SendString() {
36 var target = document.getElementById("event_target");
37 var message_event = window.document.createEvent('MessageEvent');
38 message_event.initMessageEvent('message', // type
41 kPrefix + num.toString(), // data
46 target.dispatchEvent(message_event);
49 function AddListener() {
50 var target = document.getElementById("event_target");
51 target.addEventListener("message", HandleMessage, false);
54 document.addEventListener("DOMContentLoaded", AddListener, false);
56 if (window.layoutTestController) {
57 layoutTestController.dumpAsText();
58 layoutTestController.waitUntilDone();
65 <div id="event_target"></div>