Get foreground tab on Android
[chromium-blink-merge.git] / content / test / data / workers / worker_utils.js
blob6105692e1a89b28c3069af97c281a5702c1066de
1 var shared_worker_count = 0;
2 function getWorker(worker_url)
4 // Create either a dedicated or shared worker, depending on flags
5 var url = document.location.toString();
6 if (url.search("shared") >= 0) {
7 // Make a shared worker that looks like a worker
8 var worker = new SharedWorker(worker_url, "name" + ++shared_worker_count);
9 worker.port.onmessage = function(evt) {
10 worker.onmessage(evt);
12 worker.postMessage = function(msg, port) {
13 worker.port.postMessage(msg, port);
15 return worker;
16 } else {
17 return new Worker(worker_url);
21 function onSuccess()
23 setTimeout(onFinished, 0, "OK");
26 function onFailure() {
27 setTimeout(onFinished, 0, "FAIL");
30 function onFinished(result) {
31 var statusPanel = document.getElementById("statusPanel");
32 if (statusPanel) {
33 statusPanel.innerHTML = result;
36 document.title = result;