dom/workers/test/close_worker.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/workers/test/close_worker.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,21 @@
     1.4 +/**
     1.5 + * Any copyright is dedicated to the Public Domain.
     1.6 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.7 + */
     1.8 +onclose = function() {
     1.9 +  postMessage("closed");
    1.10 +  // Try to open a new worker.
    1.11 +  try {
    1.12 +    var worker = new Worker("close_worker.js");
    1.13 +    throw new Error("We shouldn't get here!");
    1.14 +  } catch (e) {
    1.15 +    // pass
    1.16 +  }
    1.17 +};
    1.18 +
    1.19 +setTimeout(function () {
    1.20 +  setTimeout(function () {
    1.21 +    throw new Error("I should never run!");
    1.22 +  }, 1000);
    1.23 +  close();
    1.24 +}, 1000);

mercurial