2 Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/
8 Tests of DOM Worker Location
11 <title>Test for DOM Worker Location
</title>
12 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
13 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
17 <div id=
"content" style=
"display: none">
21 <script class=
"testbody" language=
"javascript">
23 var thisFilename =
"test_location.html";
24 var workerFilename =
"location_worker.js";
26 var href = window.location.href
27 var queryPos = href.lastIndexOf(window.location.search);
28 var baseHref = href.substr(
0, href.substr(
0, queryPos).lastIndexOf(
"/") +
1);
30 var path = window.location.pathname;
31 var basePath = path.substr(
0, path.lastIndexOf(
"/") +
1);
34 "toString": baseHref + workerFilename,
35 "href": baseHref + workerFilename,
36 "protocol": window.location.protocol,
37 "host": window.location.host,
38 "hostname": window.location.hostname,
39 "port": window.location.port,
40 "pathname": basePath + workerFilename,
43 "origin":
"http://mochi.test:8888"
46 var lastSlash = href.substr(
0, queryPos).lastIndexOf(
"/") +
1;
48 href.substr(lastSlash, queryPos - lastSlash),
51 var worker = new Worker(workerFilename);
53 worker.onmessage = function(event) {
54 if (event.data.string ==
"testfinished") {
58 ok(event.data.string in strings, event.data.string);
59 is(event.data.value, strings[event.data.string], event.data.string);
62 worker.onerror = function(event) {
63 ok(false,
"Worker had an error: " + event.message);
67 SimpleTest.waitForExplicitFinish();