dom/url/tests/file_worker_url.jsm
author danielleleb <danielleleb12@gmail.com>
Tue, 12 Mar 2019 17:38:47 +0000
changeset 521608 f87b1c69a88d995473d2351fa55247774be9c395
parent 458159 7bbd1a09eacb8a31f4caef5c1e526d8d32569ae9
permissions -rw-r--r--
Bug 1532934 - Enable ESLint for dom/url (automatic changes). r=Standard8,baku Differential Revision: https://phabricator.services.mozilla.com/D22736

var EXPORTED_SYMBOLS = ["checkFromJSM"];

Cu.importGlobalProperties(["URL"]);

function checkFromJSM(ok, is, finish) {
  let worker = new ChromeWorker("jsm_url_worker.js");
  worker.onmessage = function(event) {
   if (event.data.type == "finish") {
     finish();
    } else if (event.data.type == "url") {
      URL.revokeObjectURL(event.data.url);
    } else if (event.data.type == "status") {
      ok(event.data.status, event.data.msg);
    }
  };

  worker.onerror = function(event) {
    is(event.target, worker);
    ok(false, "Worker had an error: " + event.data);
    worker.terminate();
    finish();
  };

  worker.postMessage(0);
}