Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / workers / resources / worker-common.js
blobe05f7ec5e2e16e9ff90c6edb9ecfd8ac661c4c9f
1 function gc()
3 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
4 var s = new String("abc");
8 onmessage = function(evt)
10 gc();
12 if (evt.data == "ping")
13 postMessage("pong");
14 else if (evt.data == "freeze")
15 while (1) {}
16 else if (evt.data == "close")
17 close();
18 else if (/eval.+/.test(evt.data)) {
19 try {
20 postMessage(evt.data.substr(5) + ": " + eval(evt.data.substr(5)));
21 } catch (ex) {
22 postMessage(evt.data.substr(5) + ": " + ex);
25 gc();