From e59521c716f1d7957b576f3dd9b12d25effcbd1d Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 18 Jun 2021 15:04:51 +0200 Subject: [PATCH] fix: silence iframe errors, closes #1483 --- packages/app-backend-core/src/hook.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/app-backend-core/src/hook.ts b/packages/app-backend-core/src/hook.ts index 3124346f6..1aa541ef9 100644 --- a/packages/app-backend-core/src/hook.ts +++ b/packages/app-backend-core/src/hook.ts @@ -19,11 +19,15 @@ export function installHook (target, isIframe = false) { if ((iframe as any).__vdevtools__injected) continue (iframe as any).__vdevtools__injected = true const inject = () => { - (iframe.contentWindow as any).__VUE_DEVTOOLS_IFRAME__ = iframe - const script = iframe.contentDocument.createElement('script') - script.textContent = ';(' + installHook.toString() + ')(window, true)' - iframe.contentDocument.documentElement.appendChild(script) - script.parentNode.removeChild(script) + try { + (iframe.contentWindow as any).__VUE_DEVTOOLS_IFRAME__ = iframe + const script = iframe.contentDocument.createElement('script') + script.textContent = ';(' + installHook.toString() + ')(window, true)' + iframe.contentDocument.documentElement.appendChild(script) + script.parentNode.removeChild(script) + } catch (e) { + // Ignore + } } inject() iframe.addEventListener('load', () => inject())