Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(564)

Side by Side Diff: LayoutTests/fast/events/event-isolated-world-clone.html

Issue 19457002: Make 'any'-typed attributes of events available in isolated worlds (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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();
7
8 function addListener(eventType, prop, worldType) {
9 document.getElementById(worldType).addEventListener(eventType, function(even t) {
10 console.log(eventType + " received in " + worldType + " world");
11 console.log(prop + " was " + JSON.stringify(event[prop]));
12 });
13 }
14
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);
18 }
19
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");
27
28 }
29
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" }
35 ];
36
37 for (var i = 0; i < events.length; ++i) {
38 runScript(events[i].eventType, events[i].prop);
39 }
40 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698