Skip to content

Commit 2fad234

Browse files
committed
Handle potential error by logging it to the console
1 parent 4fd8bc7 commit 2fad234

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

webroot/js/inject-iframe.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ if (elem) {
9696
type: this.getResponseHeader('Content-Type'),
9797
};
9898

99-
iframe.contentWindow.postMessage(`ajax-completed$$${JSON.stringify(params)}`, window.location.origin);
99+
if (iframe && iframe.contentWindow) {
100+
iframe.contentWindow.postMessage(`ajax-completed$$${JSON.stringify(params)}`, window.location.origin);
101+
} else {
102+
console.warn('DebugKit: Unable to send ajax completion message - iframe not available');
103+
}
100104
}
101105
if (original) {
102106
return original.apply(this, [].slice.call(arguments));

0 commit comments

Comments
 (0)