Resize loop
Hi,
Configuration:
* Moodle 3.7
* Browser: Firefox 85.0.2
Firefox enters a resizing loop which exhausts CPU ressources. As a consequence the browser becomes irresponsive or javascript functions appears to not fire up
I modified the code of embed.js like so to get around this issue
resizeDelay = undefined;
H5P.on(instance, 'resize', function() {
if (H5P.isFullscreen) {
return; // Skip iframe resize.
}
// Use a delay to make sure iframe is resized to the correct size.
if (resizeDelay===undefined) {
resizeDelay = setTimeout(function() {
// Only resize if the iframe can be resized.
if (parentIsFriendly) {
H5PEmbedCommunicator.send('prepareResize',
{
scrollHeight: iFrame.contentDocument.body.scrollHeight,
clientHeight: iFrame.contentDocument.body.clientHeight
}
);
} else {
H5PEmbedCommunicator.send('hello');
}
resizeDelay=undefined;
}, 1000);
}
});
Sincere regards,
Bruno