Skip to content

Commit

Permalink
fix: silence iframe errors, closes #1483
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Jun 18, 2021
1 parent a69e697 commit e59521c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/app-backend-core/src/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit e59521c

Please sign in to comment.