dom/workers/test/subdir/relativeLoad_sub_worker.js

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 /**
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/
     4  */
     5 const importSubURL = "relativeLoad_sub_import.js";
     7 onmessage = function(event) {
     8   var xhr = new XMLHttpRequest();
     9   xhr.open("GET", "testXHR.txt", false);
    10   xhr.send(null);
    11   if (xhr.status != 404) {
    12     throw "Loaded an xhr from the wrong location!";
    13   }
    15   importScripts(importSubURL);
    16   var worker = new Worker("relativeLoad_sub_worker2.js");
    17   worker.onerror = function(event) {
    18     throw event.data;
    19   };
    20   worker.onmessage = function(event) {
    21     if (event.data != workerSubURL) {
    22       throw "Bad data!";
    23     }
    24     postMessage(workerSubURL);
    25   };
    26 };

mercurial