Backed out changeset e7d649603075 (bug 842081) for mochitest-4 bustage on a CLOSED TREE

This commit is contained in:
Wes Kocher 2013-10-15 19:54:11 -07:00
Родитель ac2a7d628f
Коммит 1172712d65
2 изменённых файлов: 29 добавлений и 67 удалений

Просмотреть файл

@ -22,7 +22,7 @@ Tests of DOM Worker transferable objects
function test1(sizes) { function test1(sizes) {
if (!sizes.length) { if (!sizes.length) {
runTests(); SimpleTest.finish();
return; return;
} }
@ -32,15 +32,10 @@ Tests of DOM Worker transferable objects
worker.onmessage = function(event) { worker.onmessage = function(event) {
ok(event.data.status, event.data.event); ok(event.data.status, event.data.event);
if (!event.data.status) { if (!event.data.status) {
runTests(); SimpleTest.finish();
return; return;
} }
if ("notEmpty" in event.data && "byteLength" in event.data.notEmpty) {
ok(event.data.notEmpty.byteLength != 0,
"P: NotEmpty object received: " + event.data.notEmpty.byteLength);
}
if (!event.data.last) if (!event.data.last)
return; return;
@ -65,57 +60,14 @@ Tests of DOM Worker transferable objects
ok(true, "P: PostMessage - Exception for duplicate"); ok(true, "P: PostMessage - Exception for duplicate");
} }
var ab = new ArrayBuffer(size); ab = new ArrayBuffer(size);
ok(ab.byteLength == size, "P: The size is: " + size + " == " + ab.byteLength); ok(ab.byteLength == size, "P: The size is: " + size + " == " + ab.byteLength);
worker.postMessage({ data: 0, timeout: 0, ab: ab, cb: ab, size: size }, [ab]); worker.postMessage({ data: 0, timeout: 0, ab: ab, cb: ab, size: size }, [ab]);
ok(ab.byteLength == 0, "P: PostMessage - The size is: 0 == " + ab.byteLength) ok(ab.byteLength == 0, "P: PostMessage - The size is: 0 == " + ab.byteLength)
} }
function test2() { test1([1024 * 1024 * 32, 128, 4]);
var worker = new Worker("transferable_worker.js");
worker.onmessage = function(event) {
ok(event.data.status, event.data.event);
if (!event.data.status) {
runTests();
return;
}
if ("notEmpty" in event.data && "byteLength" in event.data.notEmpty) {
ok(event.data.notEmpty.byteLength != 0,
"P: NotEmpty object received: " + event.data.notEmpty.byteLength);
}
if (event.data.last) {
runTests();
}
}
worker.onerror = function(event) {
ok(false, "No errors!");
}
var f = new Float32Array([0,1,2,3]);
ok(f.byteLength != 0, "P: The size is: " + f.byteLength + " is not 0");
worker.postMessage({ event: "P: postMessage with Float32Array", status: true,
size: 4, notEmpty: f, bc: [ f, f, { dd: f } ] }, [f.buffer]);
ok(f.byteLength == 0, "P: The size is: " + f.byteLength + " is 0");
}
var tests = [
function() { test1([1024 * 1024 * 32, 128, 4]); },
test2
];
function runTests() {
if (!tests.length) {
SimpleTest.finish();
return;
}
var test = tests.shift();
test();
}
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
runTests();
</script> </script>
</pre> </pre>

Просмотреть файл

@ -4,20 +4,30 @@
*/ */
onmessage = function(event) { onmessage = function(event) {
if ("notEmpty" in event.data && "byteLength" in event.data.notEmpty) { if (event.data.data == 0) {
postMessage({ event: "W: NotEmpty object received: " + event.data.notEmpty.byteLength, ab = new ArrayBuffer(event.data.size);
status: event.data.notEmpty.byteLength != 0, last: false }); postMessage({ event: "W: The size is: " + event.data.size + " == " + ab.byteLength,
status: ab.byteLength == event.data.size, last: false });
postMessage({ event: "W: postMessage with arrayBuffer", status: true,
ab: ab, bc: [ ab, ab, { dd: ab } ] }, [ab]);
postMessage({ event: "W: The size is: 0 == " + ab.byteLength,
status: ab.byteLength == 0, last: false });
postMessage({ event: "last one!", status: true, last: true });
} else {
var worker = new Worker('sync_worker.js');
worker.onmessage = function(event) {
postMessage(event.data);
}
worker.onsyncmessage = function(event) {
var v = postSyncMessage(event.data, null, 500);
event.reply(v);
}
--event.data.data;
worker.postMessage(event.data);
} }
var ab = new ArrayBuffer(event.data.size);
postMessage({ event: "W: The size is: " + event.data.size + " == " + ab.byteLength,
status: ab.byteLength == event.data.size, last: false });
postMessage({ event: "W: postMessage with arrayBuffer", status: true,
notEmpty: ab, ab: ab, bc: [ ab, ab, { dd: ab } ] }, [ab]);
postMessage({ event: "W: The size is: 0 == " + ab.byteLength,
status: ab.byteLength == 0, last: false });
postMessage({ event: "W: last one!", status: true, last: true });
} }