Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / event-isolated-world-clone.html
blobc7b955c10196545d17a4c3e693d0f16e97c308c6
1 <!DOCTYPE html>
2 <p>Tests that properties of various events are cloned between isolated worlds.</p>
3 <div id="main"></div>
4 <div id="isolated"></div>
5 <script>
6 testRunner.dumpAsText();
8 function addListener(eventType, prop, worldType) {
9 document.getElementById(worldType).addEventListener(eventType, function(event) {
10 console.log(eventType + " received in " + worldType + " world");
11 console.log(prop + " was " + JSON.stringify(event[prop]));
12 });
15 function sendCloneableObject(eventType, prop, targetWorldType) {
16 var newEvent = eval("new " + eventType + "('" + eventType + "', { " + prop + ": { foo: 5, bar: 'hello', targetWorld: targetWorldType } })");
17 document.getElementById(targetWorldType).dispatchEvent(newEvent);
20 function runScript(eventType, prop) {
21 var sendScript = "(" + sendCloneableObject.toString() + ")('" + eventType + "', '" + prop + "', 'main');";
22 addListener(eventType, prop, "main");
23 testRunner.evaluateScriptInIsolatedWorld(1, sendScript);
24 var receiveScript = "(" + addListener.toString() + ")('" + eventType + "', '" + prop + "', 'isolated');";
25 testRunner.evaluateScriptInIsolatedWorld(1, receiveScript);
26 sendCloneableObject(eventType, prop, "isolated");
30 // The events that we want to test, with the properties that each one uses.
31 var events = [
32 { eventType: "CustomEvent", prop: "detail" },
33 { eventType: "MessageEvent", prop: "data" },
34 { eventType: "PopStateEvent", prop: "state" }
37 for (var i = 0; i < events.length; ++i) {
38 runScript(events[i].eventType, events[i].prop);
40 </script>