electron / electron/electron

Support getters and setters in the context bridge API

Open
#25,516 9 comments 0 reactions 0 assignees View on GitHub
enhancement :sparkles:
Dominant language
C++
Stars
123k
Forks
17.5k
Avg merge
14h 28m
Merged PRs (30d)
870

Description

### Issue Details

* **Electron Version:**
* `9.x`
* **Operating System:**
* `macOS 10.15.x`

### Expected Behavior
Exposing API via `contextBridge.exposeInMainWorld` should not have side effects.

### Actual Behavior
Calling this method with an object that has a `get` property triggers it. This makes it impossible to lazy instantiate for example.

### To Reproduce
```js
contextBridge.exposeInMainWorld('vscode',{
get something(): { console.log("accessed"); }
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.