Chromium Code Reviews| Index: LayoutTests/http/tests/security/isolatedWorld/custom-event.html |
| diff --git a/LayoutTests/http/tests/security/isolatedWorld/custom-event.html b/LayoutTests/http/tests/security/isolatedWorld/custom-event.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..73b4f0394f8a81d2ddc185406c7173048b1ad92b |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/security/isolatedWorld/custom-event.html |
| @@ -0,0 +1,57 @@ |
| +<!DOCTYPE html> |
| +<html> |
|
haraken
2013/06/22 13:16:46
You can write the test more simply by including js
jww
2013/06/25 01:50:29
Given that I'm moving the test from http/tests to
|
| +<title>Tests that the detail property of custom events does not leak between isolated worlds (checks bug 85158)</title> |
| +<script> |
| + |
| +// This test is meaningless without testRunner. |
| +if (window.testRunner && window.eventSender) { |
|
haraken
2013/06/22 13:16:46
Nit: window.eventSender is not needed.
jww
2013/06/25 01:50:29
Done.
|
| + testRunner.dumpAsText(); |
| + testRunner.waitUntilDone(); |
| + |
| + window.addEventListener("message", function(message) |
| + { |
| + testRunner.notifyDone(); |
| + }, false); |
| + |
| + function newTest(title) |
| + { |
| + document.getElementById("log").innerHTML += "<br>" + title + ": "; |
| + } |
| + |
| + document.addEventListener("sendDocumentObject", function(event) { |
| + var documentObject = event.detail; |
| + var testResult; |
| + |
| + newTest("Object passed into isolated world should be undefined"); |
| + if (!documentObject) |
| + testResult = "PASS"; |
| + else |
| + testResult = "FAIL"; |
| + document.getElementById("log").innerHTML += testResult; |
| + |
| + newTest("The property defined in isolated world should not exist in this world"); |
| + if (!document.pageDefinedVar) |
| + testResult = "PASS"; |
| + else |
| + testResult = "FAIL"; |
| + document.getElementById("log").innerHTML += testResult; |
| + |
| + window.postMessage("done", "*"); |
| + }); |
| + |
| + function sendDocumentObject() { |
| + var customEvent = document.createEvent("CustomEvent"); |
| + customEvent.initCustomEvent("sendDocumentObject", true, true, document); |
| + document.dispatchEvent(customEvent); |
| + } |
| + |
| + function runTest() { |
| + var script = "document.pageDefinedVar = 1;(" + sendDocumentObject.toString() + ")()"; |
| + testRunner.evaluateScriptInIsolatedWorld(1, script); |
| + } |
| +} |
| +</script> |
| +<body onload="runTest()"> |
| + <div id="log"></div> |
| +</body> |
| +</html> |