add a workaround for Chrome 65 bug https://crbug.com/714373
This commit is contained in:
parent
a6e2cf47ed
commit
3df4a86428
|
@ -277,33 +277,31 @@ $('#file-all-styles').onclick = () => {
|
||||||
API.getStyles().then(styles => {
|
API.getStyles().then(styles => {
|
||||||
const text = JSON.stringify(styles, null, '\t');
|
const text = JSON.stringify(styles, null, '\t');
|
||||||
const blob = new Blob([text], {type: 'application/json'});
|
const blob = new Blob([text], {type: 'application/json'});
|
||||||
const objectURL = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
let link = $create('a', {
|
let link = $create('a', {
|
||||||
href: objectURL,
|
href: url,
|
||||||
type: 'application/json',
|
type: 'application/json',
|
||||||
download: generateFileName(),
|
download: generateFileName(),
|
||||||
});
|
});
|
||||||
// TODO: remove the fallback when FF multi-process bug is fixed
|
// https://crbug.com/714373
|
||||||
if (!FIREFOX) {
|
if (!FIREFOX && !(CHROME > 3310 && CHROME < Infinity)) {
|
||||||
link.dispatchEvent(new MouseEvent('click'));
|
link.dispatchEvent(new MouseEvent('click'));
|
||||||
setTimeout(() => URL.revokeObjectURL(objectURL));
|
return doTimeout()
|
||||||
} else {
|
.then(() => URL.revokeObjectURL(url));
|
||||||
const iframe = document.body.appendChild($create('iframe', {
|
|
||||||
style: 'width: 0; height: 0; position: fixed; opacity: 0;'.replace(/;/g, '!important;'),
|
|
||||||
}));
|
|
||||||
doTimeout()
|
|
||||||
.then(() => {
|
|
||||||
link = iframe.contentDocument.importNode(link, true);
|
|
||||||
iframe.contentDocument.body.appendChild(link);
|
|
||||||
})
|
|
||||||
.then(() => doTimeout())
|
|
||||||
.then(() => link.dispatchEvent(new MouseEvent('click')))
|
|
||||||
.then(() => doTimeout(1000))
|
|
||||||
.then(() => {
|
|
||||||
URL.revokeObjectURL(objectURL);
|
|
||||||
iframe.remove();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
const iframe = document.body.appendChild($create('iframe', {
|
||||||
|
style: 'width: 0; height: 0; position: fixed; opacity: 0;'.replace(/;/g, '!important;'),
|
||||||
|
}));
|
||||||
|
return doTimeout()
|
||||||
|
.then(() => {
|
||||||
|
link = iframe.contentDocument.importNode(link, true);
|
||||||
|
iframe.contentDocument.body.appendChild(link);
|
||||||
|
})
|
||||||
|
.then(() => doTimeout())
|
||||||
|
.then(() => link.dispatchEvent(new MouseEvent('click')))
|
||||||
|
.then(() => doTimeout(1000))
|
||||||
|
.then(() => URL.revokeObjectURL(url))
|
||||||
|
.then(() => iframe.remove());
|
||||||
});
|
});
|
||||||
|
|
||||||
function doTimeout(ms) {
|
function doTimeout(ms) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user