mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01:45:33 +01:00
Update web-platform-tests to revision 097043b336e46876e281ddec3bb014fe9c480128
This commit is contained in:
parent
ecd32570c0
commit
b68253eac0
405 changed files with 9164 additions and 3050 deletions
|
@ -1,9 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -11,15 +5,11 @@ onmessage = function(e) {
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('event-ports-dedicated.js');
|
||||
worker.postMessage(1);
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
onmessage = function(e) {
|
||||
postMessage(e.ports instanceof Array && e.ports.length === 0);
|
||||
}
|
|
@ -1,17 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -19,7 +5,7 @@ onmessage = function(e) {
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('imagedata-cloned-canvas-in-array.js');
|
||||
var canvas = document.createElement('canvas');
|
||||
var clone = canvas.cloneNode(true);
|
||||
var ctx = clone.getContext('2d');
|
||||
|
@ -33,7 +19,4 @@ onmessage = function(e) {
|
|||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,10 @@
|
|||
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]);
|
||||
}
|
|
@ -1,13 +1,3 @@
|
|||
<!--
|
||||
onmessage = (event) => {
|
||||
try {
|
||||
postMessage(event.data, {transfer: [event.data]});
|
||||
} catch(e) {
|
||||
postMessage(''+e);
|
||||
}
|
||||
}
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>Using dictionary as postMessage's second argument</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -15,7 +5,7 @@ onmessage = (event) => {
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('second-argument-dictionary.js');
|
||||
var ab = new ArrayBuffer(1);
|
||||
worker.postMessage(ab, {transfer: [ab]});
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
|
@ -23,7 +13,4 @@ onmessage = (event) => {
|
|||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,7 @@
|
|||
onmessage = (event) => {
|
||||
try {
|
||||
postMessage(event.data, {transfer: [event.data]});
|
||||
} catch(e) {
|
||||
postMessage(''+e);
|
||||
}
|
||||
}
|
|
@ -1,11 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -13,14 +5,10 @@ try {
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('second-argument-null-in-array.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
</script>
|
|
@ -0,0 +1,5 @@
|
|||
try {
|
||||
postMessage(false, [null]);
|
||||
} catch(e) {
|
||||
postMessage(e instanceof TypeError);
|
||||
}
|
|
@ -1,11 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -13,13 +5,10 @@ try {
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('second-argument-null.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(1, e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,5 @@
|
|||
try {
|
||||
postMessage(1, null);
|
||||
} catch(e) {
|
||||
postMessage(e instanceof TypeError);
|
||||
}
|
|
@ -1,11 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -13,13 +5,10 @@ try {
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('second-argument-undefined.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 1);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,5 @@
|
|||
try {
|
||||
postMessage(1, undefined);
|
||||
} catch(e) {
|
||||
postMessage(''+e);
|
||||
}
|
|
@ -1,10 +1,3 @@
|
|||
<!--
|
||||
var x = postMessage;
|
||||
postMessage = 1;
|
||||
x(postMessage == 1);
|
||||
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setting postMessage</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -12,13 +5,10 @@ x(postMessage == 1);
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('setting-postMessage.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
var x = postMessage;
|
||||
postMessage = 1;
|
||||
x(postMessage == 1);
|
|
@ -1,12 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -14,7 +5,7 @@ onmessage = function(e) {
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
(async_test()).step(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('structured-clone-imagedata.js');
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
var imagedata = ctx.getImageData(0, 0, 300, 150);
|
||||
worker.postMessage(imagedata);
|
||||
|
@ -24,7 +15,4 @@ onmessage = function(e) {
|
|||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,5 @@
|
|||
onmessage = function(e) {
|
||||
var imagedata = e.data;
|
||||
imagedata.data[0] = 128;
|
||||
postMessage(imagedata);
|
||||
}
|
|
@ -1,20 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -45,14 +28,11 @@ setTimeout(tests[tests.length-1].test.step_func(function() {
|
|||
}), 500);
|
||||
|
||||
wrapper_test.step(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('structured-clone-message.js');
|
||||
var i = 0;
|
||||
worker.onmessage = function(e) {
|
||||
tests[i].test.step(function() { tests[i].check(e); this.done(); });
|
||||
i++;
|
||||
};
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
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);
|
||||
}
|
||||
}
|
|
@ -1,22 +1,10 @@
|
|||
<!--
|
||||
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]];
|
||||
var tests = [['getting.js#1', ''], ['getting.js#2', 'a'], ['getting.js#3', -0]];
|
||||
tests.forEach(function(t) {
|
||||
async_test(function() {
|
||||
var w = new SharedWorker(t[0], t[1]);
|
||||
|
@ -27,8 +15,3 @@ tests.forEach(function(t) {
|
|||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
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);
|
|
@ -1,10 +1,3 @@
|
|||
<!--
|
||||
addEventListener('connect', function(e) {
|
||||
name = 1;
|
||||
e.ports[0].postMessage(name);
|
||||
}, false);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setting name</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -12,7 +5,7 @@ addEventListener('connect', function(e) {
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var w1 = new SharedWorker('#1', 'x');
|
||||
var w1 = new SharedWorker('setting.js#1', 'x');
|
||||
w1.port.addEventListener('message', this.step_func(function(e) {
|
||||
assert_equals(e.data, 1);
|
||||
this.done();
|
||||
|
@ -20,6 +13,3 @@ async_test(function() {
|
|||
w1.port.start();
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
addEventListener('connect', function(e) {
|
||||
name = 1;
|
||||
e.ports[0].postMessage(name);
|
||||
}, false);
|
|
@ -1,25 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -27,13 +5,10 @@ results.push(typeof onconnect);
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var w1 = new SharedWorker('#', '');
|
||||
var w1 = new SharedWorker('onconnect.js', '');
|
||||
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,19 @@
|
|||
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);
|
|
@ -1,18 +1,10 @@
|
|||
<!--
|
||||
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>
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('incoming-message.js');
|
||||
worker.onmessage = function(e) {
|
||||
assert_unreached("Got message");
|
||||
};
|
||||
|
@ -21,9 +13,4 @@ worker.onerror = function(e) {
|
|||
};
|
||||
worker.postMessage(1);
|
||||
setTimeout(done, 2000);
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
||||
</script>
|
|
@ -0,0 +1,5 @@
|
|||
onmessage = function(e) {
|
||||
postMessage(1);
|
||||
throw new Error();
|
||||
}
|
||||
close();
|
|
@ -1,9 +1,3 @@
|
|||
<!--
|
||||
postMessage(1);
|
||||
close();
|
||||
postMessage(2);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>close() and sending messages</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -11,7 +5,7 @@ postMessage(2);
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('sending-messages.js');
|
||||
var i = 0;
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
i++;
|
||||
|
@ -21,7 +15,4 @@ async_test(function() {
|
|||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
postMessage(1);
|
||||
close();
|
||||
postMessage(2);
|
|
@ -1,24 +1,10 @@
|
|||
<!--
|
||||
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>
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('setInterval.js');
|
||||
worker.onmessage = function(e) {
|
||||
assert_unreached("Got message");
|
||||
};
|
||||
|
@ -26,9 +12,4 @@ worker.onerror = function(e) {
|
|||
assert_unreached("Got error");
|
||||
};
|
||||
setTimeout(done, 2000);
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
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);
|
|
@ -1,20 +1,10 @@
|
|||
<!--
|
||||
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>
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('setTimeout.js');
|
||||
worker.onmessage = function(e) {
|
||||
assert_unreached("Got message");
|
||||
};
|
||||
|
@ -22,7 +12,4 @@ worker.onerror = function(e) {
|
|||
assert_unreached("Got error");
|
||||
};
|
||||
setTimeout(done, 2000);
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,7 @@
|
|||
function x() {
|
||||
postMessage(1);
|
||||
throw new Error();
|
||||
}
|
||||
setTimeout(x, 0);
|
||||
close();
|
||||
setTimeout(x, 0);
|
|
@ -1,9 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -11,21 +5,18 @@ postMessage([null, location.href, location.protocol, location.host,
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('members.js');
|
||||
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[1], location.href.replace('.html', '.js'), '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[6], location.pathname.replace('.html', '.js'), 'pathname');
|
||||
assert_equals(e.data[7], location.search, 'search');
|
||||
assert_equals(e.data[8], '', 'hash');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
postMessage([null, location.href, location.protocol, location.host,
|
||||
location.hostname, location.port, location.pathname,
|
||||
location.search, location.hash]);
|
|
@ -1,7 +1,3 @@
|
|||
<!--
|
||||
postMessage(location === location);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>location === location</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -9,13 +5,10 @@ postMessage(location === location);
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('returns-same-object.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
postMessage(location === location);
|
|
@ -1,19 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -21,23 +5,19 @@ postMessage([null, location.href, location.protocol, location.host,
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('setting-members.js');
|
||||
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[1], location.href.replace('.html', '.js'), '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[6], location.pathname.replace('.html', '.js'), '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>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
</script>
|
|
@ -0,0 +1,13 @@
|
|||
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]);
|
|
@ -1,13 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -15,18 +5,15 @@ x();
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('exception-in-onerror.js');
|
||||
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(e.filename, document.URL.replace('.html', '.js'), 'e.filename');
|
||||
assert_equals(typeof e.lineno, 'number', 'typeof e.lineno');
|
||||
assert_equals(typeof e.colno, 'number', 'typeof e.column');
|
||||
e.preventDefault(); // "handled"
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,7 @@
|
|||
onerror = function(a, b, c, d) {
|
||||
y(); // the error is "not handled"
|
||||
}
|
||||
function x() {
|
||||
y();
|
||||
}
|
||||
x();
|
|
@ -1,14 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -16,10 +5,10 @@ x();
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('handled.js');
|
||||
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(e.data[1], document.URL.replace('.html', '.js'), '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() {
|
||||
|
@ -30,7 +19,4 @@ async_test(function() {
|
|||
assert_unreached();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
onerror = function(a, b, c, d) {
|
||||
postMessage([a, b, c, d]);
|
||||
return true; // the error is "handled"
|
||||
}
|
||||
function x() {
|
||||
y();
|
||||
}
|
||||
x();
|
|
@ -1,13 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -15,18 +5,15 @@ x();
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('not-handled.js');
|
||||
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(e.filename, document.URL.replace('.html', '.js'), 'e.filename');
|
||||
assert_equals(typeof e.lineno, 'number', 'typeof e.lineno');
|
||||
assert_equals(typeof e.colno, 'number', 'typeof e.column');
|
||||
e.preventDefault(); // "handled"
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,7 @@
|
|||
onerror = function(a, b, c, d) {
|
||||
return false; // the error is "not handled"
|
||||
}
|
||||
function x() {
|
||||
y();
|
||||
}
|
||||
x();
|
|
@ -1,10 +1,3 @@
|
|||
<!--
|
||||
function x() {
|
||||
y();
|
||||
}
|
||||
x();
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>onerror, "not handled" with only window.onerror defined</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -15,17 +8,14 @@ setup({
|
|||
allow_uncaught_exception: true,
|
||||
});
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('propagate-to-window-onerror.js');
|
||||
window.onerror = this.step_func(function(a, b, c, d) {
|
||||
assert_equals(typeof a, 'string', 'first argument');
|
||||
assert_equals(b, document.URL+'#', 'second argument');
|
||||
assert_equals(b, document.URL.replace('.html', '.js'), 'second argument');
|
||||
assert_equals(typeof c, 'number', 'third argument');
|
||||
assert_equals(typeof d, 'number', 'fourth argument');
|
||||
this.done();
|
||||
return true; // "handled"
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,4 @@
|
|||
function x() {
|
||||
y();
|
||||
}
|
||||
x();
|
|
@ -1,23 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -25,7 +5,7 @@ postMessage(results);
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('self.js');
|
||||
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]);
|
||||
|
@ -33,7 +13,4 @@ async_test(function() {
|
|||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
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);
|
|
@ -1,7 +1,3 @@
|
|||
<!--
|
||||
setTimeout(function() { postMessage(1) }, 10);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setTimeout</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -9,15 +5,10 @@ setTimeout(function() { postMessage(1) }, 10);
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('001.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 1);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
setTimeout(function() { postMessage(1) }, 10);
|
|
@ -1,8 +1,3 @@
|
|||
<!--
|
||||
var t = setTimeout(function() { postMessage(1); }, 10);
|
||||
clearTimeout(t);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>clearTimeout</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -10,12 +5,9 @@ clearTimeout(t);
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('002.js');
|
||||
var gotMessage = false;
|
||||
worker.onmessage = function() { gotMessage = true; };
|
||||
setTimeout(this.step_func(function() { assert_false(gotMessage); this.done(); }), 100);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,2 @@
|
|||
var t = setTimeout(function() { postMessage(1); }, 10);
|
||||
clearTimeout(t);
|
|
@ -1,7 +1,3 @@
|
|||
<!--
|
||||
setInterval(function() { postMessage(1); }, 10);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setInterval</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -9,14 +5,10 @@ setInterval(function() { postMessage(1); }, 10);
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('003.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 1);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
setInterval(function() { postMessage(1); }, 10);
|
|
@ -1,10 +1,3 @@
|
|||
<!--
|
||||
var t = setInterval(function() {
|
||||
postMessage(1);
|
||||
}, 10);
|
||||
clearInterval(t);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>clearInterval</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -12,12 +5,9 @@ clearInterval(t);
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('004.js');
|
||||
var i = 0;
|
||||
worker.onmessage = function() { i++; }
|
||||
setTimeout(this.step_func(function() { assert_equals(i, 0); this.done(); }), 100);
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,4 @@
|
|||
var t = setInterval(function() {
|
||||
postMessage(1);
|
||||
}, 10);
|
||||
clearInterval(t);
|
|
@ -1,9 +1,3 @@
|
|||
<!--
|
||||
self.close();
|
||||
var t = setInterval(function() {}, 10);
|
||||
postMessage(t);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>setInterval when closing</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -11,13 +5,10 @@ postMessage(t);
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('005.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 1);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
self.close();
|
||||
var t = setInterval(function() {}, 10);
|
||||
postMessage(t);
|
|
@ -1,14 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -16,13 +5,10 @@ postMessage(x);
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('003.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, "abc");
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
var x = 'a';
|
||||
try {
|
||||
importScripts('data:text/javascript,x+="b"',
|
||||
'data:text/javascript,x+="c"');
|
||||
} catch(e) {
|
||||
x += "d"
|
||||
}
|
||||
postMessage(x);
|
|
@ -1,19 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -21,14 +5,11 @@ postMessage([x, exception]);
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('004.js');
|
||||
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>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,13 @@
|
|||
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]);
|
|
@ -1,15 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -17,14 +5,11 @@ postMessage([x, y]);
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('005.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data[0], undefined);
|
||||
assert_true(e.data[1]);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,9 @@
|
|||
var x;
|
||||
var y;
|
||||
try {
|
||||
importScripts('data:text/javascript,x={',
|
||||
'data:text/javascript,}');
|
||||
} catch(e) {
|
||||
y = true;
|
||||
}
|
||||
postMessage([x, y]);
|
|
@ -1,17 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
<meta name="timeout" content="long">
|
||||
|
@ -20,7 +6,7 @@ postMessage([x, y, z]);
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('006.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data[0], 1);
|
||||
assert_equals(e.data[1], 2);
|
||||
|
@ -28,7 +14,4 @@ async_test(function() {
|
|||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
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]);
|
|
@ -1,8 +1,3 @@
|
|||
<!--
|
||||
importScripts('data:text/javascript,postMessage(1)');
|
||||
postMessage(2);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>postMessage in importScripts</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -10,7 +5,7 @@ postMessage(2);
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('007.js');
|
||||
var i = 0;
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
i++;
|
||||
|
@ -19,7 +14,4 @@ async_test(function() {
|
|||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,2 @@
|
|||
importScripts('data:text/javascript,postMessage(1)');
|
||||
postMessage(2);
|
|
@ -1,9 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -11,13 +5,10 @@ run();
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('008.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_true(e.data);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
var log = postMessage;
|
||||
importScripts('data:text/javascript,function run() { log(true) }');
|
||||
run();
|
|
@ -1,9 +1,3 @@
|
|||
<!--
|
||||
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>
|
||||
|
@ -11,7 +5,7 @@ postMessage(run());
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('009.js');
|
||||
var i = 0;
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
i++;
|
||||
|
@ -23,7 +17,4 @@ async_test(function() {
|
|||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
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());
|
|
@ -1,17 +1,3 @@
|
|||
<!--
|
||||
// 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>
|
||||
|
@ -19,7 +5,7 @@ try {
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('010.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 'undefined');
|
||||
this.done();
|
||||
|
@ -28,7 +14,4 @@ async_test(function() {
|
|||
assert_unreached(e.message);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
// 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));
|
||||
}
|
|
@ -1,17 +1,3 @@
|
|||
<!--
|
||||
// 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>
|
||||
|
@ -19,7 +5,7 @@ try {
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('011.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, 'null');
|
||||
this.done();
|
||||
|
@ -28,7 +14,4 @@ async_test(function() {
|
|||
assert_unreached(e.message);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
// 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));
|
||||
}
|
|
@ -1,17 +1,3 @@
|
|||
<!--
|
||||
// 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>
|
||||
|
@ -19,7 +5,7 @@ try {
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('012.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, '1');
|
||||
this.done();
|
||||
|
@ -28,7 +14,4 @@ async_test(function() {
|
|||
assert_unreached(e.message);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
// 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));
|
||||
}
|
|
@ -1,7 +1,3 @@
|
|||
<!--
|
||||
postMessage(navigator.appName);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.appName</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -9,13 +5,10 @@ postMessage(navigator.appName);
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('002.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.appName);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
postMessage(navigator.appName);
|
|
@ -1,7 +1,3 @@
|
|||
<!--
|
||||
postMessage(navigator.appVersion);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.appVersion</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -9,13 +5,10 @@ postMessage(navigator.appVersion);
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('003.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.appVersion);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
postMessage(navigator.appVersion);
|
|
@ -1,7 +1,3 @@
|
|||
<!--
|
||||
postMessage(navigator.platform);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.platform</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -9,13 +5,10 @@ postMessage(navigator.platform);
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('004.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.platform);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
postMessage(navigator.platform);
|
|
@ -1,7 +1,3 @@
|
|||
<!--
|
||||
postMessage(navigator.userAgent);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.userAgent</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -9,13 +5,10 @@ postMessage(navigator.userAgent);
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('005.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.userAgent);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
postMessage(navigator.userAgent);
|
|
@ -1,7 +1,3 @@
|
|||
<!--
|
||||
postMessage(navigator.onLine);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.onLine</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -9,13 +5,10 @@ postMessage(navigator.onLine);
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('006.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.onLine);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
postMessage(navigator.onLine);
|
|
@ -1,15 +1,3 @@
|
|||
<!--
|
||||
var log = [];
|
||||
var neverEncounteredValue = "This is not the value you are looking for.";
|
||||
for (x in navigator) {
|
||||
// this should silently fail and not throw per webidl
|
||||
navigator[x] = neverEncounteredValue;
|
||||
if (navigator[x] === neverEncounteredValue)
|
||||
log.push(x);
|
||||
}
|
||||
postMessage(log.join(', '));
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>readonlyness of members of Navigator</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -17,14 +5,10 @@ postMessage(log.join(', '));
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('007.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, '');
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
|
||||
</script>
|
|
@ -0,0 +1,9 @@
|
|||
var log = [];
|
||||
var neverEncounteredValue = "This is not the value you are looking for.";
|
||||
for (x in navigator) {
|
||||
// this should silently fail and not throw per webidl
|
||||
navigator[x] = neverEncounteredValue;
|
||||
if (navigator[x] === neverEncounteredValue)
|
||||
log.push(x);
|
||||
}
|
||||
postMessage(log.join(', '));
|
|
@ -1,7 +1,3 @@
|
|||
<!--
|
||||
postMessage(navigator.language);
|
||||
/*
|
||||
-->
|
||||
<!doctype html>
|
||||
<title>navigator.language</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -9,13 +5,10 @@ postMessage(navigator.language);
|
|||
<div id=log></div>
|
||||
<script>
|
||||
async_test(function() {
|
||||
var worker = new Worker('#');
|
||||
var worker = new Worker('language.js');
|
||||
worker.onmessage = this.step_func(function(e) {
|
||||
assert_equals(e.data, navigator.language);
|
||||
this.done();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
*/
|
||||
//-->
|
||||
</script>
|
|
@ -0,0 +1 @@
|
|||
postMessage(navigator.language);
|
Loading…
Add table
Add a link
Reference in a new issue