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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/resources/message-port-iframe.html

Issue 2847943002: Cleanup LayoutTests that define a function gc(). (Closed)
Patch Set: Fixing Layout Tests Failures Created 3 years, 7 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
1 <script src="../../../resources/gc.js"></script>
1 <script> 2 <script>
2 function gc()
3 {
4 if (window.GCController)
5 return GCController.collect();
6
7 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
8 var s = new String("abc");
9 }
10 }
11
12 var port; 3 var port;
13 function onMessage(evt) { 4 function onMessage(evt) {
14 if (evt.data == "ping") 5 if (evt.data == "ping")
15 port.postMessage("pong"); 6 port.postMessage("pong");
16 else if (evt.data == "newPort") 7 else if (evt.data == "newPort")
17 evt.ports[0].postMessage("yo"); 8 evt.ports[0].postMessage("yo");
18 else if (evt.data == "newConversation") 9 else if (evt.data == "newConversation")
19 if (evt.origin == "") 10 if (evt.origin == "")
20 evt.ports[0].postMessage("hey"); 11 evt.ports[0].postMessage("hey");
21 else 12 else
22 alert("Incorrect security origin in conversation: '" + evt.origin + "'."); 13 alert("Incorrect security origin in conversation: '" + evt.origin + "'.");
23 else if (/alert.+/.test(evt.data)) 14 else if (/alert.+/.test(evt.data))
24 alert(evt.data.substr(6)); 15 alert(evt.data.substr(6));
25 else if (evt.data == "freeze") 16 else if (evt.data == "freeze")
26 while (1) {} 17 while (1) {}
27 else if (evt.data == "closePort") 18 else if (evt.data == "closePort")
28 this.close(); 19 this.close();
29 else if (evt.data == "closeFrame") { 20 else if (evt.data == "closeFrame") {
30 frameElement.parentNode.removeChild(frameElement); 21 frameElement.parentNode.removeChild(frameElement);
31 gc(); 22 gc();
32 } 23 }
33 } 24 }
34 25
35 window.addEventListener("message", function(evt) { 26 window.addEventListener("message", function(evt) {
36 port = evt.ports[0]; 27 port = evt.ports[0];
37 port.onmessage = onMessage; 28 port.onmessage = onMessage;
38 port.start(); 29 port.start();
39 }, false); 30 }, false);
40 </script> 31 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698