1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Call correct quit function and wait request sending.

This commit is contained in:
Brendan Dahl 2014-04-11 11:02:03 -07:00 committed by Yury Delendik
parent 70ce3a88a1
commit 339f8f0ac9

View file

@ -352,9 +352,16 @@ function snapshotCurrentPage(task, failure) {
});
}
function sendQuitRequest() {
function sendQuitRequest(cb) {
var r = new XMLHttpRequest();
r.open('POST', '/tellMeToQuit?path=' + escape(appPath), false);
r.onreadystatechange = function sendQuitRequestOnreadystatechange(e) {
if (r.readyState == 4) {
if (cb) {
cb();
}
}
};
r.send(null);
}
@ -362,12 +369,13 @@ function quitApp() {
log('Done !');
document.body.innerHTML = 'Tests are finished. <h1>CLOSE ME!</h1>' +
document.body.innerHTML;
if (window.SpecialPowers) {
SpecialPowers.quitApplication();
} else {
sendQuitRequest();
window.close();
}
sendQuitRequest(function () {
if (window.SpecialPowers) {
SpecialPowers.quit();
} else {
window.close();
}
});
}
function done() {