Skip to content

Commit ebbbf09

Browse files
authored
Merge pull request #898 from cakephp/4.x-error-iframe
4.x: show debug_kit iframe error nicely
2 parents 5373983 + 0c78cb5 commit ebbbf09

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

webroot/css/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,10 @@ strong {
574574
display: block;
575575
}
576576

577+
.c-panel-content-container__content {
578+
height: 100%;
579+
}
580+
577581
.c-panel-content-container__content .o-loader {
578582
display: none;
579583
}

webroot/js/inject-iframe.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ if (elem) {
2727
iframe.height = '100%';
2828
doc.body.style.overflow = 'hidden';
2929
}
30+
if (event.data === 'error') {
31+
iframe.width = '40%';
32+
iframe.height = '40%';
33+
doc.body.style.overflow = bodyOverflow;
34+
}
3035
};
3136

3237
const onReady = () => {

webroot/js/modules/Toolbar.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,14 @@ export default class Toolbar {
152152
// This initializes the panel specific JS logic (if there is any)
153153
document.dispatchEvent(new CustomEvent('initPanel', { detail: `panel${panelType}` }));
154154
that.bindDebugBlock();
155-
});
155+
})
156+
.fail((response) => {
157+
clearTimeout(timer);
158+
contentArea.html(response.responseText);
159+
$('.o-loader').removeClass('is-loading');
160+
$('.c-panel-content-container').addClass('is-active');
161+
window.parent.postMessage('error', window.location.origin);
162+
});
156163
}
157164

158165
// This re-inits the collapsible Debugger::exportVar() content of the Variables tab

0 commit comments

Comments
 (0)