Skip to content

Commit d5ed216

Browse files
committed
fix: Fix possible "Cannot read property" error by sendBeacon. (issue #615)
1 parent 56efb35 commit d5ed216

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ English | [简体中文](./CHANGELOG_CN.md)
44

55
- `Feat(Netwrk)` Add new option `network.ignoreUrlRegExp` to skip some requests. (PR #623)
66
- `Fix(Core)` Fix prototype pollution in `vConsole.setOption()`. (issue #616 #621)
7+
- `Fix(Network)` Fix possible "Cannot read property" error by `sendBeacon`. (issue #615)
78

89

910
## 3.15.0 (2022-11-02)

CHANGELOG_CN.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- `Feat(Netwrk)` 新增配置项 `network.ignoreUrlRegExp` 以跳过一些请求。 (PR #623)
66
- `Fix(Core)` 修复 `vConsole.setOption()` 中可能存在的原型污染问题。 (issue #616 #621)
7+
- `Fix(Network)` 修复可能由 `sendBeacon` 引发的 "Cannot read property" 错误。 (issue #615)
78

89

910
## 3.15.0 (2022-11-02)

src/network/network.model.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class VConsoleNetworkModel extends VConsoleModel {
105105
* @private
106106
*/
107107
private mockSendBeacon() {
108-
if (!window.navigator.sendBeacon) {
108+
if (!window?.navigator?.sendBeacon) {
109109
return;
110110
}
111111
window.navigator.sendBeacon = BeaconProxy.create((item: VConsoleNetworkRequestItem) => {

0 commit comments

Comments
 (0)