mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix: cleanup iframe first to prevent memory leaks, see #1609
This commit is contained in:
parent
6020386bbe
commit
485a49e451
@ -479,6 +479,16 @@ export class DocumentCloner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static destroy(container: HTMLIFrameElement): boolean {
|
static destroy(container: HTMLIFrameElement): boolean {
|
||||||
|
// cleanup iframe first to prevent memory leaks, see #1609
|
||||||
|
try{
|
||||||
|
const iframe=container.contentWindow;
|
||||||
|
container.src='about:blank';
|
||||||
|
if(iframe) {
|
||||||
|
iframe.document.write('');
|
||||||
|
iframe.document.clear();
|
||||||
|
iframe.close();
|
||||||
|
}
|
||||||
|
}catch {}
|
||||||
if (container.parentNode) {
|
if (container.parentNode) {
|
||||||
container.parentNode.removeChild(container);
|
container.parentNode.removeChild(container);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user