mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
|
@ -0,0 +1,21 @@
|
|||
importScripts("/resources/testharness.js");
|
||||
|
||||
test(function() {
|
||||
var i = 0;
|
||||
addEventListener("message", this.step_func(function listener(evt) {
|
||||
++i;
|
||||
removeEventListener("message", listener, true);
|
||||
}), true);
|
||||
self.dispatchEvent(new Event("message"));
|
||||
self.dispatchEvent(new Event("message"));
|
||||
assert_equals(i, 1);
|
||||
}, "removeEventListener");
|
||||
|
||||
test(function() {
|
||||
addEventListener("message", this.step_func(function(evt) {
|
||||
assert_equals(evt.target, self);
|
||||
}), true);
|
||||
self.dispatchEvent(new Event("message"));
|
||||
}, "target");
|
||||
|
||||
done();
|
|
@ -0,0 +1,40 @@
|
|||
importScripts("/resources/testharness.js");
|
||||
|
||||
test(function() {
|
||||
self.onmessage = 1;
|
||||
assert_equals(self.onmessage, null,
|
||||
"attribute should return null after being set to a primitive");
|
||||
}, "Setting onmessage to 1");
|
||||
|
||||
test(function() {
|
||||
var object = {
|
||||
handleEvent: this.unreached_func()
|
||||
};
|
||||
self.onmessage = object;
|
||||
assert_equals(self.onmessage, object,
|
||||
"attribute should return the object it was set to.");
|
||||
|
||||
self.dispatchEvent(new Event("message"));
|
||||
}, "Setting onmessage to an object");
|
||||
|
||||
test(function() {
|
||||
var triggered = false;
|
||||
var f = function(e) { triggered = true; };
|
||||
self.onmessage = f;
|
||||
assert_equals(self.onmessage, f,
|
||||
"attribute should return the function it was set to.");
|
||||
|
||||
self.dispatchEvent(new Event("message"));
|
||||
assert_true(triggered, "event handler should have been triggered");
|
||||
}, "Setting onmessage to a function");
|
||||
|
||||
|
||||
test(function() {
|
||||
assert_not_equals(self.onmessage, null,
|
||||
"attribute should not return null after being set to a function");
|
||||
self.onmessage = 1;
|
||||
assert_equals(self.onmessage, null,
|
||||
"attribute should return null after being set to a primitive");
|
||||
}, "Setting onmessage to 1 (again)");
|
||||
|
||||
done();
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
onmessage = function(e) {
|
||||
postMessage(e.ports instanceof Array && e.ports.length === 0);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>e.ports in dedicated worker</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.postMessage(1);
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<!--
|
||||
onmessage = function(e) {
|
||||
function processPixels(imagedata) {
|
||||
var pixeldata = imagedata.data;
|
||||
for (var i = 0; i < pixeldata.length; i = i+4) {
|
||||
pixeldata[i] = 128;
|
||||
}
|
||||
postMessage(imagedata);
|
||||
}
|
||||
processPixels(e.data[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>posting an imagedata (from a cloned canvas) in an array</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var canvas = document.createElement('canvas');
|
||||
var clone = canvas.cloneNode(true);
|
||||
var ctx = clone.getContext('2d');
|
||||
var imagedata = ctx.getImageData(0, 0, 300, 150);
|
||||
worker.postMessage([imagedata]);
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
var pixeldata = e.data.data;
|
||||
for (var i = 0; i < pixeldata.length; i++) {
|
||||
assert_equals(pixeldata[i], (i % 4 == 0) ? 128 : 0);
|
||||
}
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>'message' event properties</title>
|
||||
<link rel=help href="http://www.whatwg.org/html/#dom-dedicatedworkerglobalscope-postmessage">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test("Properties of the 'message' event").step(function() {
|
||||
var worker = new Worker("message-event.js");
|
||||
worker.onmessage = this.step_func_done(function (evt) {
|
||||
assert_class_string(evt, "MessageEvent");
|
||||
assert_equals(evt.type, "message");
|
||||
assert_false(evt.bubbles, "bubbles should be false");
|
||||
assert_false(evt.cancelable, "cancelable should be false");
|
||||
assert_equals(evt.data, "test");
|
||||
assert_equals(evt.origin, "", "origin");
|
||||
assert_equals(evt.lastEventId, "", "lastEventId");
|
||||
assert_equals(evt.source, null, "source");
|
||||
assert_array_equals(evt.ports, [], "ports");
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
postMessage("test");
|
|
@ -0,0 +1,8 @@
|
|||
importScripts("/resources/testharness.js");
|
||||
|
||||
test(function() {
|
||||
var rv = postMessage(1);
|
||||
assert_equals(rv, undefined);
|
||||
}, "return value of postMessage");
|
||||
|
||||
done();
|
|
@ -0,0 +1,26 @@
|
|||
<!--
|
||||
try {
|
||||
postMessage(false, [null]);
|
||||
} catch(e) {
|
||||
postMessage(e instanceof TypeError);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>Using [null] in postMessage's second argument</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
try {
|
||||
postMessage(1, null);
|
||||
} catch(e) {
|
||||
postMessage(e instanceof TypeError);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>Using null in postMessage's second argument</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
try {
|
||||
postMessage(1, undefined);
|
||||
} catch(e) {
|
||||
postMessage(''+e);
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>Using undefined in postMessage's second argument</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 1);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,24 @@
|
|||
<!--
|
||||
var x = postMessage;
|
||||
postMessage = 1;
|
||||
x(postMessage == 1);
|
||||
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setting postMessage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
onmessage = function(e) {
|
||||
var imagedata = e.data;
|
||||
imagedata.data[0] = 128;
|
||||
postMessage(imagedata);
|
||||
}
|
||||
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>structured clone of ImageData</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
var imagedata = ctx.getImageData(0, 0, 300, 150);
|
||||
worker.postMessage(imagedata);
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(''+e.data, '[object ImageData]');
|
||||
assert_equals(e.data.data[0], 128);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,58 @@
|
|||
<!--
|
||||
var err = new Error('foo');
|
||||
var date = new Date();
|
||||
// commented out bits are either tested elsewhere or not supported yet. or uncloneable.
|
||||
var tests = [undefined, null, false, true, 1, NaN, Infinity, 'foo', date, /foo/, /* ImageData, File, FileData, FileList,*/ null/*self*/,
|
||||
[undefined, null, false, true, 1, NaN, Infinity, 'foo', /*date, /foo/,*/ null/*self*/, /*[], {},*/ null/*err*/],
|
||||
{a:undefined, b:null, c:false, d:true, e:1, f:NaN, g:Infinity, h:'foo', /*i:date, j:/foo/,*/ k:null/*self*/, /*l:[], m:{},*/ n:null/*err*/},
|
||||
null/*err*/];
|
||||
for (var i = 0; i < tests.length; ++i) {
|
||||
try {
|
||||
postMessage(tests[i]);
|
||||
} catch(e) {
|
||||
postMessage(''+e);
|
||||
}
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>structured clone of message</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var wrapper_test = async_test();
|
||||
var tests = [
|
||||
{test:async_test('undefined'), check:function(e) { assert_equals(e.data, undefined); }},
|
||||
{test:async_test('null'), check:function(e) { assert_equals(e.data, null); }},
|
||||
{test:async_test('false'), check:function(e) { assert_false(e.data); }},
|
||||
{test:async_test('true'), check:function(e) { assert_true(e.data); }},
|
||||
{test:async_test('1'), check:function(e) { assert_equals(e.data, 1); }},
|
||||
{test:async_test('NaN'), check:function(e) { assert_equals(e.data, NaN); }},
|
||||
{test:async_test('Infinity'), check:function(e) { assert_equals(e.data, Infinity); }},
|
||||
{test:async_test('string'), check:function(e) { assert_equals(e.data, 'foo'); }},
|
||||
{test:async_test('date'), check:function(e) { assert_equals(e.data instanceof Date, true); }},
|
||||
{test:async_test('regexp'), check:function(e) { assert_equals('' + e.data, '/foo/'); assert_equals(e.data instanceof RegExp, true, 'e.data instanceof RegExp'); }},
|
||||
{test:async_test('self'), check:function(e) { assert_equals(e.data, null); }},
|
||||
{test:async_test('array'), check:function(e) { assert_array_equals(e.data, [undefined, null, false, true, 1, NaN, Infinity, 'foo', null, null]); }},
|
||||
{test:async_test('object'), check:function(e) { assert_object_equals(e.data, {a:undefined, b:null, c:false, d:true, e:1, f:NaN, g:Infinity, h:'foo', k:null, n:null}); }},
|
||||
{test:async_test('error'), check:function(e) { assert_equals(e.data, null, 'new Error()'); }},
|
||||
{test:wrapper_test, check:function(e) { assert_unreached(); }}
|
||||
];
|
||||
// make wrapper_test pass after 500ms
|
||||
setTimeout(tests[tests.length-1].test.step_func(function() {
|
||||
this.done();
|
||||
}), 500);
|
||||
|
||||
wrapper_test.step(function() {
|
||||
var worker = new Worker('#');
|
||||
var i = 0;
|
||||
worker.onmessage = function(e) {
|
||||
tests[i].test.step(function() { tests[i].check(e); this.done(); });
|
||||
i++;
|
||||
};
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,34 @@
|
|||
<!--
|
||||
addEventListener('connect', function(e) {
|
||||
var passed;
|
||||
switch (location.hash) {
|
||||
case '#1': passed = name == ''; break;
|
||||
case '#2': passed = name == 'a'; break;
|
||||
case '#3': passed = name == '0'; break;
|
||||
}
|
||||
e.ports[0].postMessage(passed);
|
||||
}, false);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>getting name</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var tests = [['#1', ''], ['#2', 'a'], ['#3', -0]];
|
||||
tests.forEach(function(t) {
|
||||
async_test(function() {
|
||||
var w = new SharedWorker(t[0], t[1]);
|
||||
w.port.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
addEventListener('connect', function(e) {
|
||||
name = 1;
|
||||
e.ports[0].postMessage(name);
|
||||
}, false);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setting name</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var w1 = new SharedWorker('#1', 'x');
|
||||
w1.port.addEventListener('message', this.step_func(function(e) {
|
||||
assert_equals(e.data, 'x');
|
||||
this.done();
|
||||
}), false);
|
||||
w1.port.start();
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,39 @@
|
|||
<!--
|
||||
var results = [];
|
||||
try {
|
||||
self.onconnect = 1;
|
||||
results.push(String(onconnect));
|
||||
} catch(e) {
|
||||
results.push(''+e);
|
||||
}
|
||||
try {
|
||||
self.onconnect = {handleEvent:function(){}};
|
||||
results.push(String(onconnect));
|
||||
} catch(e) {
|
||||
results.push(''+e);
|
||||
}
|
||||
var f = function(e) {
|
||||
results.push(e.data);
|
||||
e.ports[0].postMessage(results);
|
||||
};
|
||||
onconnect = f;
|
||||
results.push(typeof onconnect);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>onconnect</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var w1 = new SharedWorker('#', '');
|
||||
w1.port.addEventListener('message', this.step_func(function(e) {
|
||||
assert_array_equals(e.data, ['null', 'null', 'function', '']);
|
||||
}), false);
|
||||
w1.port.start();
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,37 @@
|
|||
<!--
|
||||
onmessage = function(e) {
|
||||
postMessage(1);
|
||||
throw new Error();
|
||||
}
|
||||
close();
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>close() and incoming message</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var gotMessage = false;
|
||||
var gotError = false;
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = function(e) {
|
||||
gotMessage = true;
|
||||
};
|
||||
worker.onerror = function(e) {
|
||||
gotError = true;
|
||||
};
|
||||
worker.postMessage(1);
|
||||
setTimeout(this.step_func(function() {
|
||||
assert_false(gotMessage, 'got message');
|
||||
assert_true(gotError, 'got error');
|
||||
this.done();
|
||||
}), 500);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<!--
|
||||
postMessage(1);
|
||||
close();
|
||||
postMessage(2);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>close() and sending messages</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var i = 0;
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
i++;
|
||||
assert_equals(e.data, i);
|
||||
if (i == 2) {
|
||||
this.done();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,42 @@
|
|||
<!--
|
||||
var interval1 = setInterval(function() {
|
||||
clearInterval(interval1);
|
||||
postMessage(1);
|
||||
throw new Error();
|
||||
}, 10);
|
||||
close();
|
||||
var interval2 = setInterval(function() {
|
||||
clearInterval(interval2);
|
||||
postMessage(1);
|
||||
throw new Error();
|
||||
}, 10);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>close() and setInterval</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var gotMessage = false;
|
||||
var gotError = false;
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = function(e) {
|
||||
gotMessage = true;
|
||||
};
|
||||
worker.onerror = function(e) {
|
||||
gotError = true;
|
||||
};
|
||||
setTimeout(this.step_func(function() {
|
||||
assert_false(gotMessage, 'got message');
|
||||
assert_true(gotError, 'got error');
|
||||
this.done();
|
||||
}), 500);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<!--
|
||||
function x() {
|
||||
postMessage(1);
|
||||
throw new Error();
|
||||
}
|
||||
setTimeout(x, 0);
|
||||
close();
|
||||
setTimeout(x, 0);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>close() and setTimeout</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
setup({allow_uncaught_exception: true});
|
||||
|
||||
async_test(function() {
|
||||
var gotMessage = false;
|
||||
var gotError = false;
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = function(e) {
|
||||
gotMessage = true;
|
||||
};
|
||||
worker.onerror = function(e) {
|
||||
gotError = true;
|
||||
};
|
||||
setTimeout(this.step_func(function() {
|
||||
assert_false(gotMessage, 'got message');
|
||||
assert_true(gotError, 'got error');
|
||||
this.done();
|
||||
}), 500);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
def main(request, response):
|
||||
response.status = 302
|
||||
response.headers.append("Location", "post-location-members.js?a")
|
|
@ -0,0 +1,31 @@
|
|||
<!--
|
||||
postMessage([null, location.href, location.protocol, location.host,
|
||||
location.hostname, location.port, location.pathname,
|
||||
location.search, location.hash]);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>members of WorkerLocation</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data[0], null);
|
||||
assert_equals(e.data[1], location.href + '#', 'href');
|
||||
assert_equals(e.data[2], location.protocol, 'protocol');
|
||||
assert_equals(e.data[3], location.host, 'host');
|
||||
assert_equals(e.data[4], location.hostname, 'hostname');
|
||||
assert_equals(e.data[5], location.port, 'port');
|
||||
assert_equals(e.data[6], location.pathname, 'pathname');
|
||||
assert_equals(e.data[7], location.search, 'search');
|
||||
assert_equals(e.data[8], '', 'hash');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,8 @@
|
|||
postMessage([location.href,
|
||||
location.protocol,
|
||||
location.host,
|
||||
location.hostname,
|
||||
location.port,
|
||||
location.pathname,
|
||||
location.search,
|
||||
location.hash]);
|
|
@ -0,0 +1,28 @@
|
|||
<!--
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>location with a worker in separate file that redirects</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('helper-redirect.py?fail');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data[0], location.href.replace(/\/[^\/]+$/, '/post-location-members.js?a'));
|
||||
assert_equals(e.data[1], location.protocol);
|
||||
assert_equals(e.data[2], location.host);
|
||||
assert_equals(e.data[3], location.hostname);
|
||||
assert_equals(e.data[4], location.port);
|
||||
assert_equals(e.data[5], location.pathname.replace(/\/[^\/]+$/, '/post-location-members.js'));
|
||||
assert_equals(e.data[6], '?a');
|
||||
assert_equals(e.data[7], '');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
postMessage(location === location);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>location === location</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,43 @@
|
|||
<!--
|
||||
var exceptions = [];
|
||||
try { location.href = 1; } catch(e) { exceptions.push('href'); }
|
||||
try { location.protocol = 1; } catch(e) { exceptions.push('protocol'); }
|
||||
try { location.host = 1; } catch(e) { exceptions.push('host'); }
|
||||
try { location.hostname = 1; } catch(e) { exceptions.push('hostname');}
|
||||
try { location.port = 1; } catch(e) { exceptions.push('port'); }
|
||||
try { location.pathname = 1; } catch(e) { exceptions.push('pathname'); }
|
||||
try { location.search = 1; } catch(e) { exceptions.push('search'); }
|
||||
try { location.hash = 1; } catch(e) { exceptions.push('hash'); }
|
||||
|
||||
postMessage([null, location.href, location.protocol, location.host,
|
||||
location.hostname, location.port, location.pathname,
|
||||
location.search, location.hash, exceptions]);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setting members of WorkerLocation</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data[0], null);
|
||||
assert_equals(e.data[1], location.href + '#', 'href');
|
||||
assert_equals(e.data[2], location.protocol, 'protocol');
|
||||
assert_equals(e.data[3], location.host, 'host');
|
||||
assert_equals(e.data[4], location.hostname, 'hostname');
|
||||
assert_equals(e.data[5], location.port, 'port');
|
||||
assert_equals(e.data[6], location.pathname, 'pathname');
|
||||
assert_equals(e.data[7], location.search, 'search');
|
||||
assert_equals(e.data[8], '', 'hash');
|
||||
assert_array_equals(e.data[9], [], 'number of exceptions');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<!--
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>location with a worker in separate file</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('post-location-members.js?a#b?c');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data[0], location.href.replace(/\/[^\/]+$/, '/post-location-members.js?a#b?c'));
|
||||
assert_equals(e.data[1], location.protocol);
|
||||
assert_equals(e.data[2], location.host);
|
||||
assert_equals(e.data[3], location.hostname);
|
||||
assert_equals(e.data[4], location.port);
|
||||
assert_equals(e.data[5], location.pathname.replace(/\/[^\/]+$/, '/post-location-members.js'));
|
||||
assert_equals(e.data[6], '?a');
|
||||
assert_equals(e.data[7], '#b?c');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<!--
|
||||
onerror = function(a, b, c, d) {
|
||||
y(); // the error is "not handled"
|
||||
}
|
||||
function x() {
|
||||
y();
|
||||
}
|
||||
x();
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>onerror, "not handled" with an error in the onerror function</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onerror = this.step_func(function(e) {
|
||||
assert_true(e instanceof ErrorEvent, 'e instanceof ErrorEvent');
|
||||
assert_equals(typeof e.message, 'string', 'typeof e.message');
|
||||
assert_equals(e.filename, document.URL+'#', 'e.filename');
|
||||
assert_equals(typeof e.lineno, 'number', 'typeof e.lineno');
|
||||
assert_equals(typeof e.column, 'number', 'typeof e.column');
|
||||
e.preventDefault(); // "handled"
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,36 @@
|
|||
<!--
|
||||
onerror = function(a, b, c, d) {
|
||||
postMessage([a, b, c, d]);
|
||||
return true; // the error is "handled"
|
||||
}
|
||||
function x() {
|
||||
y();
|
||||
}
|
||||
x();
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>onerror, "handled"</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(typeof e.data[0], 'string', 'first argument');
|
||||
assert_equals(e.data[1], document.URL+'#', 'second argument');
|
||||
assert_equals(typeof e.data[2], 'number', 'third argument');
|
||||
assert_equals(typeof e.data[3], 'number', 'fourth argument');
|
||||
setTimeout(this.step_func(function() {
|
||||
this.done();
|
||||
}), 100);
|
||||
});
|
||||
worker.onerror = this.step_func(function(e) {
|
||||
assert_unreached();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,32 @@
|
|||
<!--
|
||||
onerror = function(a, b, c, d) {
|
||||
return false; // the error is "not handled"
|
||||
}
|
||||
function x() {
|
||||
y();
|
||||
}
|
||||
x();
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>onerror, "not handled"</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onerror = this.step_func(function(e) {
|
||||
assert_true(e instanceof ErrorEvent, 'e instanceof ErrorEvent');
|
||||
assert_equals(typeof e.message, 'string', 'typeof e.message');
|
||||
assert_equals(e.filename, document.URL+'#', 'e.filename');
|
||||
assert_equals(typeof e.lineno, 'number', 'typeof e.lineno');
|
||||
assert_equals(typeof e.column, 'number', 'typeof e.column');
|
||||
e.preventDefault(); // "handled"
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,35 @@
|
|||
<!--
|
||||
function x() {
|
||||
y();
|
||||
}
|
||||
x();
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>onerror, "not handled" with only window.onerror defined</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
setup({
|
||||
allow_uncaught_exception: true,
|
||||
});
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var timeout = setTimeout(this.step_func(function() {
|
||||
assert_unreached();
|
||||
}, 500));
|
||||
window.onerror = this.step_func(function(a, b, c, d) {
|
||||
assert_true(typeof a, 'string', 'first argument');
|
||||
assert_equals(b, document.URL+'#', 'second argument');
|
||||
assert_equals(typeof c, 'number', 'third argument');
|
||||
assert_equals(typeof d, 'number', 'fourth argument');
|
||||
clearTimeout(timeout);
|
||||
this.done();
|
||||
return true; // "handled"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,39 @@
|
|||
<!--
|
||||
var results = [];
|
||||
function check(func, msg) {
|
||||
try {
|
||||
results.push([func(), msg]);
|
||||
} catch(ex) {
|
||||
results.push([String(ex), msg]);
|
||||
}
|
||||
}
|
||||
check(function() { return self === self; }, 'self === self');
|
||||
check(function() { return self instanceof WorkerGlobalScope; }, 'self instanceof WorkerGlobalScope');
|
||||
check(function() { return 'self' in self; }, '\'self\' in self');
|
||||
check(function() {
|
||||
var x = self;
|
||||
self = 1;
|
||||
return x === self;
|
||||
}, 'self = 1');
|
||||
postMessage(results);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>self</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
for (var i = 0; i < e.data.length; ++i) {
|
||||
assert_true(e.data[i][0], e.data[i][1]);
|
||||
}
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,23 @@
|
|||
<!--
|
||||
setTimeout(function() { postMessage(1) }, 10);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setTimeout</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 1);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
var t = setTimeout(function() { postMessage(1); }, 10);
|
||||
clearTimeout(t);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>clearTimeout</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var gotMessage = false;
|
||||
worker.onmessage = function() { gotMessage = true; };
|
||||
setTimeout(this.step_func(function() { assert_false(gotMessage); this.done(); }), 100);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,22 @@
|
|||
<!--
|
||||
setInterval(function() { postMessage(1); }, 10);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setInterval</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 1);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<!--
|
||||
var t = setInterval(function() {
|
||||
postMessage(1);
|
||||
}, 10);
|
||||
clearInterval(t);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>clearInterval</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var i = 0;
|
||||
worker.onmessage = function() { i++; }
|
||||
setTimeout(this.step_func(function() { assert_equals(i, 0); this.done(); }), 100);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,26 @@
|
|||
<!--
|
||||
try {
|
||||
importScripts();
|
||||
postMessage(true);
|
||||
} catch(ex) {
|
||||
postMessage(String(ex));
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>importScripts no arguments</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,32 @@
|
|||
<!--
|
||||
var ran = false;
|
||||
var threw = false;
|
||||
var code = undefined;
|
||||
try {
|
||||
importScripts('data:text/javascript,ran=true','http://foo bar');
|
||||
} catch(e) {
|
||||
threw = true;
|
||||
code = e.code;
|
||||
}
|
||||
postMessage([ran, threw, code]);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>importScripts resolving urls</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_false(e.data[0], 'first argument to importScripts ran');
|
||||
assert_true(e.data[1], 'space in URL in second argument to importScripts did not throw');
|
||||
assert_equals(e.data[2], 12, 'exception code');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,28 @@
|
|||
<!--
|
||||
var x = 'a';
|
||||
try {
|
||||
importScripts('data:text/javascript,x+="b"',
|
||||
'data:text/javascript,x+="c"');
|
||||
} catch(e) {
|
||||
x += "d"
|
||||
}
|
||||
postMessage(x);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>importScripts running scripts</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, "abc");
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,34 @@
|
|||
<!--
|
||||
var x = '';
|
||||
var exception;
|
||||
try {
|
||||
importScripts('data:text/javascript,x+="first script successful. "',
|
||||
'data:text/javascript,x+="FAIL (second script). "; for(;) break;', // doesn't compile
|
||||
'data:text/javascript,x+="FAIL (third script)"');
|
||||
} catch(ex) {
|
||||
if (ex instanceof SyntaxError)
|
||||
exception = true;
|
||||
else
|
||||
exception = String(ex);
|
||||
}
|
||||
postMessage([x, exception]);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>importScripts broken script</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data[0], "first script successful. ");
|
||||
assert_true(e.data[1], 'expected SyntaxError');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
var x;
|
||||
var y;
|
||||
try {
|
||||
importScripts('data:text/javascript,x={',
|
||||
'data:text/javascript,}');
|
||||
} catch(e) {
|
||||
y = true;
|
||||
}
|
||||
postMessage([x, y]);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>importScripts separate scripts</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data[0], undefined);
|
||||
assert_true(e.data[1]);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,33 @@
|
|||
<!--
|
||||
var x;
|
||||
var y;
|
||||
var z;
|
||||
try {
|
||||
importScripts('data:text/javascript,x=1',
|
||||
'data:text/javascript,throw 2',
|
||||
'data:text/javascript,z=3');
|
||||
} catch(e) {
|
||||
y = e;
|
||||
}
|
||||
postMessage([x, y, z]);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>importScripts uncaught exception</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data[0], 1);
|
||||
assert_equals(e.data[1], 2);
|
||||
assert_equals(e.data[2], undefined);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
importScripts('data:text/javascript,postMessage(1)');
|
||||
postMessage(2);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>postMessage in importScripts</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var i = 0;
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
i++;
|
||||
assert_equals(e.data, i);
|
||||
if (i == 2)
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,23 @@
|
|||
<!--
|
||||
var log = postMessage;
|
||||
importScripts('data:text/javascript,function run() { log(true) }');
|
||||
run();
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>variables and functions crossing importScripts boundary</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,29 @@
|
|||
<!--
|
||||
var log = postMessage;
|
||||
importScripts('data:text/javascript,function run() { for(var i = 0; i < 1000; ++i) { if (i == 500) log(true); } return 1; }');
|
||||
postMessage(run());
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>variables and functions crossing importScripts boundary, take 2</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var i = 0;
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
i++;
|
||||
if (i == 1) {
|
||||
assert_true(e.data);
|
||||
} else {
|
||||
assert_equals(e.data, 1);
|
||||
this.done();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,34 @@
|
|||
<!--
|
||||
// prevent recursion
|
||||
if ('beenThere' in self) {
|
||||
throw 'undefined stringified to the empty string';
|
||||
}
|
||||
beenThere = true;
|
||||
try {
|
||||
importScripts(undefined);
|
||||
postMessage(got);
|
||||
} catch(ex) {
|
||||
postMessage(String(ex));
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>importScripts(undefined)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 'undefined');
|
||||
this.done();
|
||||
})
|
||||
worker.onerror = this.step_func(function(e) {
|
||||
assert_unreached(e.message);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,34 @@
|
|||
<!--
|
||||
// prevent recursion
|
||||
if ('beenThere' in self) {
|
||||
throw 'null stringified to the empty string';
|
||||
}
|
||||
beenThere = true;
|
||||
try {
|
||||
importScripts(null);
|
||||
postMessage(got);
|
||||
} catch(ex) {
|
||||
postMessage(String(ex));
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>importScripts(null)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 'null');
|
||||
this.done();
|
||||
});
|
||||
worker.onerror = this.step_func(function(e) {
|
||||
assert_unreached(e.message);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,34 @@
|
|||
<!--
|
||||
// prevent recursion
|
||||
if ('beenThere' in self) {
|
||||
throw '1 stringified to the empty string';
|
||||
}
|
||||
beenThere = true;
|
||||
try {
|
||||
importScripts(1);
|
||||
postMessage(got);
|
||||
} catch(ex) {
|
||||
postMessage(String(ex));
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>importScripts(1)</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, '1');
|
||||
this.done();
|
||||
});
|
||||
worker.onerror = this.step_func(function(e) {
|
||||
assert_unreached(e.message);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1 @@
|
|||
var got = '1';
|
|
@ -0,0 +1 @@
|
|||
var got = 'null';
|
|
@ -0,0 +1 @@
|
|||
var got = 'undefined';
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
postMessage(navigator.appName);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.appName</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.appName);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
postMessage(navigator.appVersion);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.appVersion</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.appVersion);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
postMessage(navigator.platform);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.platform</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.platform);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
postMessage(navigator.userAgent);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.userAgent</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.userAgent);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
postMessage(navigator.onLine);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.onLine</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.onLine);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
|
@ -0,0 +1,28 @@
|
|||
<!--
|
||||
var log = [];
|
||||
for (x in navigator) {
|
||||
navigator[x] = 1; // this should silently fail and not throw per webidl
|
||||
if (navigator[x] === 1)
|
||||
log.push(x);
|
||||
}
|
||||
postMessage(log.join(', '));
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>readonlyness of members of Navigator</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, '');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
postMessage(navigator.language);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.language</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.language);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
Loading…
Add table
Add a link
Reference in a new issue