Skip to content

fix(sandbox): Implement send method in fakeXMLHttpRequest class #713

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

onjuju
Copy link

@onjuju onjuju commented Apr 10, 2025

Description

显式实现沙箱中 fakeXMLHttpRequest.prototype.send 方法,没有特殊逻辑,仅主动调用父类的 send 实现

Related Issue

在子应用重写 window.XMLHttpRequest.send,再在主应用中重写 window.XMLHttpRequest.send,接着在子应用中发起 xhr.send 时,不会走进第二次重写的逻辑。

原因是 Garfish 中子应用沙箱重写了 fakeXMLHttpRequest 作为 XMLHttpRequest,实现了 open/abort 方法并继承父类的实现(以及一些特殊逻辑),但没有实现 send 方法。

导致在第一次子应用重写 send 方法后,fakeXMLHttpRequest.prototype 加上了 send 方法,调用 xhr.send 时不会通过原型链找到父类的 send

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

Copy link

vercel bot commented Apr 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
garfish ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2025 7:35am

@CLAassistant
Copy link

CLAassistant commented Apr 10, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants