Chromium Code Reviews| Index: LayoutTests/fast/events/init-custom-event-isolated-world.html |
| diff --git a/LayoutTests/fast/events/init-custom-event-isolated-world.html b/LayoutTests/fast/events/init-custom-event-isolated-world.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..36eb52cdfcfc76b472ef4dcdfd54469eca8b5573 |
| --- /dev/null |
| +++ b/LayoutTests/fast/events/init-custom-event-isolated-world.html |
| @@ -0,0 +1,27 @@ |
| +<!DOCTYPE html> |
| +<div id="main"></div> |
| +<div id="isolated"></div> |
| +<script> |
| +testRunner.dumpAsText(); |
| +console.log("Tests that properties of custom events are cloned when accessed in isolated worlds."); |
|
abarth-chromium
2013/07/17 23:06:44
Why not just put this in a <p> ?
adamk
2013/07/17 23:45:10
Done.
|
| + |
| +function addListener(worldType) { |
| + document.getElementById(worldType).addEventListener("CustomEvent", function(event) { |
| + console.log("CustomEvent received in " + worldType + " world"); |
| + console.log("detail was " + JSON.stringify(event.detail)); |
| + }); |
| +} |
| + |
| +function sendCloneableObject(targetWorldType) { |
| + var newEvent = document.createEvent("CustomEvent"); |
| + newEvent.initCustomEvent("CustomEvent", false, false, { foo: 5, bar: 'hello', targetWorld: targetWorldType }); |
| + document.getElementById(targetWorldType).dispatchEvent(newEvent); |
| +} |
| + |
| +var sendScript = "(" + sendCloneableObject.toString() + ")('main');"; |
| +addListener("main"); |
| +testRunner.evaluateScriptInIsolatedWorld(1, sendScript); |
| +var receiveScript = "(" + addListener.toString() + ")('isolated');"; |
| +testRunner.evaluateScriptInIsolatedWorld(1, receiveScript); |
| +sendCloneableObject("isolated"); |
| +</script> |