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

Side by Side Diff: LayoutTests/fast/events/custom-event-isolated-world.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: Large set of fixes from adamk and haraken. 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 <script>
2 // Tests that the detail property of custom events does not leak between
3 // isolated worlds (checks bug 85158)
4
5 // This test is meaningless without testRunner.
6 function log(m)
7 {
8 var results = document.getElementById('results');
9 results.innerHTML += m + '<br>';
10 }
11
12 function shouldBe(aDescription, a, b)
haraken 2013/06/25 02:06:58 You can use fast/js/resources/js-test-pre.js.
jww 2013/06/26 02:27:06 Done.
13 {
14 if (a === b) {
15 log("PASS: " + aDescription + " should be '" + b + "' and is.");
16 } else {
17 log("FAIL: " + aDescription + " should be '" + b + "' but instead is '" + a + "'.");
18 }
19 }
20
21 if (window.testRunner) {
22
23 testRunner.dumpAsText();
haraken 2013/06/25 02:06:58 Nit: This isn't needed. js-test-pre.js will call i
jww 2013/06/26 02:27:06 Done.
24 testRunner.waitUntilDone();
25
26 window.addEventListener("message", function(message)
27 {
28 testRunner.notifyDone();
29 }, false);
30
31 document.addEventListener("sendDocumentObject", function(event) {
32 var documentObject = event.detail;
33 var testResult;
34
35 shouldBe("Object passed into isolated world", String(documentObject), Stri ng(undefined));
36
37 shouldBe("The property defined in isolated world ", String(document.pageDe finedVar), String(undefined));
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 runTests() {
49 var script = "document.pageDefinedVar = 1;(" + sendDocumentObject.toStri ng() + ")()";
50 testRunner.evaluateScriptInIsolatedWorld(1, script);
51 }
52 }
53 </script>
54 <body onload="runTests()">
haraken 2013/06/25 02:06:58 Nit: You can simply write: <!DOCTYPE html> <html>
jww 2013/06/26 02:27:06 Done.
55 <div id="results"></div>
haraken 2013/06/25 02:06:58 Nit: This isn't needed.
jww 2013/06/26 02:27:06 Done.
56 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698