Skip to content

Commit f035d8b

Browse files
authored
Merge pull request #1632 from jd-opensource/dev
发布到默认分支
2 parents b575fdd + 3b4d1f5 commit f035d8b

File tree

7 files changed

+32
-5
lines changed

7 files changed

+32
-5
lines changed

Contact.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11

22
欢迎小伙伴们加入micro-app微信群交流^ ^
3-
![f08d41cdea5a364a9277d443e90f2f25](https://github.com/user-attachments/assets/47bf5fcb-60a6-48b5-81e1-31302e10b1e9)
3+
![d9954f365a194cab1408e95846e0f98c](https://github.com/user-attachments/assets/8dd1826e-8e47-4557-b06b-26fbbfd06e4d)
4+
45

56

67

78

89

910
欢迎小伙伴们加入micro-app-DevTools开发交流群^ ^
10-
![5795b83d20722041992bc38f6917f25d](https://github.com/user-attachments/assets/bdfc12e8-982a-4772-8d80-82dc23ec1647)
11+
![20aab719ed36bb0eee4025ea957031da](https://github.com/user-attachments/assets/3872f24e-58a8-4848-bb92-7035f83edde2)
12+
1113

1214

1315

docs/zh-cn/advanced.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,12 @@ microApp.start({
102102
disableIframeRootDocument: true
103103
})
104104
```
105+
## 7、excludeRewriteIframeConstructor : iframe模式下排除对指定构造函数的Symbol.hasInstance属性重写
106+
```js
107+
import microApp from '@micro-zoe/micro-app'
105108

109+
microApp.start({
110+
// iframe模式下,不对事件对象的原型判断进行代理
111+
excludeRewriteIframeConstructor: ['EventTarget']
112+
})
113+
```

docs/zh-cn/changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
- 修订版本号:每周末会进行日常 bugfix 更新。(如果有紧急的 bugfix,则任何时候都可发布)
88

99
---
10+
### 1.0.0-rc.27
11+
12+
`2025-08-29`
13+
- **Feature**
14+
- 支持 excludeRewriteIframeConstructor : iframe模式下排除对指定构造函数的Symbol.hasInstance属性重写,默认为空会进行重写。
15+
- **Bug Fix**
16+
- 🐞 修复 当`with`沙箱自动补全生效时,实例化`XMLHttpRequest`后的`open`属性无法调用的问题
17+
1018
### 1.0.0-rc.26
1119

1220
`2025-05-25`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@micro-zoe/micro-app",
3-
"version": "1.0.0-rc.26",
3+
"version": "1.0.0-rc.27",
44
"description": "A lightweight, efficient and powerful micro front-end framework",
55
"private": false,
66
"main": "lib/index.min.js",

src/sandbox/iframe/window.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ function patchWindowProperty (
9494
* 4. native url instanceof iframe window.URL
9595
* ...
9696
*/
97-
if (isConstructor(microAppWindow[key]) && key in rawWindow && !UN_PROXY_INSTANCEOF_KEYS.includes(key)) {
97+
if (
98+
isConstructor(microAppWindow[key]) &&
99+
key in rawWindow &&
100+
!UN_PROXY_INSTANCEOF_KEYS.includes(key) &&
101+
!microApp.options.excludeRewriteIframeConstructor?.includes(key)
102+
) {
98103
rawDefineProperty(microAppWindow[key], Symbol.hasInstance, {
99104
configurable: true,
100105
enumerable: false,

src/sandbox/request.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function createMicroFetch (url: string, target?: Window['fetch']): Window
4747
export function createMicroXMLHttpRequest (url: string, target?: XMLHttpRequest): any {
4848
const rawXMLHttpRequest = !isUndefined(target) ? target : globalEnv.rawWindow.XMLHttpRequest
4949
if (!isConstructor(rawXMLHttpRequest)) return rawXMLHttpRequest
50-
return class MicroXMLHttpRequest extends rawXMLHttpRequest {
50+
class MicroXMLHttpRequest extends rawXMLHttpRequest {
5151
open (method: string, reqUrl: string, ...rests: unknown[]): void {
5252
if ((isString(reqUrl) && !/^f(ile|tp):\/\//.test(reqUrl)) || isURL(reqUrl)) {
5353
reqUrl = createURL(reqUrl, url).toString()
@@ -56,6 +56,9 @@ export function createMicroXMLHttpRequest (url: string, target?: XMLHttpRequest)
5656
super.open(method, reqUrl, ...rests)
5757
}
5858
}
59+
// The methods defined by class are hung on the prototype, and enumerable is false by default
60+
MicroXMLHttpRequest.prototype && Object.defineProperty(MicroXMLHttpRequest.prototype, 'open', { enumerable: true })
61+
return MicroXMLHttpRequest
5962
}
6063

6164
export interface EventSourceInstance {

typings/global.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ declare module '@micro-app/types' {
372372
inheritBaseBody?:boolean,
373373
escapeIframeWindowEvents? : Array<string>,
374374
disableIframeRootDocument?: boolean,
375+
excludeRewriteIframeConstructor?: string[]
375376
}
376377

377378
// MicroApp config

0 commit comments

Comments
 (0)