fix(sandbox): Implement send method in fakeXMLHttpRequest class #713
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Checklist