From ee231e79183ba1f73244f4e1a9a21920342da1d8 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Mon, 14 Mar 2016 13:41:23 +0100 Subject: [PATCH] ext6migrate: fix framework caching issue in extjs 5/6 there is a caching issue, where they save dom elements for reuse, but the garbage collector can set them to null when the framework now reuses the "cached" element it is null, and any action on it produces an error, which breaks the site for details see the forum link in the comment Signed-off-by: Dominik Csapak --- www/manager6/Toolkit.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/www/manager6/Toolkit.js b/www/manager6/Toolkit.js index 263dea16..ff59a55a 100644 --- a/www/manager6/Toolkit.js +++ b/www/manager6/Toolkit.js @@ -112,6 +112,39 @@ Ext.override(Ext.form.field.ComboBox, { } }); +// ExtJs 5-6 has an issue with caching +// see https://www.sencha.com/forum/showthread.php?308989 +Ext.define('PVE.UnderlayPool', { + override: 'Ext.dom.UnderlayPool', + + checkOut: function () { + var cache = this.cache, + len = cache.length, + el; + + // do cleanup because some of the objects might have been destroyed + while (len--) { + if (cache[len].destroyed) { + cache.splice(len, 1); + } + } + // end do cleanup + + el = cache.shift(); + + if (!el) { + el = Ext.Element.create(this.elementConfig); + el.setVisibilityMode(2); + // + // tell the spec runner to ignore this element when checking if the dom is clean + el.dom.setAttribute('data-sticky', true); + // + } + + return el; + } +}); + Ext.define('Ext.ux.IFrame', { extend: 'Ext.Component',