Skip to content

Commit

Permalink
fix: Fix possible "Cannot read property" error by sendBeacon. (issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Maizify committed May 22, 2023
1 parent 56efb35 commit d5ed216
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ English | [简体中文](./CHANGELOG_CN.md)

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


## 3.15.0 (2022-11-02)
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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


## 3.15.0 (2022-11-02)
Expand Down
2 changes: 1 addition & 1 deletion src/network/network.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class VConsoleNetworkModel extends VConsoleModel {
* @private
*/
private mockSendBeacon() {
if (!window.navigator.sendBeacon) {
if (!window?.navigator?.sendBeacon) {
return;
}
window.navigator.sendBeacon = BeaconProxy.create((item: VConsoleNetworkRequestItem) => {
Expand Down

0 comments on commit d5ed216

Please sign in to comment.