Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复子应用循环嵌套iframe出现window 指向错误 #775

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

loycoder
Copy link

@loycoder loycoder commented Dec 25, 2023

  • ✅ 提交符合commit规范
  • ✅ 测试用例添加
  • npm run test通过
详细描述

问题描述:
在子应用中,如果出现iframe 场景,使用的postmessage传递消息, 会出现事件派发到基座的 window,而并非子应用的window
image

原因:
patchIframeEvents 中对 iframe 事件的处理,当未指定 options.targetWindow 时,使用的是iframeWindow, 应该优先使用window.WUJIE_RAW_WINDOW
image

@yiludege
Copy link
Collaborator

yiludege commented Jan 2, 2024

patchIframeEvents 中对 iframe 事件的处理,当未指定 options.targetWindow 时,使用的是iframeWindow, 应该优先使用window.WUJIE_RAW_WINDOW

这个地方感觉有问题呢,子应用window监听为啥不绑子应用的iframewindow,如果采用window.WUJIE_RAW_WINDOW,意味着绑定的是主应用的window哦

@yumanman88
Copy link

子应用使用window.WUJIE_RAW_WINDOW监听message,子应用内嵌的iframe发送信息时应该怎么取target呢

@cxl623
Copy link

cxl623 commented Jan 11, 2024

好像拿到的window还是无界项目的啊

@yiludege
Copy link
Collaborator

子应用使用window.WUJIE_RAW_WINDOW监听message,子应用内嵌的iframe发送信息时应该怎么取target呢

postmessage 的使用已经在demo更新了

@yiludege yiludege added the invalid This doesn't seem right label Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants