Bug 988816 - Test case to read memory-mapped array buffer in a packaged app with OOP. r=fabrice

This commit is contained in:
Shian-Yow Wu 2014-07-18 10:46:25 +08:00
Родитель ce46456625
Коммит 2510291f80
2 изменённых файлов: 19 добавлений и 5 удалений

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

@ -23,6 +23,13 @@
sendMessage("KO: " + msg);
}
function is(a, b, msg) {
if (a == b)
sendMessage("OK: " + a + " == " + b + " - " + msg);
else
sendMessage("KO: " + a + " != " + b + " - " + msg);
}
function testXHR(file, data_head, mapped, cb) {
var xhr = new XMLHttpRequest();
xhr.open('GET', file);
@ -41,8 +48,8 @@
var data = xhr.response;
ok(data, "Data is non-null");
var str = String.fromCharCode.apply(null, Uint8Array(data));
ok(str.length == data_head.length + gPaddingSize, "Data size is correct");
ok(str.slice(0, data_head.length) == data_head, "Data head is correct");
is(str.length, data_head.length + gPaddingSize, "Data size is correct");
is(str.slice(0, data_head.length), data_head, "Data head is correct");
ok(str.slice(data_head.length) == gPadding, "Data padding is correct");
cb();
} else {

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

@ -91,8 +91,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=945152
};
yield undefined;
// Launch app.
launchApp(app, continueTest);
// Launch app non-OOP.
info("Launch app with non-OOP");
launchApp(app, continueTest, false);
yield undefined;
// Launch app OOP.
info("Launch app with OOP");
launchApp(app, continueTest, true);
yield undefined;
// Uninstall app.
@ -116,9 +122,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=945152
xhr.send();
}
function launchApp(app, cb) {
function launchApp(app, cb, oop) {
// Set up the app.
var ifr = document.createElement('iframe');
ifr.setAttribute('remote', oop ? 'true' : 'false');
ifr.setAttribute('mozbrowser', 'true');
ifr.setAttribute('mozapp', app.manifestURL);
ifr.setAttribute('src', app.origin + app.manifest.launch_path);