Skip to content

Commit 92a8d43

Browse files
committed
* modal: add error handling for iframe properties and ensure safe execution of height watching and class addition
1 parent b79a95f commit 92a8d43

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

lib/modal/src/component/modal-iframe-content.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,18 @@ export class ModalIframeContent extends Component<ModalIframeContentProps> {
7777
return;
7878
}
7979

80-
const {iframeBodyClass, watchHeight} = this.props;
80+
try {
81+
const {iframeBodyClass, watchHeight} = this.props;
8182

82-
if (watchHeight) {
83-
this._watchIframeHeight();
84-
}
83+
if (watchHeight) {
84+
this._watchIframeHeight();
85+
}
8586

86-
if (iframeBodyClass) {
87-
iframeDoc.body.classList.add(iframeBodyClass);
87+
if (iframeBodyClass) {
88+
iframeDoc.body.classList.add(iframeBodyClass);
89+
}
90+
} catch {
91+
// ignore error
8892
}
8993

9094
$(this._ref.current).trigger('modal-iframe-loaded');

0 commit comments

Comments
 (0)