From 667da96c970283cbf0fc2b3672fba3812886be65 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Sun, 31 Jul 2022 15:35:14 +0100 Subject: [PATCH] Fix crash when closing plugin library Fixes #6855 --- core/modules/startup/browser-messaging.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/modules/startup/browser-messaging.js b/core/modules/startup/browser-messaging.js index 25aae9a92..733041e45 100644 --- a/core/modules/startup/browser-messaging.js +++ b/core/modules/startup/browser-messaging.js @@ -62,12 +62,14 @@ function loadIFrame(url,callback) { Unload library iframe for given url */ function unloadIFrame(url){ - $tw.utils.each(document.getElementsByTagName('iframe'), function(iframe) { + var iframes = document.getElementsByTagName('iframe'); + for(var t=iframes.length-1; t--; t>=0) { + var iframe = iframes[t]; if(iframe.getAttribute("library") === "true" && iframe.getAttribute("src") === url) { iframe.parentNode.removeChild(iframe); } - }); + } } function saveIFrameInfoTiddler(iframeInfo) {