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..ccf3cb623ec7d8ceca01eb2cca7f27e47d1b344f |
--- /dev/null |
+++ b/LayoutTests/fast/events/init-custom-event-isolated-world.html |
@@ -0,0 +1,27 @@ |
+<!DOCTYPE html> |
+<p>Tests that properties of CustomEvent initialized with initCustomEvent() are cloned when accessed in isolated worlds.</p> |
+<div id="main"></div> |
+<div id="isolated"></div> |
+<script> |
+testRunner.dumpAsText(); |
+ |
+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> |