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 saveStyleSafe: false
sessionStorageHash: false sessionStorageHash: false
download: false download: false
doTimeout: false
# localization.js # localization.js
template: false template: false
t: false t: false

View File

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

View File

@ -359,3 +359,10 @@ function download(url) {
xhr.send(query); 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));
}