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

Unified Diff: LayoutTests/http/tests/security/isolatedWorld/custom-event.html

Issue 17063016: Remove leak of objects between isolated worlds on custom events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698