diff --git a/dom/apps/tests/file_bug_945152.html b/dom/apps/tests/file_bug_945152.html
index 2c8a09ae0a8..c8485bed4b2 100644
--- a/dom/apps/tests/file_bug_945152.html
+++ b/dom/apps/tests/file_bug_945152.html
@@ -30,7 +30,7 @@
sendMessage("KO: " + a + " != " + b + " - " + msg);
}
- function testXHR(file, data_head, mapped, cb) {
+ function check_XHR(file, data_head, mapped, cb) {
var xhr = new XMLHttpRequest();
xhr.open('GET', file);
xhr.responseType = 'arraybuffer';
@@ -60,19 +60,57 @@
xhr.send();
}
+ function check_XHR_mapped(file, cb) {
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', file);
+ xhr.responseType = 'arraybuffer';
+ xhr.onreadystatechange = function xhrReadystatechange() {
+ if (xhr.readyState !== xhr.DONE) {
+ return;
+ }
+ if (xhr.status && xhr.status == 200) {
+ var ct = xhr.getResponseHeader("Content-Type");
+ cb(ct.indexOf("mem-mapped") != -1);
+ } else {
+ cb(false);
+ }
+ }
+ xhr.send();
+ }
+
+ // Reading multiple mapped array buffer by XHR simultaneously
+ function test_simultaneous() {
+ var count = 0;
+ var num = 100;
+ var succeed = true;
+ function cb(result) {
+ if (!result) {
+ succeed = false;
+ }
+ if (++count == num) {
+ ok(succeed, "Succeeded on simultaneous access test");
+ runTests();
+ }
+ }
+ for (var i = 0; i < num; i++) {
+ check_XHR_mapped('data_1.txt', cb);
+ }
+ }
+
// Memory-mapped array buffer.
function test_mapped() {
- testXHR('data_1.txt', gData1, true, runTests);
+ check_XHR('data_1.txt', gData1, true, runTests);
}
// Non memory-mapped array buffer.
function test_non_mapped() {
// Make sure array buffer retrieved from compressed file in package is
// handled by memory allocation instead of memory mapping.
- testXHR('data_2.txt', gData2, false, runTests);
+ check_XHR('data_2.txt', gData2, false, runTests);
}
var tests = [
+ test_simultaneous,
test_mapped,
test_non_mapped
];