Skip to content

Commit 68ed5ae

Browse files
committed
fix: initiator in websocket cannot work
1 parent 7520abc commit 68ed5ae

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/network-debugger/src/fork/request-center.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,19 @@ export class RequestCenter {
141141
}
142142

143143
public initRequest(request: RequestDetail) {
144+
// replace callFrames' scriptId
145+
// TODO: 双向绑定 initiator
146+
if (request.initiator) {
147+
request.initiator.stack.callFrames.forEach((frame) => {
148+
const fileUrl = pathToFileURL(frame.url)
149+
const scriptId =
150+
this.resourceService.getScriptIdByUrl(fileUrl.href) ??
151+
this.resourceService.getScriptIdByUrl(frame.url)
152+
if (scriptId) {
153+
frame.scriptId = scriptId
154+
}
155+
})
156+
}
144157
this.requests[request.id] = request
145158
}
146159

0 commit comments

Comments
 (0)