fixup e199e1b3 for non-e10s FF: moar timeouts!

This commit is contained in:
tophf 2017-06-27 12:55:47 +03:00
parent 9163a856f6
commit 1c1a9f2804
3 changed files with 16 additions and 6 deletions

View File

@ -37,6 +37,7 @@ globals:
saveStyleSafe: false
sessionStorageHash: false
download: false
doTimeout: false
# localization.js
template: false
t: false

View File

@ -329,14 +329,16 @@ $('#file-all-styles').onclick = () => {
tag: 'iframe',
style: 'width: 0; height: 0; position: fixed; opacity: 0;'.replace(/;/g, '!important;'),
}));
setTimeout(() => {
doTimeout().then(() => {
link = iframe.contentDocument.importNode(link, true);
iframe.contentDocument.body.appendChild(link);
link.dispatchEvent(new MouseEvent('click'));
setTimeout(() => {
})
.then(doTimeout)
.then(() => link.dispatchEvent(new MouseEvent('click')))
.then(doTimeout(1000))
.then(() => {
URL.revokeObjectURL(objectURL);
iframe.remove();
}, 1000);
});
}
});

View File

@ -359,3 +359,10 @@ function download(url) {
xhr.send(query);
});
}
function doTimeout(ms = 0, ...args) {
return ms > 0
? () => new Promise(resolve => setTimeout(resolve, ms, ...args))
: new Promise(resolve => setTimeout(resolve, 0, ...args));
}