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:
parent
70ce3a88a1
commit
339f8f0ac9
1 changed files with 15 additions and 7 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue