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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <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
3 <title>Tests that the detail property of custom events does not leak between iso lated worlds (checks bug 85158)</title>
4 <script>
5
6 // This test is meaningless without testRunner.
7 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.
8 testRunner.dumpAsText();
9 testRunner.waitUntilDone();
10
11 window.addEventListener("message", function(message)
12 {
13 testRunner.notifyDone();
14 }, false);
15
16 function newTest(title)
17 {
18 document.getElementById("log").innerHTML += "<br>" + title + ": ";
19 }
20
21 document.addEventListener("sendDocumentObject", function(event) {
22 var documentObject = event.detail;
23 var testResult;
24
25 newTest("Object passed into isolated world should be undefined");
26 if (!documentObject)
27 testResult = "PASS";
28 else
29 testResult = "FAIL";
30 document.getElementById("log").innerHTML += testResult;
31
32 newTest("The property defined in isolated world should not exist in this w orld");
33 if (!document.pageDefinedVar)
34 testResult = "PASS";
35 else
36 testResult = "FAIL";
37 document.getElementById("log").innerHTML += testResult;
38
39 window.postMessage("done", "*");
40 });
41
42 function sendDocumentObject() {
43 var customEvent = document.createEvent("CustomEvent");
44 customEvent.initCustomEvent("sendDocumentObject", true, true, document);
45 document.dispatchEvent(customEvent);
46 }
47
48 function runTest() {
49 var script = "document.pageDefinedVar = 1;(" + sendDocumentObject.toStri ng() + ")()";
50 testRunner.evaluateScriptInIsolatedWorld(1, script);
51 }
52 }
53 </script>
54 <body onload="runTest()">
55 <div id="log"></div>
56 </body>
57 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698